Skip to main content

Crate sdkt_xdr

Crate sdkt_xdr 

Source
Expand description

XDR decoding engine for Stellar and Soroban structures.

Handles conversion of raw Base64, Hex, or raw-byte XDR payloads into standardized JSON formats (compact or pretty-printed).

§Supported Types

  • ScVal
  • TransactionEnvelope
  • TransactionResult
  • TransactionMeta
  • LedgerKey
  • LedgerEntry
  • ContractEvent (auto + explicit)

§Example

use sdkt_xdr::decode;

let b64 = "AAAAAQAAAAoAAAAA"; // ScVal::I32(1)
let json = decode(b64, Some("scval"), sdkt_xdr::OutputFormat::Json).unwrap();
println!("{}", json);

Re-exports§

pub use builder::build_create_contract_tx;
pub use builder::build_create_contract_tx_with_data;
pub use builder::build_create_contract_tx_with_data_and_auth;
pub use builder::build_create_contract_v2_tx;
pub use builder::build_create_contract_v2_tx_with_data;
pub use builder::build_create_contract_v2_tx_with_data_and_auth;
pub use builder::build_extend_footprint_tx;
pub use builder::build_extend_footprint_tx_with_data;
pub use builder::build_invoke_transaction;
pub use builder::build_invoke_transaction_with_data;
pub use builder::build_restore_footprint_tx;
pub use builder::build_upload_wasm_tx;
pub use builder::build_upload_wasm_tx_with_data;
pub use builder::decode_account_id;
pub use builder::decode_contract_id;
pub use builder::decode_ledger_key;
pub use builder::derive_contract_id;
pub use builder::memo_id;
pub use builder::memo_text;
pub use builder::merge_footprint_keys;
pub use builder::parse_scval_args;
pub use builder::parse_soroban_transaction_data;
pub use builder::CreateContractParams;
pub use builder::CreateContractV2Params;
pub use builder::ExtendFootprintParams;
pub use builder::InvokeTransactionParams;
pub use builder::RestoreFootprintParams;
pub use builder::UploadWasmParams;
pub use envelope::decode_envelope;
pub use envelope::render_scval;
pub use envelope::view_envelope;
pub use envelope::EnvelopeView;
pub use sign::sign_envelope_with;
pub use sign::sign_transaction;
pub use sign::verify_signature;
pub use sign::Ed25519Signer;
pub use sign::Network;
pub use sign::Signer;
pub use sign::SigningError;
pub use sign::SigningOptions;
pub use typed::decode_scvals;
pub use typed::decode_scvals_ref;
pub use typed::encode_scvals;
pub use typed::json_args_to_base64;
pub use typed::json_to_scval;
pub use typed::scval_from_base64;
pub use typed::scval_to_base64;
pub use typed::Address;
pub use typed::FromScVal;
pub use typed::IntoScVal;
pub use typed::ScValError;

Modules§

abi_decode
ABI-aware ScVal decoding using ContractSpec ().
builder
Transaction envelope building logic for Soroban.
envelope
Human-readable view of a TransactionEnvelope, for reviewing a transaction before it is signed or submitted.
sign
Native transaction signing for Soroban / Stellar.
typed
Typed Rust <-> ScVal conversion and typed contract-invocation helpers.

Structs§

ExternalExecutableRef
The owner + tag pair of a CAP-85 CONTRACT_EXECUTABLE_EXTERNAL_REF.

Enums§

ContractExecutableRef
A contract’s executable as recorded in its ContractInstance ledger entry.
DecodeError
Errors returned by the decoder.
LedgerKeyParams
Parameters for constructing a LedgerKey.
OutputFormat
Defines the output formatting style for CLI and RPC responses.

Functions§

build_map_key
Build a Soroban “enum/map”-style storage key ScVal: an ScVec whose first element is symbol and whose remaining elements are the decoded typed key arguments (each supplied as a Base64 ScVal).
decode
Decode a base64- or hex-encoded XDR payload to JSON.
decode_bytes
Decode raw bytes (no base64/hex pre-processing).
encode_ledger_key
Encodes LedgerKeyParams into a Base64 XDR LedgerKey.
estimate_xdr_size
Estimate the serialized XDR size (in bytes) of a WriteXdr value.
extract_contract_data_value
Extracts the generic val: ScVal and durability from a LedgerEntry containing a ContractData entry.
extract_contract_executable
Decode a contract instance’s executable out of a Base64 XDR LedgerEntry.
extract_wasm_bytecode
Extracts the raw WASM bytecode from a Base64 encoded LedgerEntry containing a ContractCode entry.
extract_wasm_bytecode_from_live_ledger_entry
Live-wire compatibility decoder for ContractCode entries (data-first layout).
extract_wasm_hash
Extracts the WASM hash from a Base64 encoded LedgerEntry. Traverses: LedgerEntry -> LedgerEntryData::ContractData -> ScVal::ContractInstance -> ContractExecutable::Wasm -> Hash
extract_wasm_hash_from_live_ledger_entry
Live-wire compatibility decoder: reads the LedgerEntryData union FIRST (the order the live testnet RPC uses), then ignores any trailing lastModifiedLedgerSeq/ext bytes. Scope is strictly ContractData/Wasm hash extraction.
format_json
parse_external_executable_hash
Read the 32-byte Wasm hash stored in a CAP-85 executable-tag entry.
symbol_scval
Build a validated ScVal::Symbol.
symbol_topic_base64
Encode an event-name symbol as the base64 XDR ScVal the RPC getEvents topic matcher compares against (e.g. topic[0] of a contract event).
validate_xdr
Validate that a raw byte payload is a well-formed XDR TransactionEnvelope.