args
A utility builder to be used with other builders to pass in arguments with a value and supported type.
A transaction can accept zero or more arguments that are passed into the Cadence script. The arguments on the transaction must match the number and order declared in the Cadence script.
Import
You can import the entire package and access the function:
_10import * as sdk from "@onflow/sdk"_10_10sdk.args(ax)
Or import directly the specific function:
_10import { args } from "@onflow/sdk"_10_10args(ax)
Usage
_15import * as fcl from "@onflow/fcl"_15_15await fcl.mutate({_15 cadence: `_15 transaction(amount: UFix64, to: Address) {_15 prepare(signer: AuthAccount) {_15 // transaction logic_15 }_15 }_15 `,_15 args: (arg, t) => [_15 arg("10.0", t.UFix64), // Will be the first argument `amount: UFix64`_15 arg("0xba1132bc08f82fe2", t.Address), // Will be the second argument `to: Address`_15 ],_15})
Parameters
ax
- Type:
CadenceArgument
- Description: An array of arguments
_10type CadenceArgument<T extends TypeDescriptor<any, any>> = {_10 value: TypeDescriptorInput<T>_10 xform: T_10}
Returns
InteractionBuilderFn
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>