Expand description
§trident-sdk
End-user SDK for depositing into Trident and executing cross-chain spends through the Trident delivery service.
TridentClient covers the common user flow. The crate also exposes lower-level EVM bindings and protobuf types for applications that need direct contract reads, revert decoding, custom signing, or raw gRPC access.
§Scope
- Build a
TridentClientby registering per-domain chains - Prepare and submit deposits
- Submit spend intents through the delivery service and execute returned attestations
- Access curated spender/depositor EVM bindings under
evm::abi - Access EIP-712 spend-intent signing helpers under
evm::signing - Access generated protobuf messages and gRPC client types under
proto
§Current support
- EVM chain handlers today
ChainAddressis the SDK’s chain-agnostic address trait and is implemented foralloy_primitives::AddresstodayDomainvalues are Trident domain identifiers, not raw chain IDs
§Typical flow
- Build a
TridentClientwithTridentClientBuilderand register the domains you want to use. - Call
depositto prepare a source-chain deposit, thenDeposit::sendto submit it. - Build a
SpendRequestBuilderand callspend. - Submit the returned
SpendAttestationon the destination chain withSpendAttestation::send.
deposit prepares a source-chain deposit into the domain’s Trident deposit contract. Deposit::send submits the on-chain transaction and automatically approves the deposit contract first if the current ERC-20 allowance is too low.
spend builds a spend intent, fills in the source spender, Trident contract addresses, random salt, and, unless explicitly set on the builder, the max fee and expiry height. It signs the intent, submits it to the delivery service, and returns a SpendAttestation.
§Examples
Keep runnable examples in examples/ rather than turning this README into a tutorial.
Current examples:
deposit_evm.rs: build a client for one EVM domain, prepare a deposit, and submit itspend_evm.rs: build a client across two EVM domains, submit a spend, and relay the returned attestationbalance_semantics.rs: compareTridentClient::get_balancewith on-chainTridentDeposits::depositedAmount
§Balance semantics
TridentClient::get_balance returns the delivery-service balance tracked by Trident for an account, domain, and token.
That is not the same value as evm::abi::TridentDeposits::depositedAmount, which reads the source-side on-chain bookkeeping balance in the TridentDeposits contract. Applications often need both views, but they should not be treated as interchangeable.
§Lower-level modules
Use evm::abi for curated spender/depositor contract bindings, events, errors, and direct reads such as TridentDeposits::depositedAmount or attestation validation helpers.
Use evm::signing for Trident’s EIP-712 spend-intent signing logic outside TridentClient.
Use proto for the raw generated protobuf messages and gRPC client types.
§Notes
- Token amounts are expressed in the token’s atomic units.
SpendRequestBuilderlets callers override the auto-resolved max fee, expiry height, and destination caller.
Modules§
- evm
- Lower-level EVM bindings and signature utilities for Trident integrations.
- proto
- Raw generated protobuf messages and gRPC client types.
Generated protobuf messages and gRPC client types used by
trident-sdk.
Structs§
- Balance
- Deposit
- A prepared deposit ready to be submitted on-chain.
- EvmCall
Context - Raw pieces needed to execute the
tridentSpendcall against a Trident delivery contract. - Multicall
Builder - Accumulator for a Multicall3 batch to be run via a self-call into a
7702-delegated
TridentAccountEOA. - Spend
Attestation - A spend attestation ready to be executed on-chain.
- Spend
Multicall - A
MulticallBuilderseeded with a Trident spend, carrying the attestation’s provider so.send()doesn’t need one passed in. - Spend
Request Builder - Configures a cross-chain spend request.
- Trident
Client - Client for the Trident cross-chain delivery service.
- Trident
Client Builder - Builds a
TridentClientby registering one chain-handler builder per domain and connecting to the delivery service.
Enums§
- Trident
Client Builder Error - Errors returned while building and connecting a
TridentClient. - Trident
Client Error - Errors returned by
TridentClientoperations.
Traits§
- Chain
Address - A chain-agnostic address trait used by the SDK’s cross-chain request APIs.
Type Aliases§
- Domain
- Trident domain identifier for a supported source or destination chain.