From ef5cd28fa5b3b5c07d29672c757b1ea4dd33ea87 Mon Sep 17 00:00:00 2001 From: ok300 <106775972+ok300@users.noreply.github.com> Date: Wed, 26 Jun 2024 13:55:44 +0000 Subject: [PATCH] Add `FiatAPI` methods to Liquid SDK (#331) * Add FiatAPI methods to Liquid SDK * Add mirrored structs of fiat crate on Dart bindings * Re-generate bindings * Fix sdk-common imports * Avoid using hardcoded Breez Server URL, re-use sdk-common constant * Update Cargo.lock --------- Co-authored-by: Erdem Yerebasmaz --- cli/Cargo.lock | 379 +++++++----- cli/src/commands.rs | 12 + lib/Cargo.lock | 500 ++++++++------- .../include/breez_liquid_sdk.h | 87 +++ lib/bindings/src/breez_liquid_sdk.udl | 44 ++ lib/bindings/src/lib.rs | 19 +- lib/core/src/bindings.rs | 61 +- lib/core/src/frb_generated.io.rs | 360 +++++++++++ lib/core/src/frb_generated.rs | 581 +++++++++++++++++- lib/core/src/sdk.rs | 23 +- packages/dart/lib/src/bindings.dart | 155 +++++ packages/dart/lib/src/frb_generated.dart | 519 +++++++++++++++- packages/dart/lib/src/frb_generated.io.dart | 491 +++++++++++++++ ...utter_breez_liquid_bindings_generated.dart | 214 +++++++ .../breezliquidsdk/BreezLiquidSDKMapper.kt | 243 ++++++++ .../breezliquidsdk/BreezLiquidSDKModule.kt | 24 + .../ios/BreezLiquidSDKMapper.swift | 301 +++++++++ packages/react-native/ios/RNBreezLiquidSDK.m | 10 + .../react-native/ios/RNBreezLiquidSDK.swift | 20 + packages/react-native/src/index.ts | 48 ++ 20 files changed, 3701 insertions(+), 390 deletions(-) diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 9b377b6..6ff5e42 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -162,9 +162,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] @@ -181,9 +181,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" dependencies = [ "backtrace", ] @@ -207,7 +207,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -218,7 +218,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -272,7 +272,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower", "tower-layer", "tower-service", @@ -297,9 +297,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -452,9 +452,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -565,9 +565,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" @@ -592,9 +592,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d" [[package]] name = "cfg-if" @@ -637,9 +637,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", "clap_derive", @@ -647,9 +647,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", @@ -659,21 +659,21 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "clipboard-win" @@ -727,9 +727,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -786,7 +786,7 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -801,9 +801,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "electrum-client" @@ -915,9 +915,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1012,7 +1012,7 @@ dependencies = [ "md-5", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -1101,7 +1101,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -1168,9 +1168,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1281,9 +1281,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" [[package]] name = "hex_lit" @@ -1345,12 +1345,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -1358,9 +1358,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1429,19 +1429,20 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http 1.1.0", "hyper 1.3.1", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.10", "rustls-pki-types", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tower-service", + "webpki-roots 0.26.3", ] [[package]] @@ -1471,9 +1472,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ "bytes", "futures-channel", @@ -1564,9 +1565,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -1609,15 +1610,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libsqlite3-sys" @@ -1678,9 +1679,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1700,9 +1701,9 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lwk_common" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451ed06b50b1bb76d6a910c36039a687f891868bd199c110e78529cc2e1cf634" +checksum = "b2c34354811d24b6bfd94fce8f1d3a611e034dbc91489f6be5192c0e8cda0998" dependencies = [ "base64 0.21.7", "elements", @@ -1715,16 +1716,16 @@ dependencies = [ [[package]] name = "lwk_jade" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbe9d86bbe7584ff7081760b4476a47e2c1621a05dd9ad880c3ed5d46da1059b" +checksum = "93707e1dfd7e5eda8f13f2587376e91d6b82061bb820b0d81c1f1f9ffed5cb9a" dependencies = [ "elements", "elements-miniscript", "hex", "lwk_common", "rand", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_bytes", "serde_cbor", @@ -1765,7 +1766,7 @@ dependencies = [ "once_cell", "rand", "regex-lite", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "thiserror", @@ -1790,9 +1791,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -1813,9 +1814,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -1839,11 +1840,10 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -1870,7 +1870,7 @@ version = "0.27.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "libc", ] @@ -1896,9 +1896,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -1921,7 +1921,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1938,7 +1938,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -1949,9 +1949,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.2.3+3.2.1" +version = "300.3.1+3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" dependencies = [ "cc", ] @@ -2044,7 +2044,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2095,9 +2095,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2167,9 +2167,9 @@ dependencies = [ [[package]] name = "qrcode-rs" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4680be54420a86f28b3e662bd8f76fd270c1eed5b2e3ebe9e404c12c4ec2b066" +checksum = "312bbb0be6e357c1f8191d3c3b0f892bf2b80240d379d08d92355f1dee6afa74" [[package]] name = "querystring" @@ -2183,6 +2183,53 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.10", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +dependencies = [ + "bytes", + "rand", + "ring 0.17.8", + "rustc-hash", + "rustls 0.23.10", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "quote" version = "1.0.36" @@ -2243,9 +2290,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -2255,9 +2302,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -2266,15 +2313,15 @@ dependencies = [ [[package]] name = "regex-lite" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -2315,9 +2362,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -2339,22 +2386,23 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.10", "rustls-pemfile 2.1.2", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "system-configuration", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.1", + "webpki-roots 0.26.3", "winreg 0.52.0", ] @@ -2394,7 +2442,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2418,13 +2466,19 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2464,7 +2518,21 @@ dependencies = [ "log", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.4", "subtle", "zeroize", ] @@ -2502,9 +2570,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f344d206c5e1b010eec27349b815a4805f70a778895959d70b74b9b529b30a" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" @@ -2518,9 +2586,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -2539,7 +2607,7 @@ version = "13.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "02a2d683a4ac90aeef5b1013933f6d977bd37d51ff3f4dad829d4931a7e6be86" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "clipboard-win", "fd-lock", @@ -2564,7 +2632,7 @@ checksum = "e5af959c8bf6af1aff6d2b463a57f71aae53d1332da58419e30ad8dc7011d951" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2601,7 +2669,7 @@ dependencies = [ [[package]] name = "sdk-common" version = "0.4.2-rc3" -source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01" +source = "git+https://github.com/breez/breez-sdk?branch=main#9d44ddd5fcf4a0ee70016bbb80227196b75eb788" dependencies = [ "aes 0.8.4", "anyhow", @@ -2730,18 +2798,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.14" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] @@ -2758,20 +2826,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" dependencies = [ "itoa", "ryu", @@ -2854,14 +2922,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -2876,9 +2944,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -2891,6 +2959,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -2935,22 +3009,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2964,9 +3038,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" dependencies = [ "tinyvec_macros", ] @@ -2979,9 +3053,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", @@ -3006,13 +3080,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3038,11 +3112,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.10", "rustls-pki-types", "tokio", ] @@ -3173,7 +3247,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3187,7 +3260,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3270,9 +3343,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "universal-hash" @@ -3309,18 +3382,18 @@ dependencies = [ "once_cell", "rustls 0.22.4", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", "serde", "serde_json", "url", - "webpki-roots 0.26.1", + "webpki-roots 0.26.3", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna 0.5.0", @@ -3335,9 +3408,9 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vcpkg" @@ -3387,7 +3460,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -3421,7 +3494,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3484,9 +3557,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] @@ -3719,11 +3792,11 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/cli/src/commands.rs b/cli/src/commands.rs index c2da74a..be69c09 100644 --- a/cli/src/commands.rs +++ b/cli/src/commands.rs @@ -106,6 +106,10 @@ pub(crate) enum Command { /// LNURL-auth endpoint lnurl: String, }, + /// List fiat currencies + ListFiat {}, + /// Fetch available fiat rates + FetchFiatRates {}, } #[derive(Helper, Completer, Hinter, Validator)] @@ -376,6 +380,14 @@ pub(crate) async fn handle_command( command_result!(res) } + Command::FetchFiatRates {} => { + let res = sdk.fetch_fiat_rates().await?; + command_result!(res) + } + Command::ListFiat {} => { + let res = sdk.list_fiat_currencies().await?; + command_result!(res) + } }) } diff --git a/lib/Cargo.lock b/lib/Cargo.lock index 47298be..51cdb6f 100644 --- a/lib/Cargo.lock +++ b/lib/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -162,9 +162,9 @@ dependencies = [ [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "ad186efb764318d35165f1758e7dcef3b10628e26d41a44bc5550652e6804391" dependencies = [ "windows-sys 0.52.0", ] @@ -181,9 +181,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" dependencies = [ "backtrace", ] @@ -233,7 +233,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -287,7 +287,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -298,7 +298,7 @@ checksum = "c6fa2087f2753a7da8cc1c0dbfcf89579dd57458e36769de5ac750b4671737ca" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -352,7 +352,7 @@ dependencies = [ "pin-project-lite", "rustversion", "serde", - "sync_wrapper", + "sync_wrapper 0.1.2", "tower", "tower-layer", "tower-service", @@ -377,9 +377,9 @@ dependencies = [ [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -572,9 +572,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -669,7 +669,7 @@ dependencies = [ "once_cell", "thiserror", "tokio", - "uniffi 0.27.1", + "uniffi 0.27.3", "uniffi_bindgen 0.25.3", "uniffi_bindgen_kotlin_multiplatform", ] @@ -688,9 +688,9 @@ checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" [[package]] name = "bytemuck" -version = "1.15.0" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6d68c57235a3a081186990eca2867354726650f42f7516ca50c28d6281fd15" +checksum = "b236fc92302c97ed75b38da1f4917b5cdda4984745740f153a5d3059e48d725e" [[package]] name = "byteorder" @@ -706,9 +706,9 @@ checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" [[package]] name = "camino" -version = "1.1.6" +version = "1.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c59e92b5a388f549b863a7bea62612c09f24c8393560709a54558a9abdfb3b9c" +checksum = "e0ec6b951b160caa93cc0c7b209e5a3bff7aae9062213451ac99493cd844c239" dependencies = [ "serde", ] @@ -747,9 +747,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.0.101" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "ac367972e516d45567c7eafc73d24e1c193dcf200a8d94e9db7b3d38b349572d" [[package]] name = "cfg-if" @@ -809,23 +809,23 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "5db83dced34638ad474f39f250d7fea9598bdd239eaced1bdf45d597da0f433f" dependencies = [ "clap_builder", - "clap_derive 4.5.4", + "clap_derive 4.5.5", ] [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "f7e204572485eb3fbf28f871612191521df159bc3e15a9f5064c66dba3a8c05f" dependencies = [ "anstream", "anstyle", - "clap_lex 0.7.0", + "clap_lex 0.7.1", "strsim 0.11.1", ] @@ -844,14 +844,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "c780290ccf4fb26629baa7a1081e68ced113f1d3ec302fa5948f1c381ebf06c6" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -865,9 +865,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "4b82cf0babdbd58558212896d1a4272303a57bdb245c2bf1147185fb45640e70" [[package]] name = "colorchoice" @@ -912,9 +912,9 @@ dependencies = [ [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -971,7 +971,7 @@ checksum = "51aac4c99b2e6775164b412ea33ae8441b2fde2dbf05a20bc0052a63d08c475b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -986,9 +986,9 @@ dependencies = [ [[package]] name = "either" -version = "1.12.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dca9240753cf90908d7e4aac30f630662b02aebaa1b58a3cadabdb23385b58b" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "electrum-client" @@ -1094,9 +1094,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1174,7 +1174,7 @@ dependencies = [ "md-5", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -1278,7 +1278,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -1345,9 +1345,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "glob" @@ -1480,9 +1480,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hex-conservative" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" +checksum = "212ab92002354b4819390025006c897e8140934349e8635c9b077f47b4dcbd20" [[package]] name = "hex_lit" @@ -1544,12 +1544,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http 1.1.0", "http-body 1.0.0", "pin-project-lite", @@ -1557,9 +1557,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1628,19 +1628,20 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.26.0" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0bea761b46ae2b24eb4aef630d8d1c398157b6fc29e6350ecf090a0b70c952c" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" dependencies = [ "futures-util", "http 1.1.0", "hyper 1.3.1", "hyper-util", - "rustls 0.22.4", + "rustls 0.23.10", "rustls-pki-types", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tower-service", + "webpki-roots 0.26.3", ] [[package]] @@ -1670,9 +1671,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "7b875924a60b96e5d7b9ae7b066540b1dd1cbd90d1828f54c92e02a283351c56" dependencies = [ "bytes", "futures-channel", @@ -1733,18 +1734,18 @@ dependencies = [ [[package]] name = "include_dir" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" +checksum = "923d117408f1e49d914f1a379a309cffe4f18c05cf4e3d12e613a15fc81bd0dd" dependencies = [ "include_dir_macros", ] [[package]] name = "include_dir_macros" -version = "0.7.3" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" +checksum = "7cab85a7ed0bd5f0e76d93846e0147172bed2e2d3f859bcc33a8d9699cad1a75" dependencies = [ "proc-macro2", "quote", @@ -1782,9 +1783,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", ] @@ -1827,15 +1828,15 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libsqlite3-sys" @@ -1896,9 +1897,9 @@ dependencies = [ [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1918,9 +1919,9 @@ checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" [[package]] name = "lwk_common" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451ed06b50b1bb76d6a910c36039a687f891868bd199c110e78529cc2e1cf634" +checksum = "b2c34354811d24b6bfd94fce8f1d3a611e034dbc91489f6be5192c0e8cda0998" dependencies = [ "base64 0.21.7", "elements", @@ -1933,16 +1934,16 @@ dependencies = [ [[package]] name = "lwk_jade" -version = "0.5.0" +version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbe9d86bbe7584ff7081760b4476a47e2c1621a05dd9ad880c3ed5d46da1059b" +checksum = "93707e1dfd7e5eda8f13f2587376e91d6b82061bb820b0d81c1f1f9ffed5cb9a" dependencies = [ "elements", "elements-miniscript", "hex", "lwk_common", "rand 0.8.5", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_bytes", "serde_cbor", @@ -1983,7 +1984,7 @@ dependencies = [ "once_cell", "rand 0.8.5", "regex-lite", - "reqwest 0.12.4", + "reqwest 0.12.5", "serde", "serde_json", "thiserror", @@ -2008,9 +2009,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -2047,9 +2048,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -2073,11 +2074,10 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2120,9 +2120,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434" dependencies = [ "memchr", ] @@ -2133,12 +2133,6 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" -[[package]] -name = "oneshot-uniffi" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c548d5c78976f6955d72d0ced18c48ca07030f7a1d4024529fedd7c1c01b29c" - [[package]] name = "opaque-debug" version = "0.3.1" @@ -2151,7 +2145,7 @@ version = "0.10.64" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2168,7 +2162,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2179,9 +2173,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-src" -version = "300.2.3+3.2.1" +version = "300.3.1+3.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cff92b6f71555b61bb9315f7c64da3ca43d87531622120fea0195fc761b4843" +checksum = "7259953d42a81bf137fbbd73bd30a8e1914d6dce43c2b90ed575783a22608b91" dependencies = [ "cc", ] @@ -2229,9 +2223,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core 0.9.10", @@ -2259,7 +2253,7 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.1", + "redox_syscall 0.5.2", "smallvec", "windows-targets 0.52.5", ] @@ -2309,7 +2303,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2390,9 +2384,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2472,6 +2466,53 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4ceeeeabace7857413798eb1ffa1e9c905a9946a57d81fb69b4b71c4d8eb3ad" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls 0.23.10", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddf517c03a109db8100448a4be38d498df8a210a99fe0e1b9eaf39e78c640efe" +dependencies = [ + "bytes", + "rand 0.8.5", + "ring 0.17.8", + "rustc-hash", + "rustls 0.23.10", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9096629c45860fc7fb143e125eb826b5e721e10be3263160c7d60ca832cf8c46" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.52.0", +] + [[package]] name = "quote" version = "1.0.36" @@ -2559,18 +2600,18 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "c82cf8cff14456045f55ec4241383baeff27af886adb72ffb2162f99911de0fd" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] name = "regex" -version = "1.10.4" +version = "1.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "b91213439dad192326a0d7c6ee3955910425f441d7038e0d6933b0aec5c4517f" dependencies = [ "aho-corasick", "memchr", @@ -2580,9 +2621,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -2591,15 +2632,15 @@ dependencies = [ [[package]] name = "regex-lite" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30b661b2f27137bdbc16f00eda72866a92bb28af1753ffbd56744fb6e2e9cd8e" +checksum = "53a49587ad06b26609c52e423de037e7f57f20d53535d66e08c695f347df952a" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "remove_dir_all" @@ -2649,9 +2690,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "c7d6d2a27d57148378eb5e111173f4276ad26340ecc5c49a4a2152167a2d6a37" dependencies = [ "base64 0.22.1", "bytes", @@ -2673,22 +2714,23 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls 0.22.4", + "quinn", + "rustls 0.23.10", "rustls-pemfile 2.1.2", "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", - "sync_wrapper", + "sync_wrapper 1.0.1", "system-configuration", "tokio", - "tokio-rustls 0.25.0", + "tokio-rustls 0.26.0", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots 0.26.1", + "webpki-roots 0.26.3", "winreg 0.52.0", ] @@ -2728,7 +2770,7 @@ version = "0.31.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b838eba278d213a8beaf485bd313fd580ca4505a00d5871caeb1457c55322cae" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "fallible-iterator", "fallible-streaming-iterator", "hashlink", @@ -2752,13 +2794,19 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + [[package]] name = "rustix" version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2798,7 +2846,21 @@ dependencies = [ "log", "ring 0.17.8", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls" +version = "0.23.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05cff451f60db80f490f3c182b77c35260baace73209e9cdbbe526bfe3a4d402" +dependencies = [ + "once_cell", + "ring 0.17.8", + "rustls-pki-types", + "rustls-webpki 0.102.4", "subtle", "zeroize", ] @@ -2836,9 +2898,9 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.6.0" +version = "1.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51f344d206c5e1b010eec27349b815a4805f70a778895959d70b74b9b529b30a" +checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" [[package]] name = "rustls-webpki" @@ -2852,9 +2914,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.102.3" +version = "0.102.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3bce581c0dd41bce533ce695a1437fa16a7ab5ac3ccfa99fe1a620a7885eabf" +checksum = "ff448f7e92e913c4b7d4c6d8e4540a1724b319b4152b8aef6d4cf8339712b33e" dependencies = [ "ring 0.17.8", "rustls-pki-types", @@ -2914,7 +2976,7 @@ checksum = "1db149f81d46d2deba7cd3c50772474707729550221e69588478ebf9ada425ae" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2925,7 +2987,7 @@ checksum = "7f81c2fde025af7e69b1d1420531c8a8811ca898919db177141a85313b1cb932" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -2941,7 +3003,7 @@ dependencies = [ [[package]] name = "sdk-common" version = "0.4.2-rc3" -source = "git+https://github.com/breez/breez-sdk?branch=main#3ddd68cdc524a4a640463f687f4e4d819069de01" +source = "git+https://github.com/breez/breez-sdk?branch=main#9d44ddd5fcf4a0ee70016bbb80227196b75eb788" dependencies = [ "aes 0.8.4", "anyhow", @@ -3079,18 +3141,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddc6f9cc94d67c0e21aaf7eda3a010fd3af78ebf6e096aa6e2e13c79749cce4f" +checksum = "7253ab4de971e72fb7be983802300c30b5a7f0c2e56fab8abfc6a214307c0094" dependencies = [ "serde_derive", ] [[package]] name = "serde_bytes" -version = "0.11.14" +version = "0.11.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b8497c313fd43ab992087548117643f6fcd935cbf36f176ffda0aacf9591734" +checksum = "387cc504cb06bb40a96c8e04e951fe01854cf6bc921053c954e4a606d9675c6a" dependencies = [ "serde", ] @@ -3107,20 +3169,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.200" +version = "1.0.203" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "856f046b9400cee3c8c94ed572ecdb752444c24528c035cd35882aad6f492bcb" +checksum = "500cbc0ebeb6f46627f50f3f5811ccf6bf00643be300b4c3eabc0ef55dc5b5ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.118" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "d947f6b3163d8857ea16c4fa0dd4840d52f3041039a85decd46867eb1abef2e4" dependencies = [ "itoa", "ryu", @@ -3236,14 +3298,14 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -3258,9 +3320,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.61" +version = "2.0.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c993ed8ccba56ae856363b1845da7266a7cb78e1d146c8a32d54b45a8b831fc9" +checksum = "901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9" dependencies = [ "proc-macro2", "quote", @@ -3273,6 +3335,12 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" + [[package]] name = "system-configuration" version = "0.5.1" @@ -3332,28 +3400,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" dependencies = [ "smawk", - "unicode-linebreak", - "unicode-width", ] [[package]] name = "thiserror" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "579e9083ca58dd9dcf91a9923bb9054071b9ebbd800b342194c9feb0ee89fc18" +checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.60" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2470041c06ec3ac1ab38d0356a6119054dedaea53e12fbefc0de730a1c08524" +checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3367,9 +3433,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "c55115c6fbe2d2bef26eb09ad74bde02d8255476fc0c7b515ef09fbb35742d82" dependencies = [ "tinyvec_macros", ] @@ -3382,16 +3448,16 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.38.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "ba4f4a02a7a80d6f274636f0aa95c7e383b912d41fe721a31f29e29698585a4a" dependencies = [ "backtrace", "bytes", "libc", "mio", "num_cpus", - "parking_lot 0.12.2", + "parking_lot 0.12.3", "pin-project-lite", "signal-hook-registry", "socket2", @@ -3411,13 +3477,13 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "5f5ae998a069d4b5aba8ee9dad856af7d520c3699e6159b185c2acd48155d39a" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3443,11 +3509,11 @@ dependencies = [ [[package]] name = "tokio-rustls" -version = "0.25.0" +version = "0.26.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775e0c0f0adb3a2f22a00c4745d728b479985fc15ee7ca6a2608388c5569860f" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" dependencies = [ - "rustls 0.22.4", + "rustls 0.23.10", "rustls-pki-types", "tokio", ] @@ -3587,7 +3653,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3601,7 +3666,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3676,12 +3741,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-linebreak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" - [[package]] name = "unicode-normalization" version = "0.1.22" @@ -3691,12 +3750,6 @@ dependencies = [ "tinyvec", ] -[[package]] -name = "unicode-width" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" - [[package]] name = "uniffi" version = "0.23.0" @@ -3713,17 +3766,17 @@ dependencies = [ [[package]] name = "uniffi" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5566fae48a5cb017005bf9cd622af5236b2a203a13fb548afde3506d3c68277" +checksum = "cb3a4c447c50fcda7bc5604a8588b7e1f37ffbfd8838a1516a290398efa7c6f0" dependencies = [ "anyhow", "camino", - "clap 4.5.4", - "uniffi_bindgen 0.27.1", - "uniffi_build 0.27.1", - "uniffi_core 0.27.1", - "uniffi_macros 0.27.1", + "clap 4.5.7", + "uniffi_bindgen 0.27.3", + "uniffi_build 0.27.3", + "uniffi_core 0.27.3", + "uniffi_macros 0.27.3", ] [[package]] @@ -3775,15 +3828,15 @@ dependencies = [ [[package]] name = "uniffi_bindgen" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a77bb514bcd4bf27c9bd404d7c3f2a6a8131b957eba9c22cfeb7751c4278e09" +checksum = "0be2bc6bafd82c979b0faca77c7b26630d54017de9f5bd5a686ec6ef038ad5d9" dependencies = [ "anyhow", "askama 0.12.1", "camino", "cargo_metadata", - "clap 4.5.4", + "clap 4.5.7", "fs-err", "glob", "goblin 0.8.2", @@ -3793,9 +3846,9 @@ dependencies = [ "serde", "textwrap", "toml", - "uniffi_meta 0.27.1", - "uniffi_testing 0.27.1", - "uniffi_udl 0.27.1", + "uniffi_meta 0.27.3", + "uniffi_testing 0.27.3", + "uniffi_udl 0.27.3", ] [[package]] @@ -3806,7 +3859,7 @@ dependencies = [ "anyhow", "askama 0.12.1", "camino", - "clap 4.5.4", + "clap 4.5.7", "heck 0.4.1", "include_dir", "paste", @@ -3828,13 +3881,13 @@ dependencies = [ [[package]] name = "uniffi_build" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45cba427aeb7b3a8b54830c4c915079a7a3c62608dd03dddba1d867a8a023eb4" +checksum = "1c59b65d59685ff3a10569287c6419f76487b4052ac52d5a0df38b2253d7f440" dependencies = [ "anyhow", "camino", - "uniffi_bindgen 0.27.1", + "uniffi_bindgen 0.27.3", ] [[package]] @@ -3854,17 +3907,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55137c122f712d9330fd985d66fa61bdc381752e89c35708c13ce63049a3002c" dependencies = [ "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "uniffi_checksum_derive" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae7e5a6c33b1dec3f255f57ec0b6af0f0b2bb3021868be1d5eec7a38e2905ebc" +checksum = "d5c400339a9d1d17be34257d0b407e91d64af335e5b4fa49f4bf28467fc8d635" dependencies = [ "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] @@ -3885,16 +3938,15 @@ dependencies = [ [[package]] name = "uniffi_core" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ea3eb5474d50fc149b7e4d86b9c5bd4a61dcc167f0683902bf18ae7bbb3deef" +checksum = "a02e67ac9634b10da9e4aa63a29a7920b8f1395eafef1ea659b2dd76dda96906" dependencies = [ "anyhow", "bytes", "camino", "log", "once_cell", - "oneshot-uniffi", "paste", "static_assertions", ] @@ -3920,9 +3972,9 @@ dependencies = [ [[package]] name = "uniffi_macros" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18331d35003f46f0d04047fbe4227291815b83a937a8c32bc057f990962182c4" +checksum = "b6f08d5592c669b80a8af5066027098bebec4b4af17a9b8b299bac5f518ab89e" dependencies = [ "bincode", "camino", @@ -3931,9 +3983,9 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.61", + "syn 2.0.68", "toml", - "uniffi_meta 0.27.1", + "uniffi_meta 0.27.3", ] [[package]] @@ -3961,14 +4013,14 @@ dependencies = [ [[package]] name = "uniffi_meta" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7224422c4cfd181c7ca9fca2154abca4d21db962f926f270f996edd38b0c4b8" +checksum = "583bab49f2bdf5681f9732f8b67a7e555ad920dbb5427be21450217bf1818189" dependencies = [ "anyhow", "bytes", "siphasher", - "uniffi_checksum_derive 0.27.1", + "uniffi_checksum_derive 0.27.3", ] [[package]] @@ -4001,9 +4053,9 @@ dependencies = [ [[package]] name = "uniffi_testing" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8ce878d0bdfc288b58797044eaaedf748526c56eef3575380bb4d4b19d69eee" +checksum = "13963044ca9bde9b709d2eee68bc11dafc7acea144ae0fdc0cf29ed4add44481" dependencies = [ "anyhow", "camino", @@ -4026,14 +4078,14 @@ dependencies = [ [[package]] name = "uniffi_udl" -version = "0.27.1" +version = "0.27.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c43c9ed40a8d20a5c3eae2d23031092db6b96dc8e571beb449ba9757484cea0" +checksum = "b92f984bb0d9a06778f256aec963e1e9a80714014f7a90fb0e01008821fe5a97" dependencies = [ "anyhow", "textwrap", - "uniffi_meta 0.27.1", - "uniffi_testing 0.27.1", + "uniffi_meta 0.27.3", + "uniffi_testing 0.27.3", "weedle2 5.0.0", ] @@ -4072,18 +4124,18 @@ dependencies = [ "once_cell", "rustls 0.22.4", "rustls-pki-types", - "rustls-webpki 0.102.3", + "rustls-webpki 0.102.4", "serde", "serde_json", "url", - "webpki-roots 0.26.1", + "webpki-roots 0.26.3", ] [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna 0.5.0", @@ -4098,15 +4150,15 @@ checksum = "09cc8ee72d2a9becf2f2febe0205bbed8fc6615b7cb429ad062dc7b7ddd036a9" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.8.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a183cf7feeba97b4dd1c0d46788634f6221d87fa961b305bed08c851829efcc0" +checksum = "5de17fd2f7da591098415cff336e12965a28061ddace43b59cb3c430179c9439" dependencies = [ "getrandom", ] @@ -4159,7 +4211,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", "wasm-bindgen-shared", ] @@ -4193,7 +4245,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4256,9 +4308,9 @@ checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "webpki-roots" -version = "0.26.1" +version = "0.26.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3de34ae270483955a94f4b21bdaaeb83d508bb84a01435f393818edb0012009" +checksum = "bd7c23921eeb1713a4e851530e9b9756e4fb0e89978582942612524cf09f01cd" dependencies = [ "rustls-pki-types", ] @@ -4509,11 +4561,11 @@ checksum = "15e934569e47891f7d9411f1a451d947a60e000ab3bd24fbb970f000387d1b3b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.61", + "syn 2.0.68", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/lib/bindings/langs/flutter/breez_liquid_sdk/include/breez_liquid_sdk.h b/lib/bindings/langs/flutter/breez_liquid_sdk/include/breez_liquid_sdk.h index 14150ce..136c96c 100644 --- a/lib/bindings/langs/flutter/breez_liquid_sdk/include/breez_liquid_sdk.h +++ b/lib/bindings/langs/flutter/breez_liquid_sdk/include/breez_liquid_sdk.h @@ -329,11 +329,69 @@ typedef struct wire_cst_ln_url_withdraw_success_data { struct wire_cst_ln_invoice invoice; } wire_cst_ln_url_withdraw_success_data; +typedef struct wire_cst_symbol { + struct wire_cst_list_prim_u_8_strict *grapheme; + struct wire_cst_list_prim_u_8_strict *template_; + bool *rtl; + uint32_t *position; +} wire_cst_symbol; + +typedef struct wire_cst_localized_name { + struct wire_cst_list_prim_u_8_strict *locale; + struct wire_cst_list_prim_u_8_strict *name; +} wire_cst_localized_name; + +typedef struct wire_cst_list_localized_name { + struct wire_cst_localized_name *ptr; + int32_t len; +} wire_cst_list_localized_name; + +typedef struct wire_cst_locale_overrides { + struct wire_cst_list_prim_u_8_strict *locale; + uint32_t *spacing; + struct wire_cst_symbol symbol; +} wire_cst_locale_overrides; + +typedef struct wire_cst_list_locale_overrides { + struct wire_cst_locale_overrides *ptr; + int32_t len; +} wire_cst_list_locale_overrides; + +typedef struct wire_cst_currency_info { + struct wire_cst_list_prim_u_8_strict *name; + uint32_t fraction_size; + uint32_t *spacing; + struct wire_cst_symbol *symbol; + struct wire_cst_symbol *uniq_symbol; + struct wire_cst_list_localized_name *localized_name; + struct wire_cst_list_locale_overrides *locale_overrides; +} wire_cst_currency_info; + +typedef struct wire_cst_fiat_currency { + struct wire_cst_list_prim_u_8_strict *id; + struct wire_cst_currency_info info; +} wire_cst_fiat_currency; + +typedef struct wire_cst_list_fiat_currency { + struct wire_cst_fiat_currency *ptr; + int32_t len; +} wire_cst_list_fiat_currency; + typedef struct wire_cst_list_payment { struct wire_cst_payment *ptr; int32_t len; } wire_cst_list_payment; +typedef struct wire_cst_rate { + struct wire_cst_list_prim_u_8_strict *coin; + double value; +} wire_cst_rate; + +typedef struct wire_cst_list_rate { + struct wire_cst_rate *ptr; + int32_t len; +} wire_cst_list_rate; + typedef struct wire_cst_refundable_swap { struct wire_cst_list_prim_u_8_strict *swap_address; uint32_t timestamp; @@ -680,9 +738,15 @@ void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_disconnect(int6 WireSyncRust2DartDco frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_empty_wallet_cache(uintptr_t that); +void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates(int64_t port_, + uintptr_t that); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info(int64_t port_, uintptr_t that); +void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies(int64_t port_, + uintptr_t that); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_payments(int64_t port_, uintptr_t that); @@ -778,6 +842,8 @@ struct wire_cst_binding_event_listener *frbgen_breez_liquid_cst_new_box_autoadd_ struct wire_cst_bitcoin_address_data *frbgen_breez_liquid_cst_new_box_autoadd_bitcoin_address_data(void); +bool *frbgen_breez_liquid_cst_new_box_autoadd_bool(bool value); + struct wire_cst_connect_request *frbgen_breez_liquid_cst_new_box_autoadd_connect_request(void); struct wire_cst_liquid_sdk_event *frbgen_breez_liquid_cst_new_box_autoadd_liquid_sdk_event(void); @@ -830,14 +896,26 @@ struct wire_cst_restore_request *frbgen_breez_liquid_cst_new_box_autoadd_restore struct wire_cst_success_action_processed *frbgen_breez_liquid_cst_new_box_autoadd_success_action_processed(void); +struct wire_cst_symbol *frbgen_breez_liquid_cst_new_box_autoadd_symbol(void); + +uint32_t *frbgen_breez_liquid_cst_new_box_autoadd_u_32(uint32_t value); + uint64_t *frbgen_breez_liquid_cst_new_box_autoadd_u_64(uint64_t value); struct wire_cst_url_success_action_data *frbgen_breez_liquid_cst_new_box_autoadd_url_success_action_data(void); +struct wire_cst_list_fiat_currency *frbgen_breez_liquid_cst_new_list_fiat_currency(int32_t len); + +struct wire_cst_list_locale_overrides *frbgen_breez_liquid_cst_new_list_locale_overrides(int32_t len); + +struct wire_cst_list_localized_name *frbgen_breez_liquid_cst_new_list_localized_name(int32_t len); + struct wire_cst_list_payment *frbgen_breez_liquid_cst_new_list_payment(int32_t len); struct wire_cst_list_prim_u_8_strict *frbgen_breez_liquid_cst_new_list_prim_u_8_strict(int32_t len); +struct wire_cst_list_rate *frbgen_breez_liquid_cst_new_list_rate(int32_t len); + struct wire_cst_list_refundable_swap *frbgen_breez_liquid_cst_new_list_refundable_swap(int32_t len); struct wire_cst_list_route_hint *frbgen_breez_liquid_cst_new_list_route_hint(int32_t len); @@ -850,6 +928,7 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_backup_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_binding_event_listener); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_bitcoin_address_data); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_bool); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_connect_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_liquid_sdk_event); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_ln_invoice); @@ -876,10 +955,16 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_refund_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_restore_request); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_success_action_processed); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_symbol); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_32); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_u_64); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_box_autoadd_url_success_action_data); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_fiat_currency); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_locale_overrides); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_localized_name); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_payment); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_prim_u_8_strict); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_rate); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_refundable_swap); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_route_hint); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_cst_new_list_route_hint_hop); @@ -889,7 +974,9 @@ static int64_t dummy_method_to_enforce_bundling(void) { dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_backup); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_disconnect); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_empty_wallet_cache); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info); + dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_payments); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_refundables); dummy_var ^= ((int64_t) (void*) frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_lnurl_auth); diff --git a/lib/bindings/src/breez_liquid_sdk.udl b/lib/bindings/src/breez_liquid_sdk.udl index 0c7b9bb..a0209d4 100644 --- a/lib/bindings/src/breez_liquid_sdk.udl +++ b/lib/bindings/src/breez_liquid_sdk.udl @@ -191,6 +191,44 @@ interface LnUrlAuthError { ServiceConnectivity(string err); }; +dictionary Rate { + string coin; + f64 value; +}; + +dictionary FiatCurrency { + string id; + CurrencyInfo info; +}; + +dictionary Symbol { + string? grapheme; + string? template; + boolean? rtl; + u32? position; +}; + +dictionary LocaleOverrides { + string locale; + u32? spacing; + Symbol symbol; +}; + +dictionary LocalizedName { + string locale; + string name; +}; + +dictionary CurrencyInfo { + string name; + u32 fraction_size; + u32? spacing; + Symbol? symbol; + Symbol? uniq_symbol; + sequence localized_name; + sequence locale_overrides; +}; + // END sdk-common mirror imports //////////////////////////////// @@ -498,4 +536,10 @@ interface BindingLiquidSdk { [Throws=LnUrlAuthError] LnUrlCallbackStatus lnurl_auth(LnUrlAuthRequestData req_data); + + [Throws=LiquidSdkError] + sequence fetch_fiat_rates(); + + [Throws=LiquidSdkError] + sequence list_fiat_currencies(); }; diff --git a/lib/bindings/src/lib.rs b/lib/bindings/src/lib.rs index aa52c12..36d12d3 100644 --- a/lib/bindings/src/lib.rs +++ b/lib/bindings/src/lib.rs @@ -6,11 +6,12 @@ use anyhow::Result; use breez_liquid_sdk::logger::Logger; use breez_liquid_sdk::{ error::*, model::*, sdk::LiquidSdk, AesSuccessActionDataDecrypted, AesSuccessActionDataResult, - BitcoinAddressData, InputType, LNInvoice, LnUrlAuthError, LnUrlAuthRequestData, - LnUrlCallbackStatus, LnUrlErrorData, LnUrlPayError, LnUrlPayErrorData, LnUrlPayRequest, - LnUrlPayRequestData, LnUrlWithdrawError, LnUrlWithdrawRequest, LnUrlWithdrawRequestData, - LnUrlWithdrawResult, LnUrlWithdrawSuccessData, MessageSuccessActionData, Network, RouteHint, - RouteHintHop, SuccessActionProcessed, UrlSuccessActionData, + BitcoinAddressData, CurrencyInfo, FiatCurrency, InputType, LNInvoice, LnUrlAuthError, + LnUrlAuthRequestData, LnUrlCallbackStatus, LnUrlErrorData, LnUrlPayError, LnUrlPayErrorData, + LnUrlPayRequest, LnUrlPayRequestData, LnUrlWithdrawError, LnUrlWithdrawRequest, + LnUrlWithdrawRequestData, LnUrlWithdrawResult, LnUrlWithdrawSuccessData, LocaleOverrides, + LocalizedName, MessageSuccessActionData, Network, Rate, RouteHint, RouteHintHop, + SuccessActionProcessed, Symbol, UrlSuccessActionData, }; use log::{Metadata, Record, SetLoggerError}; use once_cell::sync::Lazy; @@ -169,6 +170,14 @@ impl BindingLiquidSdk { rt().block_on(self.sdk.lnurl_auth(req_data)) } + pub fn fetch_fiat_rates(&self) -> Result, LiquidSdkError> { + rt().block_on(self.sdk.fetch_fiat_rates()) + } + + pub fn list_fiat_currencies(&self) -> Result, LiquidSdkError> { + rt().block_on(self.sdk.list_fiat_currencies()) + } + pub fn list_refundables(&self) -> LiquidSdkResult> { rt().block_on(self.sdk.list_refundables()) } diff --git a/lib/core/src/bindings.rs b/lib/core/src/bindings.rs index 9a257bf..a060daa 100644 --- a/lib/core/src/bindings.rs +++ b/lib/core/src/bindings.rs @@ -6,10 +6,11 @@ use anyhow::Result; use flutter_rust_bridge::frb; use log::{Level, LevelFilter, Metadata, Record, SetLoggerError}; pub use sdk_common::prelude::{ - AesSuccessActionDataDecrypted, AesSuccessActionDataResult, BitcoinAddressData, InputType, - LNInvoice, LnUrlAuthRequestData, LnUrlErrorData, LnUrlPayErrorData, LnUrlPayRequest, - LnUrlPayRequestData, LnUrlWithdrawRequest, LnUrlWithdrawRequestData, MessageSuccessActionData, - Network, RouteHint, RouteHintHop, SuccessActionProcessed, UrlSuccessActionData, + AesSuccessActionDataDecrypted, AesSuccessActionDataResult, BitcoinAddressData, CurrencyInfo, + FiatCurrency, InputType, LNInvoice, LnUrlAuthRequestData, LnUrlErrorData, LnUrlPayErrorData, + LnUrlPayRequest, LnUrlPayRequestData, LnUrlWithdrawRequest, LnUrlWithdrawRequestData, + LocaleOverrides, LocalizedName, MessageSuccessActionData, Network, Rate, RouteHint, + RouteHintHop, SuccessActionProcessed, Symbol, UrlSuccessActionData, }; use crate::{error::*, frb_generated::StreamSink, model::*, sdk::LiquidSdk}; @@ -186,6 +187,14 @@ impl BindingLiquidSdk { .map_err(Into::into) } + pub async fn fetch_fiat_rates(&self) -> Result, LiquidSdkError> { + self.sdk.fetch_fiat_rates().await + } + + pub async fn list_fiat_currencies(&self) -> Result, LiquidSdkError> { + self.sdk.list_fiat_currencies().await + } + pub async fn list_refundables(&self) -> Result, LiquidSdkError> { self.sdk.list_refundables().await } @@ -378,6 +387,50 @@ pub struct _LnUrlWithdrawRequest { pub description: Option, } +#[frb(mirror(Rate))] +pub struct _Rate { + pub coin: String, + pub value: f64, +} + +#[frb(mirror(FiatCurrency))] +pub struct _FiatCurrency { + pub id: String, + pub info: CurrencyInfo, +} + +#[frb(mirror(CurrencyInfo))] +pub struct _CurrencyInfo { + pub name: String, + pub fraction_size: u32, + pub spacing: Option, + pub symbol: Option, + pub uniq_symbol: Option, + pub localized_name: Vec, + pub locale_overrides: Vec, +} + +#[frb(mirror(LocaleOverrides))] +pub struct _LocaleOverrides { + pub locale: String, + pub spacing: Option, + pub symbol: Symbol, +} + +#[frb(mirror(LocalizedName))] +pub struct _LocalizedName { + pub locale: String, + pub name: String, +} + +#[frb(mirror(Symbol))] +pub struct _Symbol { + pub grapheme: Option, + pub template: Option, + pub rtl: Option, + pub position: Option, +} + /// External structs that cannot be mirrored for FRB, so are therefore duplicated instead pub mod duplicates { use sdk_common::prelude::*; diff --git a/lib/core/src/frb_generated.io.rs b/lib/core/src/frb_generated.io.rs index 4d0aac0..397c329 100644 --- a/lib/core/src/frb_generated.io.rs +++ b/lib/core/src/frb_generated.io.rs @@ -181,6 +181,12 @@ impl CstDecode for *mut wire_cst_bitcoin_ad CstDecode::::cst_decode(*wrap).into() } } +impl CstDecode for *mut bool { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> bool { + unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) } + } +} impl CstDecode for *mut wire_cst_connect_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::model::ConnectRequest { @@ -373,6 +379,19 @@ impl CstDecode for *mut wire_cst_succes CstDecode::::cst_decode(*wrap).into() } } +impl CstDecode for *mut wire_cst_symbol { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::Symbol { + let wrap = unsafe { flutter_rust_bridge::for_generated::box_from_leak_ptr(self) }; + CstDecode::::cst_decode(*wrap).into() + } +} +impl CstDecode for *mut u32 { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> u32 { + unsafe { *flutter_rust_bridge::for_generated::box_from_leak_ptr(self) } + } +} impl CstDecode for *mut u64 { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> u64 { @@ -409,6 +428,29 @@ impl CstDecode for wire_cst_connect_request { } } } +impl CstDecode for wire_cst_currency_info { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::CurrencyInfo { + crate::bindings::CurrencyInfo { + name: self.name.cst_decode(), + fraction_size: self.fraction_size.cst_decode(), + spacing: self.spacing.cst_decode(), + symbol: self.symbol.cst_decode(), + uniq_symbol: self.uniq_symbol.cst_decode(), + localized_name: self.localized_name.cst_decode(), + locale_overrides: self.locale_overrides.cst_decode(), + } + } +} +impl CstDecode for wire_cst_fiat_currency { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::FiatCurrency { + crate::bindings::FiatCurrency { + id: self.id.cst_decode(), + info: self.info.cst_decode(), + } + } +} impl CstDecode for wire_cst_get_info_response { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::model::GetInfoResponse { @@ -543,6 +585,36 @@ impl CstDecode for wire_cst_liquid_sdk_event { } } } +impl CstDecode> for *mut wire_cst_list_fiat_currency { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} +impl CstDecode> for *mut wire_cst_list_locale_overrides { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} +impl CstDecode> for *mut wire_cst_list_localized_name { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} impl CstDecode> for *mut wire_cst_list_payment { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> Vec { @@ -562,6 +634,16 @@ impl CstDecode> for *mut wire_cst_list_prim_u_8_strict { } } } +impl CstDecode> for *mut wire_cst_list_rate { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> Vec { + let vec = unsafe { + let wrap = flutter_rust_bridge::for_generated::box_from_leak_ptr(self); + flutter_rust_bridge::for_generated::vec_from_leak_ptr(wrap.ptr, wrap.len) + }; + vec.into_iter().map(CstDecode::cst_decode).collect() + } +} impl CstDecode> for *mut wire_cst_list_refundable_swap { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> Vec { @@ -919,6 +1001,25 @@ impl CstDecode } } } +impl CstDecode for wire_cst_locale_overrides { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::LocaleOverrides { + crate::bindings::LocaleOverrides { + locale: self.locale.cst_decode(), + spacing: self.spacing.cst_decode(), + symbol: self.symbol.cst_decode(), + } + } +} +impl CstDecode for wire_cst_localized_name { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::LocalizedName { + crate::bindings::LocalizedName { + locale: self.locale.cst_decode(), + name: self.name.cst_decode(), + } + } +} impl CstDecode for wire_cst_log_entry { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::model::LogEntry { @@ -1116,6 +1217,15 @@ impl CstDecode for wire_cst_prepare_send_resp } } } +impl CstDecode for wire_cst_rate { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::Rate { + crate::bindings::Rate { + coin: self.coin.cst_decode(), + value: self.value.cst_decode(), + } + } +} impl CstDecode for wire_cst_receive_onchain_request { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::model::ReceiveOnchainRequest { @@ -1234,6 +1344,17 @@ impl CstDecode for wire_cst_success_act } } } +impl CstDecode for wire_cst_symbol { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> crate::bindings::Symbol { + crate::bindings::Symbol { + grapheme: self.grapheme.cst_decode(), + template: self.template.cst_decode(), + rtl: self.rtl.cst_decode(), + position: self.position.cst_decode(), + } + } +} impl CstDecode for wire_cst_url_success_action_data { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> crate::bindings::UrlSuccessActionData { @@ -1340,6 +1461,37 @@ impl Default for wire_cst_connect_request { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_currency_info { + fn new_with_null_ptr() -> Self { + Self { + name: core::ptr::null_mut(), + fraction_size: Default::default(), + spacing: core::ptr::null_mut(), + symbol: core::ptr::null_mut(), + uniq_symbol: core::ptr::null_mut(), + localized_name: core::ptr::null_mut(), + locale_overrides: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_currency_info { + fn default() -> Self { + Self::new_with_null_ptr() + } +} +impl NewWithNullPtr for wire_cst_fiat_currency { + fn new_with_null_ptr() -> Self { + Self { + id: core::ptr::null_mut(), + info: Default::default(), + } + } +} +impl Default for wire_cst_fiat_currency { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_get_info_response { fn new_with_null_ptr() -> Self { Self { @@ -1625,6 +1777,33 @@ impl Default for wire_cst_ln_url_withdraw_success_data { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_locale_overrides { + fn new_with_null_ptr() -> Self { + Self { + locale: core::ptr::null_mut(), + spacing: core::ptr::null_mut(), + symbol: Default::default(), + } + } +} +impl Default for wire_cst_locale_overrides { + fn default() -> Self { + Self::new_with_null_ptr() + } +} +impl NewWithNullPtr for wire_cst_localized_name { + fn new_with_null_ptr() -> Self { + Self { + locale: core::ptr::null_mut(), + name: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_localized_name { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_log_entry { fn new_with_null_ptr() -> Self { Self { @@ -1825,6 +2004,19 @@ impl Default for wire_cst_prepare_send_response { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_rate { + fn new_with_null_ptr() -> Self { + Self { + coin: core::ptr::null_mut(), + value: Default::default(), + } + } +} +impl Default for wire_cst_rate { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_receive_onchain_request { fn new_with_null_ptr() -> Self { Self { @@ -1970,6 +2162,21 @@ impl Default for wire_cst_success_action_processed { Self::new_with_null_ptr() } } +impl NewWithNullPtr for wire_cst_symbol { + fn new_with_null_ptr() -> Self { + Self { + grapheme: core::ptr::null_mut(), + template: core::ptr::null_mut(), + rtl: core::ptr::null_mut(), + position: core::ptr::null_mut(), + } + } +} +impl Default for wire_cst_symbol { + fn default() -> Self { + Self::new_with_null_ptr() + } +} impl NewWithNullPtr for wire_cst_url_success_action_data { fn new_with_null_ptr() -> Self { Self { @@ -2016,6 +2223,14 @@ pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_em wire__crate__bindings__BindingLiquidSdk_empty_wallet_cache_impl(that) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates( + port_: i64, + that: usize, +) { + wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates_impl(port_, that) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info( port_: i64, @@ -2024,6 +2239,14 @@ pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_ge wire__crate__bindings__BindingLiquidSdk_get_info_impl(port_, that) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies( + port_: i64, + that: usize, +) { + wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies_impl(port_, that) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_payments( port_: i64, @@ -2278,6 +2501,11 @@ pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_bitcoin_address_data( ) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_bool(value: bool) -> *mut bool { + flutter_rust_bridge::for_generated::new_leak_box_ptr(value) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_connect_request( ) -> *mut wire_cst_connect_request { @@ -2480,6 +2708,16 @@ pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_success_action_process ) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_symbol() -> *mut wire_cst_symbol { + flutter_rust_bridge::for_generated::new_leak_box_ptr(wire_cst_symbol::new_with_null_ptr()) +} + +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_u_32(value: u32) -> *mut u32 { + flutter_rust_bridge::for_generated::new_leak_box_ptr(value) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_u_64(value: u64) -> *mut u64 { flutter_rust_bridge::for_generated::new_leak_box_ptr(value) @@ -2493,6 +2731,48 @@ pub extern "C" fn frbgen_breez_liquid_cst_new_box_autoadd_url_success_action_dat ) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_list_fiat_currency( + len: i32, +) -> *mut wire_cst_list_fiat_currency { + let wrap = wire_cst_list_fiat_currency { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_list_locale_overrides( + len: i32, +) -> *mut wire_cst_list_locale_overrides { + let wrap = wire_cst_list_locale_overrides { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_list_localized_name( + len: i32, +) -> *mut wire_cst_list_localized_name { + let wrap = wire_cst_list_localized_name { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_list_payment(len: i32) -> *mut wire_cst_list_payment { let wrap = wire_cst_list_payment { @@ -2516,6 +2796,18 @@ pub extern "C" fn frbgen_breez_liquid_cst_new_list_prim_u_8_strict( flutter_rust_bridge::for_generated::new_leak_box_ptr(ans) } +#[no_mangle] +pub extern "C" fn frbgen_breez_liquid_cst_new_list_rate(len: i32) -> *mut wire_cst_list_rate { + let wrap = wire_cst_list_rate { + ptr: flutter_rust_bridge::for_generated::new_leak_vec_ptr( + ::new_with_null_ptr(), + len, + ), + len, + }; + flutter_rust_bridge::for_generated::new_leak_box_ptr(wrap) +} + #[no_mangle] pub extern "C" fn frbgen_breez_liquid_cst_new_list_refundable_swap( len: i32, @@ -2625,6 +2917,23 @@ pub struct wire_cst_connect_request { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_currency_info { + name: *mut wire_cst_list_prim_u_8_strict, + fraction_size: u32, + spacing: *mut u32, + symbol: *mut wire_cst_symbol, + uniq_symbol: *mut wire_cst_symbol, + localized_name: *mut wire_cst_list_localized_name, + locale_overrides: *mut wire_cst_list_locale_overrides, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_fiat_currency { + id: *mut wire_cst_list_prim_u_8_strict, + info: wire_cst_currency_info, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_get_info_response { balance_sat: u64, pending_send_sat: u64, @@ -2762,6 +3071,24 @@ pub struct wire_cst_LiquidSdkEvent_PaymentWaitingConfirmation { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_list_fiat_currency { + ptr: *mut wire_cst_fiat_currency, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_list_locale_overrides { + ptr: *mut wire_cst_locale_overrides, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_list_localized_name { + ptr: *mut wire_cst_localized_name, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_list_payment { ptr: *mut wire_cst_payment, len: i32, @@ -2774,6 +3101,12 @@ pub struct wire_cst_list_prim_u_8_strict { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_list_rate { + ptr: *mut wire_cst_rate, + len: i32, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_list_refundable_swap { ptr: *mut wire_cst_refundable_swap, len: i32, @@ -3097,6 +3430,19 @@ pub struct wire_cst_ln_url_withdraw_success_data { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_locale_overrides { + locale: *mut wire_cst_list_prim_u_8_strict, + spacing: *mut u32, + symbol: wire_cst_symbol, +} +#[repr(C)] +#[derive(Clone, Copy)] +pub struct wire_cst_localized_name { + locale: *mut wire_cst_list_prim_u_8_strict, + name: *mut wire_cst_list_prim_u_8_strict, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_log_entry { line: *mut wire_cst_list_prim_u_8_strict, level: *mut wire_cst_list_prim_u_8_strict, @@ -3240,6 +3586,12 @@ pub struct wire_cst_prepare_send_response { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_rate { + coin: *mut wire_cst_list_prim_u_8_strict, + value: f64, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_receive_onchain_request { prepare_res: wire_cst_prepare_receive_onchain_response, } @@ -3331,6 +3683,14 @@ pub struct wire_cst_SuccessActionProcessed_Url { } #[repr(C)] #[derive(Clone, Copy)] +pub struct wire_cst_symbol { + grapheme: *mut wire_cst_list_prim_u_8_strict, + template: *mut wire_cst_list_prim_u_8_strict, + rtl: *mut bool, + position: *mut u32, +} +#[repr(C)] +#[derive(Clone, Copy)] pub struct wire_cst_url_success_action_data { description: *mut wire_cst_list_prim_u_8_strict, url: *mut wire_cst_list_prim_u_8_strict, diff --git a/lib/core/src/frb_generated.rs b/lib/core/src/frb_generated.rs index b6c1246..69f33b7 100644 --- a/lib/core/src/frb_generated.rs +++ b/lib/core/src/frb_generated.rs @@ -39,7 +39,7 @@ flutter_rust_bridge::frb_generated_boilerplate!( default_rust_auto_opaque = RustAutoOpaqueNom, ); pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_VERSION: &str = "2.0.0"; -pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = 671987080; +pub(crate) const FLUTTER_RUST_BRIDGE_CODEGEN_CONTENT_HASH: i32 = -1268203752; // Section: executor @@ -214,6 +214,51 @@ fn wire__crate__bindings__BindingLiquidSdk_empty_wallet_cache_impl( }, ) } +fn wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + that: impl CstDecode< + RustOpaqueNom>, + >, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "BindingLiquidSdk_fetch_fiat_rates", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let api_that = that.cst_decode(); + move |context| async move { + transform_result_dco::<_, _, crate::error::LiquidSdkError>( + (move || async move { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_guard = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = + crate::bindings::BindingLiquidSdk::fetch_fiat_rates(&*api_that_guard) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} fn wire__crate__bindings__BindingLiquidSdk_get_info_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode< @@ -258,6 +303,52 @@ fn wire__crate__bindings__BindingLiquidSdk_get_info_impl( }, ) } +fn wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies_impl( + port_: flutter_rust_bridge::for_generated::MessagePort, + that: impl CstDecode< + RustOpaqueNom>, + >, +) { + FLUTTER_RUST_BRIDGE_HANDLER.wrap_async::( + flutter_rust_bridge::for_generated::TaskInfo { + debug_name: "BindingLiquidSdk_list_fiat_currencies", + port: Some(port_), + mode: flutter_rust_bridge::for_generated::FfiCallMode::Normal, + }, + move || { + let api_that = that.cst_decode(); + move |context| async move { + transform_result_dco::<_, _, crate::error::LiquidSdkError>( + (move || async move { + let mut api_that_guard = None; + let decode_indices_ = + flutter_rust_bridge::for_generated::lockable_compute_decode_order( + vec![flutter_rust_bridge::for_generated::LockableOrderInfo::new( + &api_that, 0, false, + )], + ); + for i in decode_indices_ { + match i { + 0 => { + api_that_guard = + Some(api_that.lockable_decode_async_ref().await) + } + _ => unreachable!(), + } + } + let api_that_guard = api_that_guard.unwrap(); + let output_ok = crate::bindings::BindingLiquidSdk::list_fiat_currencies( + &*api_that_guard, + ) + .await?; + Ok(output_ok) + })() + .await, + ) + } + }, + ) +} fn wire__crate__bindings__BindingLiquidSdk_list_payments_impl( port_: flutter_rust_bridge::for_generated::MessagePort, that: impl CstDecode< @@ -1221,6 +1312,21 @@ const _: fn() = || { let _: Option = BitcoinAddressData.label; let _: Option = BitcoinAddressData.message; } + { + let CurrencyInfo = None::.unwrap(); + let _: String = CurrencyInfo.name; + let _: u32 = CurrencyInfo.fraction_size; + let _: Option = CurrencyInfo.spacing; + let _: Option = CurrencyInfo.symbol; + let _: Option = CurrencyInfo.uniq_symbol; + let _: Vec = CurrencyInfo.localized_name; + let _: Vec = CurrencyInfo.locale_overrides; + } + { + let FiatCurrency = None::.unwrap(); + let _: String = FiatCurrency.id; + let _: crate::bindings::CurrencyInfo = FiatCurrency.info; + } match None::.unwrap() { crate::bindings::InputType::BitcoinAddress { address } => { let _: crate::bindings::BitcoinAddressData = address; @@ -1311,10 +1417,26 @@ const _: fn() = || { let _: u64 = LnUrlWithdrawRequestData.min_withdrawable; let _: u64 = LnUrlWithdrawRequestData.max_withdrawable; } + { + let LocaleOverrides = None::.unwrap(); + let _: String = LocaleOverrides.locale; + let _: Option = LocaleOverrides.spacing; + let _: crate::bindings::Symbol = LocaleOverrides.symbol; + } + { + let LocalizedName = None::.unwrap(); + let _: String = LocalizedName.locale; + let _: String = LocalizedName.name; + } { let MessageSuccessActionData = None::.unwrap(); let _: String = MessageSuccessActionData.message; } + { + let Rate = None::.unwrap(); + let _: String = Rate.coin; + let _: f64 = Rate.value; + } { let RouteHint = None::.unwrap(); let _: Vec = RouteHint.hops; @@ -1340,6 +1462,13 @@ const _: fn() = || { let _: crate::bindings::UrlSuccessActionData = data; } } + { + let Symbol = None::.unwrap(); + let _: Option = Symbol.grapheme; + let _: Option = Symbol.template; + let _: Option = Symbol.rtl; + let _: Option = Symbol.position; + } { let UrlSuccessActionData = None::.unwrap(); let _: String = UrlSuccessActionData.description; @@ -1361,6 +1490,12 @@ impl CstDecode for f32 { self } } +impl CstDecode for f64 { + // Codec=Cst (C-struct based), see doc to use other codecs + fn cst_decode(self) -> f64 { + self + } +} impl CstDecode for i32 { // Codec=Cst (C-struct based), see doc to use other codecs fn cst_decode(self) -> i32 { @@ -1614,6 +1749,29 @@ impl SseDecode for crate::model::ConnectRequest { } } +impl SseDecode for crate::bindings::CurrencyInfo { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_name = ::sse_decode(deserializer); + let mut var_fractionSize = ::sse_decode(deserializer); + let mut var_spacing = >::sse_decode(deserializer); + let mut var_symbol = >::sse_decode(deserializer); + let mut var_uniqSymbol = >::sse_decode(deserializer); + let mut var_localizedName = >::sse_decode(deserializer); + let mut var_localeOverrides = + >::sse_decode(deserializer); + return crate::bindings::CurrencyInfo { + name: var_name, + fraction_size: var_fractionSize, + spacing: var_spacing, + symbol: var_symbol, + uniq_symbol: var_uniqSymbol, + localized_name: var_localizedName, + locale_overrides: var_localeOverrides, + }; + } +} + impl SseDecode for f32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1621,6 +1779,25 @@ impl SseDecode for f32 { } } +impl SseDecode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + deserializer.cursor.read_f64::().unwrap() + } +} + +impl SseDecode for crate::bindings::FiatCurrency { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_id = ::sse_decode(deserializer); + let mut var_info = ::sse_decode(deserializer); + return crate::bindings::FiatCurrency { + id: var_id, + info: var_info, + }; + } +} + impl SseDecode for crate::model::GetInfoResponse { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1786,6 +1963,42 @@ impl SseDecode for crate::model::LiquidSdkEvent { } } +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -1810,6 +2023,18 @@ impl SseDecode for Vec { } } +impl SseDecode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut len_ = ::sse_decode(deserializer); + let mut ans_ = vec![]; + for idx_ in 0..len_ { + ans_.push(::sse_decode(deserializer)); + } + return ans_; + } +} + impl SseDecode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2216,6 +2441,32 @@ impl SseDecode for crate::bindings::duplicates::LnUrlWithdrawSuccessData { } } +impl SseDecode for crate::bindings::LocaleOverrides { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_locale = ::sse_decode(deserializer); + let mut var_spacing = >::sse_decode(deserializer); + let mut var_symbol = ::sse_decode(deserializer); + return crate::bindings::LocaleOverrides { + locale: var_locale, + spacing: var_spacing, + symbol: var_symbol, + }; + } +} + +impl SseDecode for crate::bindings::LocalizedName { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_locale = ::sse_decode(deserializer); + let mut var_name = ::sse_decode(deserializer); + return crate::bindings::LocalizedName { + locale: var_locale, + name: var_name, + }; + } +} + impl SseDecode for crate::model::LogEntry { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2263,6 +2514,17 @@ impl SseDecode for Option { } } +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + impl SseDecode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2276,6 +2538,28 @@ impl SseDecode for Option { } } +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + +impl SseDecode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + if (::sse_decode(deserializer)) { + return Some(::sse_decode(deserializer)); + } else { + return None; + } + } +} + impl SseDecode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2549,6 +2833,18 @@ impl SseDecode for crate::model::PrepareSendResponse { } } +impl SseDecode for crate::bindings::Rate { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_coin = ::sse_decode(deserializer); + let mut var_value = ::sse_decode(deserializer); + return crate::bindings::Rate { + coin: var_coin, + value: var_value, + }; + } +} + impl SseDecode for crate::model::ReceiveOnchainRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2699,6 +2995,22 @@ impl SseDecode for crate::bindings::SuccessActionProcessed { } } +impl SseDecode for crate::bindings::Symbol { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { + let mut var_grapheme = >::sse_decode(deserializer); + let mut var_template = >::sse_decode(deserializer); + let mut var_rtl = >::sse_decode(deserializer); + let mut var_position = >::sse_decode(deserializer); + return crate::bindings::Symbol { + grapheme: var_grapheme, + template: var_template, + rtl: var_rtl, + position: var_position, + }; + } +} + impl SseDecode for u16 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_decode(deserializer: &mut flutter_rust_bridge::for_generated::SseDeserializer) -> Self { @@ -2936,6 +3248,53 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.name.into_into_dart().into_dart(), + self.0.fraction_size.into_into_dart().into_dart(), + self.0.spacing.into_into_dart().into_dart(), + self.0.symbol.into_into_dart().into_dart(), + self.0.uniq_symbol.into_into_dart().into_dart(), + self.0.localized_name.into_into_dart().into_dart(), + self.0.locale_overrides.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::CurrencyInfo +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.id.into_into_dart().into_dart(), + self.0.info.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::FiatCurrency +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::model::GetInfoResponse { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -3515,6 +3874,49 @@ impl flutter_rust_bridge::IntoIntoDart { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.locale.into_into_dart().into_dart(), + self.0.spacing.into_into_dart().into_dart(), + self.0.symbol.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::LocaleOverrides +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.locale.into_into_dart().into_dart(), + self.0.name.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::LocalizedName +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::model::LogEntry { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -3899,6 +4301,27 @@ impl flutter_rust_bridge::IntoIntoDart } } // Codec=Dco (DartCObject based), see doc to use other codecs +impl flutter_rust_bridge::IntoDart for FrbWrapper { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.coin.into_into_dart().into_dart(), + self.0.value.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::Rate +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for crate::model::ReceiveOnchainRequest { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [self.prepare_res.into_into_dart().into_dart()].into_dart() @@ -4117,6 +4540,29 @@ impl flutter_rust_bridge::IntoIntoDart { + fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { + [ + self.0.grapheme.into_into_dart().into_dart(), + self.0.template.into_into_dart().into_dart(), + self.0.rtl.into_into_dart().into_dart(), + self.0.position.into_into_dart().into_dart(), + ] + .into_dart() + } +} +impl flutter_rust_bridge::for_generated::IntoDartExceptPrimitive + for FrbWrapper +{ +} +impl flutter_rust_bridge::IntoIntoDart> + for crate::bindings::Symbol +{ + fn into_into_dart(self) -> FrbWrapper { + self.into() + } +} +// Codec=Dco (DartCObject based), see doc to use other codecs impl flutter_rust_bridge::IntoDart for FrbWrapper { fn into_dart(self) -> flutter_rust_bridge::for_generated::DartAbi { [ @@ -4268,6 +4714,19 @@ impl SseEncode for crate::model::ConnectRequest { } } +impl SseEncode for crate::bindings::CurrencyInfo { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.name, serializer); + ::sse_encode(self.fraction_size, serializer); + >::sse_encode(self.spacing, serializer); + >::sse_encode(self.symbol, serializer); + >::sse_encode(self.uniq_symbol, serializer); + >::sse_encode(self.localized_name, serializer); + >::sse_encode(self.locale_overrides, serializer); + } +} + impl SseEncode for f32 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4275,6 +4734,21 @@ impl SseEncode for f32 { } } +impl SseEncode for f64 { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + serializer.cursor.write_f64::(self).unwrap(); + } +} + +impl SseEncode for crate::bindings::FiatCurrency { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.id, serializer); + ::sse_encode(self.info, serializer); + } +} + impl SseEncode for crate::model::GetInfoResponse { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4414,6 +4888,36 @@ impl SseEncode for crate::model::LiquidSdkEvent { } } +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4434,6 +4938,16 @@ impl SseEncode for Vec { } } +impl SseEncode for Vec { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.len() as _, serializer); + for item in self { + ::sse_encode(item, serializer); + } + } +} + impl SseEncode for Vec { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4748,6 +5262,23 @@ impl SseEncode for crate::bindings::duplicates::LnUrlWithdrawSuccessData { } } +impl SseEncode for crate::bindings::LocaleOverrides { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.locale, serializer); + >::sse_encode(self.spacing, serializer); + ::sse_encode(self.symbol, serializer); + } +} + +impl SseEncode for crate::bindings::LocalizedName { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.locale, serializer); + ::sse_encode(self.name, serializer); + } +} + impl SseEncode for crate::model::LogEntry { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4791,6 +5322,16 @@ impl SseEncode for Option { } } +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + impl SseEncode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -4801,6 +5342,26 @@ impl SseEncode for Option { } } +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + +impl SseEncode for Option { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.is_some(), serializer); + if let Some(value) = self { + ::sse_encode(value, serializer); + } + } +} + impl SseEncode for Option { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -5022,6 +5583,14 @@ impl SseEncode for crate::model::PrepareSendResponse { } } +impl SseEncode for crate::bindings::Rate { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + ::sse_encode(self.coin, serializer); + ::sse_encode(self.value, serializer); + } +} + impl SseEncode for crate::model::ReceiveOnchainRequest { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { @@ -5127,6 +5696,16 @@ impl SseEncode for crate::bindings::SuccessActionProcessed { } } +impl SseEncode for crate::bindings::Symbol { + // Codec=Sse (Serialization based), see doc to use other codecs + fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { + >::sse_encode(self.grapheme, serializer); + >::sse_encode(self.template, serializer); + >::sse_encode(self.rtl, serializer); + >::sse_encode(self.position, serializer); + } +} + impl SseEncode for u16 { // Codec=Sse (Serialization based), see doc to use other codecs fn sse_encode(self, serializer: &mut flutter_rust_bridge::for_generated::SseSerializer) { diff --git a/lib/core/src/sdk.rs b/lib/core/src/sdk.rs index ed6e8e3..1cdc39d 100644 --- a/lib/core/src/sdk.rs +++ b/lib/core/src/sdk.rs @@ -16,6 +16,7 @@ use lwk_wollet::secp256k1::ThirtyTwoByteHash; use lwk_wollet::{elements, ElectrumUrl, ElementsNetwork}; use sdk_common::bitcoin::secp256k1::Secp256k1; use sdk_common::bitcoin::util::bip32::ChildNumber; +use sdk_common::prelude::{FiatAPI, FiatCurrency, LnUrlPayError, LnUrlWithdrawError, Rate}; use tokio::sync::{watch, Mutex, RwLock}; use tokio::time::MissedTickBehavior; use tokio_stream::wrappers::BroadcastStream; @@ -48,6 +49,7 @@ pub struct LiquidSdk { swapper: Arc, liquid_chain_service: Arc>, bitcoin_chain_service: Arc>, + fiat_api: Arc, is_started: RwLock, shutdown_sender: watch::Sender<()>, shutdown_receiver: watch::Receiver<()>, @@ -126,6 +128,8 @@ impl LiquidSdk { bitcoin_chain_service.clone(), )?; + let breez_server = BreezServer::new(PRODUCTION_BREEZSERVER_URL.into(), None)?; + let sdk = Arc::new(LiquidSdk { config: config.clone(), onchain_wallet, @@ -135,6 +139,7 @@ impl LiquidSdk { swapper, bitcoin_chain_service, liquid_chain_service, + fiat_api: Arc::new(breez_server), is_started: RwLock::new(false), shutdown_sender, shutdown_receiver, @@ -1498,7 +1503,7 @@ impl LiquidSdk { .unwrap(); let preimage = sha256::Hash::from_str(&preimage_str).map_err(|_| { - sdk_common::prelude::LnUrlPayError::Generic { + LnUrlPayError::Generic { err: "Invalid preimage".to_string(), } })?; @@ -1540,7 +1545,7 @@ impl LiquidSdk { pub async fn lnurl_withdraw( &self, req: LnUrlWithdrawRequest, - ) -> Result { + ) -> Result { let prepare_receive_res = self .prepare_receive_payment(&{ PrepareReceiveRequest { @@ -1580,6 +1585,20 @@ impl LiquidSdk { Ok(perform_lnurl_auth(linking_keys, req_data).await?) } + /// Fetch live rates of fiat currencies, sorted by name + pub async fn fetch_fiat_rates(&self) -> Result, LiquidSdkError> { + self.fiat_api.fetch_fiat_rates().await.map_err(Into::into) + } + + /// List all supported fiat currencies for which there is a known exchange rate. + /// List is sorted by the canonical name of the currency + pub async fn list_fiat_currencies(&self) -> Result, LiquidSdkError> { + self.fiat_api + .list_fiat_currencies() + .await + .map_err(Into::into) + } + pub fn default_config(network: LiquidNetwork) -> Config { match network { LiquidNetwork::Mainnet => Config::mainnet(), diff --git a/packages/dart/lib/src/bindings.dart b/packages/dart/lib/src/bindings.dart index b235ae3..263a739 100644 --- a/packages/dart/lib/src/bindings.dart +++ b/packages/dart/lib/src/bindings.dart @@ -39,8 +39,12 @@ abstract class BindingLiquidSdk implements RustOpaqueInterface { void emptyWalletCache(); + Future> fetchFiatRates(); + Future getInfo(); + Future> listFiatCurrencies(); + Future> listPayments(); Future> listRefundables(); @@ -159,6 +163,67 @@ class BitcoinAddressData { message == other.message; } +class CurrencyInfo { + final String name; + final int fractionSize; + final int? spacing; + final Symbol? symbol; + final Symbol? uniqSymbol; + final List localizedName; + final List localeOverrides; + + const CurrencyInfo({ + required this.name, + required this.fractionSize, + this.spacing, + this.symbol, + this.uniqSymbol, + required this.localizedName, + required this.localeOverrides, + }); + + @override + int get hashCode => + name.hashCode ^ + fractionSize.hashCode ^ + spacing.hashCode ^ + symbol.hashCode ^ + uniqSymbol.hashCode ^ + localizedName.hashCode ^ + localeOverrides.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is CurrencyInfo && + runtimeType == other.runtimeType && + name == other.name && + fractionSize == other.fractionSize && + spacing == other.spacing && + symbol == other.symbol && + uniqSymbol == other.uniqSymbol && + localizedName == other.localizedName && + localeOverrides == other.localeOverrides; +} + +class FiatCurrency { + final String id; + final CurrencyInfo info; + + const FiatCurrency({ + required this.id, + required this.info, + }); + + @override + int get hashCode => id.hashCode ^ info.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is FiatCurrency && runtimeType == other.runtimeType && id == other.id && info == other.info; +} + @freezed sealed class InputType with _$InputType { const InputType._(); @@ -453,6 +518,51 @@ class LnUrlWithdrawRequestData { maxWithdrawable == other.maxWithdrawable; } +class LocaleOverrides { + final String locale; + final int? spacing; + final Symbol symbol; + + const LocaleOverrides({ + required this.locale, + this.spacing, + required this.symbol, + }); + + @override + int get hashCode => locale.hashCode ^ spacing.hashCode ^ symbol.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LocaleOverrides && + runtimeType == other.runtimeType && + locale == other.locale && + spacing == other.spacing && + symbol == other.symbol; +} + +class LocalizedName { + final String locale; + final String name; + + const LocalizedName({ + required this.locale, + required this.name, + }); + + @override + int get hashCode => locale.hashCode ^ name.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is LocalizedName && + runtimeType == other.runtimeType && + locale == other.locale && + name == other.name; +} + class MessageSuccessActionData { final String message; @@ -477,6 +587,24 @@ enum Network { ; } +class Rate { + final String coin; + final double value; + + const Rate({ + required this.coin, + required this.value, + }); + + @override + int get hashCode => coin.hashCode ^ value.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Rate && runtimeType == other.runtimeType && coin == other.coin && value == other.value; +} + class RouteHint { final List hops; @@ -550,6 +678,33 @@ sealed class SuccessActionProcessed with _$SuccessActionProcessed { }) = SuccessActionProcessed_Url; } +class Symbol { + final String? grapheme; + final String? template; + final bool? rtl; + final int? position; + + const Symbol({ + this.grapheme, + this.template, + this.rtl, + this.position, + }); + + @override + int get hashCode => grapheme.hashCode ^ template.hashCode ^ rtl.hashCode ^ position.hashCode; + + @override + bool operator ==(Object other) => + identical(this, other) || + other is Symbol && + runtimeType == other.runtimeType && + grapheme == other.grapheme && + template == other.template && + rtl == other.rtl && + position == other.position; +} + class UrlSuccessActionData { final String description; final String url; diff --git a/packages/dart/lib/src/frb_generated.dart b/packages/dart/lib/src/frb_generated.dart index 04efcd0..a82c151 100644 --- a/packages/dart/lib/src/frb_generated.dart +++ b/packages/dart/lib/src/frb_generated.dart @@ -55,7 +55,7 @@ class RustLib extends BaseEntrypoint { String get codegenVersion => '2.0.0'; @override - int get rustContentHash => 671987080; + int get rustContentHash => -1268203752; static const kDefaultExternalLibraryLoaderConfig = ExternalLibraryLoaderConfig( stem: 'breez_liquid_sdk', @@ -73,8 +73,13 @@ abstract class RustLibApi extends BaseApi { void crateBindingsBindingLiquidSdkEmptyWalletCache({required BindingLiquidSdk that}); + Future> crateBindingsBindingLiquidSdkFetchFiatRates({required BindingLiquidSdk that}); + Future crateBindingsBindingLiquidSdkGetInfo({required BindingLiquidSdk that}); + Future> crateBindingsBindingLiquidSdkListFiatCurrencies( + {required BindingLiquidSdk that}); + Future> crateBindingsBindingLiquidSdkListPayments({required BindingLiquidSdk that}); Future> crateBindingsBindingLiquidSdkListRefundables({required BindingLiquidSdk that}); @@ -250,6 +255,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["that"], ); + @override + Future> crateBindingsBindingLiquidSdkFetchFiatRates({required BindingLiquidSdk that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = + cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk( + that); + return wire.wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates(port_, arg0); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_list_rate, + decodeErrorData: dco_decode_liquid_sdk_error, + ), + constMeta: kCrateBindingsBindingLiquidSdkFetchFiatRatesConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateBindingsBindingLiquidSdkFetchFiatRatesConstMeta => const TaskConstMeta( + debugName: "BindingLiquidSdk_fetch_fiat_rates", + argNames: ["that"], + ); + @override Future crateBindingsBindingLiquidSdkGetInfo({required BindingLiquidSdk that}) { return handler.executeNormal(NormalTask( @@ -274,6 +303,31 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { argNames: ["that"], ); + @override + Future> crateBindingsBindingLiquidSdkListFiatCurrencies( + {required BindingLiquidSdk that}) { + return handler.executeNormal(NormalTask( + callFfi: (port_) { + var arg0 = + cst_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerBindingLiquidSdk( + that); + return wire.wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies(port_, arg0); + }, + codec: DcoCodec( + decodeSuccessData: dco_decode_list_fiat_currency, + decodeErrorData: dco_decode_liquid_sdk_error, + ), + constMeta: kCrateBindingsBindingLiquidSdkListFiatCurrenciesConstMeta, + argValues: [that], + apiImpl: this, + )); + } + + TaskConstMeta get kCrateBindingsBindingLiquidSdkListFiatCurrenciesConstMeta => const TaskConstMeta( + debugName: "BindingLiquidSdk_list_fiat_currencies", + argNames: ["that"], + ); + @override Future> crateBindingsBindingLiquidSdkListPayments({required BindingLiquidSdk that}) { return handler.executeNormal(NormalTask( @@ -998,6 +1052,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_bitcoin_address_data(raw); } + @protected + bool dco_decode_box_autoadd_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as bool; + } + @protected ConnectRequest dco_decode_box_autoadd_connect_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1154,6 +1214,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return dco_decode_success_action_processed(raw); } + @protected + Symbol dco_decode_box_autoadd_symbol(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return dco_decode_symbol(raw); + } + + @protected + int dco_decode_box_autoadd_u_32(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as int; + } + @protected BigInt dco_decode_box_autoadd_u_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1193,12 +1265,45 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + CurrencyInfo dco_decode_currency_info(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 7) throw Exception('unexpected arr length: expect 7 but see ${arr.length}'); + return CurrencyInfo( + name: dco_decode_String(arr[0]), + fractionSize: dco_decode_u_32(arr[1]), + spacing: dco_decode_opt_box_autoadd_u_32(arr[2]), + symbol: dco_decode_opt_box_autoadd_symbol(arr[3]), + uniqSymbol: dco_decode_opt_box_autoadd_symbol(arr[4]), + localizedName: dco_decode_list_localized_name(arr[5]), + localeOverrides: dco_decode_list_locale_overrides(arr[6]), + ); + } + @protected double dco_decode_f_32(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw as double; } + @protected + double dco_decode_f_64(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw as double; + } + + @protected + FiatCurrency dco_decode_fiat_currency(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return FiatCurrency( + id: dco_decode_String(arr[0]), + info: dco_decode_currency_info(arr[1]), + ); + } + @protected GetInfoResponse dco_decode_get_info_response(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1321,6 +1426,24 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + List dco_decode_list_fiat_currency(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_fiat_currency).toList(); + } + + @protected + List dco_decode_list_locale_overrides(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_locale_overrides).toList(); + } + + @protected + List dco_decode_list_localized_name(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_localized_name).toList(); + } + @protected List dco_decode_list_payment(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1333,6 +1456,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw as Uint8List; } + @protected + List dco_decode_list_rate(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return (raw as List).map(dco_decode_rate).toList(); + } + @protected List dco_decode_list_refundable_swap(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1646,6 +1775,29 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + LocaleOverrides dco_decode_locale_overrides(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 3) throw Exception('unexpected arr length: expect 3 but see ${arr.length}'); + return LocaleOverrides( + locale: dco_decode_String(arr[0]), + spacing: dco_decode_opt_box_autoadd_u_32(arr[1]), + symbol: dco_decode_symbol(arr[2]), + ); + } + + @protected + LocalizedName dco_decode_localized_name(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return LocalizedName( + locale: dco_decode_String(arr[0]), + name: dco_decode_String(arr[1]), + ); + } + @protected LogEntry dco_decode_log_entry(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1679,12 +1831,30 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw == null ? null : dco_decode_String(raw); } + @protected + bool? dco_decode_opt_box_autoadd_bool(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_bool(raw); + } + @protected SuccessActionProcessed? dco_decode_opt_box_autoadd_success_action_processed(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs return raw == null ? null : dco_decode_box_autoadd_success_action_processed(raw); } + @protected + Symbol? dco_decode_opt_box_autoadd_symbol(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_symbol(raw); + } + + @protected + int? dco_decode_opt_box_autoadd_u_32(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + return raw == null ? null : dco_decode_box_autoadd_u_32(raw); + } + @protected BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -1901,6 +2071,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { ); } + @protected + Rate dco_decode_rate(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 2) throw Exception('unexpected arr length: expect 2 but see ${arr.length}'); + return Rate( + coin: dco_decode_String(arr[0]), + value: dco_decode_f_64(arr[1]), + ); + } + @protected ReceiveOnchainRequest dco_decode_receive_onchain_request(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -2034,6 +2215,19 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + Symbol dco_decode_symbol(dynamic raw) { + // Codec=Dco (DartCObject based), see doc to use other codecs + final arr = raw as List; + if (arr.length != 4) throw Exception('unexpected arr length: expect 4 but see ${arr.length}'); + return Symbol( + grapheme: dco_decode_opt_String(arr[0]), + template: dco_decode_opt_String(arr[1]), + rtl: dco_decode_opt_box_autoadd_bool(arr[2]), + position: dco_decode_opt_box_autoadd_u_32(arr[3]), + ); + } + @protected int dco_decode_u_16(dynamic raw) { // Codec=Dco (DartCObject based), see doc to use other codecs @@ -2226,6 +2420,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_bitcoin_address_data(deserializer)); } + @protected + bool sse_decode_box_autoadd_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_bool(deserializer)); + } + @protected ConnectRequest sse_decode_box_autoadd_connect_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2383,6 +2583,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return (sse_decode_success_action_processed(deserializer)); } + @protected + Symbol sse_decode_box_autoadd_symbol(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_symbol(deserializer)); + } + + @protected + int sse_decode_box_autoadd_u_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return (sse_decode_u_32(deserializer)); + } + @protected BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2423,12 +2635,46 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return ConnectRequest(mnemonic: var_mnemonic, config: var_config); } + @protected + CurrencyInfo sse_decode_currency_info(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_name = sse_decode_String(deserializer); + var var_fractionSize = sse_decode_u_32(deserializer); + var var_spacing = sse_decode_opt_box_autoadd_u_32(deserializer); + var var_symbol = sse_decode_opt_box_autoadd_symbol(deserializer); + var var_uniqSymbol = sse_decode_opt_box_autoadd_symbol(deserializer); + var var_localizedName = sse_decode_list_localized_name(deserializer); + var var_localeOverrides = sse_decode_list_locale_overrides(deserializer); + return CurrencyInfo( + name: var_name, + fractionSize: var_fractionSize, + spacing: var_spacing, + symbol: var_symbol, + uniqSymbol: var_uniqSymbol, + localizedName: var_localizedName, + localeOverrides: var_localeOverrides); + } + @protected double sse_decode_f_32(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs return deserializer.buffer.getFloat32(); } + @protected + double sse_decode_f_64(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + return deserializer.buffer.getFloat64(); + } + + @protected + FiatCurrency sse_decode_fiat_currency(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_id = sse_decode_String(deserializer); + var var_info = sse_decode_currency_info(deserializer); + return FiatCurrency(id: var_id, info: var_info); + } + @protected GetInfoResponse sse_decode_get_info_response(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2543,6 +2789,42 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + List sse_decode_list_fiat_currency(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_fiat_currency(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_locale_overrides(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_locale_overrides(deserializer)); + } + return ans_; + } + + @protected + List sse_decode_list_localized_name(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_localized_name(deserializer)); + } + return ans_; + } + @protected List sse_decode_list_payment(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2562,6 +2844,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return deserializer.buffer.getUint8List(len_); } + @protected + List sse_decode_list_rate(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + var len_ = sse_decode_i_32(deserializer); + var ans_ = []; + for (var idx_ = 0; idx_ < len_; ++idx_) { + ans_.add(sse_decode_rate(deserializer)); + } + return ans_; + } + @protected List sse_decode_list_refundable_swap(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2876,6 +3170,23 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return LnUrlWithdrawSuccessData(invoice: var_invoice); } + @protected + LocaleOverrides sse_decode_locale_overrides(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_locale = sse_decode_String(deserializer); + var var_spacing = sse_decode_opt_box_autoadd_u_32(deserializer); + var var_symbol = sse_decode_symbol(deserializer); + return LocaleOverrides(locale: var_locale, spacing: var_spacing, symbol: var_symbol); + } + + @protected + LocalizedName sse_decode_localized_name(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_locale = sse_decode_String(deserializer); + var var_name = sse_decode_String(deserializer); + return LocalizedName(locale: var_locale, name: var_name); + } + @protected LogEntry sse_decode_log_entry(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2909,6 +3220,17 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + bool? sse_decode_opt_box_autoadd_bool(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_bool(deserializer)); + } else { + return null; + } + } + @protected SuccessActionProcessed? sse_decode_opt_box_autoadd_success_action_processed(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -2920,6 +3242,28 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + Symbol? sse_decode_opt_box_autoadd_symbol(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_symbol(deserializer)); + } else { + return null; + } + } + + @protected + int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + if (sse_decode_bool(deserializer)) { + return (sse_decode_box_autoadd_u_32(deserializer)); + } else { + return null; + } + } + @protected BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3114,6 +3458,14 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return PrepareSendResponse(invoice: var_invoice, feesSat: var_feesSat); } + @protected + Rate sse_decode_rate(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_coin = sse_decode_String(deserializer); + var var_value = sse_decode_f_64(deserializer); + return Rate(coin: var_coin, value: var_value); + } + @protected ReceiveOnchainRequest sse_decode_receive_onchain_request(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3224,6 +3576,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + Symbol sse_decode_symbol(SseDeserializer deserializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + var var_grapheme = sse_decode_opt_String(deserializer); + var var_template = sse_decode_opt_String(deserializer); + var var_rtl = sse_decode_opt_box_autoadd_bool(deserializer); + var var_position = sse_decode_opt_box_autoadd_u_32(deserializer); + return Symbol(grapheme: var_grapheme, template: var_template, rtl: var_rtl, position: var_position); + } + @protected int sse_decode_u_16(SseDeserializer deserializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3303,6 +3665,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { return raw; } + @protected + double cst_encode_f_64(double raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw; + } + @protected int cst_encode_i_32(int raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -3498,6 +3866,12 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_bitcoin_address_data(self, serializer); } + @protected + void sse_encode_box_autoadd_bool(bool self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_bool(self, serializer); + } + @protected void sse_encode_box_autoadd_connect_request(ConnectRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3661,6 +4035,18 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_success_action_processed(self, serializer); } + @protected + void sse_encode_box_autoadd_symbol(Symbol self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_symbol(self, serializer); + } + + @protected + void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_u_32(self, serializer); + } + @protected void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3692,12 +4078,37 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_config(self.config, serializer); } + @protected + void sse_encode_currency_info(CurrencyInfo self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.name, serializer); + sse_encode_u_32(self.fractionSize, serializer); + sse_encode_opt_box_autoadd_u_32(self.spacing, serializer); + sse_encode_opt_box_autoadd_symbol(self.symbol, serializer); + sse_encode_opt_box_autoadd_symbol(self.uniqSymbol, serializer); + sse_encode_list_localized_name(self.localizedName, serializer); + sse_encode_list_locale_overrides(self.localeOverrides, serializer); + } + @protected void sse_encode_f_32(double self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs serializer.buffer.putFloat32(self); } + @protected + void sse_encode_f_64(double self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + serializer.buffer.putFloat64(self); + } + + @protected + void sse_encode_fiat_currency(FiatCurrency self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.id, serializer); + sse_encode_currency_info(self.info, serializer); + } + @protected void sse_encode_get_info_response(GetInfoResponse self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3800,6 +4211,33 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_list_fiat_currency(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_fiat_currency(item, serializer); + } + } + + @protected + void sse_encode_list_locale_overrides(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_locale_overrides(item, serializer); + } + } + + @protected + void sse_encode_list_localized_name(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_localized_name(item, serializer); + } + } + @protected void sse_encode_list_payment(List self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -3816,6 +4254,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { serializer.buffer.putUint8List(self); } + @protected + void sse_encode_list_rate(List self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_i_32(self.length, serializer); + for (final item in self) { + sse_encode_rate(item, serializer); + } + } + @protected void sse_encode_list_refundable_swap(List self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4072,6 +4519,21 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_ln_invoice(self.invoice, serializer); } + @protected + void sse_encode_locale_overrides(LocaleOverrides self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.locale, serializer); + sse_encode_opt_box_autoadd_u_32(self.spacing, serializer); + sse_encode_symbol(self.symbol, serializer); + } + + @protected + void sse_encode_localized_name(LocalizedName self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.locale, serializer); + sse_encode_String(self.name, serializer); + } + @protected void sse_encode_log_entry(LogEntry self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4101,6 +4563,16 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_box_autoadd_bool(bool? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_bool(self, serializer); + } + } + @protected void sse_encode_opt_box_autoadd_success_action_processed( SuccessActionProcessed? self, SseSerializer serializer) { @@ -4112,6 +4584,26 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_opt_box_autoadd_symbol(Symbol? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_symbol(self, serializer); + } + } + + @protected + void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + + sse_encode_bool(self != null, serializer); + if (self != null) { + sse_encode_box_autoadd_u_32(self, serializer); + } + } + @protected void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4279,6 +4771,13 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { sse_encode_u_64(self.feesSat, serializer); } + @protected + void sse_encode_rate(Rate self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_String(self.coin, serializer); + sse_encode_f_64(self.value, serializer); + } + @protected void sse_encode_receive_onchain_request(ReceiveOnchainRequest self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4369,6 +4868,15 @@ class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi { } } + @protected + void sse_encode_symbol(Symbol self, SseSerializer serializer) { + // Codec=Sse (Serialization based), see doc to use other codecs + sse_encode_opt_String(self.grapheme, serializer); + sse_encode_opt_String(self.template, serializer); + sse_encode_opt_box_autoadd_bool(self.rtl, serializer); + sse_encode_opt_box_autoadd_u_32(self.position, serializer); + } + @protected void sse_encode_u_16(int self, SseSerializer serializer) { // Codec=Sse (Serialization based), see doc to use other codecs @@ -4444,10 +4952,19 @@ class BindingLiquidSdkImpl extends RustOpaque implements BindingLiquidSdk { that: this, ); + Future> fetchFiatRates() => RustLib.instance.api.crateBindingsBindingLiquidSdkFetchFiatRates( + that: this, + ); + Future getInfo() => RustLib.instance.api.crateBindingsBindingLiquidSdkGetInfo( that: this, ); + Future> listFiatCurrencies() => + RustLib.instance.api.crateBindingsBindingLiquidSdkListFiatCurrencies( + that: this, + ); + Future> listPayments() => RustLib.instance.api.crateBindingsBindingLiquidSdkListPayments( that: this, ); diff --git a/packages/dart/lib/src/frb_generated.io.dart b/packages/dart/lib/src/frb_generated.io.dart index 11cb215..269f9be 100644 --- a/packages/dart/lib/src/frb_generated.io.dart +++ b/packages/dart/lib/src/frb_generated.io.dart @@ -83,6 +83,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected BitcoinAddressData dco_decode_box_autoadd_bitcoin_address_data(dynamic raw); + @protected + bool dco_decode_box_autoadd_bool(dynamic raw); + @protected ConnectRequest dco_decode_box_autoadd_connect_request(dynamic raw); @@ -161,6 +164,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected SuccessActionProcessed dco_decode_box_autoadd_success_action_processed(dynamic raw); + @protected + Symbol dco_decode_box_autoadd_symbol(dynamic raw); + + @protected + int dco_decode_box_autoadd_u_32(dynamic raw); + @protected BigInt dco_decode_box_autoadd_u_64(dynamic raw); @@ -173,9 +182,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ConnectRequest dco_decode_connect_request(dynamic raw); + @protected + CurrencyInfo dco_decode_currency_info(dynamic raw); + @protected double dco_decode_f_32(dynamic raw); + @protected + double dco_decode_f_64(dynamic raw); + + @protected + FiatCurrency dco_decode_fiat_currency(dynamic raw); + @protected GetInfoResponse dco_decode_get_info_response(dynamic raw); @@ -194,12 +212,24 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected LiquidSdkEvent dco_decode_liquid_sdk_event(dynamic raw); + @protected + List dco_decode_list_fiat_currency(dynamic raw); + + @protected + List dco_decode_list_locale_overrides(dynamic raw); + + @protected + List dco_decode_list_localized_name(dynamic raw); + @protected List dco_decode_list_payment(dynamic raw); @protected Uint8List dco_decode_list_prim_u_8_strict(dynamic raw); + @protected + List dco_decode_list_rate(dynamic raw); + @protected List dco_decode_list_refundable_swap(dynamic raw); @@ -257,6 +287,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected LnUrlWithdrawSuccessData dco_decode_ln_url_withdraw_success_data(dynamic raw); + @protected + LocaleOverrides dco_decode_locale_overrides(dynamic raw); + + @protected + LocalizedName dco_decode_localized_name(dynamic raw); + @protected LogEntry dco_decode_log_entry(dynamic raw); @@ -269,9 +305,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String? dco_decode_opt_String(dynamic raw); + @protected + bool? dco_decode_opt_box_autoadd_bool(dynamic raw); + @protected SuccessActionProcessed? dco_decode_opt_box_autoadd_success_action_processed(dynamic raw); + @protected + Symbol? dco_decode_opt_box_autoadd_symbol(dynamic raw); + + @protected + int? dco_decode_opt_box_autoadd_u_32(dynamic raw); + @protected BigInt? dco_decode_opt_box_autoadd_u_64(dynamic raw); @@ -320,6 +365,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PrepareSendResponse dco_decode_prepare_send_response(dynamic raw); + @protected + Rate dco_decode_rate(dynamic raw); + @protected ReceiveOnchainRequest dco_decode_receive_onchain_request(dynamic raw); @@ -353,6 +401,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected SuccessActionProcessed dco_decode_success_action_processed(dynamic raw); + @protected + Symbol dco_decode_symbol(dynamic raw); + @protected int dco_decode_u_16(dynamic raw); @@ -435,6 +486,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected BitcoinAddressData sse_decode_box_autoadd_bitcoin_address_data(SseDeserializer deserializer); + @protected + bool sse_decode_box_autoadd_bool(SseDeserializer deserializer); + @protected ConnectRequest sse_decode_box_autoadd_connect_request(SseDeserializer deserializer); @@ -514,6 +568,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected SuccessActionProcessed sse_decode_box_autoadd_success_action_processed(SseDeserializer deserializer); + @protected + Symbol sse_decode_box_autoadd_symbol(SseDeserializer deserializer); + + @protected + int sse_decode_box_autoadd_u_32(SseDeserializer deserializer); + @protected BigInt sse_decode_box_autoadd_u_64(SseDeserializer deserializer); @@ -526,9 +586,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected ConnectRequest sse_decode_connect_request(SseDeserializer deserializer); + @protected + CurrencyInfo sse_decode_currency_info(SseDeserializer deserializer); + @protected double sse_decode_f_32(SseDeserializer deserializer); + @protected + double sse_decode_f_64(SseDeserializer deserializer); + + @protected + FiatCurrency sse_decode_fiat_currency(SseDeserializer deserializer); + @protected GetInfoResponse sse_decode_get_info_response(SseDeserializer deserializer); @@ -547,12 +616,24 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected LiquidSdkEvent sse_decode_liquid_sdk_event(SseDeserializer deserializer); + @protected + List sse_decode_list_fiat_currency(SseDeserializer deserializer); + + @protected + List sse_decode_list_locale_overrides(SseDeserializer deserializer); + + @protected + List sse_decode_list_localized_name(SseDeserializer deserializer); + @protected List sse_decode_list_payment(SseDeserializer deserializer); @protected Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer); + @protected + List sse_decode_list_rate(SseDeserializer deserializer); + @protected List sse_decode_list_refundable_swap(SseDeserializer deserializer); @@ -610,6 +691,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected LnUrlWithdrawSuccessData sse_decode_ln_url_withdraw_success_data(SseDeserializer deserializer); + @protected + LocaleOverrides sse_decode_locale_overrides(SseDeserializer deserializer); + + @protected + LocalizedName sse_decode_localized_name(SseDeserializer deserializer); + @protected LogEntry sse_decode_log_entry(SseDeserializer deserializer); @@ -622,9 +709,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected String? sse_decode_opt_String(SseDeserializer deserializer); + @protected + bool? sse_decode_opt_box_autoadd_bool(SseDeserializer deserializer); + @protected SuccessActionProcessed? sse_decode_opt_box_autoadd_success_action_processed(SseDeserializer deserializer); + @protected + Symbol? sse_decode_opt_box_autoadd_symbol(SseDeserializer deserializer); + + @protected + int? sse_decode_opt_box_autoadd_u_32(SseDeserializer deserializer); + @protected BigInt? sse_decode_opt_box_autoadd_u_64(SseDeserializer deserializer); @@ -673,6 +769,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected PrepareSendResponse sse_decode_prepare_send_response(SseDeserializer deserializer); + @protected + Rate sse_decode_rate(SseDeserializer deserializer); + @protected ReceiveOnchainRequest sse_decode_receive_onchain_request(SseDeserializer deserializer); @@ -706,6 +805,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected SuccessActionProcessed sse_decode_success_action_processed(SseDeserializer deserializer); + @protected + Symbol sse_decode_symbol(SseDeserializer deserializer); + @protected int sse_decode_u_16(SseDeserializer deserializer); @@ -805,6 +907,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return ptr; } + @protected + ffi.Pointer cst_encode_box_autoadd_bool(bool raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return wire.cst_new_box_autoadd_bool(cst_encode_bool(raw)); + } + @protected ffi.Pointer cst_encode_box_autoadd_connect_request(ConnectRequest raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1031,6 +1139,20 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return ptr; } + @protected + ffi.Pointer cst_encode_box_autoadd_symbol(Symbol raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ptr = wire.cst_new_box_autoadd_symbol(); + cst_api_fill_to_wire_symbol(raw, ptr.ref); + return ptr; + } + + @protected + ffi.Pointer cst_encode_box_autoadd_u_32(int raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return wire.cst_new_box_autoadd_u_32(cst_encode_u_32(raw)); + } + @protected ffi.Pointer cst_encode_box_autoadd_u_64(BigInt raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1046,6 +1168,36 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return ptr; } + @protected + ffi.Pointer cst_encode_list_fiat_currency(List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_fiat_currency(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_fiat_currency(raw[i], ans.ref.ptr[i]); + } + return ans; + } + + @protected + ffi.Pointer cst_encode_list_locale_overrides(List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_locale_overrides(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_locale_overrides(raw[i], ans.ref.ptr[i]); + } + return ans; + } + + @protected + ffi.Pointer cst_encode_list_localized_name(List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_localized_name(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_localized_name(raw[i], ans.ref.ptr[i]); + } + return ans; + } + @protected ffi.Pointer cst_encode_list_payment(List raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1064,6 +1216,16 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return ans; } + @protected + ffi.Pointer cst_encode_list_rate(List raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + final ans = wire.cst_new_list_rate(raw.length); + for (var i = 0; i < raw.length; ++i) { + cst_api_fill_to_wire_rate(raw[i], ans.ref.ptr[i]); + } + return ans; + } + @protected ffi.Pointer cst_encode_list_refundable_swap(List raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1100,6 +1262,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return raw == null ? ffi.nullptr : cst_encode_String(raw); } + @protected + ffi.Pointer cst_encode_opt_box_autoadd_bool(bool? raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw == null ? ffi.nullptr : cst_encode_box_autoadd_bool(raw); + } + @protected ffi.Pointer cst_encode_opt_box_autoadd_success_action_processed( SuccessActionProcessed? raw) { @@ -1107,6 +1275,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { return raw == null ? ffi.nullptr : cst_encode_box_autoadd_success_action_processed(raw); } + @protected + ffi.Pointer cst_encode_opt_box_autoadd_symbol(Symbol? raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw == null ? ffi.nullptr : cst_encode_box_autoadd_symbol(raw); + } + + @protected + ffi.Pointer cst_encode_opt_box_autoadd_u_32(int? raw) { + // Codec=Cst (C-struct based), see doc to use other codecs + return raw == null ? ffi.nullptr : cst_encode_box_autoadd_u_32(raw); + } + @protected ffi.Pointer cst_encode_opt_box_autoadd_u_64(BigInt? raw) { // Codec=Cst (C-struct based), see doc to use other codecs @@ -1355,6 +1535,11 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { cst_api_fill_to_wire_success_action_processed(apiObj, wireObj.ref); } + @protected + void cst_api_fill_to_wire_box_autoadd_symbol(Symbol apiObj, ffi.Pointer wireObj) { + cst_api_fill_to_wire_symbol(apiObj, wireObj.ref); + } + @protected void cst_api_fill_to_wire_box_autoadd_url_success_action_data( UrlSuccessActionData apiObj, ffi.Pointer wireObj) { @@ -1378,6 +1563,23 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { cst_api_fill_to_wire_config(apiObj.config, wireObj.config); } + @protected + void cst_api_fill_to_wire_currency_info(CurrencyInfo apiObj, wire_cst_currency_info wireObj) { + wireObj.name = cst_encode_String(apiObj.name); + wireObj.fraction_size = cst_encode_u_32(apiObj.fractionSize); + wireObj.spacing = cst_encode_opt_box_autoadd_u_32(apiObj.spacing); + wireObj.symbol = cst_encode_opt_box_autoadd_symbol(apiObj.symbol); + wireObj.uniq_symbol = cst_encode_opt_box_autoadd_symbol(apiObj.uniqSymbol); + wireObj.localized_name = cst_encode_list_localized_name(apiObj.localizedName); + wireObj.locale_overrides = cst_encode_list_locale_overrides(apiObj.localeOverrides); + } + + @protected + void cst_api_fill_to_wire_fiat_currency(FiatCurrency apiObj, wire_cst_fiat_currency wireObj) { + wireObj.id = cst_encode_String(apiObj.id); + cst_api_fill_to_wire_currency_info(apiObj.info, wireObj.info); + } + @protected void cst_api_fill_to_wire_get_info_response(GetInfoResponse apiObj, wire_cst_get_info_response wireObj) { wireObj.balance_sat = cst_encode_u_64(apiObj.balanceSat); @@ -1787,6 +1989,19 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { cst_api_fill_to_wire_ln_invoice(apiObj.invoice, wireObj.invoice); } + @protected + void cst_api_fill_to_wire_locale_overrides(LocaleOverrides apiObj, wire_cst_locale_overrides wireObj) { + wireObj.locale = cst_encode_String(apiObj.locale); + wireObj.spacing = cst_encode_opt_box_autoadd_u_32(apiObj.spacing); + cst_api_fill_to_wire_symbol(apiObj.symbol, wireObj.symbol); + } + + @protected + void cst_api_fill_to_wire_localized_name(LocalizedName apiObj, wire_cst_localized_name wireObj) { + wireObj.locale = cst_encode_String(apiObj.locale); + wireObj.name = cst_encode_String(apiObj.name); + } + @protected void cst_api_fill_to_wire_log_entry(LogEntry apiObj, wire_cst_log_entry wireObj) { wireObj.line = cst_encode_String(apiObj.line); @@ -1980,6 +2195,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { wireObj.fees_sat = cst_encode_u_64(apiObj.feesSat); } + @protected + void cst_api_fill_to_wire_rate(Rate apiObj, wire_cst_rate wireObj) { + wireObj.coin = cst_encode_String(apiObj.coin); + wireObj.value = cst_encode_f_64(apiObj.value); + } + @protected void cst_api_fill_to_wire_receive_onchain_request( ReceiveOnchainRequest apiObj, wire_cst_receive_onchain_request wireObj) { @@ -2069,6 +2290,14 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { } } + @protected + void cst_api_fill_to_wire_symbol(Symbol apiObj, wire_cst_symbol wireObj) { + wireObj.grapheme = cst_encode_opt_String(apiObj.grapheme); + wireObj.template_ = cst_encode_opt_String(apiObj.template); + wireObj.rtl = cst_encode_opt_box_autoadd_bool(apiObj.rtl); + wireObj.position = cst_encode_opt_box_autoadd_u_32(apiObj.position); + } + @protected void cst_api_fill_to_wire_url_success_action_data( UrlSuccessActionData apiObj, wire_cst_url_success_action_data wireObj) { @@ -2094,6 +2323,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected double cst_encode_f_32(double raw); + @protected + double cst_encode_f_64(double raw); + @protected int cst_encode_i_32(int raw); @@ -2182,6 +2414,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_box_autoadd_bitcoin_address_data(BitcoinAddressData self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_bool(bool self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_connect_request(ConnectRequest self, SseSerializer serializer); @@ -2265,6 +2500,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_box_autoadd_success_action_processed(SuccessActionProcessed self, SseSerializer serializer); + @protected + void sse_encode_box_autoadd_symbol(Symbol self, SseSerializer serializer); + + @protected + void sse_encode_box_autoadd_u_32(int self, SseSerializer serializer); + @protected void sse_encode_box_autoadd_u_64(BigInt self, SseSerializer serializer); @@ -2277,9 +2518,18 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_connect_request(ConnectRequest self, SseSerializer serializer); + @protected + void sse_encode_currency_info(CurrencyInfo self, SseSerializer serializer); + @protected void sse_encode_f_32(double self, SseSerializer serializer); + @protected + void sse_encode_f_64(double self, SseSerializer serializer); + + @protected + void sse_encode_fiat_currency(FiatCurrency self, SseSerializer serializer); + @protected void sse_encode_get_info_response(GetInfoResponse self, SseSerializer serializer); @@ -2298,12 +2548,24 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_liquid_sdk_event(LiquidSdkEvent self, SseSerializer serializer); + @protected + void sse_encode_list_fiat_currency(List self, SseSerializer serializer); + + @protected + void sse_encode_list_locale_overrides(List self, SseSerializer serializer); + + @protected + void sse_encode_list_localized_name(List self, SseSerializer serializer); + @protected void sse_encode_list_payment(List self, SseSerializer serializer); @protected void sse_encode_list_prim_u_8_strict(Uint8List self, SseSerializer serializer); + @protected + void sse_encode_list_rate(List self, SseSerializer serializer); + @protected void sse_encode_list_refundable_swap(List self, SseSerializer serializer); @@ -2361,6 +2623,12 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_ln_url_withdraw_success_data(LnUrlWithdrawSuccessData self, SseSerializer serializer); + @protected + void sse_encode_locale_overrides(LocaleOverrides self, SseSerializer serializer); + + @protected + void sse_encode_localized_name(LocalizedName self, SseSerializer serializer); + @protected void sse_encode_log_entry(LogEntry self, SseSerializer serializer); @@ -2373,10 +2641,19 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_opt_String(String? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_bool(bool? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_success_action_processed( SuccessActionProcessed? self, SseSerializer serializer); + @protected + void sse_encode_opt_box_autoadd_symbol(Symbol? self, SseSerializer serializer); + + @protected + void sse_encode_opt_box_autoadd_u_32(int? self, SseSerializer serializer); + @protected void sse_encode_opt_box_autoadd_u_64(BigInt? self, SseSerializer serializer); @@ -2427,6 +2704,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_prepare_send_response(PrepareSendResponse self, SseSerializer serializer); + @protected + void sse_encode_rate(Rate self, SseSerializer serializer); + @protected void sse_encode_receive_onchain_request(ReceiveOnchainRequest self, SseSerializer serializer); @@ -2460,6 +2740,9 @@ abstract class RustLibApiImplPlatform extends BaseApiImpl { @protected void sse_encode_success_action_processed(SuccessActionProcessed self, SseSerializer serializer); + @protected + void sse_encode_symbol(Symbol self, SseSerializer serializer); + @protected void sse_encode_u_16(int self, SseSerializer serializer); @@ -2586,6 +2869,22 @@ class RustLibWire implements BaseWire { _wire__crate__bindings__BindingLiquidSdk_empty_wallet_cachePtr .asFunction(); + void wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates( + int port_, + int that, + ) { + return _wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates( + port_, + that, + ); + } + + late final _wire__crate__bindings__BindingLiquidSdk_fetch_fiat_ratesPtr = + _lookup>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates'); + late final _wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates = + _wire__crate__bindings__BindingLiquidSdk_fetch_fiat_ratesPtr.asFunction(); + void wire__crate__bindings__BindingLiquidSdk_get_info( int port_, int that, @@ -2602,6 +2901,22 @@ class RustLibWire implements BaseWire { late final _wire__crate__bindings__BindingLiquidSdk_get_info = _wire__crate__bindings__BindingLiquidSdk_get_infoPtr.asFunction(); + void wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies( + int port_, + int that, + ) { + return _wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies( + port_, + that, + ); + } + + late final _wire__crate__bindings__BindingLiquidSdk_list_fiat_currenciesPtr = + _lookup>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies'); + late final _wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies = + _wire__crate__bindings__BindingLiquidSdk_list_fiat_currenciesPtr.asFunction(); + void wire__crate__bindings__BindingLiquidSdk_list_payments( int port_, int that, @@ -3112,6 +3427,20 @@ class RustLibWire implements BaseWire { late final _cst_new_box_autoadd_bitcoin_address_data = _cst_new_box_autoadd_bitcoin_address_dataPtr .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_bool( + bool value, + ) { + return _cst_new_box_autoadd_bool( + value, + ); + } + + late final _cst_new_box_autoadd_boolPtr = + _lookup Function(ffi.Bool)>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_bool'); + late final _cst_new_box_autoadd_bool = + _cst_new_box_autoadd_boolPtr.asFunction Function(bool)>(); + ffi.Pointer cst_new_box_autoadd_connect_request() { return _cst_new_box_autoadd_connect_request(); } @@ -3378,6 +3707,30 @@ class RustLibWire implements BaseWire { late final _cst_new_box_autoadd_success_action_processed = _cst_new_box_autoadd_success_action_processedPtr .asFunction Function()>(); + ffi.Pointer cst_new_box_autoadd_symbol() { + return _cst_new_box_autoadd_symbol(); + } + + late final _cst_new_box_autoadd_symbolPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_symbol'); + late final _cst_new_box_autoadd_symbol = + _cst_new_box_autoadd_symbolPtr.asFunction Function()>(); + + ffi.Pointer cst_new_box_autoadd_u_32( + int value, + ) { + return _cst_new_box_autoadd_u_32( + value, + ); + } + + late final _cst_new_box_autoadd_u_32Ptr = + _lookup Function(ffi.Uint32)>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_u_32'); + late final _cst_new_box_autoadd_u_32 = + _cst_new_box_autoadd_u_32Ptr.asFunction Function(int)>(); + ffi.Pointer cst_new_box_autoadd_u_64( int value, ) { @@ -3402,6 +3755,48 @@ class RustLibWire implements BaseWire { late final _cst_new_box_autoadd_url_success_action_data = _cst_new_box_autoadd_url_success_action_dataPtr .asFunction Function()>(); + ffi.Pointer cst_new_list_fiat_currency( + int len, + ) { + return _cst_new_list_fiat_currency( + len, + ); + } + + late final _cst_new_list_fiat_currencyPtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_fiat_currency'); + late final _cst_new_list_fiat_currency = + _cst_new_list_fiat_currencyPtr.asFunction Function(int)>(); + + ffi.Pointer cst_new_list_locale_overrides( + int len, + ) { + return _cst_new_list_locale_overrides( + len, + ); + } + + late final _cst_new_list_locale_overridesPtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_locale_overrides'); + late final _cst_new_list_locale_overrides = _cst_new_list_locale_overridesPtr + .asFunction Function(int)>(); + + ffi.Pointer cst_new_list_localized_name( + int len, + ) { + return _cst_new_list_localized_name( + len, + ); + } + + late final _cst_new_list_localized_namePtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_localized_name'); + late final _cst_new_list_localized_name = + _cst_new_list_localized_namePtr.asFunction Function(int)>(); + ffi.Pointer cst_new_list_payment( int len, ) { @@ -3430,6 +3825,20 @@ class RustLibWire implements BaseWire { late final _cst_new_list_prim_u_8_strict = _cst_new_list_prim_u_8_strictPtr.asFunction Function(int)>(); + ffi.Pointer cst_new_list_rate( + int len, + ) { + return _cst_new_list_rate( + len, + ); + } + + late final _cst_new_list_ratePtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_rate'); + late final _cst_new_list_rate = + _cst_new_list_ratePtr.asFunction Function(int)>(); + ffi.Pointer cst_new_list_refundable_swap( int len, ) { @@ -3918,6 +4327,74 @@ final class wire_cst_ln_url_withdraw_success_data extends ffi.Struct { external wire_cst_ln_invoice invoice; } +final class wire_cst_symbol extends ffi.Struct { + external ffi.Pointer grapheme; + + external ffi.Pointer template_; + + external ffi.Pointer rtl; + + external ffi.Pointer position; +} + +final class wire_cst_localized_name extends ffi.Struct { + external ffi.Pointer locale; + + external ffi.Pointer name; +} + +final class wire_cst_list_localized_name extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + +final class wire_cst_locale_overrides extends ffi.Struct { + external ffi.Pointer locale; + + external ffi.Pointer spacing; + + external wire_cst_symbol symbol; +} + +final class wire_cst_list_locale_overrides extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + +final class wire_cst_currency_info extends ffi.Struct { + external ffi.Pointer name; + + @ffi.Uint32() + external int fraction_size; + + external ffi.Pointer spacing; + + external ffi.Pointer symbol; + + external ffi.Pointer uniq_symbol; + + external ffi.Pointer localized_name; + + external ffi.Pointer locale_overrides; +} + +final class wire_cst_fiat_currency extends ffi.Struct { + external ffi.Pointer id; + + external wire_cst_currency_info info; +} + +final class wire_cst_list_fiat_currency extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + final class wire_cst_list_payment extends ffi.Struct { external ffi.Pointer ptr; @@ -3925,6 +4402,20 @@ final class wire_cst_list_payment extends ffi.Struct { external int len; } +final class wire_cst_rate extends ffi.Struct { + external ffi.Pointer coin; + + @ffi.Double() + external double value; +} + +final class wire_cst_list_rate extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + final class wire_cst_refundable_swap extends ffi.Struct { external ffi.Pointer swap_address; diff --git a/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart b/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart index 80d007b..453150e 100644 --- a/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart +++ b/packages/flutter/lib/flutter_breez_liquid_bindings_generated.dart @@ -107,6 +107,23 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_empty_wallet_cachePtr .asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates( + int port_, + int that, + ) { + return _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates( + port_, + that, + ); + } + + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_ratesPtr = + _lookup>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates'); + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_rates = + _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_fetch_fiat_ratesPtr + .asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_info( int port_, int that, @@ -124,6 +141,23 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_get_infoPtr .asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies( + int port_, + int that, + ) { + return _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies( + port_, + that, + ); + } + + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currenciesPtr = + _lookup>( + 'frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies'); + late final _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currencies = + _frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_fiat_currenciesPtr + .asFunction(); + void frbgen_breez_liquid_wire__crate__bindings__BindingLiquidSdk_list_payments( int port_, int that, @@ -649,6 +683,20 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_cst_new_box_autoadd_bitcoin_address_dataPtr .asFunction Function()>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_bool( + bool value, + ) { + return _frbgen_breez_liquid_cst_new_box_autoadd_bool( + value, + ); + } + + late final _frbgen_breez_liquid_cst_new_box_autoadd_boolPtr = + _lookup Function(ffi.Bool)>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_bool'); + late final _frbgen_breez_liquid_cst_new_box_autoadd_bool = + _frbgen_breez_liquid_cst_new_box_autoadd_boolPtr.asFunction Function(bool)>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_connect_request() { return _frbgen_breez_liquid_cst_new_box_autoadd_connect_request(); } @@ -951,6 +999,31 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_cst_new_box_autoadd_success_action_processedPtr .asFunction Function()>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_symbol() { + return _frbgen_breez_liquid_cst_new_box_autoadd_symbol(); + } + + late final _frbgen_breez_liquid_cst_new_box_autoadd_symbolPtr = + _lookup Function()>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_symbol'); + late final _frbgen_breez_liquid_cst_new_box_autoadd_symbol = + _frbgen_breez_liquid_cst_new_box_autoadd_symbolPtr + .asFunction Function()>(); + + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_u_32( + int value, + ) { + return _frbgen_breez_liquid_cst_new_box_autoadd_u_32( + value, + ); + } + + late final _frbgen_breez_liquid_cst_new_box_autoadd_u_32Ptr = + _lookup Function(ffi.Uint32)>>( + 'frbgen_breez_liquid_cst_new_box_autoadd_u_32'); + late final _frbgen_breez_liquid_cst_new_box_autoadd_u_32 = + _frbgen_breez_liquid_cst_new_box_autoadd_u_32Ptr.asFunction Function(int)>(); + ffi.Pointer frbgen_breez_liquid_cst_new_box_autoadd_u_64( int value, ) { @@ -977,6 +1050,51 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_cst_new_box_autoadd_url_success_action_dataPtr .asFunction Function()>(); + ffi.Pointer frbgen_breez_liquid_cst_new_list_fiat_currency( + int len, + ) { + return _frbgen_breez_liquid_cst_new_list_fiat_currency( + len, + ); + } + + late final _frbgen_breez_liquid_cst_new_list_fiat_currencyPtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_fiat_currency'); + late final _frbgen_breez_liquid_cst_new_list_fiat_currency = + _frbgen_breez_liquid_cst_new_list_fiat_currencyPtr + .asFunction Function(int)>(); + + ffi.Pointer frbgen_breez_liquid_cst_new_list_locale_overrides( + int len, + ) { + return _frbgen_breez_liquid_cst_new_list_locale_overrides( + len, + ); + } + + late final _frbgen_breez_liquid_cst_new_list_locale_overridesPtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_locale_overrides'); + late final _frbgen_breez_liquid_cst_new_list_locale_overrides = + _frbgen_breez_liquid_cst_new_list_locale_overridesPtr + .asFunction Function(int)>(); + + ffi.Pointer frbgen_breez_liquid_cst_new_list_localized_name( + int len, + ) { + return _frbgen_breez_liquid_cst_new_list_localized_name( + len, + ); + } + + late final _frbgen_breez_liquid_cst_new_list_localized_namePtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_localized_name'); + late final _frbgen_breez_liquid_cst_new_list_localized_name = + _frbgen_breez_liquid_cst_new_list_localized_namePtr + .asFunction Function(int)>(); + ffi.Pointer frbgen_breez_liquid_cst_new_list_payment( int len, ) { @@ -1006,6 +1124,20 @@ class FlutterBreezLiquidBindings { _frbgen_breez_liquid_cst_new_list_prim_u_8_strictPtr .asFunction Function(int)>(); + ffi.Pointer frbgen_breez_liquid_cst_new_list_rate( + int len, + ) { + return _frbgen_breez_liquid_cst_new_list_rate( + len, + ); + } + + late final _frbgen_breez_liquid_cst_new_list_ratePtr = + _lookup Function(ffi.Int32)>>( + 'frbgen_breez_liquid_cst_new_list_rate'); + late final _frbgen_breez_liquid_cst_new_list_rate = + _frbgen_breez_liquid_cst_new_list_ratePtr.asFunction Function(int)>(); + ffi.Pointer frbgen_breez_liquid_cst_new_list_refundable_swap( int len, ) { @@ -1507,6 +1639,74 @@ final class wire_cst_ln_url_withdraw_success_data extends ffi.Struct { external wire_cst_ln_invoice invoice; } +final class wire_cst_symbol extends ffi.Struct { + external ffi.Pointer grapheme; + + external ffi.Pointer template_; + + external ffi.Pointer rtl; + + external ffi.Pointer position; +} + +final class wire_cst_localized_name extends ffi.Struct { + external ffi.Pointer locale; + + external ffi.Pointer name; +} + +final class wire_cst_list_localized_name extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + +final class wire_cst_locale_overrides extends ffi.Struct { + external ffi.Pointer locale; + + external ffi.Pointer spacing; + + external wire_cst_symbol symbol; +} + +final class wire_cst_list_locale_overrides extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + +final class wire_cst_currency_info extends ffi.Struct { + external ffi.Pointer name; + + @ffi.Uint32() + external int fraction_size; + + external ffi.Pointer spacing; + + external ffi.Pointer symbol; + + external ffi.Pointer uniq_symbol; + + external ffi.Pointer localized_name; + + external ffi.Pointer locale_overrides; +} + +final class wire_cst_fiat_currency extends ffi.Struct { + external ffi.Pointer id; + + external wire_cst_currency_info info; +} + +final class wire_cst_list_fiat_currency extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + final class wire_cst_list_payment extends ffi.Struct { external ffi.Pointer ptr; @@ -1514,6 +1714,20 @@ final class wire_cst_list_payment extends ffi.Struct { external int len; } +final class wire_cst_rate extends ffi.Struct { + external ffi.Pointer coin; + + @ffi.Double() + external double value; +} + +final class wire_cst_list_rate extends ffi.Struct { + external ffi.Pointer ptr; + + @ffi.Int32() + external int len; +} + final class wire_cst_refundable_swap extends ffi.Struct { external ffi.Pointer swap_address; diff --git a/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKMapper.kt b/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKMapper.kt index a252a55..d3b8555 100644 --- a/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKMapper.kt +++ b/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKMapper.kt @@ -214,6 +214,95 @@ fun asConnectRequestList(arr: ReadableArray): List { return list } +fun asCurrencyInfo(currencyInfo: ReadableMap): CurrencyInfo? { + if (!validateMandatoryFields( + currencyInfo, + arrayOf( + "name", + "fractionSize", + "localizedName", + "localeOverrides", + ), + ) + ) { + return null + } + val name = currencyInfo.getString("name")!! + val fractionSize = currencyInfo.getInt("fractionSize").toUInt() + val spacing = if (hasNonNullKey(currencyInfo, "spacing")) currencyInfo.getInt("spacing").toUInt() else null + val symbol = if (hasNonNullKey(currencyInfo, "symbol")) currencyInfo.getMap("symbol")?.let { asSymbol(it) } else null + val uniqSymbol = if (hasNonNullKey(currencyInfo, "uniqSymbol")) currencyInfo.getMap("uniqSymbol")?.let { asSymbol(it) } else null + val localizedName = currencyInfo.getArray("localizedName")?.let { asLocalizedNameList(it) }!! + val localeOverrides = currencyInfo.getArray("localeOverrides")?.let { asLocaleOverridesList(it) }!! + return CurrencyInfo( + name, + fractionSize, + spacing, + symbol, + uniqSymbol, + localizedName, + localeOverrides, + ) +} + +fun readableMapOf(currencyInfo: CurrencyInfo): ReadableMap = + readableMapOf( + "name" to currencyInfo.name, + "fractionSize" to currencyInfo.fractionSize, + "spacing" to currencyInfo.spacing, + "symbol" to currencyInfo.symbol?.let { readableMapOf(it) }, + "uniqSymbol" to currencyInfo.uniqSymbol?.let { readableMapOf(it) }, + "localizedName" to readableArrayOf(currencyInfo.localizedName), + "localeOverrides" to readableArrayOf(currencyInfo.localeOverrides), + ) + +fun asCurrencyInfoList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asCurrencyInfo(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + +fun asFiatCurrency(fiatCurrency: ReadableMap): FiatCurrency? { + if (!validateMandatoryFields( + fiatCurrency, + arrayOf( + "id", + "info", + ), + ) + ) { + return null + } + val id = fiatCurrency.getString("id")!! + val info = fiatCurrency.getMap("info")?.let { asCurrencyInfo(it) }!! + return FiatCurrency( + id, + info, + ) +} + +fun readableMapOf(fiatCurrency: FiatCurrency): ReadableMap = + readableMapOf( + "id" to fiatCurrency.id, + "info" to readableMapOf(fiatCurrency.info), + ) + +fun asFiatCurrencyList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asFiatCurrency(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + fun asGetInfoResponse(getInfoResponse: ReadableMap): GetInfoResponse? { if (!validateMandatoryFields( getInfoResponse, @@ -707,6 +796,81 @@ fun asLnUrlWithdrawSuccessDataList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asLocaleOverrides(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + +fun asLocalizedName(localizedName: ReadableMap): LocalizedName? { + if (!validateMandatoryFields( + localizedName, + arrayOf( + "locale", + "name", + ), + ) + ) { + return null + } + val locale = localizedName.getString("locale")!! + val name = localizedName.getString("name")!! + return LocalizedName( + locale, + name, + ) +} + +fun readableMapOf(localizedName: LocalizedName): ReadableMap = + readableMapOf( + "locale" to localizedName.locale, + "name" to localizedName.name, + ) + +fun asLocalizedNameList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asLocalizedName(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + fun asLogEntry(logEntry: ReadableMap): LogEntry? { if (!validateMandatoryFields( logEntry, @@ -1225,6 +1389,42 @@ fun asPrepareSendResponseList(arr: ReadableArray): List { return list } +fun asRate(rate: ReadableMap): Rate? { + if (!validateMandatoryFields( + rate, + arrayOf( + "coin", + "value", + ), + ) + ) { + return null + } + val coin = rate.getString("coin")!! + val value = rate.getDouble("value") + return Rate( + coin, + value, + ) +} + +fun readableMapOf(rate: Rate): ReadableMap = + readableMapOf( + "coin" to rate.coin, + "value" to rate.value, + ) + +fun asRateList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asRate(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + fun asReceiveOnchainRequest(receiveOnchainRequest: ReadableMap): ReceiveOnchainRequest? { if (!validateMandatoryFields( receiveOnchainRequest, @@ -1589,6 +1789,45 @@ fun asSendPaymentResponseList(arr: ReadableArray): List { return list } +fun asSymbol(symbol: ReadableMap): Symbol? { + if (!validateMandatoryFields( + symbol, + arrayOf(), + ) + ) { + return null + } + val grapheme = if (hasNonNullKey(symbol, "grapheme")) symbol.getString("grapheme") else null + val template = if (hasNonNullKey(symbol, "template")) symbol.getString("template") else null + val rtl = if (hasNonNullKey(symbol, "rtl")) symbol.getBoolean("rtl") else null + val position = if (hasNonNullKey(symbol, "position")) symbol.getInt("position").toUInt() else null + return Symbol( + grapheme, + template, + rtl, + position, + ) +} + +fun readableMapOf(symbol: Symbol): ReadableMap = + readableMapOf( + "grapheme" to symbol.grapheme, + "template" to symbol.template, + "rtl" to symbol.rtl, + "position" to symbol.position, + ) + +fun asSymbolList(arr: ReadableArray): List { + val list = ArrayList() + for (value in arr.toArrayList()) { + when (value) { + is ReadableMap -> list.add(asSymbol(value)!!) + else -> throw LiquidSdkException.Generic(errUnexpectedType("${value::class.java.name}")) + } + } + return list +} + fun asUrlSuccessActionData(urlSuccessActionData: ReadableMap): UrlSuccessActionData? { if (!validateMandatoryFields( urlSuccessActionData, @@ -2064,7 +2303,11 @@ fun pushToArray( ) { when (value) { null -> array.pushNull() + is FiatCurrency -> array.pushMap(readableMapOf(value)) + is LocaleOverrides -> array.pushMap(readableMapOf(value)) + is LocalizedName -> array.pushMap(readableMapOf(value)) is Payment -> array.pushMap(readableMapOf(value)) + is Rate -> array.pushMap(readableMapOf(value)) is RefundableSwap -> array.pushMap(readableMapOf(value)) is RouteHint -> array.pushMap(readableMapOf(value)) is RouteHintHop -> array.pushMap(readableMapOf(value)) diff --git a/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKModule.kt b/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKModule.kt index e97b517..012439c 100644 --- a/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKModule.kt +++ b/packages/react-native/android/src/main/java/com/breezliquidsdk/BreezLiquidSDKModule.kt @@ -500,4 +500,28 @@ class BreezLiquidSDKModule( } } } + + @ReactMethod + fun fetchFiatRates(promise: Promise) { + executor.execute { + try { + val res = getBindingLiquidSdk().fetchFiatRates() + promise.resolve(readableArrayOf(res)) + } catch (e: Exception) { + promise.reject(e.javaClass.simpleName.replace("Exception", "Error"), e.message, e) + } + } + } + + @ReactMethod + fun listFiatCurrencies(promise: Promise) { + executor.execute { + try { + val res = getBindingLiquidSdk().listFiatCurrencies() + promise.resolve(readableArrayOf(res)) + } catch (e: Exception) { + promise.reject(e.javaClass.simpleName.replace("Exception", "Error"), e.message, e) + } + } + } } diff --git a/packages/react-native/ios/BreezLiquidSDKMapper.swift b/packages/react-native/ios/BreezLiquidSDKMapper.swift index 6f26a5f..d1427b2 100644 --- a/packages/react-native/ios/BreezLiquidSDKMapper.swift +++ b/packages/react-native/ios/BreezLiquidSDKMapper.swift @@ -252,6 +252,119 @@ enum BreezLiquidSDKMapper { return connectRequestList.map { v -> [String: Any?] in dictionaryOf(connectRequest: v) } } + static func asCurrencyInfo(currencyInfo: [String: Any?]) throws -> CurrencyInfo { + guard let name = currencyInfo["name"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "name", typeName: "CurrencyInfo")) + } + guard let fractionSize = currencyInfo["fractionSize"] as? UInt32 else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "fractionSize", typeName: "CurrencyInfo")) + } + var spacing: UInt32? + if hasNonNilKey(data: currencyInfo, key: "spacing") { + guard let spacingTmp = currencyInfo["spacing"] as? UInt32 else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "spacing")) + } + spacing = spacingTmp + } + var symbol: Symbol? + if let symbolTmp = currencyInfo["symbol"] as? [String: Any?] { + symbol = try asSymbol(symbol: symbolTmp) + } + + var uniqSymbol: Symbol? + if let uniqSymbolTmp = currencyInfo["uniqSymbol"] as? [String: Any?] { + uniqSymbol = try asSymbol(symbol: uniqSymbolTmp) + } + + guard let localizedNameTmp = currencyInfo["localizedName"] as? [[String: Any?]] else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "localizedName", typeName: "CurrencyInfo")) + } + let localizedName = try asLocalizedNameList(arr: localizedNameTmp) + + guard let localeOverridesTmp = currencyInfo["localeOverrides"] as? [[String: Any?]] else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "localeOverrides", typeName: "CurrencyInfo")) + } + let localeOverrides = try asLocaleOverridesList(arr: localeOverridesTmp) + + return CurrencyInfo( + name: name, + fractionSize: fractionSize, + spacing: spacing, + symbol: symbol, + uniqSymbol: uniqSymbol, + localizedName: localizedName, + localeOverrides: localeOverrides + ) + } + + static func dictionaryOf(currencyInfo: CurrencyInfo) -> [String: Any?] { + return [ + "name": currencyInfo.name, + "fractionSize": currencyInfo.fractionSize, + "spacing": currencyInfo.spacing == nil ? nil : currencyInfo.spacing, + "symbol": currencyInfo.symbol == nil ? nil : dictionaryOf(symbol: currencyInfo.symbol!), + "uniqSymbol": currencyInfo.uniqSymbol == nil ? nil : dictionaryOf(symbol: currencyInfo.uniqSymbol!), + "localizedName": arrayOf(localizedNameList: currencyInfo.localizedName), + "localeOverrides": arrayOf(localeOverridesList: currencyInfo.localeOverrides), + ] + } + + static func asCurrencyInfoList(arr: [Any]) throws -> [CurrencyInfo] { + var list = [CurrencyInfo]() + for value in arr { + if let val = value as? [String: Any?] { + var currencyInfo = try asCurrencyInfo(currencyInfo: val) + list.append(currencyInfo) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "CurrencyInfo")) + } + } + return list + } + + static func arrayOf(currencyInfoList: [CurrencyInfo]) -> [Any] { + return currencyInfoList.map { v -> [String: Any?] in dictionaryOf(currencyInfo: v) } + } + + static func asFiatCurrency(fiatCurrency: [String: Any?]) throws -> FiatCurrency { + guard let id = fiatCurrency["id"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "id", typeName: "FiatCurrency")) + } + guard let infoTmp = fiatCurrency["info"] as? [String: Any?] else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "info", typeName: "FiatCurrency")) + } + let info = try asCurrencyInfo(currencyInfo: infoTmp) + + return FiatCurrency( + id: id, + info: info + ) + } + + static func dictionaryOf(fiatCurrency: FiatCurrency) -> [String: Any?] { + return [ + "id": fiatCurrency.id, + "info": dictionaryOf(currencyInfo: fiatCurrency.info), + ] + } + + static func asFiatCurrencyList(arr: [Any]) throws -> [FiatCurrency] { + var list = [FiatCurrency]() + for value in arr { + if let val = value as? [String: Any?] { + var fiatCurrency = try asFiatCurrency(fiatCurrency: val) + list.append(fiatCurrency) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "FiatCurrency")) + } + } + return list + } + + static func arrayOf(fiatCurrencyList: [FiatCurrency]) -> [Any] { + return fiatCurrencyList.map { v -> [String: Any?] in dictionaryOf(fiatCurrency: v) } + } + static func asGetInfoResponse(getInfoResponse: [String: Any?]) throws -> GetInfoResponse { guard let balanceSat = getInfoResponse["balanceSat"] as? UInt64 else { throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "balanceSat", typeName: "GetInfoResponse")) @@ -841,6 +954,92 @@ enum BreezLiquidSDKMapper { return lnUrlWithdrawSuccessDataList.map { v -> [String: Any?] in dictionaryOf(lnUrlWithdrawSuccessData: v) } } + static func asLocaleOverrides(localeOverrides: [String: Any?]) throws -> LocaleOverrides { + guard let locale = localeOverrides["locale"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "locale", typeName: "LocaleOverrides")) + } + var spacing: UInt32? + if hasNonNilKey(data: localeOverrides, key: "spacing") { + guard let spacingTmp = localeOverrides["spacing"] as? UInt32 else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "spacing")) + } + spacing = spacingTmp + } + guard let symbolTmp = localeOverrides["symbol"] as? [String: Any?] else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "symbol", typeName: "LocaleOverrides")) + } + let symbol = try asSymbol(symbol: symbolTmp) + + return LocaleOverrides( + locale: locale, + spacing: spacing, + symbol: symbol + ) + } + + static func dictionaryOf(localeOverrides: LocaleOverrides) -> [String: Any?] { + return [ + "locale": localeOverrides.locale, + "spacing": localeOverrides.spacing == nil ? nil : localeOverrides.spacing, + "symbol": dictionaryOf(symbol: localeOverrides.symbol), + ] + } + + static func asLocaleOverridesList(arr: [Any]) throws -> [LocaleOverrides] { + var list = [LocaleOverrides]() + for value in arr { + if let val = value as? [String: Any?] { + var localeOverrides = try asLocaleOverrides(localeOverrides: val) + list.append(localeOverrides) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "LocaleOverrides")) + } + } + return list + } + + static func arrayOf(localeOverridesList: [LocaleOverrides]) -> [Any] { + return localeOverridesList.map { v -> [String: Any?] in dictionaryOf(localeOverrides: v) } + } + + static func asLocalizedName(localizedName: [String: Any?]) throws -> LocalizedName { + guard let locale = localizedName["locale"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "locale", typeName: "LocalizedName")) + } + guard let name = localizedName["name"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "name", typeName: "LocalizedName")) + } + + return LocalizedName( + locale: locale, + name: name + ) + } + + static func dictionaryOf(localizedName: LocalizedName) -> [String: Any?] { + return [ + "locale": localizedName.locale, + "name": localizedName.name, + ] + } + + static func asLocalizedNameList(arr: [Any]) throws -> [LocalizedName] { + var list = [LocalizedName]() + for value in arr { + if let val = value as? [String: Any?] { + var localizedName = try asLocalizedName(localizedName: val) + list.append(localizedName) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "LocalizedName")) + } + } + return list + } + + static func arrayOf(localizedNameList: [LocalizedName]) -> [Any] { + return localizedNameList.map { v -> [String: Any?] in dictionaryOf(localizedName: v) } + } + static func asLogEntry(logEntry: [String: Any?]) throws -> LogEntry { guard let line = logEntry["line"] as? String else { throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "line", typeName: "LogEntry")) @@ -1421,6 +1620,44 @@ enum BreezLiquidSDKMapper { return prepareSendResponseList.map { v -> [String: Any?] in dictionaryOf(prepareSendResponse: v) } } + static func asRate(rate: [String: Any?]) throws -> Rate { + guard let coin = rate["coin"] as? String else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "coin", typeName: "Rate")) + } + guard let value = rate["value"] as? Double else { + throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "value", typeName: "Rate")) + } + + return Rate( + coin: coin, + value: value + ) + } + + static func dictionaryOf(rate: Rate) -> [String: Any?] { + return [ + "coin": rate.coin, + "value": rate.value, + ] + } + + static func asRateList(arr: [Any]) throws -> [Rate] { + var list = [Rate]() + for value in arr { + if let val = value as? [String: Any?] { + var rate = try asRate(rate: val) + list.append(rate) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "Rate")) + } + } + return list + } + + static func arrayOf(rateList: [Rate]) -> [Any] { + return rateList.map { v -> [String: Any?] in dictionaryOf(rate: v) } + } + static func asReceiveOnchainRequest(receiveOnchainRequest: [String: Any?]) throws -> ReceiveOnchainRequest { guard let prepareResTmp = receiveOnchainRequest["prepareRes"] as? [String: Any?] else { throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "prepareRes", typeName: "ReceiveOnchainRequest")) @@ -1821,6 +2058,70 @@ enum BreezLiquidSDKMapper { return sendPaymentResponseList.map { v -> [String: Any?] in dictionaryOf(sendPaymentResponse: v) } } + static func asSymbol(symbol: [String: Any?]) throws -> Symbol { + var grapheme: String? + if hasNonNilKey(data: symbol, key: "grapheme") { + guard let graphemeTmp = symbol["grapheme"] as? String else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "grapheme")) + } + grapheme = graphemeTmp + } + var template: String? + if hasNonNilKey(data: symbol, key: "template") { + guard let templateTmp = symbol["template"] as? String else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "template")) + } + template = templateTmp + } + var rtl: Bool? + if hasNonNilKey(data: symbol, key: "rtl") { + guard let rtlTmp = symbol["rtl"] as? Bool else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "rtl")) + } + rtl = rtlTmp + } + var position: UInt32? + if hasNonNilKey(data: symbol, key: "position") { + guard let positionTmp = symbol["position"] as? UInt32 else { + throw LiquidSdkError.Generic(message: errUnexpectedValue(fieldName: "position")) + } + position = positionTmp + } + + return Symbol( + grapheme: grapheme, + template: template, + rtl: rtl, + position: position + ) + } + + static func dictionaryOf(symbol: Symbol) -> [String: Any?] { + return [ + "grapheme": symbol.grapheme == nil ? nil : symbol.grapheme, + "template": symbol.template == nil ? nil : symbol.template, + "rtl": symbol.rtl == nil ? nil : symbol.rtl, + "position": symbol.position == nil ? nil : symbol.position, + ] + } + + static func asSymbolList(arr: [Any]) throws -> [Symbol] { + var list = [Symbol]() + for value in arr { + if let val = value as? [String: Any?] { + var symbol = try asSymbol(symbol: val) + list.append(symbol) + } else { + throw LiquidSdkError.Generic(message: errUnexpectedType(typeName: "Symbol")) + } + } + return list + } + + static func arrayOf(symbolList: [Symbol]) -> [Any] { + return symbolList.map { v -> [String: Any?] in dictionaryOf(symbol: v) } + } + static func asUrlSuccessActionData(urlSuccessActionData: [String: Any?]) throws -> UrlSuccessActionData { guard let description = urlSuccessActionData["description"] as? String else { throw LiquidSdkError.Generic(message: errMissingMandatoryField(fieldName: "description", typeName: "UrlSuccessActionData")) diff --git a/packages/react-native/ios/RNBreezLiquidSDK.m b/packages/react-native/ios/RNBreezLiquidSDK.m index 5e81b32..efb48d4 100644 --- a/packages/react-native/ios/RNBreezLiquidSDK.m +++ b/packages/react-native/ios/RNBreezLiquidSDK.m @@ -158,4 +158,14 @@ RCT_EXTERN_METHOD( reject: (RCTPromiseRejectBlock)reject ) +RCT_EXTERN_METHOD( + fetchFiatRates: (RCTPromiseResolveBlock)resolve + reject: (RCTPromiseRejectBlock)reject +) + +RCT_EXTERN_METHOD( + listFiatCurrencies: (RCTPromiseResolveBlock)resolve + reject: (RCTPromiseRejectBlock)reject +) + @end \ No newline at end of file diff --git a/packages/react-native/ios/RNBreezLiquidSDK.swift b/packages/react-native/ios/RNBreezLiquidSDK.swift index 30ac24e..e1d9287 100644 --- a/packages/react-native/ios/RNBreezLiquidSDK.swift +++ b/packages/react-native/ios/RNBreezLiquidSDK.swift @@ -370,6 +370,26 @@ class RNBreezLiquidSDK: RCTEventEmitter { } } + @objc(fetchFiatRates:reject:) + func fetchFiatRates(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + do { + var res = try getBindingLiquidSdk().fetchFiatRates() + resolve(BreezLiquidSDKMapper.arrayOf(rateList: res)) + } catch let err { + rejectErr(err: err, reject: reject) + } + } + + @objc(listFiatCurrencies:reject:) + func listFiatCurrencies(_ resolve: @escaping RCTPromiseResolveBlock, reject: @escaping RCTPromiseRejectBlock) { + do { + var res = try getBindingLiquidSdk().listFiatCurrencies() + resolve(BreezLiquidSDKMapper.arrayOf(fiatCurrencyList: res)) + } catch let err { + rejectErr(err: err, reject: reject) + } + } + func rejectErr(err: Error, reject: @escaping RCTPromiseRejectBlock) { var errorName = "Generic" var message = "\(err)" diff --git a/packages/react-native/src/index.ts b/packages/react-native/src/index.ts index 524cda5..e68b365 100644 --- a/packages/react-native/src/index.ts +++ b/packages/react-native/src/index.ts @@ -51,6 +51,21 @@ export interface ConnectRequest { mnemonic: string } +export interface CurrencyInfo { + name: string + fractionSize: number + spacing?: number + symbol?: SymbolType + uniqSymbol?: SymbolType + localizedName: LocalizedName[] + localeOverrides: LocaleOverrides[] +} + +export interface FiatCurrency { + id: string + info: CurrencyInfo +} + export interface GetInfoResponse { balanceSat: number pendingSendSat: number @@ -131,6 +146,17 @@ export interface LnUrlWithdrawSuccessData { invoice: LnInvoice } +export interface LocaleOverrides { + locale: string + spacing?: number + symbol: SymbolType +} + +export interface LocalizedName { + locale: string + name: string +} + export interface LogEntry { line: string level: string @@ -206,6 +232,11 @@ export interface PrepareSendResponse { feesSat: number } +export interface Rate { + coin: string + value: number +} + export interface ReceiveOnchainRequest { prepareRes: PrepareReceiveOnchainResponse } @@ -258,6 +289,13 @@ export interface SendPaymentResponse { payment: Payment } +export interface SymbolType { + grapheme?: string + template?: string + rtl?: boolean + position?: number +} + export interface UrlSuccessActionData { description: string url: string @@ -571,3 +609,13 @@ export const lnurlAuth = async (reqData: LnUrlAuthRequestData): Promise => { + const response = await BreezLiquidSDK.fetchFiatRates() + return response +} + +export const listFiatCurrencies = async (): Promise => { + const response = await BreezLiquidSDK.listFiatCurrencies() + return response +}