Skip to content

Commit

Permalink
fix: rename setExpiration parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx authored and xstelea committed Nov 7, 2024
1 parent 0ed3b37 commit a971f48
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
7 changes: 2 additions & 5 deletions examples/simple-dapp/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,7 @@ const proofOfOwnershipRequest = document.getElementById(
'proof-of-ownership-request',
)!

let subintentExpiration: 'secondsAfterSignature' | 'atTime' =
'secondsAfterSignature'
let subintentExpiration: 'afterDelay' | 'atTime' = 'afterDelay'

document.querySelectorAll('input[name="option"]').forEach((radio) => {
radio.addEventListener('change', () => {
Expand All @@ -92,9 +91,7 @@ document.querySelectorAll('input[name="option"]').forEach((radio) => {
) as HTMLInputElement
if (selectedOption) {
console.log(`Selected value: ${selectedOption.value}`)
subintentExpiration = selectedOption.value as
| 'secondsAfterSignature'
| 'atTime'
subintentExpiration = selectedOption.value as 'afterDelay' | 'atTime'
}
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ describe('SubintentRequestBuilder', () => {
it('should build a subintent request', () => {
const tx = SubintentRequestBuilder()
.manifest('...')
.setExpiration('secondsAfterSignature', 60)
.setExpiration('afterDelay', 60)
.addBlobs('deadbeef', 'beefdead')
.message('hello')
.toRequestItem()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ export const SubintentRequestBuilder = () => {
/**
* Sets the expiration for a request.
*
* @param type - The type of expiration. Can be 'atTime' for a specific time or 'secondsAfterSignature' for a duration after the signature.
* @param value - The value associated with the expiration type. For 'atTime', this is a timestamp. For 'secondsAfterSignature', this is the number of seconds.
* @param type - The type of expiration. Can be 'atTime' for a specific time or 'afterDelay' for a duration after the signature.
* @param value - The value associated with the expiration type. For 'atTime', this is a timestamp. For 'afterDelay', this is the number of seconds.
* @returns The API object for chaining.
*/
const setExpiration = (
type: 'atTime' | 'secondsAfterSignature',
value: number,
) => {
const setExpiration = (type: 'atTime' | 'afterDelay', value: number) => {
state.expiration =
type === 'atTime'
? {
Expand Down

0 comments on commit a971f48

Please sign in to comment.