trident-sdk 0.2.0

End-user SDK for Trident deposits and cross-chain spends
Documentation
// This file is @generated by prost-build.
/// Canonical EVM account/contract address.
///
/// Encoding contract:
/// - `value` must be exactly 20 bytes.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct EvmAddress {
    /// Raw EVM address bytes (20 bytes).
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Unsigned 256-bit integer encoded as exactly 32 bytes, big-endian.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct U256 {
    /// Big-endian fixed-width bytes (32 bytes).
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Fixed-length 32-byte payload.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct Bytes32 {
    /// Raw fixed-width bytes (32 bytes).
    #[prost(bytes = "vec", tag = "1")]
    pub value: ::prost::alloc::vec::Vec<u8>,
}
/// Address that may belong to different chains.
///
/// Exactly one `chain_address` variant must be set.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct MultiChainAddress {
    #[prost(oneof = "multi_chain_address::ChainAddress", tags = "1")]
    pub chain_address: ::core::option::Option<multi_chain_address::ChainAddress>,
}
/// Nested message and enum types in `MultiChainAddress`.
pub mod multi_chain_address {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum ChainAddress {
        /// EVM chain address.
        #[prost(message, tag = "1")]
        Evm(super::EvmAddress),
    }
}
/// Token identified by its on-chain address paired with an amount.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct TokenAmount {
    /// Token contract address.
    #[prost(message, optional, tag = "1")]
    pub token: ::core::option::Option<MultiChainAddress>,
    /// Token amount in the token's native decimals.
    #[prost(message, optional, tag = "2")]
    pub amount: ::core::option::Option<U256>,
}
/// Cross-chain spend specification that uniquely identifies a transfer via its hash.
///
/// Required fields:
/// - all `MultiChainAddress` fields
/// - `amount`
/// - `salt`
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendSpec {
    /// Address authorizing the spend on the source side.
    #[prost(message, optional, tag = "1")]
    pub src_spender: ::core::option::Option<MultiChainAddress>,
    /// Source domain identifier.
    #[prost(uint32, tag = "2")]
    pub src_domain: u32,
    /// Token being spent on the source domain.
    #[prost(message, optional, tag = "3")]
    pub src_token: ::core::option::Option<MultiChainAddress>,
    /// Deposit contract on the source domain that holds the source spender's balance.
    #[prost(message, optional, tag = "4")]
    pub src_deposit_contract: ::core::option::Option<MultiChainAddress>,
    /// Destination domain identifier.
    #[prost(uint32, tag = "5")]
    pub dst_domain: u32,
    /// Token to receive on the destination domain.
    #[prost(message, optional, tag = "6")]
    pub dst_token: ::core::option::Option<MultiChainAddress>,
    /// Delivery contract on the destination domain that executes the attestation.
    #[prost(message, optional, tag = "7")]
    pub dst_delivery_contract: ::core::option::Option<MultiChainAddress>,
    /// Recipient of the tokens on the destination domain.
    #[prost(message, optional, tag = "8")]
    pub dst_recipient: ::core::option::Option<MultiChainAddress>,
    /// Destination caller constraint. Use a zero address for unrestricted execution.
    #[prost(message, optional, tag = "9")]
    pub dst_caller: ::core::option::Option<MultiChainAddress>,
    /// Token amount to spend.
    #[prost(message, optional, tag = "10")]
    pub amount: ::core::option::Option<U256>,
    /// Unique anti-replay salt.
    #[prost(message, optional, tag = "11")]
    pub salt: ::core::option::Option<Bytes32>,
}
/// A spend spec wrapped with auxiliary data for submission.
///
/// Required fields:
/// - `spec`
/// - `max_fee`
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendIntent {
    /// The core spend specification.
    #[prost(message, optional, tag = "1")]
    pub spec: ::core::option::Option<SpendSpec>,
    /// Maximum fee the source spender is willing to pay.
    #[prost(message, optional, tag = "2")]
    pub max_fee: ::core::option::Option<U256>,
    /// Exclusive expiry block height; invalid at and after this height.
    #[prost(uint64, tag = "3")]
    pub expiry_height: u64,
}
/// Spend intent plus its signature bytes.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SignedSpendIntent {
    /// Unsigned intent payload.
    #[prost(message, optional, tag = "1")]
    pub intent: ::core::option::Option<SpendIntent>,
    /// Signature over the spend intent bytes.
    #[prost(bytes = "vec", tag = "2")]
    pub signature: ::prost::alloc::vec::Vec<u8>,
}
/// Attestation is waiting to be submitted on-chain.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestationPending {}
/// Attestation was successfully executed on the destination domain.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestationExecuted {
    /// Block height at which the attestation was executed.
    #[prost(uint64, tag = "1")]
    pub height: u64,
    /// Transaction hash of the execution.
    #[prost(bytes = "vec", tag = "2")]
    pub tx_hash: ::prost::alloc::vec::Vec<u8>,
}
/// Attestation was executed and subsequently settled.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestationExecutedAndSettled {
    /// Original execution details.
    #[prost(message, optional, tag = "1")]
    pub execution: ::core::option::Option<SpendAttestationExecuted>,
    /// Block height at which settlement was confirmed.
    #[prost(uint64, tag = "2")]
    pub settlement_height: u64,
    /// Transaction hash of the settlement.
    #[prost(bytes = "vec", tag = "3")]
    pub settlement_tx_hash: ::prost::alloc::vec::Vec<u8>,
}
/// Attestation expired without being executed before the expiry height.
#[derive(Clone, Copy, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestationExpired {}
/// Attester-produced attestation returned after a spend intent is accepted.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestation {
    /// Serialized attestation payload to relay to the destination domain.
    #[prost(bytes = "vec", tag = "1")]
    pub bytes: ::prost::alloc::vec::Vec<u8>,
    /// Attester signature over `bytes`.
    #[prost(bytes = "vec", tag = "2")]
    pub signature: ::prost::alloc::vec::Vec<u8>,
    /// Block height after which this attestation is considered expired.
    #[prost(uint64, tag = "3")]
    pub expiry_height: u64,
}
/// A signed spend intent paired with its attestation and lifecycle status.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct AttestedSpendIntent {
    /// The signed spend intent.
    #[prost(message, optional, tag = "1")]
    pub intent: ::core::option::Option<SignedSpendIntent>,
    /// The attestation produced by the attester.
    #[prost(message, optional, tag = "2")]
    pub attestation: ::core::option::Option<SpendAttestation>,
    /// The status of the attestation.
    #[prost(message, optional, tag = "3")]
    pub attestation_status: ::core::option::Option<SpendAttestationStatus>,
}
/// Fee breakdown for a spend operation.
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendFeesBreakdown {
    /// Token denomination used for charging fees.
    #[prost(message, optional, tag = "1")]
    pub fee_token: ::core::option::Option<MultiChainAddress>,
    /// Total fees charged in `fee_token` units.
    #[prost(message, optional, tag = "2")]
    pub total_fees: ::core::option::Option<U256>,
    /// The total amount of USDC minted in atomic units.
    #[prost(message, optional, tag = "3")]
    pub usdc_minted: ::core::option::Option<U256>,
    /// Total gateway fees in USDC atomic units (u6).
    #[prost(message, optional, tag = "4")]
    pub usdc_fees: ::core::option::Option<U256>,
    /// `usdc_fees` converted into `fee_token` units.
    #[prost(message, optional, tag = "5")]
    pub converted_usdc_fees: ::core::option::Option<U256>,
    /// Estimated gas fee, in the intent's source-token units, needed to
    /// claim the funds on the source chain.
    #[prost(message, optional, tag = "6")]
    pub claim_fee: ::core::option::Option<U256>,
}
#[derive(Clone, PartialEq, Eq, Hash, ::prost::Message)]
pub struct SpendAttestationStatus {
    #[prost(oneof = "spend_attestation_status::Status", tags = "6, 7, 8, 9")]
    pub status: ::core::option::Option<spend_attestation_status::Status>,
}
/// Nested message and enum types in `SpendAttestationStatus`.
pub mod spend_attestation_status {
    #[derive(Clone, PartialEq, Eq, Hash, ::prost::Oneof)]
    pub enum Status {
        /// Attestation is waiting to be submitted on-chain.
        #[prost(message, tag = "6")]
        Pending(super::SpendAttestationPending),
        /// Attestation was successfully executed on the destination domain.
        #[prost(message, tag = "7")]
        Executed(super::SpendAttestationExecuted),
        /// Attestation expired without being executed before the expiry height.
        #[prost(message, tag = "8")]
        Expired(super::SpendAttestationExpired),
        /// Attestation was executed and subsequently settled.
        #[prost(message, tag = "9")]
        ExecutedAndSettled(super::SpendAttestationExecutedAndSettled),
    }
}