diff --git a/clients/tfchain_client_rs/Cargo.lock b/clients/tfchain_client_rs/Cargo.lock index 875a5443f..500ced697 100644 --- a/clients/tfchain_client_rs/Cargo.lock +++ b/clients/tfchain_client_rs/Cargo.lock @@ -47,6 +47,18 @@ dependencies = [ "version_check", ] +[[package]] +name = "ahash" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" +dependencies = [ + "cfg-if", + "getrandom 0.2.8", + "once_cell", + "version_check", +] + [[package]] name = "aho-corasick" version = "0.7.20" @@ -131,7 +143,7 @@ checksum = "705339e0e4a9690e2908d2b3d049d85682cf19fbd5782494498fbf7003a6a282" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -230,6 +242,17 @@ dependencies = [ "digest 0.10.6", ] +[[package]] +name = "blake2b_simd" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" +dependencies = [ + "arrayref", + "arrayvec 0.7.2", + "constant_time_eq", +] + [[package]] name = "block-buffer" version = "0.7.3" @@ -269,6 +292,24 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "bounded-collections" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a071c348a5ef6da1d3a87166b408170b46002382b1dda83992b5c2208cefb370" +dependencies = [ + "log", + "parity-scale-codec", + "scale-info", + "serde", +] + +[[package]] +name = "bs58" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "771fe0050b883fcc3ea2359b1a96bcfbc090b7116eae7c3c512c7a083fdf23d3" + [[package]] name = "bumpalo" version = "3.11.1" @@ -348,6 +389,12 @@ version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cec318a675afcb6a1ea1d4340e2d377e56e47c266f28043ceccbf4412ddfdd3b" +[[package]] +name = "constant_time_eq" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13418e745008f7349ec7e449155f419a61b92b58a99cc3616942b926825ec76b" + [[package]] name = "core-foundation" version = "0.9.3" @@ -391,6 +438,15 @@ dependencies = [ "serde", ] +[[package]] +name = "cranelift-entity" +version = "0.93.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cf583f7b093f291005f9fb1323e2c37f6ee4c7909e39ce016b2e8360d461705" +dependencies = [ + "serde", +] + [[package]] name = "crc32fast" version = "1.3.2" @@ -498,7 +554,7 @@ dependencies = [ "proc-macro2", "quote", "scratch", - "syn", + "syn 1.0.109", ] [[package]] @@ -515,7 +571,7 @@ checksum = "39e61fda7e62115119469c7b3591fd913ecca96fb766cfd3f2e2502ab7bc87a5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -539,7 +595,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn", + "syn 1.0.109", ] [[package]] @@ -550,7 +606,7 @@ checksum = "a4aab4dbc9f7611d8b55048a3a16d2d010c2c8334e46304b40ac1cc14bf3b48e" dependencies = [ "darling_core", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -571,7 +627,7 @@ checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -582,7 +638,7 @@ checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -638,7 +694,7 @@ checksum = "558e40ea573c374cf53507fd240b7ee2f5477df7cfebdb97323ec61c719399c5" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -687,7 +743,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" dependencies = [ "curve25519-dalek 3.2.0", - "hashbrown", + "hashbrown 0.12.3", "hex", "rand_core 0.6.4", "sha2 0.9.9", @@ -696,9 +752,9 @@ dependencies = [ [[package]] name = "either" -version = "1.8.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90e5c1c8368803113bf0c9584fc495a58b86dc8a29edbf8fe877d21d9507e797" +checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" [[package]] name = "elliptic-curve" @@ -736,6 +792,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "errno" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" +dependencies = [ + "errno-dragonfly", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "errno-dragonfly" version = "0.1.2" @@ -801,6 +868,15 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "form_urlencoded" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +dependencies = [ + "percent-encoding", +] + [[package]] name = "frame-benchmarking" version = "10.0.0" @@ -882,7 +958,7 @@ dependencies = [ "itertools", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -895,7 +971,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -906,7 +982,7 @@ checksum = "6a881492b8dfdd6065d7d8537b8f79cd27aff8c501c759ac12b0295d139ff3d2" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1006,7 +1082,7 @@ checksum = "3eb14ed937631bd8b8b8977f2c198443447a8355b6e3ca599f38c975e5a963b6" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1071,10 +1147,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi 0.9.0+wasi-snapshot-preview1", - "wasm-bindgen", ] [[package]] @@ -1142,6 +1216,12 @@ version = "0.15.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d23bd4e7b5eda0d0f3a307e8b381fdc8ba9000f26fbe912250c0a4cc3956364a" +[[package]] +name = "hash-db" +version = "0.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e7d7786361d7425ae2fe4f9e407eb0efaa0840f5212d109cc018c40c35c6ab4" + [[package]] name = "hash256-std-hasher" version = "0.15.2" @@ -1157,7 +1237,16 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" dependencies = [ - "ahash", + "ahash 0.7.6", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash 0.8.3", ] [[package]] @@ -1175,6 +1264,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hex" version = "0.4.3" @@ -1325,6 +1420,16 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" +[[package]] +name = "idna" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + [[package]] name = "impl-codec" version = "0.6.0" @@ -1351,7 +1456,7 @@ checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1361,7 +1466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", "serde", ] @@ -1389,6 +1494,17 @@ version = "0.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "59ce5ef949d49ee85593fc4d3f3f95ad61657076395cbbce23e2121fc5542074" +[[package]] +name = "io-lifetimes" +version = "1.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220" +dependencies = [ + "hermit-abi 0.3.1", + "libc", + "windows-sys 0.48.0", +] + [[package]] name = "itertools" version = "0.10.5" @@ -1614,6 +1730,18 @@ version = "0.0.46" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4d2456c373231a208ad294c33dc5bff30051eafd954cd4caae83a712b12854d" +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + +[[package]] +name = "linux-raw-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" + [[package]] name = "lock_api" version = "0.4.9" @@ -1639,7 +1767,7 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b6e8aaa3f231bb4bd57b84b2d5dc3ae7f350265df8aa96492e0bc394a1571909" dependencies = [ - "hashbrown", + "hashbrown 0.12.3", ] [[package]] @@ -1675,6 +1803,15 @@ version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" +[[package]] +name = "memfd" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffc89ccdc6e10d6907450f753537ebc5c5d3460d2e4e62ea74bd571db62c0f9e" +dependencies = [ + "rustix 0.37.3", +] + [[package]] name = "memoffset" version = "0.6.5" @@ -1686,23 +1823,21 @@ dependencies = [ [[package]] name = "memory-db" -version = "0.30.0" +version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34ac11bb793c28fa095b7554466f53b3a60a2cd002afdac01bcf135cbd73a269" +checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" dependencies = [ - "hash-db", - "hashbrown", - "parity-util-mem", + "hash-db 0.15.2", + "hashbrown 0.12.3", ] [[package]] name = "memory-db" -version = "0.31.0" +version = "0.32.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e0c7cba9ce19ac7ffd2053ac9f49843bbd3f4318feedfd74e85c19d5fb0ba66" +checksum = "808b50db46293432a45e63bc15ea51e0ab4c0a1647b8eb114e31a3e698dd6fbe" dependencies = [ - "hash-db", - "hashbrown", + "hash-db 0.16.0", ] [[package]] @@ -1770,7 +1905,7 @@ checksum = "01fcc0b8149b4632adc89ac3b7b31a12fb6099a0317a4eb2ebff574ef7de7218" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -1857,7 +1992,7 @@ version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" dependencies = [ - "hermit-abi", + "hermit-abi 0.2.6", "libc", ] @@ -1868,7 +2003,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "21158b2c33aa6d4561f1c0a6ea283ca92bc54802a93b263e910746d679a7eb53" dependencies = [ "crc32fast", - "hashbrown", + "hashbrown 0.12.3", "indexmap", "memchr", ] @@ -1952,33 +2087,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", -] - -[[package]] -name = "parity-util-mem" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d32c34f4f5ca7f9196001c0aba5a1f9a5a12382c8944b8b0f90233282d1e8f8" -dependencies = [ - "cfg-if", - "hashbrown", - "impl-trait-for-tuples", - "parity-util-mem-derive", - "parking_lot", - "primitive-types", - "winapi", -] - -[[package]] -name = "parity-util-mem-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f557c32c6d268a07c921471619c0295f5efad3a0e76d4f97a05c091a51d110b2" -dependencies = [ - "proc-macro2", - "syn", - "synstructure", + "syn 1.0.109", ] [[package]] @@ -2022,15 +2131,6 @@ version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" -[[package]] -name = "pbkdf2" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216eaa586a190f0a738f2f918511eecfa90f13295abec0e457cdebcceda80cbd" -dependencies = [ - "crypto-mac 0.8.0", -] - [[package]] name = "pbkdf2" version = "0.8.0" @@ -2049,6 +2149,12 @@ dependencies = [ "digest 0.10.6", ] +[[package]] +name = "percent-encoding" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" + [[package]] name = "pin-project" version = "1.0.12" @@ -2066,7 +2172,7 @@ checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2130,7 +2236,7 @@ dependencies = [ "proc-macro-error-attr", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "version_check", ] @@ -2147,9 +2253,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.53" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba466839c78239c09faf015484e5cc04860f88242cff4d03eb038f04b4699b73" +checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" dependencies = [ "unicode-ident", ] @@ -2165,9 +2271,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.23" +version = "1.0.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" +checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" dependencies = [ "proc-macro2", ] @@ -2189,7 +2295,6 @@ dependencies = [ "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", - "rand_pcg", ] [[package]] @@ -2260,15 +2365,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_pcg" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16abd0c1b639e9eb4d7c50c0b8100b0d0f849be2349829c740fe8e6eb4816429" -dependencies = [ - "rand_core 0.5.1", -] - [[package]] name = "rawpointer" version = "0.2.1" @@ -2301,7 +2397,7 @@ checksum = "9f9c0c92af03644e4806106281fe2e068ac5bc0ae74a707266d06ea27bccee5f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -2381,13 +2477,41 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "727a1a6d65f786ec22df8a81ca3121107f235970dc1705ed681d3e6e8b9cd5f9" dependencies = [ "bitflags", - "errno", - "io-lifetimes", + "errno 0.2.8", + "io-lifetimes 0.7.5", "libc", - "linux-raw-sys", + "linux-raw-sys 0.0.46", "windows-sys 0.42.0", ] +[[package]] +name = "rustix" +version = "0.36.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0af200a3324fa5bcd922e84e9b55a298ea9f431a489f01961acdebc6e908f25" +dependencies = [ + "bitflags", + "errno 0.3.1", + "io-lifetimes 1.0.10", + "libc", + "linux-raw-sys 0.1.4", + "windows-sys 0.45.0", +] + +[[package]] +name = "rustix" +version = "0.37.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b24138615de35e32031d041a09032ef3487a616d901ca4db224e7d557efae2" +dependencies = [ + "bitflags", + "errno 0.3.1", + "io-lifetimes 1.0.10", + "libc", + "linux-raw-sys 0.3.1", + "windows-sys 0.45.0", +] + [[package]] name = "rustls" version = "0.20.7" @@ -2421,6 +2545,12 @@ dependencies = [ "base64 0.21.0", ] +[[package]] +name = "rustversion" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f3208ce4d8448b3f3e7d168a73f5e0c43a61e32930de3bceeccedb388b6bf06" + [[package]] name = "ryu" version = "1.0.12" @@ -2440,21 +2570,63 @@ dependencies = [ [[package]] name = "scale-decode" -version = "0.4.0" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e5527e4b3bf079d4c0b2f253418598c380722ba37ef20fac9088081407f2b6" +dependencies = [ + "parity-scale-codec", + "primitive-types", + "scale-bits", + "scale-decode-derive", + "scale-info", + "thiserror", +] + +[[package]] +name = "scale-decode-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b38741b2f78e4391b94eac6b102af0f6ea2b0f7fe65adb55d7f4004f507854db" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "scale-encode" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d823d4be477fc33321f93d08fb6c2698273d044f01362dc27573a750deb7c233" +checksum = "15546e5efbb45f0fc2291f7e202dee8623274c5d8bbfdf9c6886cc8b44a7ced3" dependencies = [ "parity-scale-codec", + "primitive-types", "scale-bits", + "scale-encode-derive", "scale-info", "thiserror", ] +[[package]] +name = "scale-encode-derive" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd983cf0a9effd76138554ead18a6de542d1af175ac12fd5e91836c5c0268082" +dependencies = [ + "darling", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "scale-info" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001cf62ece89779fd16105b5f515ad0e5cedcd5440d3dd806bb067978e7c3608" +checksum = "0cfdffd972d76b22f3d7f81c8be34b2296afd3a25e0a547bd9abe340a4dbbe97" dependencies = [ "bitvec", "cfg-if", @@ -2466,27 +2638,28 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.3.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "303959cf613a6f6efd19ed4b4ad5bf79966a13352716299ad532cfb115f4205c" +checksum = "61fa974aea2d63dd18a4ec3a49d59af9f34178c73a4f56d2f18205628d00681e" dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "scale-value" -version = "0.6.0" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16a5e7810815bd295da73e4216d1dfbced3c7c7c7054d70fa5f6e4c58123fff4" +checksum = "11f549769261561e6764218f847e500588f9a79a289de49ce92f9e26642a3574" dependencies = [ "either", "frame-metadata", "parity-scale-codec", "scale-bits", "scale-decode", + "scale-encode", "scale-info", "serde", "thiserror", @@ -2502,6 +2675,17 @@ dependencies = [ "windows-sys 0.42.0", ] +[[package]] +name = "schnellru" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772575a524feeb803e5b0fcbc6dd9f367e579488197c94c6e4023aad2305774d" +dependencies = [ + "ahash 0.8.3", + "cfg-if", + "hashbrown 0.13.2", +] + [[package]] name = "schnorrkel" version = "0.9.1" @@ -2608,29 +2792,29 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.152" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" +checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.152" +version = "1.0.160" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" +checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.14", ] [[package]] name = "serde_json" -version = "1.0.94" +version = "1.0.96" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c533a59c9d8a93a09c6ab31f0fd5e5f4dd1b8fc9434804029839884765d04ea" +checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" dependencies = [ "itoa", "ryu", @@ -2744,9 +2928,9 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "socket2" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" +checksum = "64a4a911eed85daf18834cfaa86a79b7d266ff93ff5ba14005426219480ed662" dependencies = [ "libc", "winapi", @@ -2773,7 +2957,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8bc6e71a70a5bd94a620be6c2351af41b659b015fdb2b1d252c98f5eae74d52d" dependencies = [ - "hash-db", + "hash-db 0.15.2", "log", "parity-scale-codec", "sp-api-proc-macro", @@ -2796,128 +2980,125 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-application-crypto" -version = "7.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a70f8245ad75c773c43e46d16e81adb62290d37cd07efcde6cef06d93235e5" +checksum = "a72575f160b1b134ee277a2ab46af4361c072a3fe661c48e474255406cb01c97" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 7.0.0", - "sp-io 7.0.0", - "sp-std 5.0.0", + "sp-core 11.0.0", + "sp-io 12.0.0", + "sp-std 6.0.0", ] [[package]] name = "sp-application-crypto" -version = "12.0.0" +version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a72575f160b1b134ee277a2ab46af4361c072a3fe661c48e474255406cb01c97" +checksum = "8cf23435a4bbd6eeec2bbbc346719ba4f3200e0ddb5f9e9f06c1724db03a8410" dependencies = [ "parity-scale-codec", "scale-info", "serde", - "sp-core 11.0.0", - "sp-io 12.0.0", - "sp-std 6.0.0", + "sp-core 20.0.0", + "sp-io 22.0.0", + "sp-std 7.0.0", ] [[package]] name = "sp-arithmetic" -version = "6.0.0" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3856b3e912f0a7a1332f1642b5fd3c2e76476e894c656538d32c004698690157" +checksum = "2038010f7514d50775dcbd3edb569e17fa9bda63128580a9e172abb1795f2c1d" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-debug-derive 5.0.0", - "sp-std 5.0.0", + "sp-std 6.0.0", "static_assertions", ] [[package]] name = "sp-arithmetic" -version = "9.0.0" +version = "15.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2038010f7514d50775dcbd3edb569e17fa9bda63128580a9e172abb1795f2c1d" +checksum = "2c3d3507a803e8bc332fa290ed3015a7b51d4436ce2b836744642fc412040456" dependencies = [ "integer-sqrt", "num-traits", "parity-scale-codec", "scale-info", "serde", - "sp-std 6.0.0", + "sp-std 7.0.0", "static_assertions", ] [[package]] name = "sp-core" -version = "7.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88c78530907dbf7949af928d0ce88b485067389201b6d9b468074b1924f209f0" +checksum = "d99984f57c9eb858d29fbe0e4cf44092eec484b2ff72176d5afa4ab7bf1dc8b1" dependencies = [ "array-bytes", "base58", "bitflags", "blake2", - "byteorder", "dyn-clonable", "ed25519-zebra", "futures", - "hash-db", + "hash-db 0.15.2", "hash256-std-hasher", "impl-serde", "lazy_static", "libsecp256k1", "log", "merlin", - "num-traits", "parity-scale-codec", "parking_lot", "primitive-types", - "rand 0.7.3", + "rand 0.8.5", "regex", "scale-info", "schnorrkel", "secp256k1", "secrecy", "serde", - "sp-core-hashing 5.0.0", - "sp-debug-derive 5.0.0", - "sp-externalities 0.13.0", - "sp-runtime-interface 7.0.0", - "sp-std 5.0.0", - "sp-storage 7.0.0", + "sp-core-hashing 6.0.0", + "sp-debug-derive 6.0.0", + "sp-externalities 0.15.0", + "sp-runtime-interface 10.0.0", + "sp-std 6.0.0", + "sp-storage 9.0.0", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39 0.8.2", - "wasmi", + "tiny-bip39", "zeroize", ] [[package]] name = "sp-core" -version = "11.0.0" +version = "20.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d99984f57c9eb858d29fbe0e4cf44092eec484b2ff72176d5afa4ab7bf1dc8b1" +checksum = "7789372146f8ad40d0b40fad0596cb1db5771187a258eabe19b06f00767fcbd6" dependencies = [ "array-bytes", - "base58", "bitflags", "blake2", + "bounded-collections", + "bs58", "dyn-clonable", "ed25519-zebra", "futures", - "hash-db", + "hash-db 0.16.0", "hash256-std-hasher", "impl-serde", "lazy_static", @@ -2934,46 +3115,46 @@ dependencies = [ "secp256k1", "secrecy", "serde", - "sp-core-hashing 6.0.0", - "sp-debug-derive 6.0.0", - "sp-externalities 0.15.0", - "sp-runtime-interface 10.0.0", - "sp-std 6.0.0", - "sp-storage 9.0.0", + "sp-core-hashing 8.0.0", + "sp-debug-derive 7.0.0", + "sp-externalities 0.18.0", + "sp-runtime-interface 16.0.0", + "sp-std 7.0.0", + "sp-storage 12.0.0", "ss58-registry", "substrate-bip39", "thiserror", - "tiny-bip39 1.0.0", + "tiny-bip39", "zeroize", ] [[package]] name = "sp-core-hashing" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49b9d1daa6aebfc144729b630885e91df92ff00560490ec065a56cb538e8895a" +checksum = "cbc2d1947252b7a4e403b0a260f596920443742791765ec111daa2bbf98eff25" dependencies = [ "blake2", "byteorder", "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 5.0.0", + "sp-std 6.0.0", "twox-hash", ] [[package]] name = "sp-core-hashing" -version = "6.0.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc2d1947252b7a4e403b0a260f596920443742791765ec111daa2bbf98eff25" +checksum = "27449abdfbe41b473e625bce8113745e81d65777dd1d5a8462cf24137930dad8" dependencies = [ - "blake2", + "blake2b_simd", "byteorder", "digest 0.10.6", "sha2 0.10.6", "sha3", - "sp-std 6.0.0", + "sp-std 7.0.0", "twox-hash", ] @@ -2986,53 +3167,53 @@ dependencies = [ "proc-macro2", "quote", "sp-core-hashing 6.0.0", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-debug-derive" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9ba7352773b96a4aa57e903447f841c6bc26e8c798377db6e7eb332346454" +checksum = "66fb9dc63d54de7d7bed62a505b6e0bd66c122525ea1abb348f6564717c3df2d" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-debug-derive" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66fb9dc63d54de7d7bed62a505b6e0bd66c122525ea1abb348f6564717c3df2d" +checksum = "62211eed9ef9dac4b9d837c56ccc9f8ee4fc49d9d9b7e6b9daf098fe173389ab" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-externalities" -version = "0.13.0" +version = "0.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef739442230f49d88ece41259e5d886d6b8bc0f4197ef7f1585c39c762ce7ef2" +checksum = "dc754e1cec66b93df0b48a8986d019c1a2a90431c42cf2614cc35a291597c329" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 5.0.0", - "sp-storage 7.0.0", + "sp-std 6.0.0", + "sp-storage 9.0.0", ] [[package]] name = "sp-externalities" -version = "0.15.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc754e1cec66b93df0b48a8986d019c1a2a90431c42cf2614cc35a291597c329" +checksum = "8ae0f275760689aaefe967943331d458cd99f5169d18364365d4cb584b246d1c" dependencies = [ "environmental", "parity-scale-codec", - "sp-std 6.0.0", - "sp-storage 9.0.0", + "sp-std 7.0.0", + "sp-storage 12.0.0", ] [[package]] @@ -3052,36 +3233,35 @@ dependencies = [ [[package]] name = "sp-io" -version = "7.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6280bd3643354f7ff0b2abd36c687745455779231a7a86d90945608f0d4924c4" +checksum = "8ac917b37c7733e3778e7ffc3958f1181a151ac3b14116d65fb10fe7b08db10e" dependencies = [ "bytes", + "ed25519", + "ed25519-dalek", "futures", - "hash-db", "libsecp256k1", "log", "parity-scale-codec", - "parking_lot", "secp256k1", - "sp-core 7.0.0", - "sp-externalities 0.13.0", - "sp-keystore 0.13.0", - "sp-runtime-interface 7.0.0", - "sp-state-machine 0.13.0", - "sp-std 5.0.0", - "sp-tracing 6.0.0", - "sp-trie 7.0.0", - "sp-wasm-interface 7.0.0", + "sp-core 11.0.0", + "sp-externalities 0.15.0", + "sp-keystore 0.17.0", + "sp-runtime-interface 10.0.0", + "sp-state-machine 0.17.0", + "sp-std 6.0.0", + "sp-tracing 7.0.0", + "sp-trie 11.0.0", "tracing", "tracing-core", ] [[package]] name = "sp-io" -version = "12.0.0" +version = "22.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ac917b37c7733e3778e7ffc3958f1181a151ac3b14116d65fb10fe7b08db10e" +checksum = "bd3431c245992fe51b8256c838fc2e981f8d3b0afc1d1377ca7dbe0a3287a764" dependencies = [ "bytes", "ed25519", @@ -3090,24 +3270,25 @@ dependencies = [ "libsecp256k1", "log", "parity-scale-codec", + "rustversion", "secp256k1", - "sp-core 11.0.0", - "sp-externalities 0.15.0", - "sp-keystore 0.17.0", - "sp-runtime-interface 10.0.0", - "sp-state-machine 0.17.0", - "sp-std 6.0.0", - "sp-tracing 7.0.0", - "sp-trie 11.0.0", + "sp-core 20.0.0", + "sp-externalities 0.18.0", + "sp-keystore 0.26.0", + "sp-runtime-interface 16.0.0", + "sp-state-machine 0.27.0", + "sp-std 7.0.0", + "sp-tracing 9.0.0", + "sp-trie 21.0.0", "tracing", "tracing-core", ] [[package]] name = "sp-keystore" -version = "0.13.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44bec4f0d036b6993c14bbee4216781f21275e5c201e43e45fed4a434bf0e5a" +checksum = "6ada8b7a72404bda58b3353830bc42f027ec764e13a28b4cd4386cf34fb1ae7c" dependencies = [ "async-trait", "futures", @@ -3115,33 +3296,32 @@ dependencies = [ "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 7.0.0", - "sp-externalities 0.13.0", + "sp-core 11.0.0", + "sp-externalities 0.15.0", "thiserror", ] [[package]] name = "sp-keystore" -version = "0.17.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ada8b7a72404bda58b3353830bc42f027ec764e13a28b4cd4386cf34fb1ae7c" +checksum = "452d079f592c97369c9ca8a5083b25f146751c6b5af10cbcacc2b24dc53fd72a" dependencies = [ - "async-trait", "futures", "merlin", "parity-scale-codec", "parking_lot", "schnorrkel", - "sp-core 11.0.0", - "sp-externalities 0.15.0", + "sp-core 20.0.0", + "sp-externalities 0.18.0", "thiserror", ] [[package]] name = "sp-panic-handler" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97549ec99cb289db2a9f5c656b6880f7c90097135e1ca6c6ae4fe5694232e526" +checksum = "4abed79c3d5b3622f65ab065676addd9923b9b122cd257df23e2757ce487c6d2" dependencies = [ "backtrace", "lazy_static", @@ -3150,9 +3330,9 @@ dependencies = [ [[package]] name = "sp-panic-handler" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abed79c3d5b3622f65ab065676addd9923b9b122cd257df23e2757ce487c6d2" +checksum = "75986cc917d897e0f6d0c848088064df4c74ccbb8f1c1848700b725f5ca7fe04" dependencies = [ "backtrace", "lazy_static", @@ -3161,33 +3341,32 @@ dependencies = [ [[package]] name = "sp-runtime" -version = "7.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0edfc5c54c2b31d2f0cf904d472a0bff7125c0c2a2e2330507842e56f9a27444" +checksum = "c86578c67b060a6ecab52af64f1cf18b3892fca7fba5ffc5c49934b2e76b1929" dependencies = [ "either", "hash256-std-hasher", "impl-trait-for-tuples", "log", "parity-scale-codec", - "parity-util-mem", "paste", - "rand 0.7.3", + "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 7.0.0", - "sp-arithmetic 6.0.0", - "sp-core 7.0.0", - "sp-io 7.0.0", - "sp-std 5.0.0", - "sp-weights 4.0.0", + "sp-application-crypto 12.0.0", + "sp-arithmetic 9.0.0", + "sp-core 11.0.0", + "sp-io 12.0.0", + "sp-std 6.0.0", + "sp-weights 8.0.0", ] [[package]] name = "sp-runtime" -version = "12.0.0" +version = "23.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c86578c67b060a6ecab52af64f1cf18b3892fca7fba5ffc5c49934b2e76b1929" +checksum = "6220216caa67e3d931c693b06a3590dfcaa255f19bb3c3e3150f1672b8bc53f6" dependencies = [ "either", "hash256-std-hasher", @@ -3198,76 +3377,76 @@ dependencies = [ "rand 0.8.5", "scale-info", "serde", - "sp-application-crypto 12.0.0", - "sp-arithmetic 9.0.0", - "sp-core 11.0.0", - "sp-io 12.0.0", - "sp-std 6.0.0", - "sp-weights 8.0.0", + "sp-application-crypto 22.0.0", + "sp-arithmetic 15.0.0", + "sp-core 20.0.0", + "sp-io 22.0.0", + "sp-std 7.0.0", + "sp-weights 19.0.0", ] [[package]] name = "sp-runtime-interface" -version = "7.0.0" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b886a5d34400b0e0c12d389e3bb48b7a93d651cddf7e248124b81fe64c339251" +checksum = "f3858935567385728ea45f6d159f9970b0b278eb22a8e77625bbf4a63e43a85a" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.13.0", - "sp-runtime-interface-proc-macro 6.0.0", - "sp-std 5.0.0", - "sp-storage 7.0.0", - "sp-tracing 6.0.0", - "sp-wasm-interface 7.0.0", + "sp-externalities 0.15.0", + "sp-runtime-interface-proc-macro 7.0.0", + "sp-std 6.0.0", + "sp-storage 9.0.0", + "sp-tracing 7.0.0", + "sp-wasm-interface 8.0.0", "static_assertions", ] [[package]] name = "sp-runtime-interface" -version = "10.0.0" +version = "16.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3858935567385728ea45f6d159f9970b0b278eb22a8e77625bbf4a63e43a85a" +checksum = "ca5d0cd80200bf85b8b064238b2508b69b6146b13adf36066ec5d924825af737" dependencies = [ "bytes", "impl-trait-for-tuples", "parity-scale-codec", "primitive-types", - "sp-externalities 0.15.0", - "sp-runtime-interface-proc-macro 7.0.0", - "sp-std 6.0.0", - "sp-storage 9.0.0", - "sp-tracing 7.0.0", - "sp-wasm-interface 8.0.0", + "sp-externalities 0.18.0", + "sp-runtime-interface-proc-macro 10.0.0", + "sp-std 7.0.0", + "sp-storage 12.0.0", + "sp-tracing 9.0.0", + "sp-wasm-interface 13.0.0", "static_assertions", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a157f1ce0108b9b87f87e826726049d9b6253318b74410c814be7fc2af416b51" +checksum = "00083a77e938c4f35d0bde7ca0b6e5f616158ebe11af6063795aa664d92a238b" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-runtime-interface-proc-macro" -version = "7.0.0" +version = "10.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00083a77e938c4f35d0bde7ca0b6e5f616158ebe11af6063795aa664d92a238b" +checksum = "05ae5b00aef477127ddb6177b3464ad1e2bdcc12ee913fc5dfc9d065c6cea89b" dependencies = [ "Inflector", "proc-macro-crate", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3285,96 +3464,94 @@ dependencies = [ [[package]] name = "sp-state-machine" -version = "0.13.0" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5c2d97ad69011d34ca257f0383532b80096d53f889f5894ae2b24a211bec66f" +checksum = "f1fd4c600df0b5abf26c19b6c61d928b64e0c2b8a709a3dbef872be0507cd1ca" dependencies = [ - "hash-db", + "hash-db 0.15.2", "log", - "num-traits", "parity-scale-codec", "parking_lot", - "rand 0.7.3", + "rand 0.8.5", "smallvec", - "sp-core 7.0.0", - "sp-externalities 0.13.0", - "sp-panic-handler 5.0.0", - "sp-std 5.0.0", - "sp-trie 7.0.0", + "sp-core 11.0.0", + "sp-externalities 0.15.0", + "sp-panic-handler 6.0.0", + "sp-std 6.0.0", + "sp-trie 11.0.0", "thiserror", "tracing", - "trie-root", ] [[package]] name = "sp-state-machine" -version = "0.17.0" +version = "0.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fd4c600df0b5abf26c19b6c61d928b64e0c2b8a709a3dbef872be0507cd1ca" +checksum = "b1e49c3bfcc8c832c34552cd8194180cc60508c6d3d9b0b9615d6b7c3e275019" dependencies = [ - "hash-db", + "hash-db 0.16.0", "log", "parity-scale-codec", "parking_lot", "rand 0.8.5", "smallvec", - "sp-core 11.0.0", - "sp-externalities 0.15.0", - "sp-panic-handler 6.0.0", - "sp-std 6.0.0", - "sp-trie 11.0.0", + "sp-core 20.0.0", + "sp-externalities 0.18.0", + "sp-panic-handler 7.0.0", + "sp-std 7.0.0", + "sp-trie 21.0.0", "thiserror", "tracing", ] [[package]] name = "sp-std" -version = "5.0.0" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3fd4c1d304be101e6ebbafd3d4be9a37b320c970ef4e8df188b16873981c93" +checksum = "af0ee286f98455272f64ac5bb1384ff21ac029fbb669afbaf48477faff12760e" [[package]] name = "sp-std" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af0ee286f98455272f64ac5bb1384ff21ac029fbb669afbaf48477faff12760e" +checksum = "1de8eef39962b5b97478719c493bed2926cf70cb621005bbf68ebe58252ff986" [[package]] name = "sp-storage" -version = "7.0.0" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb987ed2e4d7d870170a225083ea962f2a359d75cdf76935d5ed8d91bee912d9" +checksum = "9acb4059eb0ae4fa8cf9ca9119b0178ad312a592d4c6054bd17b411034f233e9" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 5.0.0", - "sp-std 5.0.0", + "sp-debug-derive 6.0.0", + "sp-std 6.0.0", ] [[package]] name = "sp-storage" -version = "9.0.0" +version = "12.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9acb4059eb0ae4fa8cf9ca9119b0178ad312a592d4c6054bd17b411034f233e9" +checksum = "9ad1f8c52d4700ac7bc42b3375679a6c6fc1fe876f4b40c6efdf36f933ef0291" dependencies = [ "impl-serde", "parity-scale-codec", "ref-cast", "serde", - "sp-debug-derive 6.0.0", - "sp-std 6.0.0", + "sp-debug-derive 7.0.0", + "sp-std 7.0.0", ] [[package]] name = "sp-tracing" -version = "6.0.0" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e761df87dc940d87720939de8f976d1fc0657e523886ae0d7bf3f7e2e2f0abb6" +checksum = "b22d28a0bc2365dfb86644d14f2682a79da35891d4656d4896fb09fb05ff1e6c" dependencies = [ "parity-scale-codec", - "sp-std 5.0.0", + "sp-std 6.0.0", "tracing", "tracing-core", "tracing-subscriber 0.2.25", @@ -3382,12 +3559,12 @@ dependencies = [ [[package]] name = "sp-tracing" -version = "7.0.0" +version = "9.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b22d28a0bc2365dfb86644d14f2682a79da35891d4656d4896fb09fb05ff1e6c" +checksum = "00fab60bf3d42255ce3f678903d3a2564662371c75623de4a1ffc7cac46143df" dependencies = [ "parity-scale-codec", - "sp-std 6.0.0", + "sp-std 7.0.0", "tracing", "tracing-core", "tracing-subscriber 0.2.25", @@ -3395,50 +3572,50 @@ dependencies = [ [[package]] name = "sp-trie" -version = "7.0.0" +version = "11.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f4f48c887e90050537e399d2d8b6ee82787ebec0fe46e4880b42cab0c2d5ba6" +checksum = "db085f134cb444e52ca569a442d12c84bd17667532613d78dd6f568942632da4" dependencies = [ - "ahash", - "hash-db", - "hashbrown", + "ahash 0.7.6", + "hash-db 0.15.2", + "hashbrown 0.12.3", "lazy_static", "lru", - "memory-db 0.30.0", + "memory-db 0.31.0", "nohash-hasher", "parity-scale-codec", "parking_lot", "scale-info", - "sp-core 7.0.0", - "sp-std 5.0.0", + "sp-core 11.0.0", + "sp-std 6.0.0", "thiserror", "tracing", - "trie-db", - "trie-root", + "trie-db 0.24.0", + "trie-root 0.17.0", ] [[package]] name = "sp-trie" -version = "11.0.0" +version = "21.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db085f134cb444e52ca569a442d12c84bd17667532613d78dd6f568942632da4" +checksum = "58401c53c08b6ecad83acd7e14534c8bbcb3fa73e81e26685e0ac70e51b00c56" dependencies = [ - "ahash", - "hash-db", - "hashbrown", + "ahash 0.8.3", + "hash-db 0.16.0", + "hashbrown 0.13.2", "lazy_static", - "lru", - "memory-db 0.31.0", + "memory-db 0.32.0", "nohash-hasher", "parity-scale-codec", "parking_lot", "scale-info", - "sp-core 11.0.0", - "sp-std 6.0.0", + "schnellru", + "sp-core 20.0.0", + "sp-std 7.0.0", "thiserror", "tracing", - "trie-db", - "trie-root", + "trie-db 0.27.1", + "trie-root 0.18.0", ] [[package]] @@ -3468,67 +3645,68 @@ dependencies = [ "parity-scale-codec", "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] name = "sp-wasm-interface" -version = "7.0.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f43c40afab6ecac20505907631c929957ed636b7af8795984649bbaa6ff38c3" +checksum = "3ebc377987d42f8fc20e3f4ec4fd1147dd098fe90bcb4269e1eddb04e920f889" dependencies = [ "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 5.0.0", + "sp-std 6.0.0", "wasmi", + "wasmtime 1.0.2", ] [[package]] name = "sp-wasm-interface" -version = "8.0.0" +version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ebc377987d42f8fc20e3f4ec4fd1147dd098fe90bcb4269e1eddb04e920f889" +checksum = "153b7374179439e2aa783c66ed439bd86920c67bbc95d34c76390561972bc02f" dependencies = [ + "anyhow", "impl-trait-for-tuples", "log", "parity-scale-codec", - "sp-std 6.0.0", + "sp-std 7.0.0", "wasmi", - "wasmtime", + "wasmtime 6.0.1", ] [[package]] name = "sp-weights" -version = "4.0.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c671673133b30e6ab6d88139b06adcdaec5aa06548abe0e155a0c830b592793b" +checksum = "90eca2a19f48978e9cd605e23905d0602419f7880a9360ac717b03412e9c7916" dependencies = [ - "impl-trait-for-tuples", "parity-scale-codec", "scale-info", "serde", "smallvec", - "sp-arithmetic 6.0.0", - "sp-core 7.0.0", - "sp-debug-derive 5.0.0", - "sp-std 5.0.0", + "sp-arithmetic 9.0.0", + "sp-core 11.0.0", + "sp-debug-derive 6.0.0", + "sp-std 6.0.0", ] [[package]] name = "sp-weights" -version = "8.0.0" +version = "19.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90eca2a19f48978e9cd605e23905d0602419f7880a9360ac717b03412e9c7916" +checksum = "123c661915e1bf328e21f8ecbe4e5247feba86f9149b782ea4348004547ce8ef" dependencies = [ "parity-scale-codec", "scale-info", "serde", "smallvec", - "sp-arithmetic 9.0.0", - "sp-core 11.0.0", - "sp-debug-derive 6.0.0", - "sp-std 6.0.0", + "sp-arithmetic 15.0.0", + "sp-core 20.0.0", + "sp-debug-derive 7.0.0", + "sp-std 7.0.0", ] [[package]] @@ -3614,26 +3792,33 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "subxt" -version = "0.25.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3cbc78fd36035a24883eada29e0205b9b1416172530a7d00a60c07d0337db0c" +checksum = "53b9c4ddefcb2d87eb18a6336f65635c29208f766d0deefaa2a1a19f7426a993" dependencies = [ - "bitvec", + "base58", + "blake2", "derivative", + "either", "frame-metadata", "futures", "getrandom 0.2.8", "hex", + "impl-serde", "jsonrpsee", "parity-scale-codec", "parking_lot", + "primitive-types", + "scale-bits", "scale-decode", + "scale-encode", "scale-info", "scale-value", "serde", "serde_json", - "sp-core 7.0.0", - "sp-runtime 7.0.0", + "sp-core 20.0.0", + "sp-core-hashing 8.0.0", + "sp-runtime 23.0.0", "subxt-macro", "subxt-metadata", "thiserror", @@ -3642,9 +3827,9 @@ dependencies = [ [[package]] name = "subxt-codegen" -version = "0.25.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7722c31febf55eb300c73d977da5d65cfd6fb443419b1185b9abcdd9925fd7be" +checksum = "e924f41069e9273236398ff89662d6d336468a5d94faac812129d44547db0e7f" dependencies = [ "darling", "frame-metadata", @@ -3652,44 +3837,55 @@ dependencies = [ "hex", "jsonrpsee", "parity-scale-codec", - "proc-macro-error", "proc-macro2", "quote", "scale-info", "subxt-metadata", - "syn", + "syn 1.0.109", + "thiserror", "tokio", ] [[package]] name = "subxt-macro" -version = "0.25.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f64826f2c4ba20e3b2a86ec81a6ae8655ca6b6a4c2a6ccc888b6615efc2df14" +checksum = "ced0b043a069ee039f8700d3dfda01be156e4229c82277c305bc8e79a7dd855d" dependencies = [ "darling", "proc-macro-error", "subxt-codegen", - "syn", + "syn 1.0.109", ] [[package]] name = "subxt-metadata" -version = "0.25.0" +version = "0.28.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "869af75e23513538ad0af046af4a97b8d684e8d202e35ff4127ee061c1110813" +checksum = "18be3b8f4308fe7369ee1df66ae59c2eca79de20eab57b0f41c75736e843300f" dependencies = [ "frame-metadata", "parity-scale-codec", "scale-info", - "sp-core 7.0.0", + "sp-core-hashing 8.0.0", ] [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcf316d5356ed6847742d036f8a39c3b8435cac10bd528a4bd461928a6ab34d5" dependencies = [ "proc-macro2", "quote", @@ -3704,7 +3900,7 @@ checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "unicode-xid", ] @@ -3744,29 +3940,29 @@ dependencies = [ "sp-std 6.0.0", "subxt", "subxt-codegen", - "syn", + "syn 1.0.109", "tokio", "tracing-subscriber 0.3.16", ] [[package]] name = "thiserror" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" +checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.38" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" +checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.14", ] [[package]] @@ -3778,25 +3974,6 @@ dependencies = [ "once_cell", ] -[[package]] -name = "tiny-bip39" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc59cb9dfc85bb312c3a78fd6aa8a8582e310b0fa885d5bb877f6dcc601839d" -dependencies = [ - "anyhow", - "hmac 0.8.1", - "once_cell", - "pbkdf2 0.4.0", - "rand 0.7.3", - "rustc-hash", - "sha2 0.9.9", - "thiserror", - "unicode-normalization", - "wasm-bindgen", - "zeroize", -] - [[package]] name = "tiny-bip39" version = "1.0.0" @@ -3833,14 +4010,13 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.26.0" +version = "1.27.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03201d01c3c27a29c8a5cee5b55a93ddae1ccf6f08f65365c2c918f8c1b76f64" +checksum = "d0de47a4eecbe11f498978a9b29d792f0d2692d1dd003650c24c76510e3bc001" dependencies = [ "autocfg", "bytes", "libc", - "memchr", "mio", "num_cpus", "pin-project-lite", @@ -3851,13 +4027,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "1.8.2" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" +checksum = "61a573bdc87985e9d6ddeed1b3d864e8a302c847e40d647746df2f1de209d1ce" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 2.0.14", ] [[package]] @@ -3921,7 +4097,7 @@ checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", ] [[package]] @@ -3997,8 +4173,21 @@ version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "004e1e8f92535694b4cb1444dc5a8073ecf0815e3357f729638b9f8fc4062908" dependencies = [ - "hash-db", - "hashbrown", + "hash-db 0.15.2", + "hashbrown 0.12.3", + "log", + "rustc-hex", + "smallvec", +] + +[[package]] +name = "trie-db" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "767abe6ffed88a1889671a102c2861ae742726f52e0a5a425b92c9fbfa7e9c85" +dependencies = [ + "hash-db 0.16.0", + "hashbrown 0.13.2", "log", "rustc-hex", "smallvec", @@ -4010,7 +4199,16 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a36c5ca3911ed3c9a5416ee6c679042064b93fc637ded67e25f92e68d783891" dependencies = [ - "hash-db", + "hash-db 0.15.2", +] + +[[package]] +name = "trie-root" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4ed310ef5ab98f5fa467900ed906cb9232dd5376597e00fd4cba2a449d06c0b" +dependencies = [ + "hash-db 0.16.0", ] [[package]] @@ -4055,6 +4253,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "unicode-bidi" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" + [[package]] name = "unicode-ident" version = "1.0.6" @@ -4088,6 +4292,17 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +[[package]] +name = "url" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + [[package]] name = "valuable" version = "0.1.0" @@ -4149,7 +4364,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-shared", ] @@ -4171,7 +4386,7 @@ checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4224,6 +4439,16 @@ dependencies = [ "indexmap", ] +[[package]] +name = "wasmparser" +version = "0.100.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64b20236ab624147dfbb62cf12a19aaf66af0e41b8398838b66e997d07d269d4" +dependencies = [ + "indexmap", + "url", +] + [[package]] name = "wasmtime" version = "1.0.2" @@ -4242,13 +4467,38 @@ dependencies = [ "psm", "serde", "target-lexicon", - "wasmparser", - "wasmtime-environ", - "wasmtime-jit", - "wasmtime-runtime", + "wasmparser 0.89.1", + "wasmtime-environ 1.0.2", + "wasmtime-jit 1.0.2", + "wasmtime-runtime 1.0.2", "windows-sys 0.36.1", ] +[[package]] +name = "wasmtime" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e89f9819523447330ffd70367ef4a18d8c832e24e8150fe054d1d912841632" +dependencies = [ + "anyhow", + "bincode", + "cfg-if", + "indexmap", + "libc", + "log", + "object 0.29.0", + "once_cell", + "paste", + "psm", + "serde", + "target-lexicon", + "wasmparser 0.100.0", + "wasmtime-environ 6.0.1", + "wasmtime-jit 6.0.1", + "wasmtime-runtime 6.0.1", + "windows-sys 0.42.0", +] + [[package]] name = "wasmtime-asm-macros" version = "1.0.2" @@ -4258,6 +4508,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "wasmtime-asm-macros" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bd3a5e46c198032da934469f3a6e48649d1f9142438e4fd4617b68a35644b8a" +dependencies = [ + "cfg-if", +] + [[package]] name = "wasmtime-environ" version = "1.0.2" @@ -4265,7 +4524,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebb881c61f4f627b5d45c54e629724974f8a8890d455bcbe634330cc27309644" dependencies = [ "anyhow", - "cranelift-entity", + "cranelift-entity 0.88.2", + "gimli 0.26.2", + "indexmap", + "log", + "object 0.29.0", + "serde", + "target-lexicon", + "thiserror", + "wasmparser 0.89.1", + "wasmtime-types 1.0.2", +] + +[[package]] +name = "wasmtime-environ" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a6db9fc52985ba06ca601f2ff0ff1f526c5d724c7ac267b47326304b0c97883" +dependencies = [ + "anyhow", + "cranelift-entity 0.93.1", "gimli 0.26.2", "indexmap", "log", @@ -4273,8 +4551,8 @@ dependencies = [ "serde", "target-lexicon", "thiserror", - "wasmparser", - "wasmtime-types", + "wasmparser 0.100.0", + "wasmtime-types 6.0.1", ] [[package]] @@ -4292,15 +4570,38 @@ dependencies = [ "log", "object 0.29.0", "rustc-demangle", - "rustix", + "rustix 0.35.13", "serde", "target-lexicon", "thiserror", - "wasmtime-environ", - "wasmtime-runtime", + "wasmtime-environ 1.0.2", + "wasmtime-runtime 1.0.2", "windows-sys 0.36.1", ] +[[package]] +name = "wasmtime-jit" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b77e3a52cd84d0f7f18554afa8060cfe564ccac61e3b0802d3fd4084772fa5f6" +dependencies = [ + "addr2line 0.17.0", + "anyhow", + "bincode", + "cfg-if", + "cpp_demangle", + "gimli 0.26.2", + "log", + "object 0.29.0", + "rustc-demangle", + "serde", + "target-lexicon", + "wasmtime-environ 6.0.1", + "wasmtime-jit-icache-coherence", + "wasmtime-runtime 6.0.1", + "windows-sys 0.42.0", +] + [[package]] name = "wasmtime-jit-debug" version = "1.0.2" @@ -4310,6 +4611,26 @@ dependencies = [ "once_cell", ] +[[package]] +name = "wasmtime-jit-debug" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0245e8a9347017c7185a72e215218a802ff561545c242953c11ba00fccc930f" +dependencies = [ + "once_cell", +] + +[[package]] +name = "wasmtime-jit-icache-coherence" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67d412e9340ab1c83867051d8d1d7c90aa8c9afc91da086088068e2734e25064" +dependencies = [ + "cfg-if", + "libc", + "windows-sys 0.42.0", +] + [[package]] name = "wasmtime-runtime" version = "1.0.2" @@ -4326,24 +4647,60 @@ dependencies = [ "memoffset", "paste", "rand 0.8.5", - "rustix", + "rustix 0.35.13", "thiserror", - "wasmtime-asm-macros", - "wasmtime-environ", - "wasmtime-jit-debug", + "wasmtime-asm-macros 1.0.2", + "wasmtime-environ 1.0.2", + "wasmtime-jit-debug 1.0.2", "windows-sys 0.36.1", ] +[[package]] +name = "wasmtime-runtime" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d594e791b5fdd4dbaf8cf7ae62f2e4ff85018ce90f483ca6f42947688e48827d" +dependencies = [ + "anyhow", + "cc", + "cfg-if", + "indexmap", + "libc", + "log", + "mach", + "memfd", + "memoffset", + "paste", + "rand 0.8.5", + "rustix 0.36.12", + "wasmtime-asm-macros 6.0.1", + "wasmtime-environ 6.0.1", + "wasmtime-jit-debug 6.0.1", + "windows-sys 0.42.0", +] + [[package]] name = "wasmtime-types" version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d23d61cb4c46e837b431196dd06abb11731541021916d03476a178b54dc07aeb" dependencies = [ - "cranelift-entity", + "cranelift-entity 0.88.2", + "serde", + "thiserror", + "wasmparser 0.89.1", +] + +[[package]] +name = "wasmtime-types" +version = "6.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6688d6f96d4dbc1f89fab626c56c1778936d122b5f4ae7a57c2eb42b8d982e2" +dependencies = [ + "cranelift-entity 0.93.1", "serde", "thiserror", - "wasmparser", + "wasmparser 0.100.0", ] [[package]] @@ -4425,12 +4782,12 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] @@ -4440,7 +4797,16 @@ version = "0.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" dependencies = [ - "windows-targets", + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.0", ] [[package]] @@ -4449,21 +4815,42 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" dependencies = [ - "windows_aarch64_gnullvm", + "windows_aarch64_gnullvm 0.42.2", "windows_aarch64_msvc 0.42.2", "windows_i686_gnu 0.42.2", "windows_i686_msvc 0.42.2", "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm", + "windows_x86_64_gnullvm 0.42.2", "windows_x86_64_msvc 0.42.2", ] +[[package]] +name = "windows-targets" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +dependencies = [ + "windows_aarch64_gnullvm 0.48.0", + "windows_aarch64_msvc 0.48.0", + "windows_i686_gnu 0.48.0", + "windows_i686_msvc 0.48.0", + "windows_x86_64_gnu 0.48.0", + "windows_x86_64_gnullvm 0.48.0", + "windows_x86_64_msvc 0.48.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" + [[package]] name = "windows_aarch64_msvc" version = "0.36.1" @@ -4476,6 +4863,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" + [[package]] name = "windows_i686_gnu" version = "0.36.1" @@ -4488,6 +4881,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" +[[package]] +name = "windows_i686_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" + [[package]] name = "windows_i686_msvc" version = "0.36.1" @@ -4500,6 +4899,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" +[[package]] +name = "windows_i686_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" + [[package]] name = "windows_x86_64_gnu" version = "0.36.1" @@ -4512,12 +4917,24 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" + [[package]] name = "windows_x86_64_gnullvm" version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" + [[package]] name = "windows_x86_64_msvc" version = "0.36.1" @@ -4530,6 +4947,12 @@ version = "0.42.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" + [[package]] name = "wyz" version = "0.5.1" @@ -4541,9 +4964,9 @@ dependencies = [ [[package]] name = "yap" -version = "0.7.2" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fc77f52dc9e9b10d55d3f4462c3b7fc393c4f17975d641542833ab2d3bc26ef" +checksum = "e2a7eb6d82a11e4d0b8e6bda8347169aff4ccd8235d039bba7c47482d977dcf7" [[package]] name = "zeroize" @@ -4562,6 +4985,6 @@ checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" dependencies = [ "proc-macro2", "quote", - "syn", + "syn 1.0.109", "synstructure", ] diff --git a/clients/tfchain_client_rs/Cargo.toml b/clients/tfchain_client_rs/Cargo.toml index 4cf20659b..892f931f8 100644 --- a/clients/tfchain_client_rs/Cargo.toml +++ b/clients/tfchain_client_rs/Cargo.toml @@ -9,13 +9,9 @@ edition = "2021" path = "src/lib.rs" name = "tfchain_client" -[[bin]] -path = "src/main.rs" -name = "tfchain_cli" - [dependencies] -subxt = "0.25.0" -subxt-codegen = "0.25.0" +subxt = "0.28.0" +subxt-codegen = "0.28.0" syn = "1.0.99" tokio = { version = "1.8", features = ["rt-multi-thread", "macros", "time"] } futures-util = "0.3.23" diff --git a/clients/tfchain_client_rs/artifacts/devnet.scale b/clients/tfchain_client_rs/artifacts/current.scale similarity index 100% rename from clients/tfchain_client_rs/artifacts/devnet.scale rename to clients/tfchain_client_rs/artifacts/current.scale diff --git a/clients/tfchain_client_rs/artifacts/local.scale b/clients/tfchain_client_rs/artifacts/local.scale deleted file mode 100644 index 18e8da5ee..000000000 Binary files a/clients/tfchain_client_rs/artifacts/local.scale and /dev/null differ diff --git a/clients/tfchain_client_rs/artifacts/mainnet.scale b/clients/tfchain_client_rs/artifacts/mainnet.scale deleted file mode 100644 index b571132d2..000000000 Binary files a/clients/tfchain_client_rs/artifacts/mainnet.scale and /dev/null differ diff --git a/clients/tfchain_client_rs/artifacts/testnet.scale b/clients/tfchain_client_rs/artifacts/testnet.scale deleted file mode 100644 index 98f2a95e7..000000000 Binary files a/clients/tfchain_client_rs/artifacts/testnet.scale and /dev/null differ diff --git a/clients/tfchain_client_rs/src/client.rs b/clients/tfchain_client_rs/src/client.rs index 16c940b08..61a9d0e5c 100644 --- a/clients/tfchain_client_rs/src/client.rs +++ b/clients/tfchain_client_rs/src/client.rs @@ -1,36 +1,12 @@ -use crate::runtimes::{devnet, local, mainnet, testnet, types}; +use crate::runtimes::current; +pub use current::{BlockNumber, Contract, Farm, Node, SystemAccountInfo, Twin, H256 as Hash}; use std::str::FromStr; +use subxt::utils::AccountId32; use subxt::{ - ext::{ - sp_core::{crypto::SecretStringError, ed25519, sr25519, Pair}, - sp_runtime::AccountId32, - }, + ext::sp_core::{crypto::SecretStringError, ed25519, sr25519, Pair}, tx::{PairSigner, Signer}, Error, OnlineClient, PolkadotConfig, }; -pub use types::{BlockNumber, Contract, Hash, SystemAccountInfo, TfgridFarm, TfgridNode, Twin}; - -#[derive(Debug, Clone, Copy, PartialEq)] -pub enum Runtime { - Local, - Devnet, - Testnet, - Mainnet, -} - -impl FromStr for Runtime { - type Err = &'static str; - - fn from_str(v: &str) -> Result { - match v { - "local" => Ok(Self::Local), - "devnet" => Ok(Self::Devnet), - "mainnet" => Ok(Self::Mainnet), - "testnet" => Ok(Self::Testnet), - _ => Err("unknown runtime"), - } - } -} #[derive(Debug, Clone, Copy, serde::Serialize, serde::Deserialize)] pub enum KeyType { @@ -78,10 +54,38 @@ impl KeyPair { Ok(pair) } - pub fn signer(&self) -> Box + Send + Sync> { + pub fn signer(&self) -> KeySigner { + match self { + Self::Ed25519(pair) => KeySigner::Ed25519(PairSigner::new(pair.clone())), + Self::Sr25519(pair) => KeySigner::Sr25519(PairSigner::new(pair.clone())), + } + } +} + +pub enum KeySigner { + Sr25519(PairSigner), + Ed25519(PairSigner), +} + +impl Signer for KeySigner { + fn account_id(&self) -> &::AccountId { + match self { + Self::Sr25519(signer) => signer.account_id(), + Self::Ed25519(signer) => signer.account_id(), + } + } + + fn address(&self) -> ::Address { + match self { + Self::Sr25519(signer) => signer.address(), + Self::Ed25519(signer) => signer.address(), + } + } + + fn sign(&self, signer_payload: &[u8]) -> ::Signature { match self { - Self::Ed25519(pair) => Box::new(PairSigner::new(pair.clone())), - Self::Sr25519(pair) => Box::new(PairSigner::new(pair.clone())), + Self::Sr25519(signer) => signer.sign(signer_payload), + Self::Ed25519(signer) => signer.sign(signer_payload), } } } @@ -100,26 +104,14 @@ impl From for KeyPair { #[derive(Clone)] pub struct Client { - pub runtime: Runtime, pub api: OnlineClient, } -macro_rules! call { - ($self:ident, $name:ident, $($arg:expr),+) => ( - match $self.runtime { - Runtime::Local => local::$name($self, $($arg),+).await, - Runtime::Devnet => devnet::$name($self, $($arg),+).await, - Runtime::Testnet => testnet::$name($self, $($arg),+).await, - Runtime::Mainnet => mainnet::$name($self, $($arg),+).await, - } - ) -} - impl Client { - pub async fn new>(url: U, runtime: Runtime) -> Result { + pub async fn new>(url: U) -> Result { let api = OnlineClient::::from_url(url).await?; - Ok(Client { api, runtime }) + Ok(Client { api }) } // Creates a twin and checks for success, twin ID is returned on success @@ -129,7 +121,7 @@ impl Client { relay: Option, pk: Option, ) -> Result { - call!(self, create_twin, kp, relay, pk) + current::create_twin(self, kp, relay, pk).await } // Updates a twin and checks for success, blockhash is returned on success @@ -139,7 +131,7 @@ impl Client { relay: Option, pk: Option<&[u8]>, ) -> Result { - call!(self, update_twin, kp, relay, pk) + current::update_twin(self, kp, relay, pk).await } // Signs terms and condition and checks for success, blockhash is returned on success @@ -149,67 +141,40 @@ impl Client { document_link: String, document_hash: String, ) -> Result { - call!( - self, - sign_terms_and_conditions, - kp, - document_link, - document_hash - ) + current::sign_terms_and_conditions(self, kp, document_link, document_hash).await } - pub async fn get_twin_by_id( - &self, - id: u32, - at_block: Option, - ) -> Result, Error> { - call!(self, get_twin_by_id, id, at_block) + pub async fn get_twin_by_id(&self, id: u32) -> Result, Error> { + current::get_twin_by_id(self, id).await } - pub async fn get_twin_id_by_account( - &self, - account: AccountId32, - at_block: Option, - ) -> Result, Error> { - call!(self, get_twin_id_by_account, account, at_block) + pub async fn get_twin_id_by_account(&self, account: AccountId32) -> Result, Error> { + current::get_twin_id_by_account(self, account).await } - pub async fn get_farm_by_id( - &self, - id: u32, - at_block: Option, - ) -> Result, Error> { - call!(self, get_farm_by_id, id, at_block) + pub async fn get_farm_by_id(&self, id: u32) -> Result, Error> { + current::get_farm_by_id(self, id).await } - pub async fn get_node_by_id( - &self, - id: u32, - at_block: Option, - ) -> Result, Error> { - call!(self, get_node_by_id, id, at_block) + pub async fn get_node_by_id(&self, id: u32) -> Result, Error> { + current::get_node_by_id(self, id).await } pub async fn get_balance( &self, account: &AccountId32, - at_block: Option, ) -> Result, Error> { - call!(self, get_balance, account, at_block) + current::get_balance(self, account).await } pub async fn get_block_hash( &self, block_number: Option, ) -> Result, Error> { - call!(self, get_block_hash, block_number) + current::get_block_hash(self, block_number).await } - pub async fn get_contract_by_id( - &self, - id: u64, - at_block: Option, - ) -> Result, Error> { - call!(self, get_contract_by_id, id, at_block) + pub async fn get_contract_by_id(&self, id: u64) -> Result, Error> { + current::get_contract_by_id(self, id).await } } diff --git a/clients/tfchain_client_rs/src/main.rs b/clients/tfchain_client_rs/src/main.rs deleted file mode 100644 index 351273b4c..000000000 --- a/clients/tfchain_client_rs/src/main.rs +++ /dev/null @@ -1,142 +0,0 @@ -// use codec::Decode; -// use futures::StreamExt; -// use sp_keyring::AccountKeyring; -// use std::time::Duration; -// use subxt::{tx::PairSigner, OnlineClient, SubstrateConfig}; - -// #[subxt::subxt(runtime_metadata_path = "artifacts/devnet.scale")] -// pub mod devnet {} - -// pub mod client; - -// /// Subscribe to all events, and then manually look through them and -// /// pluck out the events that we care about. -// #[tokio::main] -// async fn main() -> Result<(), Box> { -// tracing_subscriber::fmt::init(); - -// // Create a client to use: -// let api = OnlineClient::::new().await?; - -// // Subscribe to any events that occur: -// let mut event_sub = api.events().subscribe().await?; - -// // While this subscription is active, balance transfers are made somewhere: -// tokio::task::spawn({ -// let api = api.clone(); -// async move { -// let signer = PairSigner::new(AccountKeyring::Alice.pair()); -// let mut transfer_amount = 1_000_000_000; - -// // Make small balance transfers from Alice to Bob in a loop: -// loop { -// let transfer_tx = devnet::tx() -// .balances() -// .transfer(AccountKeyring::Bob.to_account_id().into(), transfer_amount); -// api.tx() -// .sign_and_submit_default(&transfer_tx, &signer) -// .await -// .unwrap(); - -// tokio::time::sleep(Duration::from_secs(10)).await; -// transfer_amount += 100_000_000; -// } -// } -// }); - -// // Our subscription will see the events emitted as a result of this: -// while let Some(events) = event_sub.next().await { -// let events = events?; -// let block_hash = events.block_hash(); - -// // We can dynamically decode events: -// println!(" Dynamic event details: {block_hash:?}:"); -// for event in events.iter() { -// let event = event?; -// let is_balance_transfer = event -// .as_event::()? -// .is_some(); -// let pallet = event.pallet_name(); -// let variant = event.variant_name(); -// println!(" {pallet}::{variant} (is balance transfer? {is_balance_transfer})"); -// } - -// // Or we can find the first transfer event, ignoring any others: -// let transfer_event = events.find_first::()?; - -// if let Some(ev) = transfer_event { -// println!(" - Balance transfer success: value: {:?}", ev.amount); -// } else { -// println!(" - No balance transfer event found in this block"); -// } -// } - -// Ok(()) -// } - -pub mod client; -pub mod runtimes; - -use crate::runtimes::types::BlockNumber; -use crate::runtimes::types::Hash; -use client::{KeyPair, KeyType, Runtime}; - -#[tokio::main] -async fn main() -> Result<(), Box> { - // let phrase = "oyster orient plunge devote light wrap hold mother essence casino rebel distance"; - // let p = KeyPair::from_phrase(KeyType::Sr25519, phrase, None) - // .expect("failed to get key from phrase"); - - // let seed = "0x9917ea107aca8e9c29f4530413b41333ada03cf39fede45cde611b943e2e8dd1"; - // let _ = KeyPair::from_phrase(KeyType::Sr25519, seed, None); - - // let cl = client::Client::new( - // String::from("wss://tfchain.dev.grid.tf:443"), - // Runtime::Devnet, - // ) - // .await?; - - let cl = client::Client::new( - String::from("wss://tfchain.test.grid.tf:443"), - Runtime::Testnet, - ) - .await?; - - let twin = cl.get_twin_by_id(105, None).await?; - println!("got twin: {:?}", twin); - - // let twin = cl.get_twin_by_id(1, None).await?; - // println!("got twin: {:?}", twin); - - let farm = cl.get_farm_by_id(1, None).await?; - println!("got farm: {:?}", farm); - - // let block_1 = cl - // .get_block_hash(Some(BlockNumber::from(5808046 as u64))) - // .await?; - // let cl2 = - // client::Client::new(String::from("wss://tfchain.grid.tf:443"), Runtime::Testnet).await?; - // let node2 = cl2.get_node_by_id(1, block_1).await?; - // println!("got node: {:?}", node2); - - // println!("block 1 hash {:?}", block_1); - // let node = cl.get_node_by_id(1, block_1).await?; - // println!("got node: {:?}", node); - - // let account = "5HmARi4eGLhb9hvFrbCC5F8dCNRTS8MWKc6xbmPUS1cnKD7c" - // .parse::() - // .unwrap(); - - // let balance_at_block_1 = cl.get_balance(&account, block_1).await; - // println!("balance at block 1: {:?}", balance_at_block_1); - - // let balance = cl.get_balance(&account, None).await?; - // println!("balance at current block: {:?}", balance); - - // let _ = cl.get_contract_by_id(915).await?; - - // let node = cl.get_node_by_id(15).await?; - // println!("got node: {:?}", node); - - Ok(()) -} diff --git a/clients/tfchain_client_rs/src/runtimes/devnet.rs b/clients/tfchain_client_rs/src/runtimes/current.rs similarity index 51% rename from clients/tfchain_client_rs/src/runtimes/devnet.rs rename to clients/tfchain_client_rs/src/runtimes/current.rs index 2c877eef5..e5dbb3604 100644 --- a/clients/tfchain_client_rs/src/runtimes/devnet.rs +++ b/clients/tfchain_client_rs/src/runtimes/current.rs @@ -1,23 +1,28 @@ -#[subxt::subxt(runtime_metadata_path = "artifacts/devnet.scale")] -pub mod devnet { - #[subxt(substitute_type = "frame_support::storage::bounded_vec::BoundedVec")] - use ::sp_std::vec::Vec; -} -use super::types; -pub use devnet::runtime_types::frame_system::AccountInfo; -pub use devnet::runtime_types::pallet_balances::AccountData; -pub use devnet::runtime_types::pallet_smart_contract::types::Contract; -pub use devnet::runtime_types::pallet_tfgrid::{ +#[subxt::subxt( + runtime_metadata_path = "artifacts/current.scale", + substitute_type( + type = "frame_support::storage::bounded_vec::BoundedVec", + with = "::sp_std::vec::Vec" + ) +)] +pub mod current {} + +pub use current::runtime_types::frame_system::AccountInfo; +pub use current::runtime_types::pallet_balances::AccountData; +pub use current::runtime_types::pallet_smart_contract::types::Contract; +pub use current::runtime_types::pallet_tfgrid::{ farm::FarmName, interface::{InterfaceIp, InterfaceMac, InterfaceName}, node::{Location, SerialNumber}, types::Twin as TwinData, }; -use devnet::runtime_types::sp_core::bounded::bounded_vec::BoundedVec; -pub use devnet::runtime_types::tfchain_support::types::{ +use current::runtime_types::sp_core::bounded::bounded_vec::BoundedVec; +pub use current::runtime_types::tfchain_support::types::{ Farm as FarmData, Interface, Node as NodeData, PublicConfig, PublicIP as PublicIpData, }; -use subxt::ext::{sp_core::H256, sp_runtime::AccountId32}; +pub use subxt::ext::sp_core::H256; +pub use subxt::rpc::types::BlockNumber; +use subxt::utils::AccountId32; use subxt::Error; pub type Twin = TwinData; @@ -29,9 +34,9 @@ pub type Node = NodeData; use crate::client::{Client, KeyPair}; -pub use devnet::tft_bridge_module::events::BurnTransactionReady; -pub use devnet::tft_bridge_module::events::BurnTransactionSignatureAdded; -pub use devnet::tft_bridge_module::events::MintTransactionProposed; +pub use current::tft_bridge_module::events::BurnTransactionReady; +pub use current::tft_bridge_module::events::BurnTransactionSignatureAdded; +pub use current::tft_bridge_module::events::MintTransactionProposed; pub type SystemAccountInfo = AccountInfo>; @@ -41,7 +46,7 @@ pub async fn create_twin( relay: Option, pk: Option, ) -> Result { - let create_twin_tx = devnet::tx().tfgrid_module().create_twin( + let create_twin_tx = current::tx().tfgrid_module().create_twin( relay.map(|r| BoundedVec(r.as_bytes().to_vec())), pk.map(|r| BoundedVec(r.as_bytes().to_vec())), ); @@ -51,13 +56,13 @@ pub async fn create_twin( let create_twin = cl .api .tx() - .sign_and_submit_then_watch_default(&create_twin_tx, signer.as_ref()) + .sign_and_submit_then_watch_default(&create_twin_tx, &signer) .await? .wait_for_finalized_success() .await?; let twin_create_event = - create_twin.find_first::()?; + create_twin.find_first::()?; if let Some(event) = twin_create_event { Ok(event.0.id) @@ -72,7 +77,7 @@ pub async fn update_twin( relay: Option, pk: Option<&[u8]>, ) -> Result { - let update_twin_tx = devnet::tx().tfgrid_module().update_twin( + let update_twin_tx = current::tx().tfgrid_module().update_twin( relay.map(|r| BoundedVec(r.as_bytes().to_vec())), pk.map(|r| BoundedVec(r.to_vec())), ); @@ -82,13 +87,13 @@ pub async fn update_twin( let update_twin = cl .api .tx() - .sign_and_submit_then_watch_default(&update_twin_tx, signer.as_ref()) + .sign_and_submit_then_watch_default(&update_twin_tx, &signer) .await? .wait_for_finalized_success() .await?; let twin_create_event = - update_twin.find_first::()?; + update_twin.find_first::()?; if let Some(_) = twin_create_event { Ok(update_twin.block_hash()) @@ -103,7 +108,7 @@ pub async fn sign_terms_and_conditions( document_link: String, document_hash: String, ) -> Result { - let sign_tandc_tx = devnet::tx().tfgrid_module().user_accept_tc( + let sign_tandc_tx = current::tx().tfgrid_module().user_accept_tc( BoundedVec(document_link.as_bytes().to_vec()), BoundedVec(document_hash.as_bytes().to_vec()), ); @@ -113,7 +118,7 @@ pub async fn sign_terms_and_conditions( let sign_tandc = cl .api .tx() - .sign_and_submit_then_watch_default(&sign_tandc_tx, signer.as_ref()) + .sign_and_submit_then_watch_default(&sign_tandc_tx, &signer) .await? .wait_for_finalized_success() .await?; @@ -121,93 +126,78 @@ pub async fn sign_terms_and_conditions( Ok(sign_tandc.block_hash()) } -pub async fn get_twin_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { +pub async fn get_twin_by_id(cl: &Client, id: u32) -> Result, Error> { Ok(cl .api .storage() - .fetch(&devnet::storage().tfgrid_module().twins(id), at_block) + .at_latest() .await? - .map(types::Twin::from)) + .fetch(¤t::storage().tfgrid_module().twins(id)) + .await?) } pub async fn get_twin_id_by_account( cl: &Client, account: AccountId32, - at_block: Option, ) -> Result, Error> { cl.api .storage() + .at_latest() + .await? .fetch( - &devnet::storage() + ¤t::storage() .tfgrid_module() .twin_id_by_account_id(account), - at_block, ) .await } -pub async fn get_contract_by_id( - cl: &Client, - id: u64, - at_block: Option, -) -> Result, Error> { +pub async fn get_contract_by_id(cl: &Client, id: u64) -> Result, Error> { Ok(cl .api .storage() - .fetch( - &devnet::storage().smart_contract_module().contracts(id), - at_block, - ) + .at_latest() .await? - .map(types::Contract::from)) + .fetch(¤t::storage().smart_contract_module().contracts(id)) + .await?) } -pub async fn get_node_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { +pub async fn get_node_by_id(cl: &Client, id: u32) -> Result, Error> { Ok(cl .api .storage() - .fetch(&devnet::storage().tfgrid_module().nodes(id), at_block) + .at_latest() .await? - .map(types::TfgridNode::from)) + .fetch(¤t::storage().tfgrid_module().nodes(id)) + .await?) } -pub async fn get_farm_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { +pub async fn get_farm_by_id(cl: &Client, id: u32) -> Result, Error> { Ok(cl .api .storage() - .fetch(&devnet::storage().tfgrid_module().farms(id), at_block) + .at_latest() .await? - .map(types::TfgridFarm::from)) + .fetch(¤t::storage().tfgrid_module().farms(id)) + .await?) } pub async fn get_block_hash( cl: &Client, - block_number: Option, -) -> Result, Error> { + block_number: Option, +) -> Result, Error> { cl.api.rpc().block_hash(block_number).await } pub async fn get_balance( cl: &Client, account: &AccountId32, - at_block: Option, -) -> Result, Error> { +) -> Result, Error> { Ok(cl .api .storage() - .fetch(&devnet::storage().system().account(account), at_block) + .at_latest() .await? - .map(types::SystemAccountInfo::from)) + .fetch(¤t::storage().system().account(account)) + .await?) } diff --git a/clients/tfchain_client_rs/src/runtimes/local.rs b/clients/tfchain_client_rs/src/runtimes/local.rs deleted file mode 100644 index a3ac75175..000000000 --- a/clients/tfchain_client_rs/src/runtimes/local.rs +++ /dev/null @@ -1,216 +0,0 @@ -#[subxt::subxt(runtime_metadata_path = "artifacts/local.scale")] -pub mod local { - #[subxt(substitute_type = "frame_support::storage::bounded_vec::BoundedVec")] - use ::sp_std::vec::Vec; - #[subxt(substitute_type = "bounded::bounded::BoundedVec")] - use ::sp_std::vec::Vec; -} -use super::types; -pub use local::runtime_types::frame_system::AccountInfo; -pub use local::runtime_types::pallet_balances::AccountData; -pub use local::runtime_types::pallet_smart_contract::types::Contract; -pub use local::runtime_types::pallet_tfgrid::{ - farm::FarmName, - interface::{InterfaceIp, InterfaceMac, InterfaceName}, - node::{Location, SerialNumber}, - types::Twin as TwinData, -}; -pub use local::runtime_types::tfchain_support::types::{ - Farm as FarmData, Interface, Node as NodeData, PublicConfig, PublicIP as PublicIpData, -}; -use subxt::ext::{sp_core::H256, sp_runtime::AccountId32}; - -use subxt::Error; - -use local::runtime_types::sp_core::bounded::bounded_vec::BoundedVec; - -pub type Twin = TwinData; - -pub type Farm = FarmData; - -pub type InterfaceOf = Interface>; -pub type Node = NodeData; - -pub type SystemAccountInfo = AccountInfo>; - -use crate::client::{Client, KeyPair}; - -pub use local::tft_bridge_module::events::BurnTransactionReady; -pub use local::tft_bridge_module::events::BurnTransactionSignatureAdded; -pub use local::tft_bridge_module::events::MintTransactionProposed; - -pub async fn create_twin( - cl: &Client, - kp: &KeyPair, - relay: Option, - pk: Option, -) -> Result { - let create_twin_tx = local::tx().tfgrid_module().create_twin( - relay.map(|r| BoundedVec(r.as_bytes().to_vec())), - pk.map(|r| BoundedVec(r.as_bytes().to_vec())), - ); - - let signer = kp.signer(); - - let create_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&create_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = create_twin.find_first::()?; - - if let Some(event) = twin_create_event { - Ok(event.0.id) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn update_twin( - cl: &Client, - kp: &KeyPair, - relay: Option, - pk: Option<&[u8]>, -) -> Result { - let update_twin_tx = local::tx().tfgrid_module().update_twin( - relay.map(|r| BoundedVec(r.as_bytes().to_vec())), - pk.map(|r| BoundedVec(r.to_vec())), - ); - - let signer = kp.signer(); - - let update_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&update_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = - update_twin.find_first::()?; - - if let Some(_) = twin_create_event { - Ok(update_twin.block_hash()) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn sign_terms_and_conditions( - cl: &Client, - kp: &KeyPair, - document_link: String, - document_hash: String, -) -> Result { - let sign_tandc_tx = local::tx().tfgrid_module().user_accept_tc( - BoundedVec(document_link.as_bytes().to_vec()), - BoundedVec(document_hash.as_bytes().to_vec()), - ); - - let signer = kp.signer(); - - let sign_tandc = cl - .api - .tx() - .sign_and_submit_then_watch_default(&sign_tandc_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - Ok(sign_tandc.block_hash()) -} - -pub async fn get_twin_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&local::storage().tfgrid_module().twins(id), at_block) - .await? - .map(types::Twin::from)) -} - -pub async fn get_twin_id_by_account( - cl: &Client, - account: AccountId32, - at_block: Option, -) -> Result, Error> { - cl.api - .storage() - .fetch( - &local::storage() - .tfgrid_module() - .twin_id_by_account_id(account), - at_block, - ) - .await -} - -pub async fn get_contract_by_id( - cl: &Client, - id: u64, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch( - &local::storage().smart_contract_module().contracts(id), - at_block, - ) - .await? - .map(types::Contract::from)) -} - -pub async fn get_node_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&local::storage().tfgrid_module().nodes(id), at_block) - .await? - .map(types::TfgridNode::from)) -} - -pub async fn get_farm_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&local::storage().tfgrid_module().farms(id), at_block) - .await? - .map(types::TfgridFarm::from)) -} - -pub async fn get_block_hash( - cl: &Client, - block_number: Option, -) -> Result, Error> { - cl.api.rpc().block_hash(block_number).await -} - -pub async fn get_balance( - cl: &Client, - account: &AccountId32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&local::storage().system().account(account), at_block) - .await? - .map(types::SystemAccountInfo::from)) -} diff --git a/clients/tfchain_client_rs/src/runtimes/mainnet.rs b/clients/tfchain_client_rs/src/runtimes/mainnet.rs deleted file mode 100644 index 765ae1fd1..000000000 --- a/clients/tfchain_client_rs/src/runtimes/mainnet.rs +++ /dev/null @@ -1,219 +0,0 @@ -#[subxt::subxt(runtime_metadata_path = "artifacts/mainnet.scale")] -pub mod mainnet { - #[subxt(substitute_type = "frame_support::storage::bounded_vec::BoundedVec")] - use ::sp_std::vec::Vec; -} -use super::types; -pub use mainnet::runtime_types::frame_system::AccountInfo; -pub use mainnet::runtime_types::pallet_balances::AccountData; -pub use mainnet::runtime_types::pallet_smart_contract::types::Contract; -pub use mainnet::runtime_types::pallet_tfgrid::{ - farm::FarmName, - interface::{InterfaceIp, InterfaceMac, InterfaceName}, - node::{Location, SerialNumber}, - twin::TwinIp, - types::Twin as TwinData, -}; -use mainnet::runtime_types::sp_core::bounded::bounded_vec::BoundedVec; -pub use mainnet::runtime_types::tfchain_support::types::{ - Farm as FarmData, Interface, Node as NodeData, PublicConfig, PublicIP as PublicIpData, -}; -use subxt::ext::{sp_core::H256, sp_runtime::AccountId32}; - -use subxt::Error; - -pub type Twin = TwinData; - -pub type Farm = FarmData; - -pub type InterfaceOf = Interface>; -pub type Node = NodeData; - -use crate::client::{Client, KeyPair}; - -pub use mainnet::tft_bridge_module::events::BurnTransactionReady; -pub use mainnet::tft_bridge_module::events::BurnTransactionSignatureAdded; -pub use mainnet::tft_bridge_module::events::MintTransactionProposed; - -pub type SystemAccountInfo = AccountInfo>; - -pub async fn create_twin( - cl: &Client, - kp: &KeyPair, - ip: Option, - _pk: Option, -) -> Result { - let ip = match ip { - Some(ip) => BoundedVec(ip.as_bytes().to_vec()), - None => BoundedVec(vec![]), - }; - - let create_twin_tx = mainnet::tx().tfgrid_module().create_twin(ip); - - let signer = kp.signer(); - - let create_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&create_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = - create_twin.find_first::()?; - - if let Some(event) = twin_create_event { - Ok(event.0.id) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn update_twin( - cl: &Client, - kp: &KeyPair, - ip: Option, - _pk: Option<&[u8]>, -) -> Result { - let ip = match ip { - Some(ip) => BoundedVec(ip.as_bytes().to_vec()), - None => BoundedVec(vec![]), - }; - - let update_twin_tx = mainnet::tx().tfgrid_module().update_twin(ip); - - let signer = kp.signer(); - - let update_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&update_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = - update_twin.find_first::()?; - - if let Some(_) = twin_create_event { - Ok(update_twin.block_hash()) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn sign_terms_and_conditions( - cl: &Client, - kp: &KeyPair, - document_link: String, - document_hash: String, -) -> Result { - let sign_tandc_tx = mainnet::tx().tfgrid_module().user_accept_tc( - BoundedVec(document_link.as_bytes().to_vec()), - BoundedVec(document_hash.as_bytes().to_vec()), - ); - - let signer = kp.signer(); - - let sign_tandc = cl - .api - .tx() - .sign_and_submit_then_watch_default(&sign_tandc_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - Ok(sign_tandc.block_hash()) -} - -pub async fn get_twin_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&mainnet::storage().tfgrid_module().twins(id), at_block) - .await? - .map(types::Twin::from)) -} - -pub async fn get_twin_id_by_account( - cl: &Client, - account: AccountId32, - at_block: Option, -) -> Result, Error> { - cl.api - .storage() - .fetch( - &mainnet::storage() - .tfgrid_module() - .twin_id_by_account_id(account), - at_block, - ) - .await -} - -pub async fn get_contract_by_id( - cl: &Client, - id: u64, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch( - &mainnet::storage().smart_contract_module().contracts(id), - at_block, - ) - .await? - .map(types::Contract::from)) -} - -pub async fn get_node_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&mainnet::storage().tfgrid_module().nodes(id), at_block) - .await? - .map(types::TfgridNode::from)) -} - -pub async fn get_farm_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&mainnet::storage().tfgrid_module().farms(id), at_block) - .await? - .map(types::TfgridFarm::from)) -} - -pub async fn get_block_hash( - cl: &Client, - block_number: Option, -) -> Result, Error> { - cl.api.rpc().block_hash(block_number).await -} - -pub async fn get_balance( - cl: &Client, - account: &AccountId32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&mainnet::storage().system().account(account), at_block) - .await? - .map(|t| types::SystemAccountInfo::from(t))) -} diff --git a/clients/tfchain_client_rs/src/runtimes/mod.rs b/clients/tfchain_client_rs/src/runtimes/mod.rs index 2ce94e6df..efcfceb63 100644 --- a/clients/tfchain_client_rs/src/runtimes/mod.rs +++ b/clients/tfchain_client_rs/src/runtimes/mod.rs @@ -1,7 +1,3 @@ #![allow(clippy::all)] -pub mod devnet; -pub mod local; -pub mod mainnet; -pub mod testnet; -pub mod types; +pub mod current; diff --git a/clients/tfchain_client_rs/src/runtimes/testnet.rs b/clients/tfchain_client_rs/src/runtimes/testnet.rs deleted file mode 100644 index e88c1757b..000000000 --- a/clients/tfchain_client_rs/src/runtimes/testnet.rs +++ /dev/null @@ -1,217 +0,0 @@ -#[subxt::subxt(runtime_metadata_path = "artifacts/testnet.scale")] -pub mod testnet { - #[subxt(substitute_type = "frame_support::storage::bounded_vec::BoundedVec")] - use ::sp_std::vec::Vec; -} -use super::types; -use subxt::ext::{sp_core::H256, sp_runtime::AccountId32}; -use subxt::Error; -pub use testnet::runtime_types::frame_system::AccountInfo; -pub use testnet::runtime_types::pallet_balances::AccountData; -pub use testnet::runtime_types::pallet_smart_contract::types::Contract; -pub use testnet::runtime_types::pallet_tfgrid::{ - farm::FarmName, - interface::{InterfaceIp, InterfaceMac, InterfaceName}, - node::{Location, SerialNumber}, - twin::TwinIp, - types::Twin as TwinData, -}; -use testnet::runtime_types::sp_core::bounded::bounded_vec::BoundedVec; - -pub use testnet::runtime_types::tfchain_support::types::{ - Farm as FarmData, Interface, Node as NodeData, PublicConfig, PublicIP as PublicIpData, -}; - -pub type Twin = TwinData; - -pub type Farm = FarmData; - -pub type InterfaceOf = Interface>; -pub type Node = NodeData; - -use crate::client::{Client, KeyPair}; - -pub use testnet::tft_bridge_module::events::BurnTransactionReady; -pub use testnet::tft_bridge_module::events::BurnTransactionSignatureAdded; -pub use testnet::tft_bridge_module::events::MintTransactionProposed; - -pub type SystemAccountInfo = AccountInfo>; - -pub async fn create_twin( - cl: &Client, - kp: &KeyPair, - ip: Option, - _pk: Option, -) -> Result { - let ip = match ip { - Some(ip) => BoundedVec(ip.as_bytes().to_vec()), - None => BoundedVec(vec![]), - }; - let create_twin_tx = testnet::tx().tfgrid_module().create_twin(ip); - - let signer = kp.signer(); - - let create_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&create_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = - create_twin.find_first::()?; - - if let Some(event) = twin_create_event { - Ok(event.0.id) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn update_twin( - cl: &Client, - kp: &KeyPair, - ip: Option, - _pk: Option<&[u8]>, -) -> Result { - let ip = match ip { - Some(ip) => BoundedVec(ip.as_bytes().to_vec()), - None => BoundedVec(vec![]), - }; - let update_twin_tx = testnet::tx().tfgrid_module().update_twin(ip); - - let signer = kp.signer(); - - let update_twin = cl - .api - .tx() - .sign_and_submit_then_watch_default(&update_twin_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - let twin_create_event = - update_twin.find_first::()?; - - if let Some(_) = twin_create_event { - Ok(update_twin.block_hash()) - } else { - Err(Error::Other(String::from("failed to create twin"))) - } -} - -pub async fn sign_terms_and_conditions( - cl: &Client, - kp: &KeyPair, - document_link: String, - document_hash: String, -) -> Result { - let sign_tandc_tx = testnet::tx().tfgrid_module().user_accept_tc( - BoundedVec(document_link.as_bytes().to_vec()), - BoundedVec(document_hash.as_bytes().to_vec()), - ); - - let signer = kp.signer(); - - let sign_tandc = cl - .api - .tx() - .sign_and_submit_then_watch_default(&sign_tandc_tx, signer.as_ref()) - .await? - .wait_for_finalized_success() - .await?; - - Ok(sign_tandc.block_hash()) -} - -pub async fn get_twin_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&testnet::storage().tfgrid_module().twins(id), at_block) - .await? - .map(types::Twin::from)) -} - -pub async fn get_twin_id_by_account( - cl: &Client, - account: AccountId32, - at_block: Option, -) -> Result, Error> { - cl.api - .storage() - .fetch( - &testnet::storage() - .tfgrid_module() - .twin_id_by_account_id(account), - at_block, - ) - .await -} - -pub async fn get_contract_by_id( - cl: &Client, - id: u64, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch( - &testnet::storage().smart_contract_module().contracts(id), - at_block, - ) - .await? - .map(types::Contract::from)) -} - -pub async fn get_node_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&testnet::storage().tfgrid_module().nodes(id), at_block) - .await? - .map(types::TfgridNode::from)) -} - -pub async fn get_farm_by_id( - cl: &Client, - id: u32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&testnet::storage().tfgrid_module().farms(id), at_block) - .await? - .map(types::TfgridFarm::from)) -} - -pub async fn get_block_hash( - cl: &Client, - block_number: Option, -) -> Result, Error> { - cl.api.rpc().block_hash(block_number).await -} - -pub async fn get_balance( - cl: &Client, - account: &AccountId32, - at_block: Option, -) -> Result, Error> { - Ok(cl - .api - .storage() - .fetch(&testnet::storage().system().account(account), at_block) - .await? - .map(types::SystemAccountInfo::from)) -} diff --git a/clients/tfchain_client_rs/src/runtimes/types.rs b/clients/tfchain_client_rs/src/runtimes/types.rs deleted file mode 100644 index 433cf152c..000000000 --- a/clients/tfchain_client_rs/src/runtimes/types.rs +++ /dev/null @@ -1,1169 +0,0 @@ -use serde::{Deserialize, Serialize}; -use subxt::{ext::sp_runtime::AccountId32, Config, PolkadotConfig}; - -use frame_system::AccountInfo; -use pallet_balances::AccountData; - -use super::local::local::runtime_types::pallet_tfgrid::types::EntityProof as LocalEntityProof; -use super::local::local::runtime_types::tfchain_support::types::{ - FarmCertification as LocalFarmCertification, NodeCertification as LocalNodeCertification, -}; -use super::local::{ - Contract as LocalContract, Farm as LocalFarm, Node as LocalNode, - SystemAccountInfo as LocalSystemAccountInfo, Twin as LocalTwin, -}; - -use super::devnet::devnet::runtime_types::pallet_tfgrid::types::EntityProof as DevnetEntityProof; -use super::devnet::devnet::runtime_types::tfchain_support::types::{ - FarmCertification as DevnetFarmCertification, NodeCertification as DevnetNodeCertification, -}; -use super::devnet::{ - Contract as DevnetContract, Farm as DevnetFarm, Node as DevnetNode, - SystemAccountInfo as DevnetSystemAccountInfo, Twin as DevnetTwin, -}; - -use super::mainnet::mainnet::runtime_types::pallet_tfgrid::types::EntityProof as MainnetEntityProof; -use super::mainnet::mainnet::runtime_types::tfchain_support::types::{ - FarmCertification as MainnetFarmCertification, NodeCertification as MainnetNodeCertification, -}; -use super::mainnet::{ - Contract as MainnetContract, Farm as MainnetFarm, Node as MainnetNode, - SystemAccountInfo as MainnetSystemAccountInfo, Twin as MainnetTwin, -}; - -use super::testnet::testnet::runtime_types::pallet_tfgrid::types::EntityProof as TestnetEntityProof; -use super::testnet::testnet::runtime_types::tfchain_support::types::{ - FarmCertification as TestnetFarmCertification, NodeCertification as TestnetNodeCertification, -}; -use super::testnet::{ - Contract as TestnetContract, Farm as TestnetFarm, Node as TestnetNode, - SystemAccountInfo as TestnetSystemAccountInfo, Twin as TestnetTwin, -}; - -pub type Hash = ::Hash; -pub type BlockNumber = subxt::rpc::BlockNumber; - -#[macro_export] -macro_rules! parse_vec_u8 { - ($input:expr) => { - String::from_utf8($input).expect("invalid utf8") - }; -} - -#[derive(Debug, Clone)] -pub enum FarmCertification { - NotCertified, - Gold, -} - -#[derive(Debug, Clone)] -pub struct TfgridFarm { - pub version: u32, - pub id: u32, - pub name: String, - pub twin_id: u32, - pub pricing_policy_id: u32, - pub certification: FarmCertification, - pub dedicated_farm: bool, - pub farming_policy_limits: Option, - pub public_ips: Vec, -} - -#[derive(Debug, Clone)] -pub struct TfgridNode { - pub version: u32, - pub id: u32, - pub farm_id: u32, - pub twin_id: u32, - pub resources: ConsumableResources, - pub location: Location, - pub power: Power, - pub public_config: Option, - pub created: u64, - pub farming_policy_id: u32, - pub interfaces: Vec, - pub certification: NodeCertification, - pub secure_boot: bool, - pub serial_number: Option, - pub connection_price: u32, -} - -#[derive(Debug, Clone, Default)] -pub struct ConsumableResources { - pub total_resources: Resources, - pub used_resources: Resources, -} - -#[derive(Debug, Clone, Default)] -pub struct Resources { - pub hru: u64, - pub sru: u64, - pub cru: u64, - pub mru: u64, -} - -#[derive(Debug, Clone)] -pub struct Location { - pub city: String, - pub country: String, - pub latitude: String, - pub longitude: String, -} - -#[derive(Debug, Clone)] -pub struct IP { - pub ip: String, - pub gw: String, -} - -#[derive(Debug, Clone)] -pub struct PublicConfig { - pub ip4: IP, - pub ip6: Option, - pub domain: Option, -} - -#[derive(Debug, Clone)] -pub struct Power { - pub target: PowerTarget, - pub state: PowerState, - pub last_uptime: u64, -} - -#[derive(Debug, Clone)] -pub enum PowerTarget { - Up, - Down, -} - -#[derive(Debug, Clone)] -pub enum PowerState { - Up, - Down(u32), -} - -#[derive(Debug, Clone)] -pub enum NodeCertification { - Diy, - Certified, -} - -#[derive(Debug, Clone)] -pub struct Interface { - pub name: String, - pub mac: String, - pub ips: Vec, -} - -#[derive(Debug, Clone)] -pub struct FarmPublicIP { - pub ip: String, - pub gateway: String, - pub contract_id: u64, -} - -#[derive(Debug, Clone)] -pub struct FarmingPolicyLimit { - pub farming_policy_id: u32, - pub cu: Option, - pub su: Option, - pub end: Option, - pub node_count: Option, - pub node_certification: bool, -} - -#[derive(Debug, Clone, Default)] -pub struct Contract { - pub version: u32, - pub state: ContractState, - pub contract_id: u64, - pub twin_id: u32, - pub contract_type: ContractData, - pub solution_provider_id: Option, -} - -#[derive(Debug, Clone)] -pub enum ContractState { - Created, - Deleted(Cause), - GracePeriod(u32), -} - -#[derive(Debug, Clone)] -pub enum Cause { - CanceledByUser, - OutOfFunds, -} - -impl Default for ContractState { - fn default() -> ContractState { - ContractState::Created - } -} - -// HexHash is hex encoded hash -pub type HexHash = [u8; 32]; - -#[derive(Debug, Clone, Default)] -pub struct NodeContract { - pub node_id: u32, - // Hash of the deployment, set by the user - // Max 32 bytes - pub deployment_hash: HexHash, - pub deployment_data: String, - pub public_ips: u32, - pub public_ips_list: Vec, -} - -#[derive(Debug, Clone, Default)] -pub struct NameContract { - pub name: String, -} - -#[derive(Debug, Clone, Default)] -pub struct RentContract { - pub node_id: u32, -} - -#[derive(Debug, Clone)] -pub enum ContractData { - NodeContract(NodeContract), - NameContract(NameContract), - RentContract(RentContract), -} - -impl Default for ContractData { - fn default() -> ContractData { - ContractData::RentContract(RentContract::default()) - } -} - -impl From for Contract { - fn from(contract: LocalContract) -> Self { - let mut ctr = Contract { - version: contract.version, - contract_id: contract.contract_id, - twin_id: contract.twin_id, - state: ContractState::Created, - solution_provider_id: contract.solution_provider_id, - contract_type: ContractData::default(), - }; - - match contract.contract_type { - super::local::local::runtime_types::pallet_smart_contract::types::ContractData::NodeContract(nc) => { - - ctr.contract_type = ContractData::NodeContract(NodeContract{ - node_id: nc.node_id, - deployment_data: parse_vec_u8!(nc.deployment_data.0), - deployment_hash: nc.deployment_hash.into(), - public_ips: nc.public_ips, - public_ips_list: nc.public_ips_list.0.iter().map(|ip| IP { - ip: parse_vec_u8!(ip.ip.0.clone()), - gw: parse_vec_u8!(ip.gateway.0.clone()) - }).collect() - }); - }, - super::local::local::runtime_types::pallet_smart_contract::types::ContractData::NameContract(nmc) => { - ctr.contract_type = ContractData::NameContract(NameContract{ name: parse_vec_u8!(nmc.name.0.0) }) - }, - super::local::local::runtime_types::pallet_smart_contract::types::ContractData::RentContract(rc) => { - ctr.contract_type = ContractData::RentContract(RentContract { node_id: rc.node_id }) - } - } - - match contract.state { - super::local::local::runtime_types::pallet_smart_contract::types::ContractState::Created => { - ctr.state = ContractState::Created - }, - super::local::local::runtime_types::pallet_smart_contract::types::ContractState::GracePeriod(block) => { - ctr.state = ContractState::GracePeriod(block as u32) - }, - _ => () - }; - - ctr - } -} - -impl From for Contract { - fn from(contract: DevnetContract) -> Self { - let mut ctr = Contract { - version: contract.version, - contract_id: contract.contract_id, - twin_id: contract.twin_id, - state: ContractState::Created, - solution_provider_id: contract.solution_provider_id, - contract_type: ContractData::default(), - }; - - match contract.contract_type { - super::devnet::devnet::runtime_types::pallet_smart_contract::types::ContractData::NodeContract(nc) => { - - ctr.contract_type = ContractData::NodeContract(NodeContract{ - node_id: nc.node_id, - deployment_data: parse_vec_u8!(nc.deployment_data.0), - deployment_hash: nc.deployment_hash.into(), - public_ips: nc.public_ips, - public_ips_list: nc.public_ips_list.0.iter().map(|ip| IP { - ip: parse_vec_u8!(ip.ip.0.clone()), - gw: parse_vec_u8!(ip.gateway.0.clone()) - }).collect() - }); - }, - super::devnet::devnet::runtime_types::pallet_smart_contract::types::ContractData::NameContract(nmc) => { - ctr.contract_type = ContractData::NameContract(NameContract{ name: parse_vec_u8!(nmc.name.0.0) }) - }, - super::devnet::devnet::runtime_types::pallet_smart_contract::types::ContractData::RentContract(rc) => { - ctr.contract_type = ContractData::RentContract(RentContract { node_id: rc.node_id }) - } - } - - match contract.state { - super::devnet::devnet::runtime_types::pallet_smart_contract::types::ContractState::Created => { - ctr.state = ContractState::Created - }, - super::devnet::devnet::runtime_types::pallet_smart_contract::types::ContractState::GracePeriod(block) => { - ctr.state = ContractState::GracePeriod(block as u32) - }, - _ => () - }; - - ctr - } -} - -impl From for Contract { - fn from(contract: TestnetContract) -> Self { - let mut ctr = Contract { - version: contract.version, - contract_id: contract.contract_id, - twin_id: contract.twin_id, - state: ContractState::Created, - solution_provider_id: contract.solution_provider_id, - contract_type: ContractData::default(), - }; - - match contract.contract_type { - super::testnet::testnet::runtime_types::pallet_smart_contract::types::ContractData::NodeContract(nc) => { - - ctr.contract_type = ContractData::NodeContract(NodeContract{ - node_id: nc.node_id, - deployment_data: parse_vec_u8!(nc.deployment_data.0), - deployment_hash: nc.deployment_hash.into(), - public_ips: nc.public_ips, - public_ips_list: nc.public_ips_list.0.iter().map(|ip| IP { - ip: parse_vec_u8!(ip.ip.0.clone()), - gw: parse_vec_u8!(ip.gateway.0.clone()) - }).collect() - }); - }, - super::testnet::testnet::runtime_types::pallet_smart_contract::types::ContractData::NameContract(nmc) => { - ctr.contract_type = ContractData::NameContract(NameContract{ name: parse_vec_u8!(nmc.name.0.0) }) - }, - super::testnet::testnet::runtime_types::pallet_smart_contract::types::ContractData::RentContract(rc) => { - ctr.contract_type = ContractData::RentContract(RentContract { node_id: rc.node_id }) - } - } - - match contract.state { - super::testnet::testnet::runtime_types::pallet_smart_contract::types::ContractState::Created => { - ctr.state = ContractState::Created - }, - super::testnet::testnet::runtime_types::pallet_smart_contract::types::ContractState::GracePeriod(block) => { - ctr.state = ContractState::GracePeriod(block as u32) - }, - _ => () - }; - - ctr - } -} - -impl From for Contract { - fn from(contract: MainnetContract) -> Self { - let mut ctr = Contract { - version: contract.version, - contract_id: contract.contract_id, - twin_id: contract.twin_id, - state: ContractState::Created, - solution_provider_id: contract.solution_provider_id, - contract_type: ContractData::default(), - }; - - match contract.contract_type { - super::mainnet::mainnet::runtime_types::pallet_smart_contract::types::ContractData::NodeContract(nc) => { - - ctr.contract_type = ContractData::NodeContract(NodeContract{ - node_id: nc.node_id, - deployment_data: parse_vec_u8!(nc.deployment_data.0), - deployment_hash: nc.deployment_hash.into(), - public_ips: nc.public_ips, - public_ips_list: nc.public_ips_list.0.iter().map(|ip| IP { - ip: parse_vec_u8!(ip.ip.0.clone()), - gw: parse_vec_u8!(ip.gateway.0.clone()) - }).collect() - }); - }, - super::mainnet::mainnet::runtime_types::pallet_smart_contract::types::ContractData::NameContract(nmc) => { - ctr.contract_type = ContractData::NameContract(NameContract{ name: parse_vec_u8!(nmc.name.0.0) }) - }, - super::mainnet::mainnet::runtime_types::pallet_smart_contract::types::ContractData::RentContract(rc) => { - ctr.contract_type = ContractData::RentContract(RentContract { node_id: rc.node_id }) - } - } - - match contract.state { - super::mainnet::mainnet::runtime_types::pallet_smart_contract::types::ContractState::Created => { - ctr.state = ContractState::Created - }, - super::mainnet::mainnet::runtime_types::pallet_smart_contract::types::ContractState::GracePeriod(block) => { - ctr.state = ContractState::GracePeriod(block as u32) - }, - _ => () - }; - - ctr - } -} - -impl From for TfgridFarm { - fn from(farm: MainnetFarm) -> Self { - let farm_name = parse_vec_u8!(farm.name.0 .0); - - let limit: Option = match farm.farming_policy_limits { - Some(lim) => Some(FarmingPolicyLimit { - cu: lim.cu, - su: lim.su, - end: lim.end, - farming_policy_id: lim.farming_policy_id, - node_certification: lim.node_certification, - node_count: lim.node_count, - }), - None => None, - }; - - let mut public_ips = vec![]; - for ip in farm.public_ips.0 { - public_ips.push(FarmPublicIP { - ip: parse_vec_u8!(ip.ip.0), - gateway: parse_vec_u8!(ip.gateway.0), - contract_id: ip.contract_id, - }) - } - - let farm_certification: FarmCertification = match farm.certification { - MainnetFarmCertification::Gold => FarmCertification::Gold, - MainnetFarmCertification::NotCertified => FarmCertification::NotCertified, - }; - - TfgridFarm { - version: farm.version, - id: farm.id, - name: farm_name, - twin_id: farm.twin_id, - pricing_policy_id: farm.pricing_policy_id, - certification: farm_certification, - dedicated_farm: farm.dedicated_farm, - farming_policy_limits: limit, - public_ips, - } - } -} - -impl From for TfgridFarm { - fn from(farm: TestnetFarm) -> Self { - let farm_name = parse_vec_u8!(farm.name.0 .0); - - let limit: Option = match farm.farming_policy_limits { - Some(lim) => Some(FarmingPolicyLimit { - cu: lim.cu, - su: lim.su, - end: lim.end, - farming_policy_id: lim.farming_policy_id, - node_certification: lim.node_certification, - node_count: lim.node_count, - }), - None => None, - }; - - let mut public_ips = vec![]; - for ip in farm.public_ips.0 { - public_ips.push(FarmPublicIP { - ip: parse_vec_u8!(ip.ip.0), - gateway: parse_vec_u8!(ip.gateway.0), - contract_id: ip.contract_id, - }) - } - - let farm_certification: FarmCertification = match farm.certification { - TestnetFarmCertification::Gold => FarmCertification::Gold, - TestnetFarmCertification::NotCertified => FarmCertification::NotCertified, - }; - - TfgridFarm { - version: farm.version, - id: farm.id, - name: farm_name, - twin_id: farm.twin_id, - pricing_policy_id: farm.pricing_policy_id, - certification: farm_certification, - dedicated_farm: farm.dedicated_farm, - farming_policy_limits: limit, - public_ips, - } - } -} - -impl From for TfgridFarm { - fn from(farm: DevnetFarm) -> Self { - let farm_name = parse_vec_u8!(farm.name.0 .0); - - let limit: Option = match farm.farming_policy_limits { - Some(lim) => Some(FarmingPolicyLimit { - cu: lim.cu, - su: lim.su, - end: lim.end, - farming_policy_id: lim.farming_policy_id, - node_certification: lim.node_certification, - node_count: lim.node_count, - }), - None => None, - }; - - let mut public_ips = vec![]; - for ip in farm.public_ips.0 { - public_ips.push(FarmPublicIP { - ip: parse_vec_u8!(ip.ip.0), - gateway: parse_vec_u8!(ip.gateway.0), - contract_id: ip.contract_id, - }) - } - - let farm_certification: FarmCertification = match farm.certification { - DevnetFarmCertification::Gold => FarmCertification::Gold, - DevnetFarmCertification::NotCertified => FarmCertification::NotCertified, - }; - - TfgridFarm { - version: farm.version, - id: farm.id, - name: farm_name, - twin_id: farm.twin_id, - pricing_policy_id: farm.pricing_policy_id, - certification: farm_certification, - dedicated_farm: farm.dedicated_farm, - farming_policy_limits: limit, - public_ips, - } - } -} - -impl From for TfgridFarm { - fn from(farm: LocalFarm) -> Self { - let farm_name = parse_vec_u8!(farm.name.0 .0); - - let limit: Option = match farm.farming_policy_limits { - Some(lim) => Some(FarmingPolicyLimit { - cu: lim.cu, - su: lim.su, - end: lim.end, - farming_policy_id: lim.farming_policy_id, - node_certification: lim.node_certification, - node_count: lim.node_count, - }), - None => None, - }; - - let mut public_ips = vec![]; - for ip in farm.public_ips.0 { - public_ips.push(FarmPublicIP { - ip: parse_vec_u8!(ip.ip.0), - gateway: parse_vec_u8!(ip.gateway.0), - contract_id: ip.contract_id, - }) - } - - let farm_certification: FarmCertification = match farm.certification { - LocalFarmCertification::Gold => FarmCertification::Gold, - LocalFarmCertification::NotCertified => FarmCertification::NotCertified, - }; - - TfgridFarm { - version: farm.version, - id: farm.id, - name: farm_name, - twin_id: farm.twin_id, - pricing_policy_id: farm.pricing_policy_id, - certification: farm_certification, - dedicated_farm: farm.dedicated_farm, - farming_policy_limits: limit, - public_ips, - } - } -} - -impl From for TfgridNode { - fn from(node: LocalNode) -> Self { - let mut resources = ConsumableResources::default(); - resources.total_resources.cru = node.resources.cru; - resources.total_resources.hru = node.resources.hru; - resources.total_resources.mru = node.resources.mru; - resources.total_resources.sru = node.resources.sru; - - let location = Location { - city: parse_vec_u8!(node.location.city.0 .0), - country: parse_vec_u8!(node.location.country.0 .0), - latitude: parse_vec_u8!(node.location.latitude.0), - longitude: parse_vec_u8!(node.location.longitude.0), - }; - - let public_config = match node.public_config { - Some(config) => { - let mut pub_conf = PublicConfig { - ip4: IP { - ip: parse_vec_u8!(config.ip4.ip.0), - gw: parse_vec_u8!(config.ip4.gw.0), - }, - ip6: None, - domain: None, - }; - - pub_conf.ip6 = match config.ip6 { - Some(conf6) => Some(IP { - ip: parse_vec_u8!(conf6.ip.0), - gw: parse_vec_u8!(conf6.gw.0), - }), - None => None, - }; - - pub_conf.domain = match config.domain { - Some(domain) => Some(parse_vec_u8!(domain.0)), - None => None, - }; - - Some(pub_conf) - } - None => None, - }; - - let interfaces = node - .interfaces - .into_iter() - .map(|intf| { - let ips = intf - .ips - .0 - .into_iter() - .map(|ip| parse_vec_u8!(ip.0 .0)) - .collect(); - Interface { - name: parse_vec_u8!(intf.name.0 .0), - mac: parse_vec_u8!(intf.mac.0 .0), - ips, - } - }) - .collect(); - - let certification = match node.certification { - LocalNodeCertification::Certified => NodeCertification::Certified, - LocalNodeCertification::Diy => NodeCertification::Diy, - }; - - let serial_number = match node.serial_number { - Some(s) => Some(parse_vec_u8!(s.0 .0)), - None => None, - }; - - TfgridNode { - version: node.version, - id: node.id, - farm_id: node.farm_id, - twin_id: node.twin_id, - resources, - location, - power: Power { - target: PowerTarget::Up, - state: PowerState::Up, - last_uptime: 0, - }, - public_config, - created: node.created, - farming_policy_id: node.farming_policy_id, - interfaces, - certification, - secure_boot: node.secure_boot, - serial_number, - connection_price: node.connection_price, - } - } -} - -impl From for TfgridNode { - fn from(node: DevnetNode) -> Self { - let mut resources = ConsumableResources::default(); - resources.total_resources.cru = node.resources.cru; - resources.total_resources.hru = node.resources.hru; - resources.total_resources.mru = node.resources.mru; - resources.total_resources.sru = node.resources.sru; - - let location = Location { - city: parse_vec_u8!(node.location.city.0 .0), - country: parse_vec_u8!(node.location.country.0 .0), - latitude: parse_vec_u8!(node.location.latitude.0), - longitude: parse_vec_u8!(node.location.longitude.0), - }; - - let public_config = match node.public_config { - Some(config) => { - let mut pub_conf = PublicConfig { - ip4: IP { - ip: parse_vec_u8!(config.ip4.ip.0), - gw: parse_vec_u8!(config.ip4.gw.0), - }, - ip6: None, - domain: None, - }; - - pub_conf.ip6 = match config.ip6 { - Some(conf6) => Some(IP { - ip: parse_vec_u8!(conf6.ip.0), - gw: parse_vec_u8!(conf6.gw.0), - }), - None => None, - }; - - pub_conf.domain = match config.domain { - Some(domain) => Some(parse_vec_u8!(domain.0)), - None => None, - }; - - Some(pub_conf) - } - None => None, - }; - - let interfaces = node - .interfaces - .into_iter() - .map(|intf| { - let ips = intf - .ips - .0 - .into_iter() - .map(|ip| parse_vec_u8!(ip.0 .0)) - .collect(); - Interface { - name: parse_vec_u8!(intf.name.0 .0), - mac: parse_vec_u8!(intf.mac.0 .0), - ips, - } - }) - .collect(); - - let certification = match node.certification { - DevnetNodeCertification::Certified => NodeCertification::Certified, - DevnetNodeCertification::Diy => NodeCertification::Diy, - }; - - let serial_number = match node.serial_number { - Some(s) => Some(parse_vec_u8!(s.0 .0)), - None => None, - }; - - TfgridNode { - version: node.version, - id: node.id, - farm_id: node.farm_id, - twin_id: node.twin_id, - resources, - location, - power: Power { - target: PowerTarget::Up, - state: PowerState::Up, - last_uptime: 0, - }, - public_config, - created: node.created, - farming_policy_id: node.farming_policy_id, - interfaces, - certification, - secure_boot: node.secure_boot, - serial_number, - connection_price: node.connection_price, - } - } -} - -impl From for TfgridNode { - fn from(node: TestnetNode) -> Self { - let mut resources = ConsumableResources::default(); - resources.total_resources.cru = node.resources.cru; - resources.total_resources.hru = node.resources.hru; - resources.total_resources.mru = node.resources.mru; - resources.total_resources.sru = node.resources.sru; - - let location = Location { - city: parse_vec_u8!(node.location.city.0 .0), - country: parse_vec_u8!(node.location.country.0 .0), - latitude: parse_vec_u8!(node.location.latitude.0), - longitude: parse_vec_u8!(node.location.longitude.0), - }; - - let public_config = match node.public_config { - Some(config) => { - let mut pub_conf = PublicConfig { - ip4: IP { - ip: parse_vec_u8!(config.ip4.ip.0), - gw: parse_vec_u8!(config.ip4.gw.0), - }, - ip6: None, - domain: None, - }; - - pub_conf.ip6 = match config.ip6 { - Some(conf6) => Some(IP { - ip: parse_vec_u8!(conf6.ip.0), - gw: parse_vec_u8!(conf6.gw.0), - }), - None => None, - }; - - pub_conf.domain = match config.domain { - Some(domain) => Some(parse_vec_u8!(domain.0)), - None => None, - }; - - Some(pub_conf) - } - None => None, - }; - - let interfaces = node - .interfaces - .into_iter() - .map(|intf| { - let ips = intf - .ips - .0 - .into_iter() - .map(|ip| parse_vec_u8!(ip.0 .0)) - .collect(); - Interface { - name: parse_vec_u8!(intf.name.0 .0), - mac: parse_vec_u8!(intf.mac.0 .0), - ips, - } - }) - .collect(); - - let certification = match node.certification { - TestnetNodeCertification::Certified => NodeCertification::Certified, - TestnetNodeCertification::Diy => NodeCertification::Diy, - }; - - let serial_number = match node.serial_number { - Some(s) => Some(parse_vec_u8!(s.0 .0)), - None => None, - }; - - TfgridNode { - version: node.version, - id: node.id, - farm_id: node.farm_id, - twin_id: node.twin_id, - resources, - location, - power: Power { - target: PowerTarget::Up, - state: PowerState::Up, - last_uptime: 0, - }, - public_config, - created: node.created, - farming_policy_id: node.farming_policy_id, - interfaces, - certification, - secure_boot: node.secure_boot, - serial_number, - connection_price: node.connection_price, - } - } -} - -impl From for TfgridNode { - fn from(node: MainnetNode) -> Self { - let mut resources = ConsumableResources::default(); - resources.total_resources.cru = node.resources.cru; - resources.total_resources.hru = node.resources.hru; - resources.total_resources.mru = node.resources.mru; - resources.total_resources.sru = node.resources.sru; - - let location = Location { - city: parse_vec_u8!(node.location.city.0 .0), - country: parse_vec_u8!(node.location.country.0 .0), - latitude: parse_vec_u8!(node.location.latitude.0), - longitude: parse_vec_u8!(node.location.longitude.0), - }; - - let public_config = match node.public_config { - Some(config) => { - let mut pub_conf = PublicConfig { - ip4: IP { - ip: parse_vec_u8!(config.ip4.ip.0), - gw: parse_vec_u8!(config.ip4.gw.0), - }, - ip6: None, - domain: None, - }; - - pub_conf.ip6 = match config.ip6 { - Some(conf6) => Some(IP { - ip: parse_vec_u8!(conf6.ip.0), - gw: parse_vec_u8!(conf6.gw.0), - }), - None => None, - }; - - pub_conf.domain = match config.domain { - Some(domain) => Some(parse_vec_u8!(domain.0)), - None => None, - }; - - Some(pub_conf) - } - None => None, - }; - - let interfaces = node - .interfaces - .into_iter() - .map(|intf| { - let ips = intf - .ips - .0 - .into_iter() - .map(|ip| parse_vec_u8!(ip.0 .0)) - .collect(); - Interface { - name: parse_vec_u8!(intf.name.0 .0), - mac: parse_vec_u8!(intf.mac.0 .0), - ips, - } - }) - .collect(); - - let certification = match node.certification { - MainnetNodeCertification::Certified => NodeCertification::Certified, - MainnetNodeCertification::Diy => NodeCertification::Diy, - }; - - let serial_number = match node.serial_number { - Some(s) => Some(parse_vec_u8!(s.0 .0)), - None => None, - }; - - TfgridNode { - version: node.version, - id: node.id, - farm_id: node.farm_id, - twin_id: node.twin_id, - resources, - location, - power: Power { - target: PowerTarget::Up, - state: PowerState::Up, - last_uptime: 0, - }, - public_config, - created: node.created, - farming_policy_id: node.farming_policy_id, - interfaces, - certification, - secure_boot: node.secure_boot, - serial_number, - connection_price: node.connection_price, - } - } -} - -pub type SystemAccountInfo = AccountInfo>; - -impl From for SystemAccountInfo { - fn from(info: MainnetSystemAccountInfo) -> Self { - SystemAccountInfo { - nonce: info.nonce, - consumers: info.consumers, - providers: info.providers, - sufficients: info.sufficients, - data: pallet_balances::AccountData { - free: info.data.free, - fee_frozen: info.data.fee_frozen, - misc_frozen: info.data.misc_frozen, - reserved: info.data.reserved, - }, - } - } -} - -impl From for SystemAccountInfo { - fn from(info: TestnetSystemAccountInfo) -> Self { - SystemAccountInfo { - nonce: info.nonce, - consumers: info.consumers, - providers: info.providers, - sufficients: info.sufficients, - data: pallet_balances::AccountData { - free: info.data.free, - fee_frozen: info.data.fee_frozen, - misc_frozen: info.data.misc_frozen, - reserved: info.data.reserved, - }, - } - } -} - -impl From for SystemAccountInfo { - fn from(info: DevnetSystemAccountInfo) -> Self { - SystemAccountInfo { - nonce: info.nonce, - consumers: info.consumers, - providers: info.providers, - sufficients: info.sufficients, - data: pallet_balances::AccountData { - free: info.data.free, - fee_frozen: info.data.fee_frozen, - misc_frozen: info.data.misc_frozen, - reserved: info.data.reserved, - }, - } - } -} - -impl From for SystemAccountInfo { - fn from(info: LocalSystemAccountInfo) -> Self { - SystemAccountInfo { - nonce: info.nonce, - consumers: info.consumers, - providers: info.providers, - sufficients: info.sufficients, - data: pallet_balances::AccountData { - free: info.data.free, - fee_frozen: info.data.fee_frozen, - misc_frozen: info.data.misc_frozen, - reserved: info.data.reserved, - }, - } - } -} - -#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct Twin { - pub id: u32, - pub account: AccountId32, - pub relay: Option, - pub entities: Vec, - pub pk: Option>, -} - -#[derive(Deserialize, Serialize, Debug, Clone, Eq, PartialEq)] -pub struct EntityProof { - entity_id: u32, - signature: String, -} - -impl From for Twin { - fn from(twin: LocalTwin) -> Self { - let entities = twin.entities.into_iter().map(|e| e.into()).collect(); - - Twin { - id: twin.id, - account: twin.account_id, - relay: twin.relay.map(|v| parse_vec_u8!(v.0)), - entities, - pk: twin.pk.map(|v| v.0), - } - } -} - -impl From for Twin { - fn from(twin: DevnetTwin) -> Self { - let entities = twin.entities.into_iter().map(|e| e.into()).collect(); - - Twin { - id: twin.id, - account: twin.account_id, - relay: twin.relay.map(|v| parse_vec_u8!(v.0)), - entities, - pk: twin.pk.map(|v| v.0), - } - } -} - -impl From for EntityProof { - fn from(proof: LocalEntityProof) -> Self { - let signature = parse_vec_u8!(proof.signature); - EntityProof { - entity_id: proof.entity_id, - signature, - } - } -} - -impl From for EntityProof { - fn from(proof: DevnetEntityProof) -> Self { - let signature = parse_vec_u8!(proof.signature); - EntityProof { - entity_id: proof.entity_id, - signature, - } - } -} - -impl From for Twin { - fn from(twin: TestnetTwin) -> Self { - let entities = twin.entities.into_iter().map(|e| e.into()).collect(); - - Twin { - id: twin.id, - account: twin.account_id, - relay: Some(parse_vec_u8!(twin.ip.0 .0)), - entities, - pk: None, - } - } -} - -impl From for EntityProof { - fn from(proof: TestnetEntityProof) -> Self { - let signature = parse_vec_u8!(proof.signature); - EntityProof { - entity_id: proof.entity_id, - signature, - } - } -} - -impl From for Twin { - fn from(twin: MainnetTwin) -> Self { - let entities = twin.entities.into_iter().map(|e| e.into()).collect(); - - Twin { - id: twin.id, - account: twin.account_id, - relay: Some(parse_vec_u8!(twin.ip.0 .0)), - entities, - pk: None, - } - } -} - -impl From for EntityProof { - fn from(proof: MainnetEntityProof) -> Self { - let signature = parse_vec_u8!(proof.signature); - // let signature = String::from_utf8(proof.signature); - EntityProof { - entity_id: proof.entity_id, - signature, - } - } -}