near-kit 0.9.0

A clean, ergonomic Rust client for NEAR Protocol
Documentation
//! Core types for NEAR Protocol.
//!
//! This module provides hand-rolled types based on NEAR RPC responses,
//! designed for ergonomic use in client applications.
//!
//! # Primary Types
//!
//! | Type | Description |
//! |------|-------------|
//! | [`AccountId`] | Validated NEAR account identifier |
//! | [`NearToken`] | Token amount with yoctoNEAR (10⁻²⁴) precision |
//! | [`Gas`] | Gas units for transactions |
//! | [`PublicKey`] | Ed25519 or Secp256k1 public key |
//! | [`SecretKey`] | Ed25519 or Secp256k1 secret key |
//! | [`CryptoHash`] | 32-byte SHA-256 hash (blocks, transactions) |
//!
//! # Amount Types
//!
//! [`NearToken`] and [`Gas`] support both typed constructors and string parsing:
//!
//! ```
//! use near_kit::{NearToken, Gas};
//!
//! // Typed constructors (compile-time safe, zero-cost)
//! let amount = NearToken::from_near(5);
//! let gas = Gas::from_tgas(30);
//!
//! // String parsing (for runtime input)
//! let amount: NearToken = "5 NEAR".parse().unwrap();
//! let gas: Gas = "30 Tgas".parse().unwrap();
//! ```
//!
//! # Block References
//!
//! [`BlockReference`] specifies which block state to query:
//!
//! - `BlockReference::Finality(Finality::Final)` — Fully finalized (default)
//! - `BlockReference::Finality(Finality::Optimistic)` — Latest optimistic
//! - `BlockReference::Height(12345)` — Specific block height
//! - `BlockReference::Hash(hash)` — Specific block hash
//!
//! # RPC Response Types
//!
//! Types for RPC responses include [`AccountView`], [`BlockView`],
//! [`FinalExecutionOutcome`], and others.

mod account;
mod action;
mod block_reference;
mod error;
mod hash;
mod hd;
mod key;
pub mod nep413;
mod network;
pub(crate) mod rpc;
mod rpc_extra;
mod transaction;
mod units;
mod wait_level;

pub use account::{AccountId, AccountIdExt, AccountIdRef, AccountType, TryIntoAccountId};
pub use action::{
    AccessKey, AccessKeyPermission, Action, AddKeyAction, CreateAccountAction,
    DELEGATE_ACTION_PREFIX, DecodeError as DelegateDecodeError, DelegateAction,
    DeleteAccountAction, DeleteKeyAction, DeployContractAction, DeployGlobalContractAction,
    DeterministicAccountStateInit, DeterministicAccountStateInitV1, DeterministicStateInitAction,
    FunctionCallAction, FunctionCallPermission, GasKeyInfo, GlobalContractDeployMode,
    GlobalContractIdentifier, GlobalContractRef, NonDelegateAction, PublishMode,
    SignedDelegateAction, StakeAction, TransferAction, TransferToGasKeyAction,
    UseGlobalContractAction, WithdrawFromGasKeyAction,
};
pub use block_reference::{BlockReference, Finality, SyncCheckpoint, TxExecutionStatus};
pub use error::{
    ActionError, ActionErrorKind, ActionsValidationError, CompilationError,
    DepositCostFailureReason, FunctionCallError, HostError, InvalidAccessKeyError, InvalidTxError,
    MethodResolveError, PrepareError, ReceiptValidationError, StorageError, TxExecutionError,
    WasmTrap,
};
pub use hash::CryptoHash;
pub use key::{
    DEFAULT_HD_PATH, DEFAULT_WORD_COUNT, KeyPair, KeyType, PublicKey, SecretKey, Signature,
    generate_seed_phrase,
};
pub use network::ChainId;
pub use rpc::{
    AccessKeyDetails, AccessKeyInfoView, AccessKeyListView, AccessKeyPermissionView, AccessKeyView,
    AccountBalance, AccountView, ActionReceiptData, ActionView, BandwidthRequest,
    BandwidthRequestBitmap, BandwidthRequests, BandwidthRequestsV1, BlockHeaderView, BlockView,
    ChunkHeaderView, CongestionInfoView, DataReceiptData, DataReceiverView, DelegateActionView,
    ExecutionMetadata, ExecutionOutcome, ExecutionOutcomeWithId, ExecutionStatus,
    FinalExecutionOutcome, FinalExecutionStatus, GasPrice, GasProfileEntry,
    GlobalContractIdentifierView, MerkleDirection, MerklePathItem, NodeVersion,
    RawTransactionResponse, Receipt, ReceiptContent, STORAGE_AMOUNT_PER_BYTE, SendTxResponse,
    SlashedValidator, StatusResponse, SyncInfo, TransactionView, TrieSplit, ValidatorInfo,
    ValidatorStakeView, ValidatorStakeViewV1, ViewFunctionResult,
};
pub use rpc_extra::{
    BlockHeaderInnerLiteView, CurrentEpochValidatorInfo, EpochValidatorInfo,
    LightClientBlockLiteView, LightClientBlockView, NextEpochValidatorInfo, StateChangeCauseView,
    StateChangeValueView, StateChangeWithCauseView, ValidatorKickoutReason, ValidatorKickoutView,
};
pub use transaction::{SignedTransaction, Transaction};
pub use units::{Gas, IntoGas, IntoNearToken, NearToken};
pub use wait_level::{
    Executed, ExecutedOptimistic, Final, Included, IncludedFinal, Submitted, WaitLevel,
};