API Overview
This reference provides an overview of the NeoRust SDK API, including the main modules and their functionality.
Core Modules
The NeoRust SDK is organized into several core modules, each responsible for a specific aspect of Neo blockchain interaction:
neo_wallets
The neo_wallets
module provides functionality for creating, loading, and managing Neo wallets and accounts.
Key components:
Wallet
: Manages multiple accounts and provides wallet-level operationsAccount
: Represents a Neo account with a key pairAddress
: Represents a Neo address
neo_clients
The neo_clients
module provides clients for interacting with Neo nodes via RPC.
Key components:
Provider
: Main client for interacting with Neo nodesRpcClient
: Low-level RPC clientWebSocketProvider
: Provider with WebSocket support for subscriptions
neo_types
The neo_types
module provides fundamental Neo blockchain types.
Key components:
Address
: Neo addressScriptHash
: Contract script hashTxHash
: Transaction hashContractParameter
: Parameter for contract invocation
neo_crypto
The neo_crypto
module provides cryptographic functionality.
Key components:
KeyPair
: Represents a public/private key pairPublicKey
: Represents a public keyPrivateKey
: Represents a private keySignature
: Represents a cryptographic signature
neo_builder
The neo_builder
module provides builders for creating transactions and scripts.
Key components:
TransactionBuilder
: Builder for creating transactionsScriptBuilder
: Builder for creating VM scripts
neo_contract
The neo_contract
module provides interfaces for interacting with Neo smart contracts.
Key components:
Nep17Contract
: Interface for NEP-17 tokensNeoToken
: Interface for the NEO tokenGasToken
: Interface for the GAS tokenNameService
: Interface for the Neo Name Service
neo_x
The neo_x
module provides support for Neo X, an EVM-compatible chain maintained by Neo.
Key components:
NeoXProvider
: Provider for interacting with Neo X nodesNeoXTransaction
: Transaction for Neo XNeoXBridgeContract
: Interface for the Neo X bridge
neo_sgx
The neo_sgx
module provides support for Intel SGX (Software Guard Extensions) for secure operations.
Key components:
SgxEnclaveManager
: Manager for SGX enclavesSgxWallet
: Secure wallet implementationSgxRpcClient
: Secure RPC client
Prelude
The prelude
module re-exports commonly used types and functions for convenience:
This imports all the essential types and functions you need for most operations with the NeoRust SDK.
Feature Flags
The NeoRust SDK supports various feature flags to enable specific functionality:
ledger
: Support for Ledger hardware walletsaws
: AWS integrationsgx
: Intel SGX support
Enable these features in your Cargo.toml:
[dependencies]
neo = { git = "https://github.com/R3E-Network/NeoRust", features = ["ledger", "aws", "sgx"] }
Error Handling
The NeoRust SDK uses Rust's Result
type for error handling. Most functions return a Result<T, Error>
where Error
is a custom error type that can represent various error conditions.
For more detailed information on specific modules and types, see the corresponding reference pages.