From db2e122d86b54b341d32669cf6ac37ae15cb4810 Mon Sep 17 00:00:00 2001 From: Alex Coats Date: Mon, 4 Mar 2024 09:25:54 -0500 Subject: [PATCH] update SDK --- Cargo.lock | 168 +++++++++++------------ src/bin/inx-chronicle/api/core/routes.rs | 45 +++--- src/bin/inx-chronicle/api/error.rs | 11 +- src/db/mongodb/error.rs | 6 +- src/inx/error.rs | 2 +- src/model/expiration.rs | 7 +- src/model/native_token.rs | 4 +- src/model/storage_deposit_return.rs | 4 +- 8 files changed, 129 insertions(+), 118 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 645366531..bbe4ac794 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -54,9 +54,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b79b82693f705137f8fb9b37871d99e4f9a7df12b917eed79c3d3954830a60b" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" dependencies = [ "cfg-if", "getrandom", @@ -138,7 +138,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -149,7 +149,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -301,7 +301,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -430,7 +430,7 @@ dependencies = [ "base64 0.13.1", "bitvec", "hex", - "indexmap 2.2.3", + "indexmap 2.2.5", "js-sys", "once_cell", "rand", @@ -473,9 +473,9 @@ checksum = "a3e368af43e418a04d52505cf3dbc23dda4e3407ae2fa99fd0e4f308ce546acc" [[package]] name = "cc" -version = "1.0.88" +version = "1.0.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02f341c093d19155a6e41631ce5971aac4e9a868262212153124c15fa22d1cdc" +checksum = "a0ba8f7aaa012f30d5b2861462f6708eccd49c3c39863fe083a308035f63d723" [[package]] name = "cfg-if" @@ -570,7 +570,7 @@ dependencies = [ "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -614,7 +614,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -753,7 +753,7 @@ checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -801,7 +801,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -823,7 +823,7 @@ checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" dependencies = [ "darling_core 0.20.8", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -886,7 +886,7 @@ dependencies = [ "darling 0.20.8", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1203,7 +1203,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1273,9 +1273,9 @@ dependencies = [ [[package]] name = "ghash" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d930750de5717d2dd0b8c0d42c076c0e884c81a73e6cab859bbd2339c71e3e40" +checksum = "f0d8a4362ccb29cb0b265253fb0a2728f592895ee6854fd9bc13f2ffda266ff1" dependencies = [ "opaque-debug", "polyval", @@ -1322,7 +1322,7 @@ dependencies = [ "futures-sink", "futures-util", "http 0.2.11", - "indexmap 2.2.3", + "indexmap 2.2.5", "slab", "tokio", "tokio-util", @@ -1341,7 +1341,7 @@ dependencies = [ "futures-sink", "futures-util", "http 1.0.0", - "indexmap 2.2.3", + "indexmap 2.2.5", "slab", "tokio", "tokio-util", @@ -1397,9 +1397,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -1712,9 +1712,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.3" +version = "2.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233cf39063f058ea2caae4091bf4a3ef70a653afbc026f5c4a4135d114e3c177" +checksum = "7b0b929d511467233429c45a44ac1dcaa21ba0f5ba11e4879e6ed28ddb4f9df4" dependencies = [ "equivalent", "hashbrown 0.14.3", @@ -1746,7 +1746,7 @@ checksum = "6ac96b3660efd0cde32b0b20bc86cc93f33269cd9f6c97e759e0b0259b2133fb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -1806,7 +1806,7 @@ dependencies = [ [[package]] name = "iota-sdk" version = "1.1.4" -source = "git+https://github.com/iotaledger/iota-sdk?branch=2.0#6e020c15383b1910421254ec4176bace32344950" +source = "git+https://github.com/iotaledger/iota-sdk?branch=2.0#d2dc74d0d4250bc0ed71a618e3e3607f84679dad" dependencies = [ "bech32", "bitflags 2.4.2", @@ -1991,9 +1991,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.20" +version = "0.4.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" +checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lru-cache" @@ -2073,9 +2073,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.10" +version = "0.8.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" +checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" dependencies = [ "libc", "wasi", @@ -2208,9 +2208,9 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "opaque-debug" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" [[package]] name = "overload" @@ -2240,7 +2240,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2339,7 +2339,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap 2.2.3", + "indexmap 2.2.5", ] [[package]] @@ -2359,7 +2359,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2409,9 +2409,9 @@ dependencies = [ [[package]] name = "polyval" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d52cff9d1d4dee5fe6d03729099f4a310a41179e0a10dbf542039873f2e826fb" +checksum = "9d1fe60d06143b2430aa532c94cfe9e29783047f06c0d7fd359a9a51b729fa25" dependencies = [ "cfg-if", "cpufeatures", @@ -2459,7 +2459,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2544,7 +2544,7 @@ dependencies = [ "prost", "prost-types", "regex", - "syn 2.0.51", + "syn 2.0.52", "tempfile", "which", ] @@ -2559,7 +2559,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -2656,7 +2656,7 @@ checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.5", + "regex-automata 0.4.6", "regex-syntax 0.8.2", ] @@ -2671,9 +2671,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" +checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" dependencies = [ "aho-corasick", "memchr", @@ -3009,7 +3009,7 @@ checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3018,7 +3018,7 @@ version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.5", "itoa", "ryu", "serde", @@ -3042,7 +3042,7 @@ checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3307,7 +3307,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3329,9 +3329,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.51" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ab617d94515e94ae53b8406c628598680aa0c9587474ecbe58188f7b345d66c" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -3416,7 +3416,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3522,7 +3522,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3573,7 +3573,7 @@ version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" dependencies = [ - "indexmap 2.2.3", + "indexmap 2.2.5", "toml_datetime", "winnow", ] @@ -3615,7 +3615,7 @@ dependencies = [ "proc-macro2", "prost-build", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3687,7 +3687,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -3888,9 +3888,9 @@ checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" [[package]] name = "walkdir" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" dependencies = [ "same-file", "winapi-util", @@ -3932,7 +3932,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", "wasm-bindgen-shared", ] @@ -3966,7 +3966,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4061,7 +4061,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -4079,7 +4079,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.3", + "windows-targets 0.52.4", ] [[package]] @@ -4099,17 +4099,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" +checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" dependencies = [ - "windows_aarch64_gnullvm 0.52.3", - "windows_aarch64_msvc 0.52.3", - "windows_i686_gnu 0.52.3", - "windows_i686_msvc 0.52.3", - "windows_x86_64_gnu 0.52.3", - "windows_x86_64_gnullvm 0.52.3", - "windows_x86_64_msvc 0.52.3", + "windows_aarch64_gnullvm 0.52.4", + "windows_aarch64_msvc 0.52.4", + "windows_i686_gnu 0.52.4", + "windows_i686_msvc 0.52.4", + "windows_x86_64_gnu 0.52.4", + "windows_x86_64_gnullvm 0.52.4", + "windows_x86_64_msvc 0.52.4", ] [[package]] @@ -4120,9 +4120,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" +checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" [[package]] name = "windows_aarch64_msvc" @@ -4138,9 +4138,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" +checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" [[package]] name = "windows_i686_gnu" @@ -4156,9 +4156,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" +checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" [[package]] name = "windows_i686_msvc" @@ -4174,9 +4174,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" +checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" [[package]] name = "windows_x86_64_gnu" @@ -4192,9 +4192,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" +checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" [[package]] name = "windows_x86_64_gnullvm" @@ -4204,9 +4204,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" +checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" [[package]] name = "windows_x86_64_msvc" @@ -4222,9 +4222,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.3" +version = "0.52.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" +checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" [[package]] name = "winnow" @@ -4288,7 +4288,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] [[package]] @@ -4309,5 +4309,5 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.51", + "syn 2.0.52", ] diff --git a/src/bin/inx-chronicle/api/core/routes.rs b/src/bin/inx-chronicle/api/core/routes.rs index 9d3e88768..c9eae59a8 100644 --- a/src/bin/inx-chronicle/api/core/routes.rs +++ b/src/bin/inx-chronicle/api/core/routes.rs @@ -12,7 +12,7 @@ use chronicle::{ db::{ mongodb::collections::{ ApplicationStateCollection, BlockCollection, CommittedSlotCollection, OutputCollection, OutputMetadata, - OutputWithMetadataResult, UtxoChangesResult, + UtxoChangesResult, }, MongoDb, }, @@ -20,13 +20,12 @@ use chronicle::{ }; use iota_sdk::types::{ api::core::{ - BaseTokenResponse, BlockMetadataResponse, OutputWithMetadataResponse, ProtocolParametersResponse, - TransactionMetadataResponse, UtxoChangesResponse, + BaseTokenResponse, BlockMetadataResponse, OutputResponse, OutputWithMetadataResponse, + ProtocolParametersResponse, TransactionMetadataResponse, UtxoChangesResponse, }, block::{ output::{ OutputConsumptionMetadata, OutputId, OutputInclusionMetadata, OutputMetadata as OutputMetadataResponse, - OutputWithMetadata, }, payload::signed_transaction::TransactionId, slot::{SlotCommitment, SlotCommitmentId, SlotIndex}, @@ -213,20 +212,10 @@ async fn output( database: State, Path(output_id): Path, headers: HeaderMap, -) -> ApiResult> { - let latest_slot = database - .collection::() - .get_latest_committed_slot() - .await? - .ok_or(MissingError::NoResults)?; - - let OutputWithMetadataResult { - output_id, - output, - metadata, - } = database +) -> ApiResult> { + let output = database .collection::() - .get_output_with_metadata(&output_id, latest_slot.slot_index) + .get_output(&output_id) .await? .ok_or(MissingError::NoResults)?; @@ -234,9 +223,23 @@ async fn output( return Ok(IotaRawResponse::Raw(output.pack_to_vec())); } - let metadata = create_output_metadata_response(output_id, metadata, latest_slot.commitment_id)?; + let included_block = database + .collection::() + .get_block_for_transaction(output_id.transaction_id()) + .await? + .ok_or(MissingError::NoResults)?; - Ok(IotaRawResponse::Json(OutputWithMetadataResponse { metadata, output })) + Ok(IotaRawResponse::Json(OutputResponse { + output, + output_id_proof: included_block + .block + .as_basic() + .payload() + .unwrap() + .as_signed_transaction() + .transaction() + .output_id_proof(output_id.index())?, + })) } async fn output_metadata( @@ -260,7 +263,7 @@ async fn output_metadata( async fn output_full( database: State, Path(output_id): Path, -) -> ApiResult> { +) -> ApiResult> { let latest_slot = database .collection::() .get_latest_committed_slot() @@ -277,7 +280,7 @@ async fn output_full( .await? .ok_or(MissingError::NoResults)?; - Ok(OutputWithMetadata { + Ok(OutputWithMetadataResponse { output: output_with_metadata.output, output_id_proof: included_block .block diff --git a/src/bin/inx-chronicle/api/error.rs b/src/bin/inx-chronicle/api/error.rs index 6e2bec878..70429bf21 100644 --- a/src/bin/inx-chronicle/api/error.rs +++ b/src/bin/inx-chronicle/api/error.rs @@ -7,7 +7,7 @@ use axum::{extract::rejection::QueryRejection, response::IntoResponse}; use axum_extra::typed_header::TypedHeaderRejection; use chronicle::db::mongodb::collections::ParseSortError; use hyper::{header::InvalidHeaderValue, StatusCode}; -use iota_sdk::types::block::output::ProofError; +use iota_sdk::types::block::{output::ProofError, BlockError, IdentifierError}; use serde::Serialize; use thiserror::Error; use tracing::error; @@ -61,7 +61,8 @@ impl_internal_error!( axum::extract::rejection::ExtensionRejection, auth_helper::jwt::Error, argon2::Error, - iota_sdk::types::block::Error + BlockError, + IdentifierError ); impl IntoResponse for ApiError { @@ -159,8 +160,10 @@ pub enum RequestError { BadPagingState, #[error("invalid time range")] BadTimeRange, - #[error("invalid IOTA Stardust data: {0}")] - IotaStardust(#[from] iota_sdk::types::block::Error), + #[error("invalid block data: {0}")] + Block(#[from] BlockError), + #[error("invalid block data: {0}")] + Identifier(#[from] IdentifierError), #[error("invalid bool value provided: {0}")] Bool(#[from] ParseBoolError), #[error("invalid U256 value provided: {0}")] diff --git a/src/db/mongodb/error.rs b/src/db/mongodb/error.rs index 419938a16..1d85ef214 100644 --- a/src/db/mongodb/error.rs +++ b/src/db/mongodb/error.rs @@ -13,8 +13,10 @@ pub enum DbError { BsonDeserialization(#[from] mongodb::bson::de::Error), #[error("mongodb error: {0}")] MongoDb(#[from] mongodb::error::Error), - #[error("SDK type error: {0}")] - SDK(#[from] iota_sdk::types::block::Error), + #[error("SDK block error: {0}")] + SdkBlock(#[from] iota_sdk::types::block::BlockError), + #[error("SDK mana error: {0}")] + SdkMana(#[from] iota_sdk::types::block::mana::ManaError), #[error("missing record: {0}")] MissingRecord(String), } diff --git a/src/inx/error.rs b/src/inx/error.rs index 09ef08b40..ddf3d20a7 100644 --- a/src/inx/error.rs +++ b/src/inx/error.rs @@ -22,5 +22,5 @@ pub enum InxError { #[error(transparent)] TonicError(#[from] tonic::transport::Error), #[error("SDK type error: {0}")] - SDK(#[from] iota_sdk::types::block::Error), + SDK(#[from] iota_sdk::types::block::BlockError), } diff --git a/src/model/expiration.rs b/src/model/expiration.rs index fd9f9b243..1dc419e5b 100644 --- a/src/model/expiration.rs +++ b/src/model/expiration.rs @@ -5,7 +5,10 @@ use core::borrow::Borrow; -use iota_sdk::types::block::{output::unlock_condition::ExpirationUnlockCondition, slot::SlotIndex}; +use iota_sdk::types::block::{ + output::unlock_condition::{ExpirationUnlockCondition, UnlockConditionError}, + slot::SlotIndex, +}; use serde::{Deserialize, Serialize}; use super::address::AddressDto; @@ -30,7 +33,7 @@ impl> From for ExpirationUnlockCondition } impl TryFrom for ExpirationUnlockCondition { - type Error = iota_sdk::types::block::Error; + type Error = UnlockConditionError; fn try_from(value: ExpirationUnlockConditionDto) -> Result { Self::new(value.return_address, value.slot_index) diff --git a/src/model/native_token.rs b/src/model/native_token.rs index 02a15a7cd..b9ae40952 100644 --- a/src/model/native_token.rs +++ b/src/model/native_token.rs @@ -5,7 +5,7 @@ use core::borrow::Borrow; -use iota_sdk::types::block::output::{NativeToken, TokenId}; +use iota_sdk::types::block::output::{NativeToken, NativeTokenError, TokenId}; use primitive_types::U256; use serde::{Deserialize, Serialize}; @@ -28,7 +28,7 @@ impl> From for NativeTokenDto { } impl TryFrom for NativeToken { - type Error = iota_sdk::types::block::Error; + type Error = NativeTokenError; fn try_from(value: NativeTokenDto) -> Result { Self::new(value.token_id, value.amount) diff --git a/src/model/storage_deposit_return.rs b/src/model/storage_deposit_return.rs index b0ab8b0f1..205801bab 100644 --- a/src/model/storage_deposit_return.rs +++ b/src/model/storage_deposit_return.rs @@ -5,7 +5,7 @@ use core::borrow::Borrow; -use iota_sdk::types::block::output::unlock_condition::StorageDepositReturnUnlockCondition; +use iota_sdk::types::block::output::unlock_condition::{StorageDepositReturnUnlockCondition, UnlockConditionError}; use serde::{Deserialize, Serialize}; use super::address::AddressDto; @@ -30,7 +30,7 @@ impl> From for StorageDepositR } impl TryFrom for StorageDepositReturnUnlockCondition { - type Error = iota_sdk::types::block::Error; + type Error = UnlockConditionError; fn try_from(value: StorageDepositReturnUnlockConditionDto) -> Result { Self::new(value.return_address, value.amount)