diff --git a/Cargo.lock b/Cargo.lock index e8700ee4f..601501c26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -60,9 +60,9 @@ checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" [[package]] name = "ahash" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" +checksum = "5a824f2aa7e75a0c98c5a504fceb80649e9c35265d44525b5f94de4771a395cd" dependencies = [ "getrandom", "once_cell", @@ -174,9 +174,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.4" +version = "0.21.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ba43ea6f343b788c8764558649e08df62f86c6ef251fdaeb1ffd010a9ae50a2" +checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" [[package]] name = "base64ct" @@ -463,9 +463,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.10" +version = "0.2.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fbc60abd742b35f2492f808e1abbb83d45f72db402e14c55057edc9c7b1e9e4" +checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" dependencies = [ "libc", ] @@ -618,9 +618,9 @@ checksum = "6c2141d6d6c8512188a7891b4b01590a45f6dac67afb4f255c4124dbb86d4eaa" [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -633,9 +633,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -643,15 +643,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -660,15 +660,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -677,21 +677,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -845,7 +845,7 @@ version = "0.11.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ab5ef0d4909ef3724cc8cce6ccc8572c5c817592e9285f5464f8e86f8bd3726e" dependencies = [ - "ahash 0.7.6", + "ahash 0.7.7", "serde", ] @@ -1008,9 +1008,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.8.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" +checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "itertools" @@ -1029,9 +1029,9 @@ checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" [[package]] name = "js-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" +checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" dependencies = [ "wasm-bindgen", ] @@ -1170,9 +1170,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" +checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" dependencies = [ "libc", "wasi", @@ -1340,7 +1340,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "525a8f75106f4eeb1fedaacadc61547548fe4715c3edde7d03eed2900b467952" dependencies = [ "aes", - "base64 0.21.4", + "base64 0.21.5", "bitcoin_hashes 0.12.0", "cbc", "getrandom", @@ -1425,9 +1425,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.57" +version = "0.10.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bac25ee399abb46215765b1cb35bc0212377e58a061560d8b29b024fd0430e7c" +checksum = "a9dfc0783362704e97ef3bd24261995a699468440099ef95d869b4d9732f829a" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -1457,9 +1457,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.93" +version = "0.9.94" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db4d56a4c0478783083cfafcc42493dd4a981d41669da64b4572a2a089b51b1d" +checksum = "2f55da20b29f956fb01f0add8683eb26ee13ebe3ebd935e49898717c6b4b2830" dependencies = [ "cc", "libc", @@ -1653,9 +1653,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.3.5" +version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" +checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" dependencies = [ "bitflags 1.3.2", ] @@ -1695,7 +1695,7 @@ version = "0.11.22" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" dependencies = [ - "base64 0.21.4", + "base64 0.21.5", "bytes", "encoding_rs", "futures-core", @@ -1745,17 +1745,16 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" dependencies = [ "cc", + "getrandom", "libc", - "once_cell", "spin", "untrusted", - "web-sys", - "winapi", + "windows-sys", ] [[package]] @@ -1775,9 +1774,9 @@ dependencies = [ [[package]] name = "rustix" -version = "0.38.20" +version = "0.38.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ce50cb2e16c2903e30d1cbccfd8387a74b9d4c938b6a4c5ec6cc7556f7a8a0" +checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" dependencies = [ "bitflags 2.4.1", "errno", @@ -1788,9 +1787,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.21.7" +version = "0.21.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd8d6c9f025a446bc4d18ad9632e69aec8f287aa84499ee335599fabd20c3fd8" +checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" dependencies = [ "log", "ring", @@ -1800,9 +1799,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.101.6" +version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7d5dece342910d9ba34d259310cae3e0154b873b35408b787b59bce53d34fe" +checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ "ring", "untrusted", @@ -1831,9 +1830,9 @@ checksum = "e1cf6437eb19a8f4a6cc0f7dca544973b0b78843adbfeb3683d1a94a0024a294" [[package]] name = "sct" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" +checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ "ring", "untrusted", @@ -1936,18 +1935,18 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -1956,9 +1955,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.107" +version = "1.0.108" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b420ce6e3d8bd882e9b243c6eed35dbc9a6110c9769e74b584e0d68d1f20c65" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" dependencies = [ "itoa", "ryu", @@ -2036,9 +2035,9 @@ dependencies = [ [[package]] name = "spin" -version = "0.5.2" +version = "0.9.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "subtle" @@ -2091,9 +2090,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.0" +version = "3.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb94d2f3cc536af71caac6b6fcebf65860b347e7ce0cc9ebe8f70d3e521054ef" +checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" dependencies = [ "cfg-if", "fastrand", @@ -2234,9 +2233,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.9" +version = "0.7.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d68074620f57a0b21594d9735eb2e98ab38b17f80d3fcb189fca266771ca60d" +checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" dependencies = [ "bytes", "futures-core", @@ -2368,9 +2367,9 @@ dependencies = [ [[package]] name = "untrusted" -version = "0.7.1" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" @@ -2434,9 +2433,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" +checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2444,9 +2443,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" +checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" dependencies = [ "bumpalo", "log", @@ -2459,9 +2458,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" +checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" dependencies = [ "cfg-if", "js-sys", @@ -2471,9 +2470,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" +checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2481,9 +2480,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" +checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" dependencies = [ "proc-macro2", "quote", @@ -2494,15 +2493,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.87" +version = "0.2.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" +checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" [[package]] name = "wasm-bindgen-test" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e6e302a7ea94f83a6d09e78e7dc7d9ca7b186bc2829c24a22d0753efd680671" +checksum = "c6433b7c56db97397842c46b67e11873eda263170afeb3a2dc74a7cb370fee0d" dependencies = [ "console_error_panic_hook", "js-sys", @@ -2514,12 +2513,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.37" +version = "0.3.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecb993dd8c836930ed130e020e77d9b2e65dd0fbab1b67c790b0f5d80b11a575" +checksum = "493fcbab756bb764fa37e6bee8cec2dd709eb4273d06d0c282a5e74275ded735" dependencies = [ "proc-macro2", "quote", + "syn 2.0.38", ] [[package]] @@ -2535,9 +2535,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.64" +version = "0.3.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" +checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" dependencies = [ "js-sys", "wasm-bindgen", diff --git a/mutiny-core/Cargo.toml b/mutiny-core/Cargo.toml index 052d69579..f628612e9 100644 --- a/mutiny-core/Cargo.toml +++ b/mutiny-core/Cargo.toml @@ -67,10 +67,10 @@ ignored_tests = ["test-utils"] test-utils = [] [target.'cfg(target_arch = "wasm32")'.dependencies] -wasm-bindgen = "0.2.84" -wasm-bindgen-futures = { version = "0.4.33" } -web-sys = { version = "0.3.60", features = ["console"] } -js-sys = { version = "0.3.60" } +wasm-bindgen = "0.2.88" +wasm-bindgen-futures = { version = "0.4.38" } +web-sys = { version = "0.3.65", features = ["console"] } +js-sys = { version = "0.3.65" } gloo-net = { version = "0.2.4" } instant = { version = "0.1", features = ["wasm-bindgen"] } getrandom = { version = "0.2", features = ["js"] } diff --git a/mutiny-wasm/Cargo.toml b/mutiny-wasm/Cargo.toml index 3388628df..08b4e1620 100644 --- a/mutiny-wasm/Cargo.toml +++ b/mutiny-wasm/Cargo.toml @@ -19,8 +19,8 @@ crate-type = ["cdylib"] mutiny-core = { path = "../mutiny-core" } anyhow = "1.0" -wasm-bindgen = "0.2.84" -wasm-bindgen-futures = "0.4.33" +wasm-bindgen = "0.2.88" +wasm-bindgen-futures = "0.4.38" serde = { version = "^1.0", features = ["derive"] } serde_json = { version = "^1.0" } bitcoin = { version = "0.29.2", default-features = false, features = ["serde", "secp-recovery", "rand"] } @@ -36,7 +36,7 @@ rexie = "0.4" js-sys = "0.3.60" gloo-storage = "0.2.2" gloo-utils = { version = "0.1.6", features = ["serde"] } -web-sys = { version = "0.3.60", features = ["console"] } +web-sys = { version = "0.3.65", features = ["console"] } bip39 = { version = "2.0.0" } getrandom = { version = "0.2", features = ["js"] } futures = "0.3.25" @@ -47,7 +47,7 @@ once_cell = "1.18.0" # logging them with `console.error`. This is great for development, but requires # all the `std::fmt` and `std::panicking` infrastructure, so isn't great for # code size when deploying. -console_error_panic_hook = { version = "0.1.6", optional = true } +console_error_panic_hook = { version = "0.1.7", optional = true } [dev-dependencies] mutiny-core = { path = "../mutiny-core", features = ["test-utils"] } diff --git a/mutiny-wasm/src/lib.rs b/mutiny-wasm/src/lib.rs index e557fc9cd..13e919f7d 100644 --- a/mutiny-wasm/src/lib.rs +++ b/mutiny-wasm/src/lib.rs @@ -305,11 +305,8 @@ impl MutinyWallet { #[wasm_bindgen] pub fn get_new_address( &self, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; let address = self.inner.node_manager.get_new_address(labels.clone())?; Ok(MutinyBip21RawMaterials { address: address.to_string(), @@ -356,11 +353,8 @@ impl MutinyWallet { pub async fn create_bip21( &self, amount: Option, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -378,13 +372,10 @@ impl MutinyWallet { &self, destination_address: String, amount: u64, - labels: &JsValue, /* Vec */ + labels: Vec, fee_rate: Option, ) -> Result { let send_to = Address::from_str(&destination_address)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -401,13 +392,10 @@ impl MutinyWallet { pub async fn sweep_wallet( &self, destination_address: String, - labels: &JsValue, /* Vec */ + labels: Vec, fee_rate: Option, ) -> Result { let send_to = Address::from_str(&destination_address)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -619,11 +607,8 @@ impl MutinyWallet { pub async fn create_invoice( &self, amount: Option, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -641,13 +626,10 @@ impl MutinyWallet { from_node: String, invoice_str: String, amt_sats: Option, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { let from_node = PublicKey::from_str(&from_node)?; let invoice = Bolt11Invoice::from_str(&invoice_str)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -665,13 +647,10 @@ impl MutinyWallet { to_node: String, amt_sats: u64, message: Option, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { let from_node = PublicKey::from_str(&from_node)?; let to_node = PublicKey::from_str(&to_node)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -717,13 +696,10 @@ impl MutinyWallet { lnurl: String, amount_sats: u64, zap_npub: Option, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result { let from_node = PublicKey::from_str(&from_node)?; let lnurl = LnUrl::from_str(&lnurl)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; let zap_npub = match zap_npub.filter(|z| !z.is_empty()) { Some(z) => { @@ -1060,12 +1036,9 @@ impl MutinyWallet { pub fn set_address_labels( &self, address: String, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result<(), MutinyJsError> { let address = Address::from_str(&address)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -1086,12 +1059,9 @@ impl MutinyWallet { pub fn set_invoice_labels( &self, invoice: String, - labels: &JsValue, /* Vec */ + labels: Vec, ) -> Result<(), MutinyJsError> { let invoice = Bolt11Invoice::from_str(&invoice)?; - let labels: Vec = labels - .into_serde() - .map_err(|_| MutinyJsError::InvalidArgumentsError)?; Ok(self .inner .node_manager @@ -1156,7 +1126,7 @@ impl MutinyWallet { Ok(self.inner.node_manager.edit_contact(id, contact.into())?) } - pub fn get_tag_items(&self) -> Result */, MutinyJsError> { + pub fn get_tag_items(&self) -> Result, MutinyJsError> { let mut tags: Vec = self .inner .node_manager @@ -1167,7 +1137,7 @@ impl MutinyWallet { tags.sort(); - Ok(JsValue::from_serde(&tags)?) + Ok(tags) } /// Gets the current bitcoin price in chosen Fiat. @@ -1202,13 +1172,13 @@ impl MutinyWallet { /// Get nostr wallet connect profiles #[wasm_bindgen] - pub fn get_nwc_profiles(&self) -> Result */, MutinyJsError> { + pub fn get_nwc_profiles(&self) -> Result, MutinyJsError> { let profiles = self.inner.nostr.profiles(); let p = profiles .into_iter() .map(models::NwcProfile::from) .collect::>(); - Ok(JsValue::from_serde(&p)?) + Ok(p) } /// Create a nostr wallet connect profile @@ -1333,9 +1303,7 @@ impl MutinyWallet { } /// Lists all pending NWC invoices - pub fn get_pending_nwc_invoices( - &self, - ) -> Result */, MutinyJsError> { + pub fn get_pending_nwc_invoices(&self) -> Result, MutinyJsError> { let pending: Vec = self .inner .nostr @@ -1344,7 +1312,7 @@ impl MutinyWallet { .map(|i| i.into()) .collect(); - Ok(JsValue::from_serde(&pending)?) + Ok(pending) } /// Approves an invoice and sends the payment diff --git a/mutiny-wasm/src/models.rs b/mutiny-wasm/src/models.rs index e4071ce4d..f72ea6c71 100644 --- a/mutiny-wasm/src/models.rs +++ b/mutiny-wasm/src/models.rs @@ -52,13 +52,13 @@ impl ActivityItem { } #[wasm_bindgen(getter)] - pub fn labels(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&self.labels).unwrap() + pub fn labels(&self) -> Vec { + self.labels.clone() } #[wasm_bindgen(getter)] - pub fn contacts(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&self.contacts).unwrap() + pub fn contacts(&self) -> Vec { + self.contacts.clone() } } @@ -170,8 +170,8 @@ impl MutinyInvoice { } #[wasm_bindgen(getter)] - pub fn labels(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&self.labels).unwrap() + pub fn labels(&self) -> Vec { + self.labels.clone() } } @@ -486,8 +486,8 @@ impl MutinyBip21RawMaterials { } #[wasm_bindgen(getter)] - pub fn labels(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&self.labels).unwrap() + pub fn labels(&self) -> Vec { + self.labels.clone() } } @@ -523,8 +523,8 @@ impl AuthProfile { } #[wasm_bindgen(getter)] - pub fn used_services(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&serde_json::to_value(&self.used_services).unwrap()).unwrap() + pub fn used_services(&self) -> Vec { + self.used_services.clone() } } @@ -998,8 +998,8 @@ impl NwcProfile { } #[wasm_bindgen(getter)] - pub fn active_payments(&self) -> JsValue /* Vec */ { - JsValue::from_serde(&serde_json::to_value(self._active_payments()).unwrap()).unwrap() + pub fn active_payments(&self) -> Vec { + self._active_payments().clone() } #[wasm_bindgen(getter)] @@ -1045,21 +1045,40 @@ impl From for NwcProfile { /// An invoice received over Nostr Wallet Connect that is pending approval or rejection #[derive(Debug, Clone, PartialEq, Eq, Hash, Serialize, Deserialize)] +#[wasm_bindgen] pub struct PendingNwcInvoice { /// Index of the profile that received the invoice pub index: u32, /// The invoice that awaiting approval - pub invoice: String, + invoice: String, /// The id of the invoice, this is the payment hash - pub id: String, + id: String, /// The amount of sats that the invoice is for pub amount_sats: u64, /// The description of the invoice - pub invoice_description: Option, + invoice_description: Option, /// Invoice expire time in seconds since epoch pub expiry: u64, } +#[wasm_bindgen] +impl PendingNwcInvoice { + #[wasm_bindgen(getter)] + pub fn invoice(&self) -> String { + self.invoice.clone() + } + + #[wasm_bindgen(getter)] + pub fn id(&self) -> String { + self.id.clone() + } + + #[wasm_bindgen(getter)] + pub fn invoice_description(&self) -> Option { + self.invoice_description.clone() + } +} + impl From for PendingNwcInvoice { fn from(value: nostr::nwc::PendingNwcInvoice) -> Self { let invoice_description = match value.invoice.description() {