Skip to main content

makeArgument

Creates an argument resolver and adds it to an interaction. This function is...

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.makeArgument(arg)

Or import directly the specific function:


_10
import { makeArgument } from "@onflow/sdk"
_10
_10
makeArgument(arg)

Usage


_19
import { makeArgument, initInteraction } from "@onflow/sdk"
_19
import * as fcl from "@onflow/fcl";
_19
_19
const interaction = initInteraction();
_19
_19
// Create an argument resolver (usually you'd use fcl.arg instead)
_19
const argResolver = {
_19
value: 42,
_19
xform: fcl.t.Int,
_19
resolve: (value, xform) => ({ value, xform })
_19
};
_19
_19
// Add the argument to the interaction
_19
makeArgument(argResolver)(interaction);
_19
_19
console.log(interaction.message.arguments.length); // 1
_19
_19
// Preferred way - use fcl.arg instead:
_19
// fcl.args([fcl.arg(42, fcl.t.Int)])

Parameters

arg

  • Type: Record<string, any>
  • Description: The argument configuration object

Returns

function


Rate this page