From ef0c7cefa95deb3b54ae8f9d9541213149683633 Mon Sep 17 00:00:00 2001 From: Mateusz Jasiuk Date: Thu, 17 Oct 2024 09:44:59 +0200 Subject: [PATCH] feat: masp building compiles --- packages/shared/lib/.cargo/config.toml | 2 + packages/shared/lib/Cargo.lock | 428 ++++++++++++---------- packages/shared/lib/Cargo.toml | 2 +- packages/shared/lib/src/sdk/args.rs | 57 ++- packages/shared/lib/src/sdk/mod.rs | 40 +- packages/shared/lib/src/sdk/tx.rs | 1 + packages/shared/lib/src/sdk/wallet/mod.rs | 2 +- 7 files changed, 320 insertions(+), 212 deletions(-) create mode 100644 packages/shared/lib/.cargo/config.toml diff --git a/packages/shared/lib/.cargo/config.toml b/packages/shared/lib/.cargo/config.toml new file mode 100644 index 000000000..f4e8c002f --- /dev/null +++ b/packages/shared/lib/.cargo/config.toml @@ -0,0 +1,2 @@ +[build] +target = "wasm32-unknown-unknown" diff --git a/packages/shared/lib/Cargo.lock b/packages/shared/lib/Cargo.lock index c4f60e291..ae56bf072 100644 --- a/packages/shared/lib/Cargo.lock +++ b/packages/shared/lib/Cargo.lock @@ -2782,6 +2782,19 @@ dependencies = [ "subtle", ] +[[package]] +name = "masp_note_encryption" +version = "1.0.0" +source = "git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa#2914e6ff9a922bae8f1cb63a79d796a69af3d8aa" +dependencies = [ + "borsh", + "chacha20", + "chacha20poly1305", + "cipher", + "rand_core 0.6.4", + "subtle", +] + [[package]] name = "masp_primitives" version = "1.0.0" @@ -2802,7 +2815,38 @@ dependencies = [ "incrementalmerkletree", "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", - "masp_note_encryption", + "masp_note_encryption 1.0.0 (git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4)", + "memuse", + "nonempty", + "num-traits 0.2.19 (git+https://github.com/heliaxdev/num-traits?rev=3f3657caa34b8e116fdf3f8a3519c4ac29f012fe)", + "rand 0.8.5", + "rand_core 0.6.4", + "sha2 0.10.8", + "subtle", + "zcash_encoding", +] + +[[package]] +name = "masp_primitives" +version = "1.0.0" +source = "git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa#2914e6ff9a922bae8f1cb63a79d796a69af3d8aa" +dependencies = [ + "aes", + "bip0039", + "bitvec", + "blake2b_simd", + "blake2s_simd", + "bls12_381 0.8.0 (git+https://github.com/heliaxdev/bls12_381.git?rev=d3ebe9dd6488fac1923db120a7498079e55dd838)", + "borsh", + "byteorder", + "ff", + "fpe", + "group", + "hex", + "incrementalmerkletree", + "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", + "lazy_static", + "masp_note_encryption 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", "memuse", "nonempty", "num-traits 0.2.19 (git+https://github.com/heliaxdev/num-traits?rev=3f3657caa34b8e116fdf3f8a3519c4ac29f012fe)", @@ -2816,7 +2860,7 @@ dependencies = [ [[package]] name = "masp_proofs" version = "1.0.0" -source = "git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4#12ed8b060b295c06502a2ff8468e4a941cb7cca4" +source = "git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa#2914e6ff9a922bae8f1cb63a79d796a69af3d8aa" dependencies = [ "bellman", "blake2b_simd", @@ -2827,7 +2871,7 @@ dependencies = [ "itertools 0.11.0", "jubjub 0.10.0 (git+https://github.com/heliaxdev/jubjub.git?rev=a373686962f4e9d0edb3b4716f86ff6bbd9aa86c)", "lazy_static", - "masp_primitives", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", "rand_core 0.6.4", "redjubjub", "tracing", @@ -2889,30 +2933,30 @@ version = "0.46.0" source = "git+https://github.com/anoma/namada?tag=v0.46.0#cc531ec513b8ade85b221dd0a6c11818927fd247" dependencies = [ "borsh", - "namada_core 0.46.0", - "namada_macros 0.46.0", - "namada_storage 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "serde", ] [[package]] name = "namada_account" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", - "namada_core 0.46.1", - "namada_macros 0.46.1", - "namada_storage 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "serde", ] [[package]] name = "namada_controller" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "smooth-operator", "thiserror", ] @@ -2937,8 +2981,8 @@ dependencies = [ "index-set", "indexmap 2.2.4", "k256", - "masp_primitives", - "namada_macros 0.46.0", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "num-integer", "num-rational", "num-traits 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2964,8 +3008,8 @@ dependencies = [ [[package]] name = "namada_core" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "bech32 0.8.1", "borsh", @@ -2983,8 +3027,8 @@ dependencies = [ "indexmap 2.2.4", "k256", "lazy_static", - "masp_primitives", - "namada_macros 0.46.1", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "num-integer", "num-rational", "num-traits 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", @@ -3014,24 +3058,24 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "ethers", "eyre", "itertools 0.12.1", "konst", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_parameters", "namada_proof_of_stake", "namada_state", - "namada_storage 0.46.1", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_systems", "namada_trans_token", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vote_ext", "namada_vp_env", "serde", @@ -3046,8 +3090,8 @@ version = "0.46.0" source = "git+https://github.com/anoma/namada?tag=v0.46.0#cc531ec513b8ade85b221dd0a6c11818927fd247" dependencies = [ "borsh", - "namada_core 0.46.0", - "namada_macros 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "serde", "serde_json", "thiserror", @@ -3056,12 +3100,12 @@ dependencies = [ [[package]] name = "namada_events" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", - "namada_core 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "serde", "serde_json", "thiserror", @@ -3074,41 +3118,41 @@ version = "0.46.0" source = "git+https://github.com/anoma/namada?tag=v0.46.0#cc531ec513b8ade85b221dd0a6c11818927fd247" dependencies = [ "borsh", - "namada_core 0.46.0", - "namada_events 0.46.0", - "namada_macros 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "serde", "thiserror", ] [[package]] name = "namada_gas" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "serde", "thiserror", ] [[package]] name = "namada_governance" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "itertools 0.12.1", "konst", - "namada_account 0.46.1", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_macros 0.46.1", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp_env", "serde", "serde_json", @@ -3119,8 +3163,8 @@ dependencies = [ [[package]] name = "namada_ibc" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "data-encoding", @@ -3128,14 +3172,14 @@ dependencies = [ "ibc-derive", "ics23", "konst", - "masp_primitives", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", - "namada_macros 0.46.1", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp", "primitive-types", "prost 0.13.2", @@ -3149,12 +3193,12 @@ dependencies = [ [[package]] name = "namada_io" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "async-trait", "kdam", - "namada_core 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "tendermint-rpc", "thiserror", "tokio", @@ -3174,8 +3218,8 @@ dependencies = [ [[package]] name = "namada_macros" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "data-encoding", "proc-macro2", @@ -3192,8 +3236,8 @@ dependencies = [ "borsh", "eyre", "ics23", - "namada_core 0.46.0", - "namada_macros 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "prost 0.13.2", "sparse-merkle-tree", "thiserror", @@ -3201,14 +3245,14 @@ dependencies = [ [[package]] name = "namada_merkle_tree" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "eyre", "ics23", - "namada_core 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "prost 0.13.2", "sparse-merkle-tree", "thiserror", @@ -3216,14 +3260,14 @@ dependencies = [ [[package]] name = "namada_parameters" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp_env", "smooth-operator", "thiserror", @@ -3231,20 +3275,20 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "itertools 0.12.1", "konst", - "namada_account 0.46.1", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_controller", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp_env", "once_cell", "serde", @@ -3258,21 +3302,21 @@ name = "namada_replay_protection" version = "0.46.0" source = "git+https://github.com/anoma/namada?tag=v0.46.0#cc531ec513b8ade85b221dd0a6c11818927fd247" dependencies = [ - "namada_core 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", ] [[package]] name = "namada_replay_protection" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", ] [[package]] name = "namada_sdk" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "async-trait", "bimap", @@ -3290,23 +3334,23 @@ dependencies = [ "init-once", "itertools 0.12.1", "lazy_static", - "masp_primitives", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", "masp_proofs", - "namada_account 0.46.1", - "namada_core 0.46.1", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_ethereum_bridge", - "namada_events 0.46.1", - "namada_gas 0.46.1", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_governance", "namada_ibc", "namada_io", - "namada_macros 0.46.1", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_parameters", "namada_proof_of_stake", "namada_state", - "namada_storage 0.46.1", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_token", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vm", "namada_vote_ext", "namada_vp", @@ -3340,8 +3384,8 @@ dependencies = [ [[package]] name = "namada_shielded_token" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "async-trait", "borsh", @@ -3350,18 +3394,18 @@ dependencies = [ "futures", "itertools 0.12.1", "lazy_static", - "masp_primitives", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", "masp_proofs", - "namada_account 0.46.1", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_controller", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_io", - "namada_macros 0.46.1", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp_env", "namada_wallet", "rand 0.8.5", @@ -3381,21 +3425,21 @@ dependencies = [ [[package]] name = "namada_state" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "clru", "itertools 0.12.1", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", - "namada_macros 0.46.1", - "namada_merkle_tree 0.46.1", - "namada_replay_protection 0.46.1", - "namada_storage 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_merkle_tree 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_replay_protection 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "patricia_tree", "smooth-operator", "thiserror", @@ -3409,11 +3453,11 @@ source = "git+https://github.com/anoma/namada?tag=v0.46.0#cc531ec513b8ade85b221d dependencies = [ "borsh", "itertools 0.12.1", - "namada_core 0.46.0", - "namada_gas 0.46.0", - "namada_macros 0.46.0", - "namada_merkle_tree 0.46.0", - "namada_replay_protection 0.46.0", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_merkle_tree 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_replay_protection 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "regex", "serde", "smooth-operator", @@ -3423,16 +3467,16 @@ dependencies = [ [[package]] name = "namada_storage" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "itertools 0.12.1", - "namada_core 0.46.1", - "namada_gas 0.46.1", - "namada_macros 0.46.1", - "namada_merkle_tree 0.46.1", - "namada_replay_protection 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_merkle_tree 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_replay_protection 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "regex", "serde", "smooth-operator", @@ -3442,43 +3486,43 @@ dependencies = [ [[package]] name = "namada_systems" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_storage 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", ] [[package]] name = "namada_token" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_macros 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_shielded_token", - "namada_storage 0.46.1", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_systems", "namada_trans_token", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_tx_env", "serde", ] [[package]] name = "namada_trans_token" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "konst", - "namada_core 0.46.1", - "namada_events 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", "namada_systems", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_tx_env", "namada_vp_env", "thiserror", @@ -3496,12 +3540,12 @@ dependencies = [ "data-encoding", "either", "konst", - "masp_primitives", - "namada_account 0.46.0", - "namada_core 0.46.0", - "namada_events 0.46.0", - "namada_gas 0.46.0", - "namada_macros 0.46.0", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=12ed8b060b295c06502a2ff8468e4a941cb7cca4)", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "num-derive 0.4.2", "num-traits 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.13.2", @@ -3516,8 +3560,8 @@ dependencies = [ [[package]] name = "namada_tx" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "ark-bls12-381", "bitflags 2.5.0", @@ -3525,12 +3569,12 @@ dependencies = [ "data-encoding", "either", "konst", - "masp_primitives", - "namada_account 0.46.1", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", - "namada_macros 0.46.1", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "num-derive 0.4.2", "num-traits 0.2.19 (registry+https://github.com/rust-lang/crates.io-index)", "prost 0.13.2", @@ -3545,29 +3589,29 @@ dependencies = [ [[package]] name = "namada_tx_env" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_storage 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", ] [[package]] name = "namada_vm" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", "clru", - "namada_account 0.46.1", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", + "namada_account 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_parameters", "namada_state", "namada_token", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp", "smooth-operator", "thiserror", @@ -3577,26 +3621,26 @@ dependencies = [ [[package]] name = "namada_vote_ext" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "borsh", - "namada_core 0.46.1", - "namada_macros 0.46.1", - "namada_tx 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "serde", ] [[package]] name = "namada_vp" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_state", - "namada_tx 0.46.1", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_vp_env", "smooth-operator", "thiserror", @@ -3605,23 +3649,23 @@ dependencies = [ [[package]] name = "namada_vp_env" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "derivative", - "masp_primitives", - "namada_core 0.46.1", - "namada_events 0.46.1", - "namada_gas 0.46.1", - "namada_storage 0.46.1", - "namada_tx 0.46.1", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_events 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_gas 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_storage 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "smooth-operator", ] [[package]] name = "namada_wallet" -version = "0.46.1" -source = "git+https://github.com/anoma/namada?tag=v0.46.1#b24938efd948cb43fc996a729138cb099abcadc0" +version = "0.46.0" +source = "git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp#79106c5a2632700eda207756df3765c38379f928" dependencies = [ "bimap", "borsh", @@ -3629,10 +3673,10 @@ dependencies = [ "data-encoding", "derivation-path", "itertools 0.12.1", - "masp_primitives", - "namada_core 0.46.1", + "masp_primitives 1.0.0 (git+https://github.com/anoma/masp?rev=2914e6ff9a922bae8f1cb63a79d796a69af3d8aa)", + "namada_core 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "namada_ibc", - "namada_macros 0.46.1", + "namada_macros 0.46.0 (git+https://github.com/anoma/namada?branch=murisi/integrate-hw-masp)", "orion", "rand 0.8.5", "rand_core 0.6.4", @@ -5097,7 +5141,7 @@ dependencies = [ "hex", "js-sys", "namada_sdk", - "namada_tx 0.46.0", + "namada_tx 0.46.0 (git+https://github.com/anoma/namada?tag=v0.46.0)", "rand 0.8.5", "rayon", "reqwest", diff --git a/packages/shared/lib/Cargo.toml b/packages/shared/lib/Cargo.toml index 288baee76..4fbf4bc44 100644 --- a/packages/shared/lib/Cargo.toml +++ b/packages/shared/lib/Cargo.toml @@ -27,7 +27,7 @@ chrono = "0.4.22" getrandom = { version = "0.2.7", features = ["js"] } gloo-utils = { version = "0.1.5", features = ["serde"] } js-sys = "0.3.60" -namada_sdk = { git = "https://github.com/anoma/namada", tag="v0.46.1", default-features = false } +namada_sdk = { git = "https://github.com/anoma/namada", branch="murisi/integrate-hw-masp", default-features = false } rand = "0.8.5" rayon = { version = "1.5.3", optional = true } rexie = "0.5" diff --git a/packages/shared/lib/src/sdk/args.rs b/packages/shared/lib/src/sdk/args.rs index c7fe3bd9f..7cd3f0a3c 100644 --- a/packages/shared/lib/src/sdk/args.rs +++ b/packages/shared/lib/src/sdk/args.rs @@ -3,8 +3,12 @@ use std::{path::PathBuf, str::FromStr}; use namada_sdk::borsh::{BorshDeserialize, BorshSerialize}; use namada_sdk::ibc::core::host::types::identifiers::{ChannelId, PortId}; use namada_sdk::ibc::IbcShieldingData; -use namada_sdk::tendermint_rpc; +use namada_sdk::masp_primitives::transaction::components::sapling::builder::{ + BuildParams, RngBuildParams, +}; +use namada_sdk::masp_primitives::zip32::PseudoExtendedKey; use namada_sdk::tx::data::GasLimit; +use namada_sdk::PaymentAddress; use namada_sdk::{ address::Address, args::{self, InputAmount, TxExpiration}, @@ -14,7 +18,8 @@ use namada_sdk::{ token::{Amount, DenominatedAmount, NATIVE_MAX_DECIMAL_PLACES}, TransferSource, }; -use namada_sdk::{ExtendedSpendingKey, PaymentAddress}; +use namada_sdk::{error, tendermint_rpc}; +use rand::rngs::OsRng; use wasm_bindgen::JsError; #[derive(BorshSerialize, BorshDeserialize, Debug)] @@ -484,7 +489,7 @@ pub fn transparent_transfer_tx_args( #[derive(BorshSerialize, BorshDeserialize, Debug)] #[borsh(crate = "namada_sdk::borsh")] pub struct ShieldedTransferDataMsg { - source: String, + source: Vec, target: String, token: String, amount: String, @@ -494,7 +499,7 @@ pub struct ShieldedTransferDataMsg { #[borsh(crate = "namada_sdk::borsh")] pub struct ShieldedTransferMsg { data: Vec, - gas_spending_key: Option, + gas_spending_keys: Vec>, } /// Maps serialized tx_msg into TxShieldedTransfer args. @@ -521,7 +526,7 @@ pub fn shielded_transfer_tx_args( let mut shielded_transfer_data: Vec = vec![]; for shielded_transfer in data { - let source = ExtendedSpendingKey::from_str(&shielded_transfer.source)?; + let source = PseudoExtendedKey::try_from_slice(&shielded_transfer.source)?; let target = PaymentAddress::from_str(&shielded_transfer.target)?; let token = Address::from_str(&shielded_transfer.token)?; let denom_amount = @@ -537,9 +542,12 @@ pub fn shielded_transfer_tx_args( } let tx = tx_msg_into_args(tx_msg)?; - let gas_spending_key = gas_spending_key - .map(|v| ExtendedSpendingKey::from_str(&v)) - .transpose()?; + let mut gsk: Vec = vec![]; + + for sk in gas_spending_keys { + let gas_spending_key = PseudoExtendedKey::try_from_slice(&sk)?; + gsk.push(gas_spending_key); + } let args = args::TxShieldedTransfer { data: shielded_transfer_data, @@ -626,9 +634,9 @@ pub struct UnshieldingTransferDataMsg { #[derive(BorshSerialize, BorshDeserialize, Debug)] #[borsh(crate = "namada_sdk::borsh")] pub struct UnshieldingTransferMsg { - source: String, + source: Vec, data: Vec, - gas_spending_key: Option, + gas_spending_keys: Vec>, } /// Maps serialized tx_msg into TxUnshieldingTransfer args. @@ -653,7 +661,7 @@ pub fn unshielding_transfer_tx_args( data, gas_spending_key, } = unshielding_transfer_msg; - let source = ExtendedSpendingKey::from_str(&source)?; + let source = PseudoExtendedKey::try_from_slice(&source)?; let mut unshielding_transfer_data: Vec = vec![]; @@ -671,9 +679,13 @@ pub fn unshielding_transfer_tx_args( }); } - let gas_spending_key = gas_spending_key - .map(|v| ExtendedSpendingKey::from_str(&v)) - .transpose()?; + let mut gsk: Vec = vec![]; + + for sk in gas_spending_keys { + let gas_spending_key = PseudoExtendedKey::try_from_slice(&sk)?; + gsk.push(gas_spending_key); + } + let tx = tx_msg_into_args(tx_msg)?; let args = args::TxUnshieldingTransfer { @@ -940,3 +952,20 @@ fn tx_msg_into_args(tx_msg: &[u8]) -> Result { Ok(args) } + +pub async fn generate_masp_build_params( + // TODO: those will be needed for HD Wallet support + _spend_len: usize, + _convert_len: usize, + _output_len: usize, + args: &args::Tx, +) -> Result, error::Error> { + // Construct the build parameters that parameterized the Transaction + // authorizations + if args.use_device { + // HD Wallet support + Err(error::Error::Other("Device not supported".into())) + } else { + Ok(Box::new(RngBuildParams::new(OsRng))) + } +} diff --git a/packages/shared/lib/src/sdk/mod.rs b/packages/shared/lib/src/sdk/mod.rs index 0f683b358..dfbf8bca3 100644 --- a/packages/shared/lib/src/sdk/mod.rs +++ b/packages/shared/lib/src/sdk/mod.rs @@ -13,6 +13,7 @@ use crate::utils::set_panic_hook; #[cfg(feature = "web")] use crate::utils::to_bytes; use crate::utils::to_js_result; +use args::generate_masp_build_params; use gloo_utils::format::JsValueSerdeExt; use namada_sdk::address::{Address, MASP}; use namada_sdk::args::{GenIbcShieldingTransfer, InputAmount, Query, TxExpiration}; @@ -41,6 +42,22 @@ use namada_sdk::{Namada, NamadaImpl, PaymentAddress, TransferTarget}; use std::str::FromStr; use wasm_bindgen::{prelude::wasm_bindgen, JsError, JsValue}; +// Maximum number of spend description randomness parameters that can be +// generated on the hardware wallet. It is hard to compute the exact required +// number because a given MASP source could be distributed amongst several +// notes. +const MAX_HW_SPEND: usize = 15; +// Maximum number of convert description randomness parameters that can be +// generated on the hardware wallet. It is hard to compute the exact required +// number because the number of conversions that are used depends on the +// protocol's current state. +const MAX_HW_CONVERT: usize = 15; +// Maximum number of output description randomness parameters that can be +// generated on the hardware wallet. It is hard to compute the exact required +// number because the number of outputs depends on the number of dummy outputs +// introduced. +const MAX_HW_OUTPUT: usize = 15; + /// Represents the Sdk public API. #[wasm_bindgen] pub struct Sdk { @@ -344,7 +361,12 @@ impl Sdk { wrapper_tx_msg: &[u8], ) -> Result { let mut args = args::shielded_transfer_tx_args(shielded_transfer_msg, wrapper_tx_msg)?; - let (tx, signing_data) = build_shielded_transfer(&self.namada, &mut args).await?; + let mut bparams = + generate_masp_build_params(MAX_HW_SPEND, MAX_HW_CONVERT, MAX_HW_OUTPUT, &args.tx) + .await?; + let (tx, signing_data) = + build_shielded_transfer(&self.namada, &mut args, &mut bparams).await?; + self.serialize_tx_result(tx, wrapper_tx_msg, signing_data) } @@ -355,7 +377,11 @@ impl Sdk { ) -> Result { let mut args = args::unshielding_transfer_tx_args(unshielding_transfer_msg, wrapper_tx_msg)?; - let (tx, signing_data) = build_unshielding_transfer(&self.namada, &mut args).await?; + let mut bparams = + generate_masp_build_params(MAX_HW_SPEND, MAX_HW_CONVERT, MAX_HW_OUTPUT, &args.tx) + .await?; + let (tx, signing_data) = + build_unshielding_transfer(&self.namada, &mut args, &mut bparams).await?; self.serialize_tx_result(tx, wrapper_tx_msg, signing_data) } @@ -365,8 +391,11 @@ impl Sdk { wrapper_tx_msg: &[u8], ) -> Result { let mut args = args::shielding_transfer_tx_args(shielding_transfer_msg, wrapper_tx_msg)?; + let mut bparams = + generate_masp_build_params(MAX_HW_SPEND, MAX_HW_CONVERT, MAX_HW_OUTPUT, &args.tx) + .await?; let (tx, signing_data, _masp_epoch) = - build_shielding_transfer(&self.namada, &mut args).await?; + build_shielding_transfer(&self.namada, &mut args, &mut bparams).await?; self.serialize_tx_result(tx, wrapper_tx_msg, signing_data) } @@ -376,7 +405,10 @@ impl Sdk { wrapper_tx_msg: &[u8], ) -> Result { let args = args::ibc_transfer_tx_args(ibc_transfer_msg, wrapper_tx_msg)?; - let (tx, signing_data, _) = build_ibc_transfer(&self.namada, &args).await?; + let mut bparams = + generate_masp_build_params(MAX_HW_SPEND, MAX_HW_CONVERT, MAX_HW_OUTPUT, &args.tx) + .await?; + let (tx, signing_data, _) = build_ibc_transfer(&self.namada, &args, &mut bparams).await?; self.serialize_tx_result(tx, wrapper_tx_msg, signing_data) } diff --git a/packages/shared/lib/src/sdk/tx.rs b/packages/shared/lib/src/sdk/tx.rs index de1350b53..580eb2470 100644 --- a/packages/shared/lib/src/sdk/tx.rs +++ b/packages/shared/lib/src/sdk/tx.rs @@ -101,6 +101,7 @@ impl SigningData { fee_payer, threshold, account_public_keys_map, + shielded_hash: None, }) } } diff --git a/packages/shared/lib/src/sdk/wallet/mod.rs b/packages/shared/lib/src/sdk/wallet/mod.rs index 6184ba6a2..4346c991e 100644 --- a/packages/shared/lib/src/sdk/wallet/mod.rs +++ b/packages/shared/lib/src/sdk/wallet/mod.rs @@ -48,7 +48,7 @@ pub fn add_viewing_key(wallet: &mut Wallet, xvk: String, alias: if wallet .store_mut() - .insert_viewing_key::(alias.clone(), xvk, None, true) + .insert_viewing_key::(alias.clone(), xvk, None, None, true) .is_none() { panic!("Action cancelled, no changes persisted.");