Skip to main content

Core Concepts

EIP-7702 Delegation

EIP-7702 allows users to delegate transaction execution to a smart contract. This is essential for enabling cross-chain transactions without requiring users to sign multiple transactions. Read more about EIP-7702 here.

Intent

An Intent is the parent action which contains ChainBatch(es) wherein each ChainBatch is for a specific chain and has many Call(s).

Chain Batch

Each chain involved in a cross-chain transaction requires its own batch with:
  • Chain ID
  • Call data (what to execute)
  • Recent block number

Chain Batch

A Chain Batch is the per-chain unit containing calls and chainId. Each Chain Batch is hashed (via hashChainBatches) to create its hash, which is included in the intent signature.

Setup and Dependencies

Required Dependencies

viem

Used for interacting with EVM chains. Documentation

wagmi

Used for wallet management and signing. Documentation

Core Type Definitions

Types Guide

Intent Creation Implementation

This page is the low-level, roll-it-yourself path. For most apps, use the prebuilt components and hooks (useSpiceExecution) instead. Even on the manual path, do not reimplement the intent hashing: import it from @spicenet-io/spiceflow-core.

Intent hashing

Import the hashing functions from the SDK rather than hand-rolling them. Two things that changed from older examples: a chain batch is { chainId, calls } (there is no recentBlock), and the intent hash includes the signatureType, nbf, and exp values.

Utility Functions

Creating Intent with Chain Batches

Delegation Signing

EIP-7702 Delegation Process

Each chain requires a separate EIP-7702 delegation signature.
Produce EIP-7702 authorizations with viem’s signAuthorization (see the Native Swap guide), not a custom EIP-712 signTypedData scheme. The delegate contract differs per chain: read it with getDelegateContract(chainId) from @spicenet-io/spiceflow-core.

Multi-Chain Delegation Example

Transaction Submission

Complete Transaction Submission

See the POST /actions reference for the full request and response schema.

Best Practices

1. Chain Switching

2. Progress Tracking