Add typed RPC errors for submit-and-wait#328
Open
e-desouza wants to merge 2 commits into
Open
Conversation
Patel-Raj11
reviewed
Jun 10, 2026
| if let Some(error) = response.error { | ||
| if error == "txnNotFound" { | ||
| if let Some(error) = response.error.as_ref() { | ||
| if response.rpc_error() == Some(XRPLRpcError::TxnNotFound) { |
Collaborator
There was a problem hiding this comment.
I think submit_and_wait only cares about txnNotFound error. So, would it be good idea to only list the error codes that we actually use in XRPLRpcError, instead of being exhaustive here? With the current exhaustive list, we would deviate from xrpld implementation as we maintain the copy.
Collaborator
There was a problem hiding this comment.
If in future we want to make use of some other error code in source code, we can come here and that specific error code.
## Summary Adds XLS-0033 Multi-Purpose Token (MPT) support to `xrpl-rust`, including typed models, binary codec support, request/result handling, and integration coverage against local `xrpld`/Clio services. ## MPT Support - Add MPT amount/currency support: - `MPTAmount` - `MPTCurrency` - `Amount::MPTAmount` - `Currency::MPTCurrency` - Add MPT transaction models and validation: - `MPTokenIssuanceCreate` - `MPTokenIssuanceDestroy` - `MPTokenIssuanceSet` - `MPTokenAuthorize` - Add MPT ledger object models: - `MPToken` - `MPTokenIssuance` - Add MPT binary codec support for Hash192 / MPTokenIssuanceID and MPT amounts. - Add MPT support in transaction parsing / balance conversion helpers. - Add `account_objects` MPT filters for `mpt_issuance` and `mptoken`. ## Correctness / Review Follow-ups - Align MPT validation with XLS-0033 and `xrpld` behavior: - 63-bit maximum MPT amount handling. - strict decimal-string MPT amount validation. - strict 48-hex-character MPTokenIssuanceID validation. - metadata hex validation and 1024-byte limit. - non-zero transfer fee requires `tfMPTCanTransfer`. - Harden `Amount` and `Currency` deserialization to avoid ambiguous MPT/issued-currency fallback. - Replace fragile RPC string checks with typed `XRPLRpcError` mapping where touched. - Replace hardcoded branch test literals with named fixtures. - Preserve `no_std` compatibility for model/helper paths. ## Integration Coverage Adds end-to-end MPT coverage for: - Issuance creation with XLS-89-style metadata. - Holder opt-in / issuer authorization / holder unauthorize lifecycle. - Issuance destroy success and destroy-with-obligations rejection. - MPT payments and outstanding amount updates. - Require-auth rejection before issuer authorization. - Global lock transfer rejection. - Maximum amount enforcement. - Clawback success and clawback permission rejection. - Holder transfer restriction when `tfMPTCanTransfer` is absent. - MPT payment binary codec round-trip. ## Validation Validated locally against Podman `xrpld` / Clio services: - `cargo fmt --check` - `git diff --check` - `cargo test --features integration --lib -- --test-threads=1` - `cargo test --features integration --test integration_test -- --test-threads=1` - `cargo test --features integration --test cli_integration -- --test-threads=1` - `cargo test --no-default-features --features models --lib -- --test-threads=1` - `cargo test --no-default-features --features "models,wallet,helpers,json-rpc,embassy-rt" --lib -- --test-threads=1` - `cargo test --no-default-features --features "models,wallet,helpers,websocket,embassy-rt" --lib -- --test-threads=1` - `cargo check --no-default-features --features "models,wallet,helpers,json-rpc,websocket,embassy-rt"`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Local validation
Integration patch coverage locally: 100% (no measured integration patch lines after workflow scope).