Skip to main content

Crate onemoney_protocol

Crate onemoney_protocol 

Source
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§

AccountBBNonce
Account BB nonce information from API response. Matches the L1 server’s AccountInfo structure: { “bbnonce”: u64 }
AccountNonce
Account nonce information from API response. Matches the L1 server’s AccountInfo structure: { “nonce”: u64 }
AssociatedTokenAccount
Represents the token holdings and associated data for a specific address.
ChainIdResponse
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.
CheckpointNumber
Checkpoint number response.
CreateMultiSigPayload
Payload for creating a multi-signature account
EpochResponse
Response containing epoch information and certificate data
FeeEstimate
Fee estimation result. Matches L1 server’s EstimateFee structure: { “fee”: String }
FeeEstimateRequest
Fee estimation request. Matches L1 server’s EstimateFeeRequest structure with string query parameters.
FinalizedTransaction
A finalized transaction with epoch confirmation and validator BLS signatures.
Hash
Represents a transaction hash returned by the API.
HashWithToken
Represents a transaction hash and the token that created by the transaction.
KeyValuePair
MetadataKVPair
The additional key-value properties for one token.
MintInfo
MintInfo is the struct for token contract. One mint account represents one token.
MinterAllowance
MultiSigSignatureEntry
Multi-signature entry containing both the signature and the signer’s public key
MultiSigSigner
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
MultiSigSignerInfo
Multi-signature signer information for REST API
PaymentPayload
Payment transaction payload.
PaymentTransactionRequest
Payment transaction request.
RestBlsAggregateSignature
BLS aggregate signature representation for REST API. Contains the aggregated signature, signer bitmask, and validator public keys needed for verification.
RestSignature
ECDSA signature components.
Signature
ECDSA signature components.
TokenAuthorityPayload
Token authority payload (unified for grant/revoke operations).
TokenAuthorityRequest
Token authority management request.
TokenBlacklistPayload
Token blacklist management payload.
TokenBlacklistRequest
Blacklist request for managing token blacklists
TokenBridgeAndMintPayload
Token bridge and mint payload.
TokenBridgeAndMintRequest
Token bridge and mint request.
TokenBurnAndBridgePayload
TokenBurnAndBridgeRequest
Token burn and bridge request.
TokenBurnPayload
Token burn payload.
TokenBurnRequest
Token burn request.
TokenClawbackPayload
TokenClawbackQuery
Query parameters for token clawback operations.
TokenClawbackRequest
Request parameters for token clawback.
TokenIssuePayload
TokenIssueRequest
Request parameters for the token issue.
TokenMetadata
Token metadata for one token.
TokenMetadataUpdatePayload
Token metadata update payload.
TokenMetadataUpdateRequest
Token metadata update request.
TokenMintPayload
Token mint payload.
TokenMintRequest
Request parameters for the token mint.
TokenPausePayload
Token pause payload.
TokenPauseRequest
Token pause request.
TokenWhitelistPayload
Token whitelist management payload.
TokenWhitelistRequest
Whitelist request for managing token whitelists
Transaction
TransactionReceipt
Transaction receipt response. Matches L1 server’s TransactionReceipt structure with proper types.
TransactionResponse
Generic transaction response from API operations. All transaction operations return the same format: {“hash”: “string”} Used by payment transactions, token operations, etc.

Enums§

ActionType
Transaction action types.
Authority
Authority levels that can be granted or revoked for a token.
AuthorityAction
Authority action type for granting or revoking permissions.
BlacklistAction
CertificateData
The encoding format determines which variant is used:
CheckpointTransactions
Checkpoint transactions representation. This can be either transaction hashes or full transaction objects.
CryptoError
NamedChain
Named chain is one of the predefined chains.
PauseAction
Pause action types matching L1 server implementation.
TransactionSignature
Transaction signature type - either single signature or multi-signature
TxPayload
Instructions supported by mint token
WhitelistAction
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