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:
_10import * as sdk from "@onflow/sdk"_10_10sdk.put(key, value)
Or import directly the specific function:
_10import { put } from "@onflow/sdk"_10_10put(key, value)
Usage
_14import * as fcl from "@onflow/fcl";_14import { put } from "@onflow/sdk"_14_14// Using put in a custom builder function_14const setCustomData = (data) => put("custom.data", data);_14_14await fcl.send([_14 fcl.script`access(all) fun main(): String { return "Hello" }`,_14 setCustomData({ userId: 123, timestamp: Date.now() })_14]);_14_14// Direct usage_14const interaction = initInteraction();_14put("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