Expand description
Deterministic transaction compilation for Ethereum (EVM) and Tron.
This crate converts WalletSuite canonical prepared transaction payloads
into signer-ready unsigned artifacts and human-reviewable representations.
§Example
use walletsuite_tx_compiler::{compile, review, validate};
let raw: serde_json::Value = serde_json::from_str(r#"{
"chain": "ethereum",
"chainId": 1,
"txType": "TRANSFER_NATIVE",
"from": "0x1111111111111111111111111111111111111111",
"to": "0x2222222222222222222222222222222222222222",
"valueWei": "1000000000000000000",
"nonce": "0",
"fee": {
"mode": "EIP1559",
"gasLimit": "21000",
"maxFeePerGas": "30000000000",
"maxPriorityFeePerGas": "1500000000"
}
}"#)?;
let prepared = validate(&raw)?;
let _review = review(&prepared)?;
let result = compile(&prepared, Default::default())?;
assert!(result.unsigned_tx.starts_with("0x02")); // EIP-1559 envelope§Determinism
The compiler is byte-exact against the pinned canonical fixture set
in tests/fixtures/canonical.json. Any change that alters compiled
bytes must update that fixture and is treated as a hard-failing
regression by the CI determinism suite.
Modules§
- constants
- Shared on-chain constants used across validation, review, and compilation.
Structs§
- Compilation
Metadata - Metadata describing how a transaction was compiled.
- Compilation
Result - Result of compiling a prepared transaction.
- Compile
Options - Options for
crate::compile. - FeeParams
- Mode-discriminated fee parameters. Exactly one of the three
mode-specific subsets is populated; the others are
None. - FeeReview
- Fee summary sized for display to a human reviewer.
- Prepared
Transaction - Canonical prepared transaction payload from the
WalletSuiteprepare-sign API. - Transaction
Review - Human-reviewable representation of a transaction.
- Tron
Block Header - Tron block-header reference used for replay protection and
Transaction.raw_dataconstruction. - TxCompiler
Error - Structured error returned by every public operation.
Enums§
- Chain
- Supported chain families.
- FeeMode
- Fee calculation mode carried by a prepared transaction.
- TxCompiler
Error Code - Discriminator for the class of error raised by the compiler.
- TxType
- Intent expressed by the prepared payload.
Functions§
- compile
- Compile a validated prepared transaction into unsigned signer-ready artifacts.
- review
- Produce a human-reviewable summary of
prepared. - tron_
address_ to_ bytes - Decode a Tron address into its raw 21-byte representation.
- validate
- Validate an arbitrary JSON payload into a
PreparedTransaction.