diff --git a/examples/simple-dapp/src/main.ts b/examples/simple-dapp/src/main.ts index 47ed5f18..9f34c98d 100644 --- a/examples/simple-dapp/src/main.ts +++ b/examples/simple-dapp/src/main.ts @@ -90,7 +90,7 @@ subintentButton.onclick = async () => { childSubintentHashes: [], expiration: { discriminator: 'expireAfterSignature', - value: '3600', + value: 3600, }, }) diff --git a/packages/dapp-toolkit/src/modules/wallet-request/wallet-request.ts b/packages/dapp-toolkit/src/modules/wallet-request/wallet-request.ts index a97f2f9f..43e27f89 100644 --- a/packages/dapp-toolkit/src/modules/wallet-request/wallet-request.ts +++ b/packages/dapp-toolkit/src/modules/wallet-request/wallet-request.ts @@ -12,8 +12,6 @@ import { validateRolaChallenge, type Logger } from '../../helpers' import { TransactionStatus } from '../gateway' import { ResultAsync, err, ok, okAsync } from 'neverthrow' import type { - ExpireAfterSignature, - ExpireAtTime, MessageLifeCycleEvent, WalletInteraction, } from '../../schemas' @@ -311,7 +309,7 @@ export const WalletRequestModule = (input: { SdkError > => { const walletInteraction = walletRequestSdk.createWalletInteraction({ - discriminator: 'preAuthorizedRequest', + discriminator: 'preAuthorizationRequest', subintent: { discriminator: 'subintent', blobs: value.blobs, diff --git a/packages/dapp-toolkit/src/schemas/index.ts b/packages/dapp-toolkit/src/schemas/index.ts index 1d72b34a..200a0caa 100644 --- a/packages/dapp-toolkit/src/schemas/index.ts +++ b/packages/dapp-toolkit/src/schemas/index.ts @@ -247,13 +247,13 @@ export const CancelRequest = object({ export type ExpireAtTime = InferOutput export const ExpireAtTime = object({ discriminator: literal('expireAtTime'), - value: string(), + value: number(), }) export type ExpireAfterSignature = InferOutput export const ExpireAfterSignature = object({ discriminator: literal('expireAfterSignature'), - value: string(), + value: number(), }) export type SubintentRequestItem = InferOutput @@ -277,7 +277,7 @@ export type WalletPreAuthorizationItems = InferOutput< typeof WalletPreAuthorizationItems > export const WalletPreAuthorizationItems = object({ - discriminator: literal('preAuthorizedRequest'), + discriminator: literal('preAuthorizationRequest'), subintent: optional(SubintentRequestItem), }) @@ -332,6 +332,14 @@ export const AuthLoginWithChallengeRequestResponseItem = object({ proof: Proof, }) +export type WalletPreAuthorizationResponseItems = InferOutput< + typeof WalletPreAuthorizationResponseItems +> +export const WalletPreAuthorizationResponseItems = object({ + discriminator: literal('preAuthorizationRequest'), + subintent: optional(SubintentResponseItem), +}) + export const AuthLoginRequestResponseItem = union([ AuthLoginWithoutChallengeRequestResponseItem, AuthLoginWithChallengeRequestResponseItem, @@ -380,6 +388,7 @@ export type WalletInteractionResponseItems = InferOutput< const WalletInteractionResponseItems = union([ WalletRequestResponseItems, WalletTransactionResponseItems, + WalletPreAuthorizationResponseItems, ]) export type WalletInteractionSuccessResponse = InferOutput<