Skip to main content

put

Sets a value in an interaction object using a dot-notation key path.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.put(key, value)

Or import directly the specific function:


_10
import { put } from "@onflow/sdk"
_10
_10
put(key, value)

Usage


_14
import * as fcl from "@onflow/fcl";
_14
import { put } from "@onflow/sdk"
_14
_14
// Using put in a custom builder function
_14
const setCustomData = (data) => put("custom.data", data);
_14
_14
await fcl.send([
_14
fcl.script`access(all) fun main(): String { return "Hello" }`,
_14
setCustomData({ userId: 123, timestamp: Date.now() })
_14
]);
_14
_14
// Direct usage
_14
const interaction = initInteraction();
_14
put("network.endpoint", "https://access.mainnet.onflow.org")(interaction);

Parameters

key

  • Type: string
  • Description: The dot-notation key path (e.g., "message.arguments")

value

  • Type: any
  • Description: The value to set

Returns

function


Rate this page