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. This function returns a Partial Interaction that contains the arguments and types passed in. This alone is a partial and incomplete interaction.
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:
_10CadenceArgument<any>[]
- Description: An array of argument objects created with fcl.arg()
Returns
_10export type InteractionBuilderFn = (_10 ix: Interaction_10) => Interaction | Promise<Interaction>
A Partial Interaction object containing the arguments and types passed in