From e87e64aab8e3b95268556f88c8053302caa4e05d Mon Sep 17 00:00:00 2001 From: Dawid Sowa Date: Fri, 25 Oct 2024 11:19:52 +0200 Subject: [PATCH] fix: rename `setExpiration` parameter --- examples/simple-dapp/src/main.ts | 2 +- .../subintent-builder.spec.ts | 2 +- .../subintent-builder.ts | 26 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/examples/simple-dapp/src/main.ts b/examples/simple-dapp/src/main.ts index 56e41af1..9aaf85e1 100644 --- a/examples/simple-dapp/src/main.ts +++ b/examples/simple-dapp/src/main.ts @@ -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) diff --git a/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.spec.ts b/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.spec.ts index 6c719dc3..f28b1709 100644 --- a/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.spec.ts +++ b/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.spec.ts @@ -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() diff --git a/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.ts b/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.ts index a27964e0..183d9c11 100644 --- a/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.ts +++ b/packages/dapp-toolkit/src/modules/wallet-request/pre-authorization-request/subintent-builder.ts @@ -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 }