Skip to main content

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:


_10
import * as fcl from "@onflow/fcl-core"
_10
_10
fcl.args(ax)

Or import directly the specific function:


_10
import { args } from "@onflow/fcl-core"
_10
_10
args(ax)

Usage


_15
import * as fcl from "@onflow/fcl"
_15
_15
await 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:

_10
CadenceArgument<any>[]

  • Description: An array of argument objects created with fcl.arg()

Returns


_10
export type InteractionBuilderFn = (
_10
ix: Interaction
_10
) => Interaction | Promise<Interaction>

A Partial Interaction object containing the arguments and types passed in


Rate this page