Expand description
§OneMoney Rust SDK
Official Rust SDK for OneMoney L1 blockchain REST API.
§Quick Start
use onemoney_protocol::{Client, ClientBuilder, Network};
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create clients for different networks
let mainnet_client = Client::mainnet()?; // Mainnet
let testnet_client = Client::testnet()?; // Testnet
let local_client = Client::local()?; // Local development
// Or use the builder pattern
let client = ClientBuilder::new()
.network(Network::Testnet)
.timeout(std::time::Duration::from_secs(30))
.build()?;
Ok(())
}Re-exports§
pub use client::Client;pub use client::ClientBuilder;pub use client::Network;pub use error::ConfigError;pub use error::Error;pub use error::Result;pub use transport::*;pub use utils::*;
Modules§
- api
- API interaction modules for the OneMoney SDK.
- client
- Client core functionality and configuration.
- common
- Common types used throughout the OneMoney SDK.
- crypto
- Cryptographic utilities for signing and address derivation.
- error
- Error types for the OneMoney SDK.
- keys
- Cryptographic key operations and address derivation.
- requests
- API request type definitions.
- responses
- API response type definitions.
- signing
- Digital signature operations.
- transaction
- transport
- HTTP transport layer for API communication.
- utils
- Utility functions and helper types.
Structs§
- AccountBB
Nonce - Account BB nonce information from API response. Matches the L1 server’s AccountInfo structure: { “bbnonce”: u64 }
- Account
Nonce - Account nonce information from API response. Matches the L1 server’s AccountInfo structure: { “nonce”: u64 }
- Associated
Token Account - Represents the token holdings and associated data for a specific address.
- Chain
IdResponse - Response type for chain ID endpoint
- Checkpoint
- A checkpoint includes header data and transactions. Header fields are flattened at the top level to match L1 server format.
- Checkpoint
Number - Checkpoint number response.
- Create
Multi SigPayload - Payload for creating a multi-signature account
- Epoch
Response - Response containing epoch information and certificate data
- FeeEstimate
- Fee estimation result. Matches L1 server’s EstimateFee structure: { “fee”: String }
- FeeEstimate
Request - Fee estimation request. Matches L1 server’s EstimateFeeRequest structure with string query parameters.
- Finalized
Transaction - A finalized transaction with epoch confirmation and validator BLS signatures.
- Hash
- Represents a transaction hash returned by the API.
- Hash
With Token - Represents a transaction hash and the token that created by the transaction.
- KeyValue
Pair - MetadataKV
Pair - The additional key-value properties for one token.
- Mint
Info MintInfois the struct for token contract. One mint account represents one token.- Minter
Allowance - Multi
SigSignature Entry - Multi-signature entry containing both the signature and the signer’s public key
- Multi
SigSigner - Simplified signer configuration for transaction payload Note: This is the wire format. The full SignerConfig with Secp256k1PublicKey is defined in om-primitives::core::multi_account
- Multi
SigSigner Info - Multi-signature signer information for REST API
- Payment
Payload - Payment transaction payload.
- Payment
Transaction Request - Payment transaction request.
- Rest
BlsAggregate Signature - BLS aggregate signature representation for REST API. Contains the aggregated signature, signer bitmask, and validator public keys needed for verification.
- Rest
Signature - ECDSA signature components.
- Signature
- ECDSA signature components.
- Token
Authority Payload - Token authority payload (unified for grant/revoke operations).
- Token
Authority Request - Token authority management request.
- Token
Blacklist Payload - Token blacklist management payload.
- Token
Blacklist Request - Blacklist request for managing token blacklists
- Token
Bridge AndMint Payload - Token bridge and mint payload.
- Token
Bridge AndMint Request - Token bridge and mint request.
- Token
Burn AndBridge Payload - Token
Burn AndBridge Request - Token burn and bridge request.
- Token
Burn Payload - Token burn payload.
- Token
Burn Request - Token burn request.
- Token
Clawback Payload - Token
Clawback Query - Query parameters for token clawback operations.
- Token
Clawback Request - Request parameters for token clawback.
- Token
Issue Payload - Token
Issue Request - Request parameters for the token issue.
- Token
Metadata - Token metadata for one token.
- Token
Metadata Update Payload - Token metadata update payload.
- Token
Metadata Update Request - Token metadata update request.
- Token
Mint Payload - Token mint payload.
- Token
Mint Request - Request parameters for the token mint.
- Token
Pause Payload - Token pause payload.
- Token
Pause Request - Token pause request.
- Token
Whitelist Payload - Token whitelist management payload.
- Token
Whitelist Request - Whitelist request for managing token whitelists
- Transaction
- Transaction
Receipt - Transaction receipt response. Matches L1 server’s TransactionReceipt structure with proper types.
- Transaction
Response - Generic transaction response from API operations. All transaction operations return the same format: {“hash”: “string”} Used by payment transactions, token operations, etc.
Enums§
- Action
Type - Transaction action types.
- Authority
- Authority levels that can be granted or revoked for a token.
- Authority
Action - Authority action type for granting or revoking permissions.
- Blacklist
Action - Certificate
Data - The encoding format determines which variant is used:
- Checkpoint
Transactions - Checkpoint transactions representation. This can be either transaction hashes or full transaction objects.
- Crypto
Error - Named
Chain - Named chain is one of the predefined chains.
- Pause
Action - Pause action types matching L1 server implementation.
- Transaction
Signature - Transaction signature type - either single signature or multi-signature
- TxPayload
- Instructions supported by mint token
- Whitelist
Action - Action types for whitelist operations
Traits§
- Signable
- Trait for types that can be cryptographically signed.
Functions§
- derive_
token_ account_ address - Derive a token account address from wallet and mint addresses.
- private_
key_ to_ address - Convert a private key hex string to an address.
- sign_
hash - Sign a pre-computed hash using ECDSA.
- sign_
multisig_ transaction_ payload - Sign a multi-sig transaction payload bound to a multi-sig account address.
- sign_
transaction_ payload - Sign a transaction payload using the same method as L1. This function matches the L1 implementation’s sign_transaction_payload.
Type Aliases§
- Nonce
- Nonce type from L1 primitives