From f0037142bd5c00caab83cab875c0cb77ba2ebff3 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Tue, 29 Jul 2025 13:19:10 -0300 Subject: [PATCH 1/3] feat: pretty message for tx3 error --- Cargo.lock | 1220 +++++++++++++++++++++++++++++++++-- Cargo.toml | 1 + sdk/Cargo.toml | 2 + sdk/src/trp/error/mod.rs | 1 + sdk/src/trp/error/pretty.rs | 257 ++++++++ sdk/src/trp/mod.rs | 1 + 6 files changed, 1427 insertions(+), 55 deletions(-) create mode 100644 sdk/src/trp/error/mod.rs create mode 100644 sdk/src/trp/error/pretty.rs diff --git a/Cargo.lock b/Cargo.lock index c85781c..a98d5fd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,53 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.98" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e16d2d3311acee920a9eb8d33b8cbc1787ce4a264e85f964c2404b969bdcd487" + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + [[package]] name = "backtrace" version = "0.3.75" @@ -41,12 +88,30 @@ dependencies = [ "backtrace", ] +[[package]] +name = "base58" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6107fe1be6682a68940da878d9e9f5e90ca5745b3dec9fd1bb393c8777d4f581" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + [[package]] name = "base64" version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" +[[package]] +name = "bech32" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" + [[package]] name = "bech32" version = "0.11.0" @@ -73,6 +138,34 @@ dependencies = [ "virtue", ] +[[package]] +name = "bip39" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d193de1f7487df1914d3a568b772458861d33f9c54249612cc2893d6915054" +dependencies = [ + "bitcoin_hashes", + "rand_core 0.6.4", + "serde", + "unicode-normalization", +] + +[[package]] +name = "bitcoin-internals" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9425c3bf7089c983facbae04de54513cce73b41c7f9ff8c845b54e7bc64ebbfb" + +[[package]] +name = "bitcoin_hashes" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1930a4dabfebb8d7d9992db18ebe3ae2876f0a305fab206fd168df931ede293b" +dependencies = [ + "bitcoin-internals", + "hex-conservative", +] + [[package]] name = "bitflags" version = "2.9.1" @@ -94,6 +187,12 @@ version = "3.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46c5e41b57b8bba42a04676d81cb89e9ee8e859a1a66f80a5a72e1cb76b34d43" +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + [[package]] name = "bytes" version = "1.10.1" @@ -102,9 +201,9 @@ checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" [[package]] name = "cc" -version = "1.2.29" +version = "1.2.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c1599538de2394445747c8cf7935946e3cc27e9625f889d979bfb2aaf569362" +checksum = "deec109607ca693028562ed836a5f1c4b8bd77755c4e132fc5ce11b0b6211ae7" dependencies = [ "shlex", ] @@ -121,6 +220,27 @@ version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "js-sys", + "num-traits", + "serde", + "wasm-bindgen", + "windows-link", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + [[package]] name = "cpufeatures" version = "0.2.17" @@ -130,6 +250,27 @@ dependencies = [ "libc", ] +[[package]] +name = "crc" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crunchy" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "460fbee9c2c2f33933d720630a6a0bac33ba7053db5344fac858d4b8952d77d5" + [[package]] name = "crypto-common" version = "0.1.6" @@ -140,6 +281,57 @@ dependencies = [ "typenum", ] +[[package]] +name = "cryptoxide" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "382ce8820a5bb815055d3553a610e8cb542b2d767bbacea99038afda96cd760d" + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "deranged" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", + "serde", +] + [[package]] name = "digest" version = "0.10.7" @@ -161,6 +353,33 @@ dependencies = [ "syn", ] +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "ed25519-bip32" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb588f93c0d91b2f668849fd6d030cddb0b2e31f105963be189da5acdf492a21" +dependencies = [ + "cryptoxide", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + [[package]] name = "errno" version = "0.3.13" @@ -171,6 +390,18 @@ dependencies = [ "windows-sys 0.60.2", ] +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fixedbitset" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d674e81391d1e1ab681a28d99df07927c6d4aa5b027d7da16ba32d1d21ecd99" + [[package]] name = "fnv" version = "1.0.7" @@ -262,12 +493,46 @@ version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" +[[package]] +name = "half" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459196ed295495a68f7d7fe1d84f6c4b7ff0e21fe3017b2f283c6fac3ad803c9" +dependencies = [ + "cfg-if", + "crunchy", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + [[package]] name = "hex" version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" + [[package]] name = "http" version = "1.3.1" @@ -346,11 +611,11 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.15" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f66d5bd4c6f02bf0542fad85d626775bab9258cf795a4256dcaf3161114d1df" +checksum = "8d9b05277c7e8da2c93a568989bb6207bef0112e8d17df7a6eda4a3cf143bc5e" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-channel", "futures-core", @@ -362,12 +627,36 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.6.0", "tokio", "tower-service", "tracing", ] +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.0.0" @@ -454,6 +743,12 @@ dependencies = [ "zerovec", ] +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + [[package]] name = "idna" version = "1.0.3" @@ -475,11 +770,33 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe4cd85333e22411419a0bcae1297d25e58c9443848b11dc6a86fefe8c78a661" +dependencies = [ + "equivalent", + "hashbrown 0.15.4", + "serde", +] + [[package]] name = "io-uring" -version = "0.7.8" +version = "0.7.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +checksum = "d93587f37623a1a17d94ef2bc9ada592f5465fe7732084ab7beefabe5c77c0c4" dependencies = [ "bitflags", "cfg-if", @@ -508,6 +825,24 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.15" @@ -590,6 +925,27 @@ dependencies = [ "syn", ] +[[package]] +name = "minicbor" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0452a60c1863c1f50b5f77cd295e8d2786849f35883f0b9e18e7e6e1b5691b0" +dependencies = [ + "half", + "minicbor-derive", +] + +[[package]] +name = "minicbor-derive" +version = "0.15.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd2209fff77f705b00c737016a48e73733d7fbccb8b007194db148f03561fb70" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "miniz_oxide" version = "0.8.9" @@ -610,6 +966,57 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "multimap" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d87ecb2933e8aeadb3e3a02b828fed80a7528047e68b4f424523a0981a3a084" + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + [[package]] name = "object" version = "0.36.7" @@ -631,6 +1038,242 @@ version = "4.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48dd4f4a2c8405440fd0462561f0e5806bd0f77e86f51c761481bdd4018b545e" +[[package]] +name = "pallas" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37bba5e9e84978df0d42b72c3b92ead5a3b1c4852f66c08b648a5c057f58717a" +dependencies = [ + "pallas-addresses", + "pallas-codec", + "pallas-configs", + "pallas-crypto", + "pallas-network", + "pallas-primitives", + "pallas-traverse", + "pallas-txbuilder", + "pallas-utxorpc", +] + +[[package]] +name = "pallas-addresses" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18f5f4dd205316335bf8eef77227e01a8a00b1fd60503d807520e93dd0362d0e" +dependencies = [ + "base58", + "bech32 0.9.1", + "crc", + "cryptoxide", + "hex", + "pallas-codec", + "pallas-crypto", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-applying" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b196174663e1c4eb80a286b8ddca78f75fca5fc57b0baaa5b1143a6dd76ca71b" +dependencies = [ + "chrono", + "hex", + "pallas-addresses", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "pallas-traverse", + "rand 0.8.5", +] + +[[package]] +name = "pallas-codec" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b2737b05f0dbb6d197feeb26ef15d2567e54833184bd469f5655a0537da89fa" +dependencies = [ + "hex", + "minicbor", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-configs" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a4e63bff98bd71b3057a0986dc72e6ba58afaf063bce3dc8243fda5f0665726" +dependencies = [ + "base64 0.22.1", + "hex", + "num-rational", + "pallas-addresses", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "serde", + "serde_json", + "serde_with", +] + +[[package]] +name = "pallas-crypto" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0368945cd093e550febe36aef085431b1611c2e9196297cd70f4b21a4add054c" +dependencies = [ + "cryptoxide", + "hex", + "pallas-codec", + "rand_core 0.6.4", + "serde", + "thiserror 1.0.69", + "zeroize", +] + +[[package]] +name = "pallas-network" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1244da7a760a08b8a9d9a28a28112f10a7b6476d64192696a269cfd09a7ec55c" +dependencies = [ + "byteorder", + "hex", + "itertools 0.13.0", + "pallas-codec", + "pallas-crypto", + "rand 0.8.5", + "socket2 0.5.10", + "thiserror 1.0.69", + "tokio", + "tracing", +] + +[[package]] +name = "pallas-primitives" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb2acde8875c43446194d387c60fe2d6a127e4f8384bef3dcabd5a04e9422429" +dependencies = [ + "base58", + "bech32 0.9.1", + "hex", + "log", + "pallas-codec", + "pallas-crypto", + "serde", + "serde_json", +] + +[[package]] +name = "pallas-traverse" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab64895a0d94fed1ef2d99dd37e480ed0483e91eb98dcd2f94cc614fb9575173" +dependencies = [ + "hex", + "itertools 0.13.0", + "pallas-addresses", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "paste", + "serde", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-txbuilder" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46ff1f49d99aced71b20daa68577167e1db3f0aaffe92fbc1de6df0b6002a66e" +dependencies = [ + "hex", + "pallas-addresses", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "pallas-traverse", + "pallas-wallet", + "serde", + "serde_json", + "thiserror 1.0.69", +] + +[[package]] +name = "pallas-utxorpc" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bdf89daca5ebfbcd9b5cf8b480486302ffd3401f6891d3c4f02087fd7687b94" +dependencies = [ + "pallas-applying", + "pallas-codec", + "pallas-crypto", + "pallas-primitives", + "pallas-traverse", + "prost-types", + "utxorpc-spec", +] + +[[package]] +name = "pallas-wallet" +version = "0.33.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d91b48fe1d0d07b425aed4b1c6ac5d962e0a392ccc58e2f3faa8ad250a5c364" +dependencies = [ + "bech32 0.9.1", + "bip39", + "cryptoxide", + "ed25519-bip32", + "pallas-crypto", + "rand 0.8.5", + "thiserror 1.0.69", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pbjson" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e6349fa080353f4a597daffd05cb81572a9c031a6d4fff7e504947496fcc68" +dependencies = [ + "base64 0.21.7", + "serde", +] + +[[package]] +name = "pbjson-build" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eea3058763d6e656105d1403cb04e0a41b7bbac6362d413e7c33be0c32279c9" +dependencies = [ + "heck", + "itertools 0.13.0", + "prost", + "prost-types", +] + +[[package]] +name = "pbjson-types" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e54e5e7bfb1652f95bc361d76f3c780d8e526b134b85417e774166ee941f0887" +dependencies = [ + "bytes", + "chrono", + "pbjson", + "pbjson-build", + "prost", + "prost-build", + "serde", +] + [[package]] name = "percent-encoding" version = "2.3.1" @@ -647,7 +1290,7 @@ dependencies = [ "miette", "serde", "serde_json", - "thiserror", + "thiserror 2.0.12", "ucd-trie", ] @@ -684,6 +1327,36 @@ dependencies = [ "sha2", ] +[[package]] +name = "petgraph" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3672b37090dbd86368a4145bc067582552b29c27377cad4e0a306c97f9bd7772" +dependencies = [ + "fixedbitset", + "indexmap 2.10.0", +] + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" version = "0.2.16" @@ -697,30 +1370,98 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] -name = "potential_utf" -version = "0.1.2" +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff24dfcda44452b9816fff4cd4227e1bb73ff5a2f1bc1105aa92fb8565ce44d2" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "prost" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2796faa41db3ec313a31f7624d9286acf277b52de526150b7e69f3debf891ee5" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-build" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +checksum = "be769465445e8c1474e9c5dac2018218498557af32d9ed057325ec9a41ae81bf" dependencies = [ - "zerovec", + "heck", + "itertools 0.14.0", + "log", + "multimap", + "once_cell", + "petgraph", + "prettyplease", + "prost", + "prost-types", + "regex", + "syn", + "tempfile", ] [[package]] -name = "ppv-lite86" -version = "0.2.21" +name = "prost-derive" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +checksum = "8a56d757972c98b346a9b766e3f02746cde6dd1cd1d1d563472929fdd74bec4d" dependencies = [ - "zerocopy", + "anyhow", + "itertools 0.14.0", + "proc-macro2", + "quote", + "syn", ] [[package]] -name = "proc-macro2" -version = "1.0.95" +name = "prost-types" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +checksum = "52c2c1bf36ddb1a1c396b3601a3cec27c2462e45f07c386894ec3ccf5332bd16" dependencies = [ - "unicode-ident", + "prost", ] [[package]] @@ -736,8 +1477,8 @@ dependencies = [ "quinn-udp", "rustc-hash", "rustls", - "socket2", - "thiserror", + "socket2 0.5.10", + "thiserror 2.0.12", "tokio", "tracing", "web-time", @@ -752,13 +1493,13 @@ dependencies = [ "bytes", "getrandom 0.3.3", "lru-slab", - "rand", + "rand 0.9.2", "ring", "rustc-hash", "rustls", "rustls-pki-types", "slab", - "thiserror", + "thiserror 2.0.12", "tinyvec", "tracing", "web-time", @@ -773,7 +1514,7 @@ dependencies = [ "cfg_aliases", "libc", "once_cell", - "socket2", + "socket2 0.5.10", "tracing", "windows-sys 0.59.0", ] @@ -795,12 +1536,33 @@ checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" [[package]] name = "rand" -version = "0.9.1" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" dependencies = [ - "rand_chacha", - "rand_core", + "ppv-lite86", + "rand_core 0.6.4", ] [[package]] @@ -810,7 +1572,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" dependencies = [ "ppv-lite86", - "rand_core", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", ] [[package]] @@ -822,13 +1593,62 @@ dependencies = [ "getrandom 0.3.3", ] +[[package]] +name = "ref-cast" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0ae411dbe946a674d89546582cea4ba2bb8defac896622d6496f14c23ba5cf" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1165225c21bff1f3bbce98f5a1f889949bc902d3575308cc7b0de30b4f6d27c7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + [[package]] name = "reqwest" version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ - "base64", + "base64 0.22.1", "bytes", "futures-core", "http", @@ -876,9 +1696,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.25" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" +checksum = "56f7d92ca342cea22a06f2121d944b4fd82af56988c270852495420f961d4ace" [[package]] name = "rustc-hash" @@ -888,15 +1708,15 @@ checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" [[package]] name = "rustix" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +checksum = "11181fbabf243db407ef8df94a6ce0b2f9a733bd8be4ad02b4eda9602296cac8" dependencies = [ "bitflags", "errno", "libc", "linux-raw-sys", - "windows-sys 0.59.0", + "windows-sys 0.60.2", ] [[package]] @@ -946,6 +1766,30 @@ version = "1.0.20" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82d20c4491bc164fa2f6c5d44565947a52ad80b9505d8e36f8d54c27c739fcd0" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "serde" version = "1.0.219" @@ -968,9 +1812,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.140" +version = "1.0.141" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +checksum = "30b9eff21ebe718216c6ec64e1d9ac57087aad11efc64e32002bce4a0d4c03d3" dependencies = [ "itoa", "memchr", @@ -990,6 +1834,38 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_with" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2c45cd61fefa9db6f254525d46e392b852e0e61d9a1fd36e5bd183450a556d5" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.10.0", + "schemars 0.9.0", + "schemars 1.0.4", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de90945e6565ce0d9a25098082ed4ee4002e047cb59892c318d66821e14bb30f" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "sha2" version = "0.10.9" @@ -1029,12 +1905,28 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233504af464074f9d066d7b5416c5f9b894a5862a6506e306f7b816cdd6f1807" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + [[package]] name = "stable_deref_trait" version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + [[package]] name = "subtle" version = "2.6.1" @@ -1093,6 +1985,19 @@ dependencies = [ "syn", ] +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + [[package]] name = "terminal_size" version = "0.4.2" @@ -1113,13 +2018,33 @@ dependencies = [ "unicode-width 0.2.1", ] +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + [[package]] name = "thiserror" version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl", + "thiserror-impl 2.0.12", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1133,6 +2058,37 @@ dependencies = [ "syn", ] +[[package]] +name = "time" +version = "0.3.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" + +[[package]] +name = "time-macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +dependencies = [ + "num-conv", + "time-core", +] + [[package]] name = "tinystr" version = "0.8.1" @@ -1160,9 +2116,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.46.1" +version = "1.47.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cc3a2344dafbe23a245241fe8b09735b521110d30fcefbbd5feb1797ca35d17" +checksum = "43864ed400b6043a4757a25c7a64a8efde741aed79a056a2fb348a406701bb35" dependencies = [ "backtrace", "bytes", @@ -1171,8 +2127,20 @@ dependencies = [ "mio", "pin-project-lite", "slab", - "socket2", - "windows-sys 0.52.0", + "socket2 0.6.0", + "tokio-macros", + "windows-sys 0.59.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn", ] [[package]] @@ -1185,6 +2153,38 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tonic" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877c5b330756d856ffcc4553ab34a5684481ade925ecc54bcd1bf02b1d0d4d52" +dependencies = [ + "async-trait", + "base64 0.22.1", + "bytes", + "http", + "http-body", + "http-body-util", + "percent-encoding", + "pin-project", + "prost", + "tokio-stream", + "tower-layer", + "tower-service", + "tracing", +] + [[package]] name = "tower" version = "0.5.2" @@ -1237,9 +2237,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81383ab64e72a7a8b8e13130c49e3dab29def6d0c7d76a03087b3cf71c5c6903" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.34" @@ -1268,9 +2280,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tx3-lang" -version = "0.10.0" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d67a332fe43d1758581f69810fa0eb8ec5cb044b3a1d0219beedd831a99cdd8f" +checksum = "0ffaa32efb0788a1de7a67be5b13233a6b24a5cce0247c6d7411cb4c84e88b88" dependencies = [ "bincode", "hex", @@ -1278,22 +2290,35 @@ dependencies = [ "pest", "pest_derive", "serde", - "thiserror", + "thiserror 2.0.12", + "trait-variant", +] + +[[package]] +name = "tx3-resolver" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d50ad0c4d6b63a3d425044ba40aa96dd1092a8366bacfebe562c3cafa10a6769" +dependencies = [ + "thiserror 2.0.12", "trait-variant", + "tx3-lang", ] [[package]] name = "tx3-sdk" version = "0.7.0" dependencies = [ - "base64", - "bech32", + "base64 0.22.1", + "bech32 0.11.0", "hex", + "pallas", "reqwest", "serde", "serde_json", - "thiserror", + "thiserror 2.0.12", "tx3-lang", + "tx3-resolver", "uuid", ] @@ -1321,6 +2346,15 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + [[package]] name = "unicode-width" version = "0.1.14" @@ -1362,6 +2396,22 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" +[[package]] +name = "utxorpc-spec" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c73cb3e15766a14cbc99fbd6dbbee04496fc9c64b47b088ae1d7698d43e357" +dependencies = [ + "bytes", + "futures-core", + "pbjson", + "pbjson-types", + "prost", + "prost-types", + "serde", + "tonic", +] + [[package]] name = "uuid" version = "1.17.0" @@ -1502,13 +2552,72 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8782dd5a41a24eed3a4f40b606249b3e236ca61adf1f25ea4d45c73de122b502" +checksum = "7e8983c3ab33d6fb807cfcdad2491c4ea8cbc8ed839181c7dfd9c67c83e261b2" dependencies = [ "rustls-pki-types", ] +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + [[package]] name = "windows-sys" version = "0.52.0" @@ -1533,7 +2642,7 @@ version = "0.60.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" dependencies = [ - "windows-targets 0.53.2", + "windows-targets 0.53.3", ] [[package]] @@ -1554,10 +2663,11 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.53.2" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c66f69fcc9ce11da9966ddb31a40968cad001c5bedeb5c2b82ede4253ab48aef" +checksum = "d5fe6031c4041849d7c496a8ded650796e7b6ecc19df1a431c1a363342e5dc91" dependencies = [ + "windows-link", "windows_aarch64_gnullvm 0.53.0", "windows_aarch64_msvc 0.53.0", "windows_i686_gnu 0.53.0", diff --git a/Cargo.toml b/Cargo.toml index 1a06dd3..786d28b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,4 +16,5 @@ readme = "README.md" [workspace.dependencies] tx3-lang = "^0" +tx3-resolver = "^0" # tx3-lang = { version = "*", path = "../tx3/crates/tx3-lang" } diff --git a/sdk/Cargo.toml b/sdk/Cargo.toml index 31c1a04..86f5950 100644 --- a/sdk/Cargo.toml +++ b/sdk/Cargo.toml @@ -14,6 +14,7 @@ readme.workspace = true [dependencies] tx3-lang = { workspace = true } +tx3-resolver = { workspace = true } reqwest = { version = "0.12.20", features = ["json", "rustls-tls"], default-features = false } serde = { version = "1.0", features = ["derive"] } @@ -23,3 +24,4 @@ thiserror = "2.0.12" hex = "0.4.3" base64 = "0.22.1" bech32 = "0.11.0" +pallas = { version = "0.33.0" } diff --git a/sdk/src/trp/error/mod.rs b/sdk/src/trp/error/mod.rs new file mode 100644 index 0000000..c3b7109 --- /dev/null +++ b/sdk/src/trp/error/mod.rs @@ -0,0 +1 @@ +pub mod pretty; diff --git a/sdk/src/trp/error/pretty.rs b/sdk/src/trp/error/pretty.rs new file mode 100644 index 0000000..7cbe028 --- /dev/null +++ b/sdk/src/trp/error/pretty.rs @@ -0,0 +1,257 @@ +use pallas::ledger::addresses::Address; +use tx3_lang::{ + applying::Error as ApplyingError, + backend::Error as BackendError, + ir::{AssetExpr, BuiltInOp, Coerce, CompilerOp, Expression, InputQuery, Param, Type}, + UtxoRef, +}; +use tx3_resolver::Error as ResolverError; + +pub trait PrettyError { + fn pretty(&self) -> String; +} + +impl PrettyError for ResolverError { + fn pretty(&self) -> String { + match self { + ResolverError::InputQueryTooBroad => { + "Input query is too broad, try adding more constraints.".to_string() + } + ResolverError::InputNotResolved(v, q) => { + format!("Input not resolved: {} with {}", v, q.pretty()) + } + ResolverError::ExpectedData(data_type, expression) => { + format!("Expected {}, got {}", data_type, expression.pretty()) + } + ResolverError::ApplyError(error) => { + format!("Apply error: {}", error.pretty()) + } + ResolverError::CantCompileNonConstantTir => { + "Can't compile non-constant TIR.".to_string() + } + ResolverError::BackendError(error) => { + format!("Backend error: {}", error.pretty()) + } + } + } +} + +impl PrettyError for Expression { + fn pretty(&self) -> String { + match self { + Expression::None => "none".to_string(), + Expression::Bytes(bytes) => hex::encode(bytes), + Expression::Number(n) => n.to_string(), + Expression::Bool(b) => b.to_string(), + Expression::String(s) => s.to_owned(), + Expression::Address(addr) => Address::from_bytes(&addr).unwrap().to_bech32().unwrap(), + Expression::Hash(hash) => hex::encode(hash), + Expression::UtxoRefs(refs) => refs + .iter() + .map(|r| r.pretty()) + .collect::>() + .join(", "), + Expression::Assets(assets) => { + let assets_str: Vec = assets.iter().map(|a| a.pretty()).collect(); + format!("assets[{}]", assets_str.join(", ")) + } + Expression::List(items) => { + let items_str: Vec = items.iter().map(|item| item.pretty()).collect(); + format!("[{}]", items_str.join(", ")) + } + Expression::Tuple(tuple) => { + format!("({}, {})", tuple.0.pretty(), tuple.1.pretty()) + } + Expression::Struct(s) => { + let fields_str: Vec = s.fields.iter().map(|f| f.pretty()).collect(); + format!("struct_{} {{ {} }}", s.constructor, fields_str.join(", ")) + } + Expression::UtxoSet(utxos) => { + format!("utxo_set({} items)", utxos.len()) + } + Expression::EvalParam(param) => { + format!("eval_param({})", param.pretty()) + } + Expression::EvalBuiltIn(op) => { + format!("eval_builtin({})", op.pretty()) + } + Expression::EvalCompiler(op) => { + format!("eval_compiler({})", op.pretty()) + } + Expression::EvalCoerce(coerce) => { + format!("eval_coerce({})", coerce.pretty()) + } + Expression::AdHocDirective(directive) => { + format!("directive({})", directive.name) + } + } + } +} + +impl PrettyError for UtxoRef { + fn pretty(&self) -> String { + format!("{}#{}", hex::encode(&self.txid), self.index) + } +} + +impl PrettyError for AssetExpr { + fn pretty(&self) -> String { + if self.policy.is_none() { + return format!("lovelace = {}", self.amount.pretty()); + } + + format!( + "{}.{} = {}", + self.policy.pretty(), + self.asset_name.pretty(), + self.amount.pretty() + ) + } +} + +impl PrettyError for Param { + fn pretty(&self) -> String { + match self { + Param::Set(expr) => format!("set({})", expr.pretty()), + Param::ExpectValue(name, type_) => { + format!("expect_value({}: {})", name, type_.pretty()) + } + Param::ExpectInput(name, query) => { + format!("expect_input({}: {})", name, query.pretty()) + } + Param::ExpectFees => "expect_fees".to_string(), + } + } +} + +impl PrettyError for Type { + fn pretty(&self) -> String { + match self { + Type::Undefined => "Undefined".to_string(), + Type::Unit => "Unit".to_string(), + Type::Int => "Int".to_string(), + Type::Bool => "Bool".to_string(), + Type::Bytes => "Bytes".to_string(), + Type::Address => "Address".to_string(), + Type::Utxo => "Utxo".to_string(), + Type::UtxoRef => "UtxoRef".to_string(), + Type::AnyAsset => "AnyAsset".to_string(), + Type::List => "List".to_string(), + Type::Custom(name) => name.clone(), + } + } +} + +impl PrettyError for InputQuery { + fn pretty(&self) -> String { + let flags = match (self.many, self.collateral) { + (true, true) => " [many, collateral]", + (true, false) => " [many]", + (false, true) => " [collateral]", + (false, false) => "", + }; + format!( + "query(addr: {}, min: {}, ref: {}{})", + self.address.pretty(), + self.min_amount.pretty(), + self.r#ref.pretty(), + flags + ) + } +} + +impl PrettyError for BuiltInOp { + fn pretty(&self) -> String { + match self { + BuiltInOp::NoOp(expr) => format!("noop({})", expr.pretty()), + BuiltInOp::Add(a, b) => format!("{} + {}", a.pretty(), b.pretty()), + BuiltInOp::Sub(a, b) => format!("{} - {}", a.pretty(), b.pretty()), + BuiltInOp::Concat(a, b) => format!("{} ++ {}", a.pretty(), b.pretty()), + BuiltInOp::Negate(expr) => format!("-{}", expr.pretty()), + BuiltInOp::Property(expr, idx) => format!("{}.{}", expr.pretty(), idx), + } + } +} + +impl PrettyError for CompilerOp { + fn pretty(&self) -> String { + match self { + CompilerOp::BuildScriptAddress(expr) => { + format!("build_script_address({})", expr.pretty()) + } + } + } +} + +impl PrettyError for Coerce { + fn pretty(&self) -> String { + match self { + Coerce::NoOp(expr) => format!("coerce_noop({})", expr.pretty()), + Coerce::IntoAssets(expr) => format!("into_assets({})", expr.pretty()), + Coerce::IntoDatum(expr) => format!("into_datum({})", expr.pretty()), + Coerce::IntoScript(expr) => format!("into_script({})", expr.pretty()), + } + } +} + +impl PrettyError for BackendError { + fn pretty(&self) -> String { + match self { + BackendError::TransientError(s) => { + format!("a transient error occurred: {}", s) + } + BackendError::StoreError(s) => format!("a storage error occurred: {}", s), + BackendError::InvalidPattern(s) => format!("invalid pattern: {}", s), + BackendError::UtxoNotFound(utxo_ref) => { + format!("UTXO not found: {}", utxo_ref.pretty()) + } + BackendError::CoerceError(from, to) => { + format!("error coercing {} into {}", from, to) + } + BackendError::ConsistencyError(s) => { + format!("a consistency error occurred: {}", s) + } + BackendError::ArgNotAssigned(s) => format!("argument not assigned: {}", s), + BackendError::FormatError(s) => format!("a format error occurred: {}", s), + BackendError::MissingExpression(s) => format!("missing expression: {}", s), + BackendError::ValueOverflow(s) => format!("a value overflow occurred: {}", s), + BackendError::NoAstAnalysis => "no AST analysis was performed".to_string(), + BackendError::CantResolveSymbol(s) => format!("can't resolve symbol: {}", s), + BackendError::CantReduce(op) => format!("can't reduce: {}", op.pretty()), + } + } +} + +impl PrettyError for ApplyingError { + fn pretty(&self) -> String { + match self { + ApplyingError::InvalidBuiltInOp(op) => { + format!("invalid built-in operation: {}", op.pretty()) + } + ApplyingError::BackendError(be) => { + format!("a backend error occurred: {}", be) + } + ApplyingError::InvalidArgument(val, name) => { + format!("invalid argument {:?} for {}", val, name) + } + ApplyingError::PropertyNotFound(prop, obj) => { + format!("property '{}' not found in {}", prop, obj) + } + ApplyingError::PropertyIndexNotFound(idx, obj) => { + format!("property index {} not found in {}", idx, obj) + } + ApplyingError::InvalidBinaryOp(op, a, b) => { + format!("invalid binary operation '{}' over {} and {}", op, a, b) + } + ApplyingError::InvalidUnaryOp(op, a) => { + format!("invalid unary operation '{}' over {}", op, a) + } + ApplyingError::CannotCoerceIntoAssets(expr) => { + format!("cannot coerce {} into assets", expr.pretty()) + } + ApplyingError::CannotCoerceIntoDatum(expr) => { + format!("cannot coerce {} into datum", expr.pretty()) + } + } + } +} diff --git a/sdk/src/trp/mod.rs b/sdk/src/trp/mod.rs index 4a7030a..cbff428 100644 --- a/sdk/src/trp/mod.rs +++ b/sdk/src/trp/mod.rs @@ -5,6 +5,7 @@ use std::collections::HashMap; use uuid::Uuid; pub mod args; +pub mod error; pub use args::ArgValue; From e9dde3b4606886a8835f3a6aa4b616165809f17d Mon Sep 17 00:00:00 2001 From: paulobressan Date: Tue, 29 Jul 2025 13:19:57 -0300 Subject: [PATCH 2/3] chore: adjusted lint warning --- sdk/src/trp/error/pretty.rs | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/sdk/src/trp/error/pretty.rs b/sdk/src/trp/error/pretty.rs index 7cbe028..cde59e7 100644 --- a/sdk/src/trp/error/pretty.rs +++ b/sdk/src/trp/error/pretty.rs @@ -44,7 +44,7 @@ impl PrettyError for Expression { Expression::Number(n) => n.to_string(), Expression::Bool(b) => b.to_string(), Expression::String(s) => s.to_owned(), - Expression::Address(addr) => Address::from_bytes(&addr).unwrap().to_bech32().unwrap(), + Expression::Address(addr) => Address::from_bytes(addr).unwrap().to_bech32().unwrap(), Expression::Hash(hash) => hex::encode(hash), Expression::UtxoRefs(refs) => refs .iter() @@ -198,25 +198,25 @@ impl PrettyError for BackendError { fn pretty(&self) -> String { match self { BackendError::TransientError(s) => { - format!("a transient error occurred: {}", s) + format!("a transient error occurred: {s}") } - BackendError::StoreError(s) => format!("a storage error occurred: {}", s), - BackendError::InvalidPattern(s) => format!("invalid pattern: {}", s), + BackendError::StoreError(s) => format!("a storage error occurred: {s}"), + BackendError::InvalidPattern(s) => format!("invalid pattern: {s}"), BackendError::UtxoNotFound(utxo_ref) => { format!("UTXO not found: {}", utxo_ref.pretty()) } BackendError::CoerceError(from, to) => { - format!("error coercing {} into {}", from, to) + format!("error coercing {from} into {to}") } BackendError::ConsistencyError(s) => { - format!("a consistency error occurred: {}", s) + format!("a consistency error occurred: {s}") } - BackendError::ArgNotAssigned(s) => format!("argument not assigned: {}", s), - BackendError::FormatError(s) => format!("a format error occurred: {}", s), - BackendError::MissingExpression(s) => format!("missing expression: {}", s), - BackendError::ValueOverflow(s) => format!("a value overflow occurred: {}", s), + BackendError::ArgNotAssigned(s) => format!("argument not assigned: {s}"), + BackendError::FormatError(s) => format!("a format error occurred: {s}"), + BackendError::MissingExpression(s) => format!("missing expression: {s}"), + BackendError::ValueOverflow(s) => format!("a value overflow occurred: {s}"), BackendError::NoAstAnalysis => "no AST analysis was performed".to_string(), - BackendError::CantResolveSymbol(s) => format!("can't resolve symbol: {}", s), + BackendError::CantResolveSymbol(s) => format!("can't resolve symbol: {s}"), BackendError::CantReduce(op) => format!("can't reduce: {}", op.pretty()), } } @@ -229,22 +229,22 @@ impl PrettyError for ApplyingError { format!("invalid built-in operation: {}", op.pretty()) } ApplyingError::BackendError(be) => { - format!("a backend error occurred: {}", be) + format!("a backend error occurred: {be}") } ApplyingError::InvalidArgument(val, name) => { - format!("invalid argument {:?} for {}", val, name) + format!("invalid argument {val:?} for {name}") } ApplyingError::PropertyNotFound(prop, obj) => { - format!("property '{}' not found in {}", prop, obj) + format!("property '{prop}' not found in {obj}") } ApplyingError::PropertyIndexNotFound(idx, obj) => { - format!("property index {} not found in {}", idx, obj) + format!("property index {idx} not found in {obj}") } ApplyingError::InvalidBinaryOp(op, a, b) => { - format!("invalid binary operation '{}' over {} and {}", op, a, b) + format!("invalid binary operation '{op}' over {a} and {b}") } ApplyingError::InvalidUnaryOp(op, a) => { - format!("invalid unary operation '{}' over {}", op, a) + format!("invalid unary operation '{op}' over {a}") } ApplyingError::CannotCoerceIntoAssets(expr) => { format!("cannot coerce {} into assets", expr.pretty()) From e656cc5a64a7b69a24ac3bcfd6b5ac92bbc5f6a4 Mon Sep 17 00:00:00 2001 From: paulobressan Date: Thu, 31 Jul 2025 11:08:57 -0300 Subject: [PATCH 3/3] feat: updated pretty error --- Cargo.lock | 13 +++++++------ sdk/src/trp/error/pretty.rs | 29 ++++++++++++++++++++--------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a98d5fd..4b012ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1721,9 +1721,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.29" +version = "0.23.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2491382039b29b9b11ff08b76ff6c97cf287671dbb74f0be44bda389fffe9bd1" +checksum = "c0ebcbd2f03de0fc1122ad9bb24b127a5a6cd51d72604a3f3c50ac459762b6cc" dependencies = [ "once_cell", "ring", @@ -2280,9 +2280,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "tx3-lang" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ffaa32efb0788a1de7a67be5b13233a6b24a5cce0247c6d7411cb4c84e88b88" +checksum = "6b9d050963aff1d574bfc4635d01b01e09df2401633ccbf83c24797de5f426b9" dependencies = [ "bincode", "hex", @@ -2296,10 +2296,11 @@ dependencies = [ [[package]] name = "tx3-resolver" -version = "0.10.1" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d50ad0c4d6b63a3d425044ba40aa96dd1092a8366bacfebe562c3cafa10a6769" +checksum = "9c4b6d485b257ffbdd41f0bfa9d9f2e5ab31a89cc174e92c048f83f8b5964337" dependencies = [ + "hex", "thiserror 2.0.12", "trait-variant", "tx3-lang", diff --git a/sdk/src/trp/error/pretty.rs b/sdk/src/trp/error/pretty.rs index cde59e7..7caaed9 100644 --- a/sdk/src/trp/error/pretty.rs +++ b/sdk/src/trp/error/pretty.rs @@ -14,15 +14,6 @@ pub trait PrettyError { impl PrettyError for ResolverError { fn pretty(&self) -> String { match self { - ResolverError::InputQueryTooBroad => { - "Input query is too broad, try adding more constraints.".to_string() - } - ResolverError::InputNotResolved(v, q) => { - format!("Input not resolved: {} with {}", v, q.pretty()) - } - ResolverError::ExpectedData(data_type, expression) => { - format!("Expected {}, got {}", data_type, expression.pretty()) - } ResolverError::ApplyError(error) => { format!("Apply error: {}", error.pretty()) } @@ -32,6 +23,23 @@ impl PrettyError for ResolverError { ResolverError::BackendError(error) => { format!("Backend error: {}", error.pretty()) } + ResolverError::InputsError(error) => match error { + tx3_resolver::inputs::Error::InputQueryTooBroad => { + "Input query is too broad, try adding more constraints.".to_string() + } + tx3_resolver::inputs::Error::ExpectedData(data_type, expression) => { + format!("Input expected {}, got {}", data_type, expression.pretty()) + } + tx3_resolver::inputs::Error::InputNotResolved(v, q, s) => { + format!("Input not resolved: {v} with {q} {s}") + } + tx3_resolver::inputs::Error::StoreError(error) => { + format!("Input a storage error occurred: {}", error.pretty()) + } + tx3_resolver::inputs::Error::ApplyError(error) => { + format!("Input apply error: {}", error.pretty()) + } + }, } } } @@ -179,6 +187,9 @@ impl PrettyError for CompilerOp { CompilerOp::BuildScriptAddress(expr) => { format!("build_script_address({})", expr.pretty()) } + CompilerOp::ComputeMinUtxo(expr) => { + format!("compute_min_utxo({})", expr.pretty()) + } } } }