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.