turnkey_client 0.14.0

A Rust client to interact with the Turnkey API.
Documentation
#[derive(Debug)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct Timestamp {
    pub seconds: ::prost::alloc::string::String,
    pub nanos: ::prost::alloc::string::String,
}
#[derive(Debug)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct Credential {
    pub public_key: ::prost::alloc::string::String,
    pub r#type: super::super::common::v1::CredentialType,
}
#[derive(Debug)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct Quorum {
    #[serde(default)]
    pub threshold: i32,
    #[serde(default)]
    pub user_ids: ::prost::alloc::vec::Vec<::prost::alloc::string::String>,
}
#[derive(Debug)]
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct Feature {
    pub name: super::super::common::v1::FeatureName,
    #[serde(default)]
    pub value: ::core::option::Option<::prost::alloc::string::String>,
}
#[derive(Debug)]
/// A reference to a Smart Contract Interface (ABI or IDL), to be stored within Org Data.
/// We intentionally store a reference, and not the entire smart contract interface, as
/// ABIs/IDLs are JSON objects and can be up to several hundred kb in size.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct SmartContractInterfaceReference {
    pub smart_contract_interface_id: ::prost::alloc::string::String,
    pub smart_contract_address: ::prost::alloc::string::String,
    /// digest pertaining to a SmartContractInterfacePayload (containing all its details), originally generated by evm parser
    pub digest: ::prost::alloc::string::String,
}
#[derive(Debug)]
/// The org's Earn configuration, stored in Org Data (enclave-signed) as a
/// JSON-serialized value under the FEATURE_NAME_EARN_CONFIG feature. There are
/// no Postgres tables for Earn data: wrapper addresses and the full fee config
/// live here so the enclave can trust them when signing deposits/withdrawals.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct EarnConfig {
    /// Schema version of this config blob. Bump on breaking shape changes so readers
    /// can migrate older stored configs.
    #[serde(default)]
    pub version: u32,
    /// One entry per vault the org has enabled via DeployEarnWrapper.
    #[serde(default)]
    pub wrappers: ::prost::alloc::vec::Vec<EarnWrapper>,
}
#[derive(Debug)]
/// A single deployed Earn wrapper stack for one (vault, chain) the org enabled.
/// Written by the enclave when a DeployEarnWrapper activity is processed.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct EarnWrapper {
    /// The underlying yield vault being wrapped.
    pub vault_address: ::prost::alloc::string::String,
    /// CAIP-2 chain identifier the vault lives on (e.g. "eip155:8453").
    pub chain_caip2: ::prost::alloc::string::String,
    /// The deployed fee wrapper (Morpho FeeWrapper / Aave ATokenVault) - the deposit target.
    pub wrapper_address: ::prost::alloc::string::String,
    /// The deployed fee splitter (Morpho PaymentSplitter / Aave RevenueSplitterOwner).
    pub splitter_address: ::prost::alloc::string::String,
    /// The provider that owns this wrapper.
    pub provider: EarnProvider,
    /// Deployment nonce, incremented on each wrapper deployment to the same vault+chain.
    pub deploy_nonce: ::prost::alloc::string::String,
    /// The client's fee cut of gross yield, in basis points (e.g. "2000" for 20%).
    pub client_fee_bps: ::prost::alloc::string::String,
    /// The wallet address that receives the client's fee payouts on-chain.
    pub client_fee_wallet: ::prost::alloc::string::String,
    /// Turnkey's fee cut of gross yield, in basis points.
    pub turnkey_fee_bps: ::prost::alloc::string::String,
    /// The wallet address that receives Turnkey's fee payouts on-chain.
    pub turnkey_fee_wallet: ::prost::alloc::string::String,
    /// The vault's underlying ERC-20 asset (the deposit approve target), pinned at
    /// deploy time from the TLS-Fetcher-verified vault.
    pub underlying_asset: ::prost::alloc::string::String,
    /// When true, deposits to this wrapper are rejected; withdrawals are unaffected.
    /// Toggled via EarnSetWrapperState (e.g. incident brake for a compromised vault).
    #[serde(default)]
    pub deposits_disabled: bool,
}
#[derive(Debug)]
/// The signer-signed payload authorizing a wrapper's insertion into an org's EarnConfig.
/// The signer derives the wrapper/splitter addresses from a secret salt the coordinator
/// cannot reproduce, so the notarizer trusts these addresses via the signature; it binds
/// organization_id + the wrapper's vault/chain to the authorizing ruling before inserting.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct EarnWrapperPayload {
    /// The org this wrapper belongs to.
    pub organization_id: ::prost::alloc::string::String,
    /// The wrapper entry to insert into the org's EarnConfig.
    #[serde(default)]
    pub wrapper: ::core::option::Option<EarnWrapper>,
}
#[derive(Debug)]
/// EarnWrapperPayload signed by the signer's quorum key. The notarizer verifies the
/// signature against its pinned signer public key.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[serde(rename_all = "camelCase")]
#[derive(Clone, PartialEq)]
pub struct SignedEarnWrapper {
    #[serde(default)]
    pub payload: ::core::option::Option<EarnWrapperPayload>,
    /// Signer signature over hash(payload).
    #[serde(default)]
    pub signature: ::core::option::Option<super::super::models::v1::Signature>,
}
/// The yield protocol backing an Earn wrapper.
#[derive(::serde::Serialize, ::serde::Deserialize)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum EarnProvider {
    #[serde(rename = "EARN_PROVIDER_UNSPECIFIED")]
    Unspecified = 0,
    #[serde(rename = "EARN_PROVIDER_MORPHO")]
    Morpho = 1,
    #[serde(rename = "EARN_PROVIDER_AAVE")]
    Aave = 2,
}
impl EarnProvider {
    /// String value of the enum field names used in the ProtoBuf definition.
    ///
    /// The values are not transformed in any way and thus are considered stable
    /// (if the ProtoBuf definition does not change) and safe for programmatic use.
    pub fn as_str_name(&self) -> &'static str {
        match self {
            Self::Unspecified => "EARN_PROVIDER_UNSPECIFIED",
            Self::Morpho => "EARN_PROVIDER_MORPHO",
            Self::Aave => "EARN_PROVIDER_AAVE",
        }
    }
    /// Creates an enum from field names used in the ProtoBuf definition.
    pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
        match value {
            "EARN_PROVIDER_UNSPECIFIED" => Some(Self::Unspecified),
            "EARN_PROVIDER_MORPHO" => Some(Self::Morpho),
            "EARN_PROVIDER_AAVE" => Some(Self::Aave),
            _ => None,
        }
    }
}