Skip to main content

isInteraction

Checks if an object is a valid interaction.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.isInteraction(ix)

Or import directly the specific function:


_10
import { isInteraction } from "@onflow/sdk"
_10
_10
isInteraction(ix)

Usage


_11
import * as fcl from "@onflow/fcl";
_11
import { isInteraction, initInteraction } from "@onflow/sdk"
_11
_11
const interaction = initInteraction();
_11
console.log(isInteraction(interaction)); // true
_11
console.log(isInteraction({})); // false
_11
console.log(isInteraction(null)); // false
_11
_11
// Check if a builder result is a valid interaction
_11
const built = await fcl.build([fcl.script`access(all) fun main(): Int { return 42 }`]);
_11
console.log(isInteraction(built)); // true

Parameters

ix

  • Type: unknown
  • Description: The object to check

Returns

boolean


Rate this page