@@ -8,6 +8,11 @@ import dayjs from "dayjs"
88import Client from "mina-signer"
99
1010import type { SignedTransaction } from "@mina-js/utils"
11+ import type {
12+ Payment ,
13+ StakeDelegation ,
14+ ZkappCommand ,
15+ } from "mina-signer/dist/node/mina-signer/src/types"
1116import type { IVaultService } from "./types"
1217
1318export enum AuthorizationState {
@@ -74,9 +79,23 @@ export const createVaultService = (): IVaultService => {
7479 const accounts = await getAccounts ( )
7580 const publicKey = accounts ?. [ 0 ]
7681 if ( ! publicKey ) throw new Error ( "Wallet is not initialized." )
77- const validTransaction = signer . verifyTransaction ( sendable . input as never )
78- if ( ! validTransaction ) throw new Error ( "Invalid transaction." )
7982 const type = getTxType ( sendable . input as never )
83+ const signedData : StakeDelegation | Payment | ZkappCommand =
84+ sendable . input as any
85+ const verifyTransactionParams =
86+ "feePayer" in signedData
87+ ? {
88+ signature : signedData . zkappCommand . feePayer . authorization ,
89+ publicKey : signedData . zkappCommand . feePayer . body . publicKey ,
90+ data : signedData ,
91+ }
92+ : {
93+ signature : ( sendable as any ) . signature ,
94+ publicKey : signedData . from ,
95+ data : signedData ,
96+ }
97+ if ( ! signer . verifyTransaction ( verifyTransactionParams ) )
98+ throw new Error ( "Invalid transaction." )
8099 const payload =
81100 type === "zkapp"
82101 ? { input : sendable . input }
0 commit comments