Skip to content

Commit

Permalink
fix: rename setExpiration parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
dawidsowardx committed Oct 25, 2024
1 parent a8aac19 commit e87e64a
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion examples/simple-dapp/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ subintentButton.onclick = async () => {
const result = await dAppToolkit.walletApi.sendPreAuthorizationRequest(
SubintentRequestBuilder()
.manifest(subintentManifest.value)
.setExpiration('secondsAfterSignature', 3600),
.setExpiration('afterDelay', 3600),
)

console.log(result)
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,21 +27,21 @@ 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,
) => {
state.expiration = type === 'atTime' ? {
discriminator: 'expireAtTime',
unixTimestampSeconds: value,
} : {
discriminator: 'expireAfterDelay',
expireAfterSeconds: value
}
const setExpiration = (type: 'atTime' | 'afterDelay', value: number) => {
state.expiration =
type === 'atTime'
? {
discriminator: 'expireAtTime',
unixTimestampSeconds: value,
}
: {
discriminator: 'expireAfterDelay',
expireAfterSeconds: value,
}
return api
}

Expand Down

0 comments on commit e87e64a

Please sign in to comment.