Index of every page on this site: llms.txt
All skills
availproject avatar

/nexus-sdk-bridge-flows

@8f83d92
Run it yourself

Implement bridge, bridgeAndTransfer, bridgeAndExecute, and execute flows with Nexus SDK. Use when wiring cross-chain bridge and execution operations, simulations, or max-amount checks.

Use this Skill: https://skilld.dev/gh/availproject/widgets/nexus-sdk-bridge-flows

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈52 tokens for metadata: the name and description. ≈911 when used: this file.

Description uses 2.6% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈209 characters, or 2.6%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

Bridge and Execute Flows

Call bridge(params, options?)

  • Use to move tokens cross-chain (intent-based bridge).
  • Signature:
    • sdk.bridge(params, { onEvent? })
  • Params (BridgeParams):
    • toTokenSymbol: string — token symbol (e.g., "ETH", "USDC")
    • toAmountRaw: bigint — smallest units
    • toChainId: number — destination chain id
    • recipient?: Hex — defaults to connected user address
    • toNativeAmountRaw?: bigint — optional native token output
    • sources?: number[] — restrict source chains
  • Result (BridgeResult):
    • intentExplorerUrl: string
    • sourceTxs: { chain, txHash, txExplorerUrl }[]
    • intent: BridgeIntent

Call bridgeAndTransfer(params, options?)

  • Use to bridge and transfer to a recipient address.
  • Signature:
    • sdk.bridgeAndTransfer(params, { onEvent? })
  • Params (TransferParams):
    • toTokenSymbol: string
    • toAmountRaw: bigint
    • toChainId: number
    • recipient: Hex
    • sources?: number[]
  • Result (TransferResult):
    • Transfer result follows BridgeAndExecuteResult.

Call bridgeAndExecute(params, options?)

  • Use to bridge (if needed) and then execute a contract call.
  • Signature:
    • sdk.bridgeAndExecute(params, { onEvent?, beforeExecute? })
  • Params (BridgeAndExecuteParams):
    • toTokenSymbol: string, toAmountRaw: bigint, toChainId: number
    • execute: Omit<ExecuteParams, "toChainId">
    • Optional: waitForReceipt, requiredConfirmations, timeouts
  • beforeExecute hook (optional):
    • beforeExecute?: () => Promise<{ value?: bigint; data?: Hex; gas?: bigint }>
    • Use to dynamically override execute payload before sending.
  • Result (BridgeAndExecuteResult):
    • execute transaction result and optional approval transaction result
    • bridge result fields when a bridge was required
    • bridgeSkipped: boolean
    • intent?: BridgeIntent

Call execute(params, options?)

  • Use for a standalone contract call on a chain.
  • Signature:
    • sdk.execute(params, { onEvent? })
  • Params (ExecuteParams):
    • toChainId: number
    • to: Hex (contract address)
    • data?: Hex
    • value?: bigint
    • gas?: bigint (optional but recommended for deterministic behavior)
    • gasPrice?: 'low' | 'medium' | 'high'
    • Optional receipt config: waitForReceipt, receiptTimeout, requiredConfirmations
    • Optional tokenApproval?: { toTokenSymbol: string; amount: bigint; spender: Hex }
  • Result (ExecuteResult):
    • execute, optional approval, and chainId
    • optional receipt fields

Use simulation helpers

  • Call sdk.simulateBridge(params) → SimulationResult.
  • Call sdk.simulateBridgeAndTransfer(params) → BridgeAndExecuteSimulationResult.
  • Call sdk.simulateBridgeAndExecute(params) → BridgeAndExecuteSimulationResult.
  • Use simulation to show fees and gas before execution.
  • Expect BridgeAndExecuteSimulationResult.bridgeSimulation to be null if bridge is skipped.

Compute max bridgeable amount

  • Call sdk.calculateMaxForBridge({ toTokenSymbol, toChainId, recipient?, sources? }).
  • Use BridgeMaxResult to set “max” or validate input.

Convert amounts to bigint

  • Use sdk.convertTokenReadableAmountToBigInt(amountString, tokenSymbol, chainId).
  • Or use sdk.utils.parseUnits(value, decimals) if decimals are known.

Attach hooks and events

  • Attach intent and allowance hooks before calling bridge flows.
  • Use NEXUS_EVENTS.STEPS_LIST and NEXUS_EVENTS.STEP_COMPLETE for progress UI.

Handle common failures

  • On throw, clear intent/allowance refs and reset UI state.
  • On user cancel, call deny() on the active hook and abort.

Source: SKILL.md on GitHub

No rule matched.

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning8mo3 checks · Risk SAFE
  • Gen Agent Trust Hub9mo

    The skill provides a technical reference for using the Nexus SDK for cross-chain transactions. It does not contain any malicious code, scripts, or direct prompt injections. It is rated LOW due to the inherent risk of indirect prompt injection when the agent processes user-provided transaction data for contract execution.

  • Socket8mo

    No alerts

  • Snyk9mo

    Risk: MEDIUM · No issues

Signed by skilld at 8f83d92. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub last week.

Activeupdated 5 months ago

README badge

README badge for availproject/widgets/nexus-sdk-bridge-flows