createSignableVoucher
Creates a signable voucher object from an interaction for signing purposes.
A voucher is a standardized representation of a transaction that contains all the necessary information for signing and submitting to the Flow network. This function transforms an interaction object into a voucher format.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.createSignableVoucher(ix)
Or import directly the specific function:
_10import { createSignableVoucher } from "@onflow/sdk"_10_10createSignableVoucher(ix)
Usage
_27import * as fcl from "@onflow/fcl";_27import { createSignableVoucher } from "@onflow/sdk"_27_27// Build a transaction interaction_27const interaction = await fcl.build([_27 fcl.transaction`_27 transaction(amount: UFix64) {_27 prepare(account: AuthAccount) {_27 log(amount)_27 }_27 }_27 `,_27 fcl.args([fcl.arg("10.0", fcl.t.UFix64)]),_27 fcl.proposer(proposerAuthz),_27 fcl.payer(payerAuthz),_27 fcl.authorizations([authorizerAuthz]),_27 fcl.limit(100)_27]);_27_27// Create a voucher for signing_27const voucher = createSignableVoucher(interaction);_27console.log(voucher.cadence); // The Cadence script_27console.log(voucher.arguments); // The transaction arguments_27console.log(voucher.proposalKey); // Proposer account details_27console.log(voucher.authorizers); // List of authorizer addresses_27_27// The voucher can now be signed and submitted
Parameters
ix
- Type:
Interaction
- Description: The interaction object containing transaction details
Returns
{ cadence: string; refBlock: string; computeLimit: number; arguments: any[]; proposalKey: { address: string; keyId: string | number; sequenceNum: number; } | { address?: undefined; keyId?: undefined; sequenceNum?: undefined; }; payer: string; authorizers: string[]; payloadSigs: { address: string; keyId: string | number; sig: string; }[]; envelopeSigs: { address: string; keyId: string | number; sig: string; }[]; }