From d544ac3e4e07d9f625e649c77c36eee26b8da22c Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:16:18 -0300 Subject: [PATCH 001/197] added removeListeners and initLogger --- bindings/swift/Cargo.lock | 66 +++++++++++++++++--------------- bindings/swift/Cargo.toml | 13 +++---- bindings/swift/iota_wallet_ffi.h | 3 +- bindings/swift/src/lib.rs | 8 +++- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/bindings/swift/Cargo.lock b/bindings/swift/Cargo.lock index 41d9424800..743ac15be5 100644 --- a/bindings/swift/Cargo.lock +++ b/bindings/swift/Cargo.lock @@ -86,6 +86,12 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + [[package]] name = "arrayvec" version = "0.7.2" @@ -94,9 +100,9 @@ checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" [[package]] name = "async-trait" -version = "0.1.59" +version = "0.1.58" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6e93155431f3931513b243d371981bb2770112b370c82745a1d19d2f99364" +checksum = "1e805d94e6b5001b651426cf4cd446b1ab5f319d27bab5c644f61de0a804360c" dependencies = [ "proc-macro2", "quote", @@ -199,7 +205,7 @@ version = "0.10.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b12e5fd123190ce1c2e559308a94c9bacad77907d4c6005d9e58fe1a0689e55e" dependencies = [ - "digest 0.10.6", + "digest 0.10.3", ] [[package]] @@ -359,19 +365,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "cpufeatures" -version = "0.2.5" +name = "crossbeam-utils" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ - "libc", + "cfg-if", ] [[package]] name = "crossbeam-utils" -version = "0.8.14" +version = "0.8.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" dependencies = [ "cfg-if", ] @@ -988,8 +994,8 @@ dependencies = [ [[package]] name = "iota-client" -version = "2.0.1-rc.4" -source = "git+https://github.com/iotaledger/iota.rs?rev=3715998ad6b81904308402b79ad64e559b5a79dc#3715998ad6b81904308402b79ad64e559b5a79dc" +version = "2.0.1-rc.3" +source = "git+https://github.com/iotaledger/iota.rs?rev=9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51#9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51" dependencies = [ "async-trait", "backtrace", @@ -1046,7 +1052,7 @@ dependencies = [ [[package]] name = "iota-pow" version = "1.0.0-rc.1" -source = "git+https://github.com/iotaledger/iota.rs?rev=3715998ad6b81904308402b79ad64e559b5a79dc#3715998ad6b81904308402b79ad64e559b5a79dc" +source = "git+https://github.com/iotaledger/iota.rs?rev=9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51#9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51" dependencies = [ "iota-crypto", "thiserror", @@ -1054,14 +1060,14 @@ dependencies = [ [[package]] name = "iota-types" -version = "1.0.0-rc.3" -source = "git+https://github.com/iotaledger/iota.rs?rev=3715998ad6b81904308402b79ad64e559b5a79dc#3715998ad6b81904308402b79ad64e559b5a79dc" +version = "1.0.0-rc.1" +source = "git+https://github.com/iotaledger/iota.rs?rev=9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51#9e1b3ea7b73f4cf0fdab7e00275d5e7d0ad05b51" dependencies = [ "bech32", "bitflags", "bytemuck", "derive_more", - "hashbrown 0.13.1", + "hashbrown 0.12.3", "hex", "iota-crypto", "iota-pow", @@ -1081,7 +1087,7 @@ version = "0.1.0" dependencies = [ "fern-logger", "futures", - "iota-wallet 1.0.0-rc.3", + "iota-wallet 1.0.0-rc.2", "log", "once_cell", "serde", @@ -1091,7 +1097,7 @@ dependencies = [ [[package]] name = "iota-wallet" -version = "1.0.0-rc.3" +version = "1.0.0-rc.2" dependencies = [ "async-trait", "backtrace", @@ -1291,9 +1297,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ "bitflags", "cfg-if", @@ -1780,9 +1786,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.148" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53f64bb4ba0191d6d0676e1b141ca55047d83b74f5607e6d8eb88126c52c2dc" +checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" dependencies = [ "serde_derive", ] @@ -1798,9 +1804,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.148" +version = "1.0.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55492425aa53521babf6137309e7d34c20bbfbbfcfe2c7f3a047fd1f6b92c0c" +checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" dependencies = [ "proc-macro2", "quote", @@ -1809,9 +1815,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.89" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db" +checksum = "6ce777b7b150d76b9cf60d28b55f5847135a003f7d7350c6be7a773508ce7d45" dependencies = [ "itoa", "ryu", @@ -1851,7 +1857,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.3", ] [[package]] @@ -1963,9 +1969,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.105" +version = "1.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" +checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" dependencies = [ "proc-macro2", "quote", @@ -2065,9 +2071,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "a9e03c497dc955702ba729190dc4aac6f2a0ce97f913e5b1b5912fc5039d9099" dependencies = [ "autocfg", "bytes", diff --git a/bindings/swift/Cargo.toml b/bindings/swift/Cargo.toml index 57cff11c98..024958208d 100644 --- a/bindings/swift/Cargo.toml +++ b/bindings/swift/Cargo.toml @@ -9,12 +9,11 @@ edition = "2021" crate-type = [ "cdylib", "staticlib" ] # Creates dynamic lib [dependencies] -iota-wallet = { path = "../../", features = [ "message_interface", "events" ] } - fern-logger = { version = "0.5.0", default-features = false } -futures = { version = "0.3.25", default-features = false } +futures = { version = "0.3.23", default-features = false } +iota-wallet = { path = "../../", features = ["message_interface", "events"] } log = { version = "0.4.17", default-features = false } -once_cell = { version = "1.16.0", default-features = false } -serde = { version = "1.0.147", default-features = false, features = [ "derive" ] } -serde_json = { version = "1.0.88", default-features = false } -tokio = { version = "1.22.0", default-features = false } +once_cell = { version = "1.13.1", default-features = false } +serde = { version = "1.0.143", default-features = false, features = ["derive"] } +serde_json = { version = "1.0.83", default-features = false } +tokio = { version = "1.20.1", default-features = false} diff --git a/bindings/swift/iota_wallet_ffi.h b/bindings/swift/iota_wallet_ffi.h index c3853f0c1c..f7cc0450ae 100644 --- a/bindings/swift/iota_wallet_ffi.h +++ b/bindings/swift/iota_wallet_ffi.h @@ -19,7 +19,8 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + #ifdef __cplusplus diff --git a/bindings/swift/src/lib.rs b/bindings/swift/src/lib.rs index 63d1d1bc0e..82e5f729c8 100644 --- a/bindings/swift/src/lib.rs +++ b/bindings/swift/src/lib.rs @@ -7,6 +7,7 @@ use iota_wallet::{ }; use std::{ + str::FromStr, ffi::{CStr, CString}, os::raw::{c_char, c_void}, str::FromStr, @@ -16,6 +17,7 @@ use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; use once_cell::sync::OnceCell; use std::sync::Arc; use tokio::runtime::Runtime; +use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; // use bee_common::logger::{LoggerConfig, LoggerOutputConfigBuilder}; // use log::LevelFilter; @@ -214,7 +216,7 @@ pub unsafe extern "C" fn iota_listen( /// /// `callback` will be invoked from another thread so context must be safe to `Send` across threads #[no_mangle] -pub unsafe extern "C" fn iota_clear_listeners( +pub unsafe extern "C" fn clear_listeners( handle: *mut IotaWalletHandle, event_types: *const c_char, callback: Callback, @@ -277,7 +279,9 @@ pub unsafe extern "C" fn iota_init_logger(file_name: *const c_char, level_filter level = log::LevelFilter::from_str(level_filter.to_str().unwrap()).unwrap(); } - let output_config = LoggerOutputConfigBuilder::new().name(file_name).level_filter(level); + let output_config = LoggerOutputConfigBuilder::new() + .name(file_name) + .level_filter(level); match logger_init(LoggerConfig::build().with_output(output_config).finish()) { Ok(_) => 0, Err(_) => -1, From a03488e83bd9b7628afbd9ee24bc46f9849d65ff Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:28:08 -0300 Subject: [PATCH 002/197] added xcode method and added iota_ prefix --- bindings/swift/iota_wallet_ffi.h | 2 +- bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bindings/swift/iota_wallet_ffi.h b/bindings/swift/iota_wallet_ffi.h index f7cc0450ae..1548f22692 100644 --- a/bindings/swift/iota_wallet_ffi.h +++ b/bindings/swift/iota_wallet_ffi.h @@ -19,7 +19,7 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); diff --git a/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index e7a1c75e6d..1b567a2308 100644 --- a/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -+ (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) level_filter { ++ (BOOL) init_logger:(nullable NSString*) file_name level_filter: (nullable NSString*) { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } diff --git a/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h b/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h index c3853f0c1c..f7cc0450ae 100644 --- a/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h +++ b/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h @@ -19,7 +19,8 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + #ifdef __cplusplus From 60a1b12f4ffed4a0f4486e4720dd6c60582aaef1 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:28:25 -0300 Subject: [PATCH 003/197] fmt --- bindings/swift/src/lib.rs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bindings/swift/src/lib.rs b/bindings/swift/src/lib.rs index 82e5f729c8..1d76b5373c 100644 --- a/bindings/swift/src/lib.rs +++ b/bindings/swift/src/lib.rs @@ -7,7 +7,6 @@ use iota_wallet::{ }; use std::{ - str::FromStr, ffi::{CStr, CString}, os::raw::{c_char, c_void}, str::FromStr, @@ -17,7 +16,6 @@ use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; use once_cell::sync::OnceCell; use std::sync::Arc; use tokio::runtime::Runtime; -use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; // use bee_common::logger::{LoggerConfig, LoggerOutputConfigBuilder}; // use log::LevelFilter; @@ -279,9 +277,7 @@ pub unsafe extern "C" fn iota_init_logger(file_name: *const c_char, level_filter level = log::LevelFilter::from_str(level_filter.to_str().unwrap()).unwrap(); } - let output_config = LoggerOutputConfigBuilder::new() - .name(file_name) - .level_filter(level); + let output_config = LoggerOutputConfigBuilder::new().name(file_name).level_filter(level); match logger_init(LoggerConfig::build().with_output(output_config).finish()) { Ok(_) => 0, Err(_) => -1, From 66d752acbd215e12cf751e6ec6a5c1223f742f2a Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:32:00 -0300 Subject: [PATCH 004/197] removed nullable and format on .h file --- bindings/swift/iota_wallet_ffi.h | 1 - bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h | 3 +-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bindings/swift/iota_wallet_ffi.h b/bindings/swift/iota_wallet_ffi.h index 1548f22692..c3853f0c1c 100644 --- a/bindings/swift/iota_wallet_ffi.h +++ b/bindings/swift/iota_wallet_ffi.h @@ -22,7 +22,6 @@ extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); - #ifdef __cplusplus } #endif diff --git a/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index 1b567a2308..a457e5ec0c 100644 --- a/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -+ (BOOL) init_logger:(nullable NSString*) file_name level_filter: (nullable NSString*) { ++ (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } diff --git a/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h b/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h index f7cc0450ae..c3853f0c1c 100644 --- a/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h +++ b/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h @@ -19,8 +19,7 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); - +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); #ifdef __cplusplus From 226deb1dbdfeed1cc5d5eb150c0d70580aeea6d4 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 25 Nov 2022 14:41:25 +0100 Subject: [PATCH 005/197] added spaces for fancyness --- bindings/swift/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/swift/Cargo.toml b/bindings/swift/Cargo.toml index 024958208d..35e50dd03d 100644 --- a/bindings/swift/Cargo.toml +++ b/bindings/swift/Cargo.toml @@ -11,9 +11,9 @@ crate-type = [ "cdylib", "staticlib" ] # Creates dynamic lib [dependencies] fern-logger = { version = "0.5.0", default-features = false } futures = { version = "0.3.23", default-features = false } -iota-wallet = { path = "../../", features = ["message_interface", "events"] } +iota-wallet = { path = "../../", features = [ "message_interface", "events" ] } log = { version = "0.4.17", default-features = false } once_cell = { version = "1.13.1", default-features = false } -serde = { version = "1.0.143", default-features = false, features = ["derive"] } +serde = { version = "1.0.143", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0.83", default-features = false } tokio = { version = "1.20.1", default-features = false} From 6eaea97ece3dad487ebf77e27d05920a8f33a845 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:48:55 +0100 Subject: [PATCH 006/197] chore: define plugin basis --- bindings/capacitorjs/.gitignore | 60 +++++++++++++++++++ bindings/capacitorjs/IotaWalletMobile.podspec | 26 ++++++++ bindings/capacitorjs/package.json | 58 ++++++++++++++++++ bindings/capacitorjs/rollup.config.js | 19 ++++++ 4 files changed, 163 insertions(+) create mode 100644 bindings/capacitorjs/.gitignore create mode 100644 bindings/capacitorjs/IotaWalletMobile.podspec create mode 100644 bindings/capacitorjs/package.json create mode 100644 bindings/capacitorjs/rollup.config.js diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore new file mode 100644 index 0000000000..2058c00f47 --- /dev/null +++ b/bindings/capacitorjs/.gitignore @@ -0,0 +1,60 @@ +# node files +dist +node_modules + +# iOS files +Pods +Build +xcuserdata + +# macOS files +.DS_Store + + + +# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore + +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin +gen +out + +# Gradle files +.gradle +build + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation + +# Android Studio captures folder +captures + +# IntelliJ +*.iml +.idea + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild diff --git a/bindings/capacitorjs/IotaWalletMobile.podspec b/bindings/capacitorjs/IotaWalletMobile.podspec new file mode 100644 index 0000000000..c544913736 --- /dev/null +++ b/bindings/capacitorjs/IotaWalletMobile.podspec @@ -0,0 +1,26 @@ + + Pod::Spec.new do |s| + s.name = 'IotaWalletMobile' + s.version = '0.0.1' + s.summary = 'Capacitor plugin binding to the wallet library' + s.license = { :type => 'Apache-2.0' } + s.homepage = 'https://github.com/iotaledger/wallet.rs#readme' + s.author = 'IOTA Stiftung' + s.source = { :git => 'https://github.com/iotaledger/firefly.git', :tag => s.version.to_s } + s.source_files = ['ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/*.{h,m,swift}'] + s.ios.deployment_target = '12.0' + s.dependency 'Capacitor' + s.pod_target_xcconfig = { + 'OTHER_LDFLAGS' => '-lc++', + 'ENABLE_BITCODE' => '$(ENABLE_BITCODE_$(CONFIGURATION))', + 'ENABLE_BITCODE_Release' => 'NO', + 'ENABLE_BITCODE_Debug' => 'YES' + } + s.frameworks = 'WalletFramework' + s.vendored_frameworks = 'ios/WalletFramework.xcframework' + + s.platform = :ios, "12.0" + s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => ['$(PODS_TARGET_SRCROOT)/ios/Plugin/Libraries', '$(PODS_TARGET_SRCROOT)/ios/WalletFramework.xcframework'] } + s.preserve_paths = ['ios/Plugin/Libraries/module.modulemap'] + s.preserve_paths = ['ios/WalletFramework.xcframework'] + end diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json new file mode 100644 index 0000000000..d990e17d1c --- /dev/null +++ b/bindings/capacitorjs/package.json @@ -0,0 +1,58 @@ +{ + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "description": "Capacitor plugin binding to the wallet library", + "homepage": "https://github.com/iotaledger/wallet.rs#readme", + "main": "dist/esm/index.js", + "module": "dist/esm/index.js", + "files": [ + "android/src/main/", + "android/build.gradle", + "dist/", + "ios/Plugin/", + "IotaWalletMobile.podspec" + ], + "types": "dist/esm/index.d.ts", + "scripts": { + "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", + "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", + "verify:android": "cd android && ./gradlew clean build test && cd ..", + "build": "npm run clean && tsc && rollup -c rollup.config.js", + "clean": "rm -rf ./dist", + "watch": "tsc --watch", + "prepublishOnly": "npm run build" + }, + "author": "IOTA Stiftung", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/iotaledger/wallet.rs.git" + }, + "bugs": { + "url": "https://github.com/iotaledger/wallet.rs/issues" + }, + "dependencies": { + "@capacitor/core": "^3.4.1", + "@iota/types": "^1.0.0-beta.15" + }, + "devDependencies": { + "@capacitor/android": "^3.4.1", + "@capacitor/core": "^3.4.1", + "@capacitor/docgen": "^0.0.10", + "@capacitor/ios": "^3.4.1", + "rimraf": "^3.0.2", + "rollup": "^2.32.0", + "typescript": "~4.0.3" + }, + "peerDependencies": { + "@capacitor/core": "^3.4.1" + }, + "capacitor": { + "ios": { + "src": "ios" + }, + "android": { + "src": "android" + } + } +} diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js new file mode 100644 index 0000000000..3ee3206fc8 --- /dev/null +++ b/bindings/capacitorjs/rollup.config.js @@ -0,0 +1,19 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +export default { + input: 'dist/esm/index.js', + output: [ + { + file: 'dist/plugin.js', + format: 'iife', + name: 'capacitorPlugin', + globals: { + '@capacitor/core': 'capacitorExports', + }, + sourcemap: true, + inlineDynamicImports: true, + }, + ], + external: ['@capacitor/core'], +}; \ No newline at end of file From adc2681fdf409f5782b729fbf6875933f750a651 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:49:52 +0100 Subject: [PATCH 007/197] chore: adapt nodejs lib folder api --- bindings/capacitorjs/src/definitions.ts | 33 + bindings/capacitorjs/src/index.ts | 17 + bindings/capacitorjs/src/lib/Account.ts | 961 ++++++++++++++++++ .../capacitorjs/src/lib/AccountManager.ts | 350 +++++++ .../capacitorjs/src/lib/MessageHandler.ts | 73 ++ bindings/capacitorjs/src/lib/bindings.ts | 40 + bindings/capacitorjs/src/types/account.ts | 135 +++ .../capacitorjs/src/types/accountManager.ts | 11 + bindings/capacitorjs/src/types/address.ts | 65 ++ .../capacitorjs/src/types/bridge/account.ts | 317 ++++++ .../src/types/bridge/accountManager.ts | 142 +++ .../capacitorjs/src/types/bridge/index.ts | 150 +++ .../capacitorjs/src/types/buildOutputData.ts | 37 + bindings/capacitorjs/src/types/event.ts | 28 + .../src/types/incomingTransactionData.ts | 3 + bindings/capacitorjs/src/types/index.ts | 16 + .../capacitorjs/src/types/loggerConfig.ts | 16 + bindings/capacitorjs/src/types/network.ts | 69 ++ bindings/capacitorjs/src/types/output.ts | 40 + .../capacitorjs/src/types/outputOptions.ts | 43 + .../src/types/preparedTransactionData.ts | 66 ++ .../capacitorjs/src/types/secretManager.ts | 52 + .../src/types/signedTransactionEssence.ts | 8 + bindings/capacitorjs/src/types/transaction.ts | 40 + .../src/types/transactionOptions.ts | 81 ++ 25 files changed, 2793 insertions(+) create mode 100644 bindings/capacitorjs/src/definitions.ts create mode 100644 bindings/capacitorjs/src/index.ts create mode 100644 bindings/capacitorjs/src/lib/Account.ts create mode 100644 bindings/capacitorjs/src/lib/AccountManager.ts create mode 100644 bindings/capacitorjs/src/lib/MessageHandler.ts create mode 100644 bindings/capacitorjs/src/lib/bindings.ts create mode 100644 bindings/capacitorjs/src/types/account.ts create mode 100644 bindings/capacitorjs/src/types/accountManager.ts create mode 100644 bindings/capacitorjs/src/types/address.ts create mode 100644 bindings/capacitorjs/src/types/bridge/account.ts create mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.ts create mode 100644 bindings/capacitorjs/src/types/bridge/index.ts create mode 100644 bindings/capacitorjs/src/types/buildOutputData.ts create mode 100644 bindings/capacitorjs/src/types/event.ts create mode 100644 bindings/capacitorjs/src/types/incomingTransactionData.ts create mode 100644 bindings/capacitorjs/src/types/index.ts create mode 100644 bindings/capacitorjs/src/types/loggerConfig.ts create mode 100644 bindings/capacitorjs/src/types/network.ts create mode 100644 bindings/capacitorjs/src/types/output.ts create mode 100644 bindings/capacitorjs/src/types/outputOptions.ts create mode 100644 bindings/capacitorjs/src/types/preparedTransactionData.ts create mode 100644 bindings/capacitorjs/src/types/secretManager.ts create mode 100644 bindings/capacitorjs/src/types/signedTransactionEssence.ts create mode 100644 bindings/capacitorjs/src/types/transaction.ts create mode 100644 bindings/capacitorjs/src/types/transactionOptions.ts diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts new file mode 100644 index 0000000000..404995ac0d --- /dev/null +++ b/bindings/capacitorjs/src/definitions.ts @@ -0,0 +1,33 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { PluginListenerHandle } from "@capacitor/core" +import { MessageHandler } from "./lib/MessageHandler" +import type { + EventType, + AccountManagerOptions, + __Message__, + __AccountMethod__, +} from './types' + +export * from './types' +export interface IotaWalletMobileTypes { + initLogger(path: string): Promise + messageHandlerNew(messageOptions: string): Promise + clearListeners( + eventTypes: EventType[], + messageHandler: any + ): void + initialize(options: AccountManagerOptions): Promise + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + messageHandler: any + ): void + destroy(messageHandler: any): void + sendMessage( + message: string, + handler :MessageHandler, + callback: (error: Error, result: string) => void + ): PluginListenerHandle +} diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts new file mode 100644 index 0000000000..57be241602 --- /dev/null +++ b/bindings/capacitorjs/src/index.ts @@ -0,0 +1,17 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { internalInitLogger } from './lib/bindings' +import type { LoggerConfig } from './types' + +export * from './lib/AccountManager' +export * from './lib/MessageHandler' +export * from './lib/Account' +// Moved to definitions.ts, TODO modify tsconfig to adapt it +// export * from './types' + +/** Function to create wallet logs */ +const initLogger = (config: LoggerConfig) => + internalInitLogger(JSON.stringify(config)) + +export { initLogger } diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts new file mode 100644 index 0000000000..6ee0575bab --- /dev/null +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -0,0 +1,961 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import type { MessageHandler } from './MessageHandler'; +import type { + AccountBalance, + AccountMetadata, + AccountSyncOptions, + AccountMeta, + Address, + AddressWithAmount, + AddressWithMicroAmount, + AddressNativeTokens, + AddressNftId, + AddressGenerationOptions, + AddressWithUnspentOutputs, + AliasOutputOptions, + FilterOptions, + IncreaseNativeTokenSupplyOptions, + MintTokenTransaction, + NativeTokenOptions, + NftOptions, + OutputData, + OutputOptions, + OutputsToClaim, + PreparedTransactionData, + Transaction, + TransactionOptions, + IncomingTransactionData, +} from '../types'; +import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; +import type { + BuildAliasOutputData, + BuildBasicOutputData, + BuildFoundryOutputData, + BuildNftOutputData, +} from '../types/buildOutputData'; +import type { + HexEncodedAmount, + IAliasOutput, + IBasicOutput, + IFoundryOutput, + INftOutput, + OutputTypes, +} from '@iota/types'; + +/** The Account class. */ +export class Account { + // private because the data isn't updated + private meta: AccountMeta; + private messageHandler: MessageHandler; + + constructor(accountMeta: AccountMeta, messageHandler: MessageHandler) { + this.meta = accountMeta; + this.messageHandler = messageHandler; + } + + /** + * Build an `AliasOutput`. + * @param data Options for building an `AliasOutput`. + * @returns The built `AliasOutput`. + */ + async buildAliasOutput(data: BuildAliasOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildAliasOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build a `BasicOutput`. + * @param data Options for building a `BasicOutput`. + * @returns The built `BasicOutput`. + */ + async buildBasicOutput(data: BuildBasicOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildBasicOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build a `FoundryOutput`. + * @param data Options for building a `FoundryOutput`. + * @returns The built `FoundryOutput`. + */ + async buildFoundryOutput( + data: BuildFoundryOutputData, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildFoundryOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build an `NftOutput`. + * @param data Options for building an `NftOutput`. + * @returns The built `NftOutput`. + */ + async buildNftOutput(data: BuildNftOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildNftOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Burn native tokens. This doesn't require the foundry output which minted them, but will not increase + * the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. Therefore it's + * recommended to use melting, if the foundry output is available. + * @param tokenId The native token id. + * @param burnAmount The to be burned amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNativeToken( + tokenId: string, + burnAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'burnNativeToken', + data: { + tokenId, + burnAmount, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Burn an nft output. Outputs controlled by it will be sweeped before if they don't have a storage + * deposit return, timelock or expiration unlock condition. This should be preferred over burning, because after + * burning, the foundry can never be destroyed anymore. + * @param nftId The NftId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNft( + nftId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'burnNft', + data: { + nftId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Claim basic or nft outputs that have additional unlock conditions + * to their `AddressUnlockCondition` from the account. + * @param outputIds The outputs to claim. + * @returns The resulting transaction. + */ + async claimOutputs(outputIds: string[]): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'claimOutputs', + data: { + outputIdsToClaim: outputIds, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Consolidate basic outputs with only an `AddressUnlockCondition` from an account + * by sending them to an own address again if the output amount is greater or + * equal to the output consolidation threshold. + * @param force Force consolidation on addresses where the threshold isn't met. + * @param outputConsolidationThreshold A default threshold is used if this is omitted. + * @returns The consolidation transaction. + */ + async consolidateOutputs( + force: boolean, + outputConsolidationThreshold?: number, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'consolidateOutputs', + data: { + force, + outputConsolidationThreshold, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * `createAliasOutput` creates an alias output + * @param aliasOutputOptions The alias output options. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns A transaction object. + */ + async createAliasOutput( + aliasOutputOptions?: AliasOutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'createAliasOutput', + data: { + aliasOutputOptions, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Melt native tokens. This happens with the foundry output which minted them, by increasing its + * `melted_tokens` field. + * @param tokenId The native token id. + * @param meltAmount To be melted amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async decreaseNativeTokenSupply( + tokenId: string, + meltAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'decreaseNativeTokenSupply', + data: { + tokenId, + meltAmount, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Destroy an alias output. Outputs controlled by it will be sweeped before if they don't have a + * storage deposit return, timelock or expiration unlock condition. The amount and possible native tokens will be + * sent to the governor address. + * @param aliasId The AliasId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyAlias( + aliasId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'destroyAlias', + data: { + aliasId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Function to destroy a foundry output with a circulating supply of 0. + * Native tokens in the foundry (minted by other foundries) will be transactioned to the controlling alias. + * @param foundryId The FoundryId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyFoundry( + foundryId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'destroyFoundry', + data: { + foundryId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Generate a new unused address. + * @param options Options for address generation. + * @returns The address. + */ + async generateAddress( + options?: AddressGenerationOptions, + ): Promise
{ + const addresses = await this.generateAddresses(1, options); + return addresses[0]; + } + + /** + * Generate new unused addresses. + * @param amount The amount of addresses to generate. + * @param options Options for address generation. + * @returns The addresses. + */ + async generateAddresses( + amount: number, + options?: AddressGenerationOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'generateAddresses', + data: { + amount, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get the account balance. + * @returns The account balance. + */ + async getBalance(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getBalance', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Get the data for an output. + * @param outputId The output to get. + * @returns The `OutputData`. + */ + async getOutput(outputId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getOutput', + data: { + outputId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get a `FoundryOutput` by native token ID. It will try to get the foundry from + * the account, if it isn't in the account it will try to get it from the node. + * @param tokenId The native token ID to get the foundry for. + * @returns The `FoundryOutput` that minted the token. + */ + async getFoundryOutput(tokenId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getFoundryOutput', + data: { + tokenId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get outputs with additional unlock conditions. + * @param outputs The type of outputs to claim. + * @returns The output IDs of the unlockable outputs. + */ + async getOutputsWithAdditionalUnlockConditions( + outputs: OutputsToClaim, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getOutputsWithAdditionalUnlockConditions', + data: { + outputsToClaim: outputs, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get a transaction stored in the account. + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getTransaction(transactionId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getTransaction', + data: { + transactionId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get the transaction with inputs of an incoming transaction stored in the account + * List might not be complete, if the node pruned the data already + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getIncomingTransactionData(transactionId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getIncomingTransactionData', + data: { + transactionId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * List all the addresses of the account. + * @returns The addresses. + */ + async addresses(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'addresses', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List the addresses of the account with unspent outputs. + * @returns The addresses. + */ + async addressesWithUnspentOutputs(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'addressesWithUnspentOutputs', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async outputs(filterOptions?: FilterOptions): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'outputs', + data: { filterOptions }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the pending transactions of the account. + * @returns The transactions. + */ + async pendingTransactions(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'pendingTransactions', + }, + ); + return JSON.parse(response).payload; + } + + /** + * List all incoming transactions of the account. + * @returns The incoming transactions with their inputs. + */ + async incomingTransactions(): Promise< + [string, IncomingTransactionData][] + > { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'incomingTransactions', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the transactions of the account. + * @returns The transactions. + */ + async transactions(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'transactions', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the unspent outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async unspentOutputs(filterOptions?: FilterOptions): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'unspentOutputs', + data: { filterOptions }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Get the accounts metadata. + * @returns The accounts metadata. + */ + getMetadata(): AccountMetadata { + return { + alias: this.meta.alias, + coinType: this.meta.coinType, + index: this.meta.index, + }; + } + + /** + * Calculate the minimum required storage deposit for an output. + * @param output output to calculate the deposit amount for. + * @returns The amount. + */ + async minimumRequiredStorageDeposit(output: OutputTypes): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'minimumRequiredStorageDeposit', + data: { + output, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Mint more native tokens. + * @param tokenId The native token id. + * @param mintAmount To be minted amount. + * @param increaseNativeTokenSupplyOptions Options for minting more tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async increaseNativeTokenSupply( + tokenId: string, + mintAmount: HexEncodedAmount, + increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'increaseNativeTokenSupply', + data: { + tokenId, + mintAmount, + increaseNativeTokenSupplyOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Mint native tokens. + * @param nativeTokenOptions The options for minting tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async mintNativeToken( + nativeTokenOptions: NativeTokenOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'mintNativeToken', + data: { + nativeTokenOptions: nativeTokenOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Mint nfts. + * @param nftsOptions The options for minting nfts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction. + */ + async mintNfts( + nftsOptions: NftOptions[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'mintNfts', + data: { + nftsOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Prepare an output for sending, useful for offline signing. + * @param options The options for preparing an output. If the amount is + * below the minimum required storage deposit, by default the remaining + * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, + * when setting the `ReturnStrategy` to `gift`, the full minimum required + * storage deposit will be sent to the recipient. When the assets contain + * an nft id, the data from the existing `NftOutput` will be used, just with + * the address unlock conditions replaced. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared output. + */ + async prepareOutput( + options: OutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareOutput', + data: { + options, + transactionOptions, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Prepare a send amount transaction, useful for offline signing. + * @param addressesWithAmount Address with amounts to send. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareSendAmount( + addressesWithAmount: AddressWithAmount[], + options?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareSendAmount', + data: { + addressesWithAmount, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Prepare a transaction, useful for offline signing. + * @param outputs Outputs to use in the transaction. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareTransaction( + outputs: OutputTypes[], + options?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareTransaction', + data: { + outputs, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Send a transaction with amounts from input addresses. + * @param addressesWithAmount Addresses with amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendAmount( + addressesWithAmount: AddressWithAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendAmount', + data: { + addressesWithAmount, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send a micro transaction with amount below minimum storage deposit. + * @param addressesWithMicroAmount Addresses with micro amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendMicroTransaction( + addressesWithMicroAmount: AddressWithMicroAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendMicroTransaction', + data: { + addressesWithMicroAmount, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send native tokens. + * @param addressesNativeTokens Addresses amounts and native tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNativeTokens( + addressesNativeTokens: AddressNativeTokens[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendNativeTokens', + data: { + addressesNativeTokens, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send nft. + * @param addressesAndNftIds Addresses and nft ids. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNft( + addressesAndNftIds: AddressNftId[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendNft', + data: { + addressesAndNftIds, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send outputs in a transaction. + * @param outputs The outputs to send. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendOutputs( + outputs: OutputTypes[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendOutputs', + data: { + outputs, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + async setAlias(alias: string): Promise { + await this.messageHandler.callAccountMethod(this.meta.index, { + name: 'setAlias', + data: { + alias, + }, + }); + } + + /** + * Sign a prepared transaction, useful for offline signing. + * @param preparedTransactionData The prepared transaction data to sign. + * @returns The signed transaction essence. + */ + async signTransactionEssence( + preparedTransactionData: PreparedTransactionData, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'signTransactionEssence', + data: { + preparedTransactionData, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Validate the transaction, submit it to a node and store it in the account. + * @param signedTransactionData A signed transaction to submit and store. + * @returns The sent transaction. + */ + async submitAndStoreTransaction( + signedTransactionData: SignedTransactionEssence, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'submitAndStoreTransaction', + data: { + signedTransactionData, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Sync the account by fetching new information from the nodes. + * Will also retry pending transactions if necessary. + * @param options Optional synchronization options. + * @returns The account balance. + */ + async sync(options?: AccountSyncOptions): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'syncAccount', + data: { + options, + }, + }, + ); + return JSON.parse(resp).payload; + } +} diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts new file mode 100644 index 0000000000..648fcf341f --- /dev/null +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -0,0 +1,350 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { MessageHandler } from './MessageHandler'; +import { Account } from './Account'; + +import type { + AccountId, + Auth, + EventType, + AccountManagerOptions, + CreateAccountPayload, + NodeInfoWrapper, + ClientOptions, + AccountSyncOptions, + WalletEvent, + LedgerNanoStatus, +} from '../types'; + +/** The AccountManager class. */ +export class AccountManager { + private messageHandler: MessageHandler; + + constructor(options: AccountManagerOptions) { + this.messageHandler = new MessageHandler(options); + } + + /** + * Backup the data to a Stronghold snapshot. + */ + async backup(destination: string, password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'backup', + payload: { + destination, + password, + }, + }); + } + + /** + * Transform a bech32 encoded address to a hex encoded address + */ + async bech32ToHex(bech32Address: string): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'bech32ToHex', + payload: bech32Address, + }); + return JSON.parse(response).payload; + } + + /** + * Change the Stronghold password. + */ + async changeStrongholdPassword( + currentPassword: string, + newPassword: string, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'changeStrongholdPassword', + payload: { + currentPassword, + newPassword, + }, + }); + } + + /** + * Clear the Stronghold password from memory. + */ + async clearStrongholdPassword(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'clearStrongholdPassword', + }); + } + + /** + * Create a new account. + */ + async createAccount(payload: CreateAccountPayload): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'createAccount', + payload, + }); + return new Account(JSON.parse(response).payload, this.messageHandler); + } + + /** + * Destroy the AccountManager and drop its database connection. + */ + destroy(): void { + this.messageHandler.destroy(); + } + + /** + * Emit a provided event for testing of the event system. + */ + async emitTestEvent(event: WalletEvent): Promise { + await this.messageHandler.sendMessage({ + cmd: 'emitTestEvent', + payload: event, + }); + } + + /** + * Generate a random BIP39 mnemonic. + */ + async generateMnemonic(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'generateMnemonic', + }); + return JSON.parse(response).payload; + } + + /** + * Get an account by its alias or index. + */ + async getAccount(accountId: AccountId): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccount', + payload: accountId, + }); + + const account = new Account( + JSON.parse(response).payload, + this.messageHandler, + ); + + return account; + } + + /** + * Get all account indexes. + */ + async getAccountIndexes(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccountIndexes', + }); + + return JSON.parse(response).payload; + } + + /** + * Get all accounts. + */ + async getAccounts(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccounts', + }); + + const { payload } = JSON.parse(response); + + const accounts: Account[] = []; + + for (const account of payload) { + accounts.push(new Account(account, this.messageHandler)); + } + return accounts; + } + + /** + * Get the node info. + */ + async getNodeInfo(url?: string, auth?: Auth): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getNodeInfo', + payload: { url, auth }, + }); + return JSON.parse(response).payload; + } + + /** + * Get the status for a Ledger Nano. + */ + async getLedgerNanoStatus(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getLedgerNanoStatus', + }); + return JSON.parse(response).payload; + } + + /** + * Transform hex encoded address to bech32 encoded address. If no bech32Hrp + * is provided, the AccountManager will attempt to retrieve it from the + * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. + */ + async hexToBech32(hex: string, bech32Hrp?: string): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'hexToBech32', + payload: { hex, bech32Hrp }, + }); + return JSON.parse(response).payload; + } + + /** + * Check if the Stronghold password has been set. + */ + async isStrongholdPasswordAvailable(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'isStrongholdPasswordAvailable', + }); + return JSON.parse(response).payload; + } + + /** + * Listen to wallet events with a callback. An empty array will listen to all possible events. + */ + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + ): void { + return this.messageHandler.listen(eventTypes, callback); + } + + /** + * Clear the callbacks for provided events. An empty array will clear all listeners. + */ + clearListeners(eventTypes: EventType[]): void { + return this.messageHandler.clearListeners(eventTypes); + } + + /** + * Find accounts with unspent outputs. + */ + async recoverAccounts( + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions: AccountSyncOptions, + ): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'recoverAccounts', + payload: { + accountStartIndex, + accountGapLimit, + addressGapLimit, + syncOptions, + }, + }); + + const accounts: Account[] = []; + + for (const account of JSON.parse(response).payload) { + accounts.push(new Account(account, this.messageHandler)); + } + return accounts; + } + + /** + * Delete the latest account. + */ + async removeLatestAccount(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'removeLatestAccount', + }); + } + + /** + * Restore a backup from a Stronghold file + * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created + * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was + * stored, it will be gone. + */ + async restoreBackup(source: string, password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'restoreBackup', + payload: { + source, + password, + }, + }); + } + + /** + * Set ClientOptions. + */ + async setClientOptions(options: ClientOptions): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setClientOptions', + payload: options, + }); + } + + /** + * Set the Stronghold password. + */ + async setStrongholdPassword(password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setStrongholdPassword', + payload: password, + }); + } + + /** + * Set the interval after which the Stronghold password gets cleared from memory. + */ + async setStrongholdPasswordClearInterval( + intervalInMilliseconds?: number, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setStrongholdPasswordClearInterval', + payload: intervalInMilliseconds, + }); + } + + /** + * Start the background syncing process for all accounts. + */ + async startBackgroundSync( + options?: AccountSyncOptions, + intervalInMilliseconds?: number, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'startBackgroundSync', + payload: { + options, + intervalInMilliseconds, + }, + }); + } + + /** + * Stop the background syncing process for all accounts. + */ + async stopBackgroundSync(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'stopBackgroundSync', + }); + } + + /** + * Store a mnemonic in the Stronghold snapshot. + */ + async storeMnemonic(mnemonic: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'storeMnemonic', + payload: mnemonic, + }); + } + + /** + * Verify if a mnemonic is a valid BIP39 mnemonic. + */ + async verifyMnemonic(mnemonic: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'verifyMnemonic', + payload: mnemonic, + }); + } +} diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts new file mode 100644 index 0000000000..5f30b4efd5 --- /dev/null +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -0,0 +1,73 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { + sendMessageAsync, + messageHandlerNew, + listen, + clearListeners, + destroy, +} from './bindings'; +import type { + EventType, + AccountManagerOptions, + __Message__, + __AccountMethod__, + AccountId, +} from '../types'; + +// The MessageHandler class interacts with messages with the rust bindings. +export class MessageHandler { + messageHandler: any; + + constructor(options?: AccountManagerOptions) { + const messageOptions = { + storagePath: options?.storagePath, + clientOptions: options?.clientOptions, + coinType: options?.coinType, + secretManager: options?.secretManager, + }; + + this.messageHandler = messageHandlerNew(JSON.stringify(messageOptions)); + } + + async sendMessage(message: __Message__): Promise { + return sendMessageAsync( + JSON.stringify(message), + this.messageHandler, + ).catch((error) => { + try { + error = JSON.parse(error).payload; + } catch (e) {} + return Promise.reject(error); + }); + } + + async callAccountMethod( + accountIndex: AccountId, + method: __AccountMethod__, + ): Promise { + return this.sendMessage({ + cmd: 'callAccountMethod', + payload: { + accountId: accountIndex, + method, + }, + }); + } + + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + ): void { + return listen(eventTypes, callback, this.messageHandler); + } + + clearListeners(eventTypes: EventType[]): void { + return clearListeners(eventTypes, this.messageHandler); + } + + destroy(): void { + return destroy(this.messageHandler); + } +} diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts new file mode 100644 index 0000000000..f90f2c11ae --- /dev/null +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -0,0 +1,40 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import type { MessageHandler } from './MessageHandler' +import { IotaWalletMobileTypes } from '../definitions' +import { registerPlugin } from '@capacitor/core' + +const IotaWalletMobile = registerPlugin('IotaWalletMobile') + +const { + initLogger, + sendMessage, + messageHandlerNew, + listen, + clearListeners, + destroy, +} = IotaWalletMobile + +const sendMessageAsync = ( + message: string, + handler: MessageHandler, +): Promise => + new Promise((resolve, reject) => { + sendMessage(message, handler, (error: Error, result: string) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); + }) + +export { + initLogger as internalInitLogger, + sendMessageAsync, + messageHandlerNew, + listen, + clearListeners, + destroy, +} diff --git a/bindings/capacitorjs/src/types/account.ts b/bindings/capacitorjs/src/types/account.ts new file mode 100644 index 0000000000..9107152c92 --- /dev/null +++ b/bindings/capacitorjs/src/types/account.ts @@ -0,0 +1,135 @@ +import type { Address, AddressWithUnspentOutputs } from './address'; +import type { OutputData } from './output'; +import type { Transaction } from './transaction'; +import type { + HexEncodedAmount, + IOutputResponse, + ITransactionPayload, +} from '@iota/types'; + +/** + * Account identifier + * Could be the account index (number) or account alias (string) + */ +export type AccountId = number | string; + +/** The balance of an account */ +export interface AccountBalance { + /** The balance of the base coin */ + baseCoin: BaseCoinBalance; + /** The required storage deposit for the outputs */ + requiredStorageDeposit: string; + /** The balance of the native tokens */ + nativeTokens: NativeTokenBalance[]; + /** Nft outputs */ + nfts: string[]; + /** Alias outputs */ + aliases: string[]; + /** Foundry outputs */ + foundries: string[]; + /** + * Outputs with multiple unlock conditions and if they can currently be spent or not. If there is a + * TimelockUnlockCondition or ExpirationUnlockCondition this can change at any time + */ + potentiallyLockedOutputs: { [outputId: string]: boolean }; +} + +/** Sync options for an account */ +export interface AccountSyncOptions { + /** + * Specific Bech32 encoded addresses of the account to sync, if addresses are provided, + * then `address_start_index` will be ignored + */ + addresses?: string[]; + /** + * Address index from which to start syncing addresses. 0 by default, using a higher index will be faster because + * addresses with a lower index will be skipped, but could result in a wrong balance for that reason + */ + addressStartIndex?: number; + /** + * Address index from which to start syncing internal addresses. 0 by default, using a higher index will be faster + * because addresses with a lower index will be skipped, but could result in a wrong balance for that reason + */ + addressStartIndexInternal?: number; + /** + * Usually syncing is skipped if it's called in between 200ms, because there can only be new changes every + * milestone and calling it twice "at the same time" will not return new data + * When this to true, we will sync anyways, even if it's called 0ms after the las sync finished. Default: false. + */ + forceSyncing?: boolean; + /// Try to sync transactions from incoming outputs with their inputs. Some data may not be obtained if it has been + /// pruned. + syncIncomingTransactions?: boolean; + /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ + syncPendingTransactions?: boolean; + /** Specifies if only basic outputs should be synced or also alias and nft outputs. Default: true. */ + syncAliasesAndNfts?: boolean; + /** Specifies if only basic outputs with an AddressUnlockCondition alone should be synced, will overwrite + * `syncAliasesAndNfts`. Default: false. */ + syncOnlyMostBasicOutputs?: boolean; +} + +/** The account object */ +export interface AccountMeta { + index: number; + coinType: CoinType; + alias: string; + publicAddresses: Address[]; + internalAddresses: Address[]; + addressesWithUnspentOutputs: AddressWithUnspentOutputs[]; + outputs: { [outputId: string]: OutputData }; + /** Output IDs of unspent outputs that are currently used as input for transactions */ + lockedOutputs: Set; + unspentOutputs: { [outputId: string]: OutputData }; + transactions: { [transactionId: string]: Transaction }; + /** Transaction IDs of pending transactions */ + pendingTransactions: Set; + /** Incoming transactions with their inputs if available and not already pruned */ + incomingTransactions: { + [transactionId: string]: [ITransactionPayload, IOutputResponse[]]; + }; +} + +/** The account metadata */ +export interface AccountMetadata { + /** The account alias */ + alias: string; + /** The used coin type */ + coinType: CoinType; + /** The account index which will be used in the BIP32 path */ + index: number; +} + +/** The balance of the base coin */ +export interface BaseCoinBalance { + /** The total amount of the outputs */ + total: string; + /** The amount of the outputs that aren't used in a transaction */ + available: string; +} + +/** The balance of a native token */ +export interface NativeTokenBalance { + tokenId: string; + total: HexEncodedAmount; + available: HexEncodedAmount; +} + +/** IOTA and Shimmer coin types */ +export enum CoinType { + IOTA = 4218, + Shimmer = 4219, +} + +/** Options for account creation */ +export interface CreateAccountPayload { + alias?: string; +} + +/** Options to filter outputs */ +export interface FilterOptions { + /** Filter all outputs where the booked milestone index is below the specified timestamp */ + lowerBoundBookedTimestamp: number; + /** Filter all outputs where the booked milestone index is above the specified timestamp */ + upperBoundBookedTimestamp: number; +} diff --git a/bindings/capacitorjs/src/types/accountManager.ts b/bindings/capacitorjs/src/types/accountManager.ts new file mode 100644 index 0000000000..8827634050 --- /dev/null +++ b/bindings/capacitorjs/src/types/accountManager.ts @@ -0,0 +1,11 @@ +import type { CoinType } from './account'; +import type { ClientOptions } from './network'; +import type { SecretManager } from './secretManager'; + +/** Options for the AccountManager builder */ +export interface AccountManagerOptions { + storagePath?: string; + clientOptions?: ClientOptions; + coinType?: CoinType; + secretManager?: SecretManager; +} diff --git a/bindings/capacitorjs/src/types/address.ts b/bindings/capacitorjs/src/types/address.ts new file mode 100644 index 0000000000..3fc0b1bbc1 --- /dev/null +++ b/bindings/capacitorjs/src/types/address.ts @@ -0,0 +1,65 @@ +import type { Network } from './network'; +import type { HexEncodedAmount } from '@iota/types'; + +/** Address Types */ +export enum AddressType { + Ed25519 = 'Ed25519', + Alias = 'Alias', + Nft = 'Nft', +} + +/** An Address of the Account */ +export interface Address { + address: string; + keyIndex: number; + internal: boolean; + used: boolean; +} + +/** Address with a base token amount */ +export interface AddressWithAmount { + address: string; + amount: string; +} + +/** Address with unspent outputs */ +export interface AddressWithUnspentOutputs { + address: string; + keyIndex: number; + internal: boolean; + outputIds: string[]; +} + +/** Address with a base token amount for a micro transaction */ +export interface AddressWithMicroAmount { + address: string; + amount: string; + returnAddress?: string; + expiration?: number; +} + +/** Address with native tokens */ +export interface AddressNativeTokens { + address: string; + nativeTokens: [string, HexEncodedAmount][]; + returnAddress?: string; + expiration?: number; +} + +/** Address with an NftId */ +export interface AddressNftId { + address: string; + nftId: string; +} + +/** Options for address generation, metadata is used only with a Ledger Nano SecretManager */ +export interface AddressGenerationOptions { + internal: boolean; + metadata: GenerateAddressMetadata; +} + +/** Metadata for address generation, useful with a Ledger Nano SecretManager */ +export interface GenerateAddressMetadata { + syncing: boolean; + network: Network; +} diff --git a/bindings/capacitorjs/src/types/bridge/account.ts b/bindings/capacitorjs/src/types/bridge/account.ts new file mode 100644 index 0000000000..f66ca0bd0d --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/account.ts @@ -0,0 +1,317 @@ +import type { OutputTypes, HexEncodedAmount } from '@iota/types'; +import type { AccountSyncOptions, FilterOptions } from '../account'; +import type { + AddressWithAmount, + AddressWithMicroAmount, + AddressNativeTokens, + AddressNftId, + AddressGenerationOptions, +} from '../address'; +import type { + BuildAliasOutputData, + BuildBasicOutputData, + BuildFoundryOutputData, + BuildNftOutputData, +} from '../buildOutputData'; +import type { OutputOptions } from '../outputOptions'; +import type { OutputsToClaim } from '../output'; +import type { SignedTransactionEssence } from '../signedTransactionEssence'; +import type { PreparedTransactionData } from '../preparedTransactionData'; +import type { + AliasOutputOptions, + IncreaseNativeTokenSupplyOptions, + NativeTokenOptions, + TransactionOptions, + NftOptions, +} from '../transactionOptions'; + +export type __BuildAliasOutputMethod__ = { + name: 'buildAliasOutput'; + data: BuildAliasOutputData; +}; + +export type __BuildBasicOutputMethod__ = { + name: 'buildBasicOutput'; + data: BuildBasicOutputData; +}; + +export type __BuildFoundryOutputMethod__ = { + name: 'buildFoundryOutput'; + data: BuildFoundryOutputData; +}; + +export type __BuildNftOutputMethod__ = { + name: 'buildNftOutput'; + data: BuildNftOutputData; +}; + +export type __BurnNativeTokenMethod__ = { + name: 'burnNativeToken'; + data: { + tokenId: string; + burnAmount: HexEncodedAmount; + options?: TransactionOptions; + }; +}; + +export type __BurnNftMethod__ = { + name: 'burnNft'; + data: { + nftId: string; + options?: TransactionOptions; + }; +}; + +export type __ClaimOutputsMethod__ = { + name: 'claimOutputs'; + data: { + outputIdsToClaim: string[]; + }; +}; + +export type __ConsolidateOutputsMethod__ = { + name: 'consolidateOutputs'; + data: { + force: boolean; + outputConsolidationThreshold?: number; + }; +}; + +export type __CreateAliasOutputMethod__ = { + name: 'createAliasOutput'; + data: { + aliasOutputOptions?: AliasOutputOptions; + options?: TransactionOptions; + }; +}; + +export type __DecreaseNativeTokenSupplyMethod__ = { + name: 'decreaseNativeTokenSupply'; + data: { + tokenId: string; + meltAmount: HexEncodedAmount; + options?: TransactionOptions; + }; +}; + +export type __DestroyAliasMethod__ = { + name: 'destroyAlias'; + data: { + aliasId: string; + options?: TransactionOptions; + }; +}; + +export type __DestroyFoundryMethod__ = { + name: 'destroyFoundry'; + data: { + foundryId: string; + options?: TransactionOptions; + }; +}; + +export type __GenerateAddressesMethod__ = { + name: 'generateAddresses'; + data: { + amount: number; + options?: AddressGenerationOptions; + }; +}; + +export type __GetBalanceMethod__ = { + name: 'getBalance'; +}; + +export type __GetIncomingTransactionDataMethod__ = { + name: 'getIncomingTransactionData'; + data: { + transactionId: string, + }; +}; + +export type __GetOutputMethod__ = { + name: 'getOutput'; + data: { + outputId: string; + }; +}; + +export type __GetFoundryOutputMethod__ = { + name: 'getFoundryOutput'; + data: { + tokenId: string; + }; +}; + +export type __GetOutputsWithAdditionalUnlockConditionsMethod__ = { + name: 'getOutputsWithAdditionalUnlockConditions'; + data: { + outputsToClaim: OutputsToClaim; + }; +}; + +export type __GetTransactionMethod__ = { + name: 'getTransaction'; + data: { + transactionId: string; + }; +}; + +export type __AddressesMethod__ = { + name: 'addresses'; +}; + +export type __AddressesWithUnspentOutputsMethod__ = { + name: 'addressesWithUnspentOutputs'; +}; + +export type __OutputsMethod__ = { + name: 'outputs'; + data: { + filterOptions?: FilterOptions; + }; +}; + +export type __PendingTransactionsMethod__ = { + name: 'pendingTransactions'; +}; + +export type __IncomingTransactionsMethod__ = { + name: 'incomingTransactions'; +}; + +export type __TransactionsMethod__ = { + name: 'transactions'; +}; + +export type __UnspentOutputsMethod__ = { + name: 'unspentOutputs'; + data: { + filterOptions?: FilterOptions; + }; +}; + +export type __MinimumRequiredStorageDepositMethod__ = { + name: 'minimumRequiredStorageDeposit'; + data: { + output: OutputTypes; + }; +}; + +export type __IncreaseNativeTokenSupplyMethod__ = { + name: 'increaseNativeTokenSupply'; + data: { + tokenId: string; + mintAmount: HexEncodedAmount; + increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions; + options?: TransactionOptions; + }; +}; + +export type __MintNativeTokenMethod__ = { + name: 'mintNativeToken'; + data: { + nativeTokenOptions: NativeTokenOptions; + options?: TransactionOptions; + }; +}; + +export type __MintNftsMethod__ = { + name: 'mintNfts'; + data: { + nftsOptions: NftOptions[]; + options?: TransactionOptions; + }; +}; + +export type __PrepareOutputMethod__ = { + name: 'prepareOutput'; + data: { + options: OutputOptions; + transactionOptions?: TransactionOptions; + }; +}; + +export type __PrepareSendAmountMethod__ = { + name: 'prepareSendAmount'; + data: { + addressesWithAmount: AddressWithAmount[]; + options?: TransactionOptions; + }; +}; + +export type __PrepareTransactionMethod__ = { + name: 'prepareTransaction'; + data: { + outputs: OutputTypes[]; + options?: TransactionOptions; + }; +}; + +export type __SendAmountMethod__ = { + name: 'sendAmount'; + data: { + addressesWithAmount: AddressWithAmount[]; + options?: TransactionOptions; + }; +}; + +export type __SendMicroTransactionMethod__ = { + name: 'sendMicroTransaction'; + data: { + addressesWithMicroAmount: AddressWithMicroAmount[]; + options?: TransactionOptions; + }; +}; + +export type __SendNativeTokensMethod__ = { + name: 'sendNativeTokens'; + data: { + addressesNativeTokens: AddressNativeTokens[]; + options?: TransactionOptions; + }; +}; + +export type __SendNftMethod__ = { + name: 'sendNft'; + data: { + addressesAndNftIds: AddressNftId[]; + options?: TransactionOptions; + }; +}; + +export type __SendOutputsMethod__ = { + name: 'sendOutputs'; + data: { + outputs: OutputTypes[]; + options?: TransactionOptions; + }; +}; + +export type __SetAliasMethod__ = { + name: 'setAlias'; + data: { + alias: string; + }; +}; + +export type __SignTransactionEssenceMethod__ = { + name: 'signTransactionEssence'; + data: { + preparedTransactionData: PreparedTransactionData; + }; +}; + +export type __SubmitAndStoreTransactionMethod__ = { + name: 'submitAndStoreTransaction'; + data: { + signedTransactionData: SignedTransactionEssence; + }; +}; + +export type __SyncAccountMethod__ = { + name: 'syncAccount'; + data: { + options?: AccountSyncOptions; + }; +}; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.ts b/bindings/capacitorjs/src/types/bridge/accountManager.ts new file mode 100644 index 0000000000..7a9a720244 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -0,0 +1,142 @@ +import type { + AccountId, + AccountSyncOptions, + CreateAccountPayload, +} from '../account'; +import type { WalletEvent } from '../event'; +import type { Auth, ClientOptions } from '../network'; + +export type __BackupMessage__ = { + cmd: 'backup'; + payload: { + destination: string; + password: string; + }; +}; + +export type __Bech32ToHex__ = { + cmd: 'bech32ToHex'; + payload: string; +}; + +export type __ChangeStrongholdPasswordMessage__ = { + cmd: 'changeStrongholdPassword'; + payload: { + currentPassword: string; + newPassword: string; + }; +}; + +export type __ClearStrongholdPasswordMessage__ = { + cmd: 'clearStrongholdPassword'; +}; + +export type __CreateAccountMessage__ = { + cmd: 'createAccount'; + payload: CreateAccountPayload; +}; + +export type __EmitTestEventMessage__ = { + cmd: 'emitTestEvent'; + payload: WalletEvent; +}; + +export type __GenerateMnemonicMessage__ = { + cmd: 'generateMnemonic'; +}; + +export type __GetAccountIndexesMessage__ = { + cmd: 'getAccountIndexes'; +}; + +export type __GetAccountsMessage__ = { + cmd: 'getAccounts'; +}; + +export type __GetAccountMessage__ = { + cmd: 'getAccount'; + payload: AccountId; +}; + +export type __GetLedgerNanoStatusMessage__ = { + cmd: 'getLedgerNanoStatus'; +}; + +export type __GetNodeInfoMessage__ = { + cmd: 'getNodeInfo'; + payload: { + url?: string; + auth?: Auth; + }; +}; + +export type __HexToBech32__ = { + cmd: 'hexToBech32'; + payload: { + hex: string; + bech32Hrp?: string; + }; +}; + +export type __IsStrongholdPasswordAvailableMessage__ = { + cmd: 'isStrongholdPasswordAvailable'; +}; + +export type __RecoverAccountsMessage__ = { + cmd: 'recoverAccounts'; + payload: { + accountStartIndex: number; + accountGapLimit: number; + addressGapLimit: number; + syncOptions?: AccountSyncOptions; + }; +}; + +export type __RemoveLatestAccountMessage__ = { + cmd: 'removeLatestAccount'; +}; + +export type __RestoreBackupMessage__ = { + cmd: 'restoreBackup'; + payload: { + source: string; + password: string; + }; +}; + +export type __SetClientOptionsMessage__ = { + cmd: 'setClientOptions'; + payload: ClientOptions; +}; + +export type __SetStrongholdPasswordMessage__ = { + cmd: 'setStrongholdPassword'; + payload: string; +}; + +export type __SetStrongholdPasswordClearIntervalMessage__ = { + cmd: 'setStrongholdPasswordClearInterval'; + payload?: number; +}; + +export type __StartBackgroundSyncMessage__ = { + cmd: 'startBackgroundSync'; + payload: { + options?: AccountSyncOptions; + intervalInMilliseconds?: number; + }; +}; + +export type __StopBackgroundSyncMessage__ = { + cmd: 'stopBackgroundSync'; +}; + +export type __StoreMnemonicMessage__ = { + cmd: 'storeMnemonic'; + payload: string; +}; + +export type __VerifyMnemonicMessage__ = { + cmd: 'verifyMnemonic'; + payload: string; +}; diff --git a/bindings/capacitorjs/src/types/bridge/index.ts b/bindings/capacitorjs/src/types/bridge/index.ts new file mode 100644 index 0000000000..1ea2ad6ac9 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/index.ts @@ -0,0 +1,150 @@ +import type { AccountId } from '../account'; +import type { + __BuildAliasOutputMethod__, + __BuildBasicOutputMethod__, + __BuildFoundryOutputMethod__, + __BuildNftOutputMethod__, + __BurnNativeTokenMethod__, + __BurnNftMethod__, + __ClaimOutputsMethod__, + __ConsolidateOutputsMethod__, + __CreateAliasOutputMethod__, + __DecreaseNativeTokenSupplyMethod__, + __DestroyAliasMethod__, + __DestroyFoundryMethod__, + __GenerateAddressesMethod__, + __GetBalanceMethod__, + __GetOutputMethod__, + __GetFoundryOutputMethod__, + __GetOutputsWithAdditionalUnlockConditionsMethod__, + __GetTransactionMethod__, + __AddressesMethod__, + __AddressesWithUnspentOutputsMethod__, + __OutputsMethod__, + __PendingTransactionsMethod__, + __IncomingTransactionsMethod__, + __TransactionsMethod__, + __UnspentOutputsMethod__, + __MinimumRequiredStorageDepositMethod__, + __IncreaseNativeTokenSupplyMethod__, + __MintNativeTokenMethod__, + __MintNftsMethod__, + __PrepareOutputMethod__, + __PrepareSendAmountMethod__, + __PrepareTransactionMethod__, + __SendAmountMethod__, + __SendMicroTransactionMethod__, + __SendNativeTokensMethod__, + __SendNftMethod__, + __SendOutputsMethod__, + __SetAliasMethod__, + __SignTransactionEssenceMethod__, + __SubmitAndStoreTransactionMethod__, + __SyncAccountMethod__, + __GetIncomingTransactionDataMethod__, +} from './account'; +import type { + __BackupMessage__, + __Bech32ToHex__, + __ChangeStrongholdPasswordMessage__, + __ClearStrongholdPasswordMessage__, + __CreateAccountMessage__, + __EmitTestEventMessage__, + __GenerateMnemonicMessage__, + __GetAccountMessage__, + __GetAccountIndexesMessage__, + __GetAccountsMessage__, + __GetLedgerNanoStatusMessage__, + __GetNodeInfoMessage__, + __HexToBech32__, + __IsStrongholdPasswordAvailableMessage__, + __RecoverAccountsMessage__, + __RemoveLatestAccountMessage__, + __RestoreBackupMessage__, + __SetClientOptionsMessage__, + __SetStrongholdPasswordClearIntervalMessage__, + __SetStrongholdPasswordMessage__, + __StartBackgroundSyncMessage__, + __StopBackgroundSyncMessage__, + __StoreMnemonicMessage__, + __VerifyMnemonicMessage__, +} from './accountManager'; + +export type __AccountMethod__ = + | __BuildAliasOutputMethod__ + | __BuildBasicOutputMethod__ + | __BuildFoundryOutputMethod__ + | __BuildNftOutputMethod__ + | __BurnNativeTokenMethod__ + | __BurnNftMethod__ + | __ClaimOutputsMethod__ + | __ConsolidateOutputsMethod__ + | __CreateAliasOutputMethod__ + | __DestroyAliasMethod__ + | __DestroyFoundryMethod__ + | __GenerateAddressesMethod__ + | __GetBalanceMethod__ + | __GetOutputMethod__ + | __GetIncomingTransactionDataMethod__ + | __GetFoundryOutputMethod__ + | __GetOutputsWithAdditionalUnlockConditionsMethod__ + | __GetTransactionMethod__ + | __AddressesMethod__ + | __AddressesWithUnspentOutputsMethod__ + | __OutputsMethod__ + | __PendingTransactionsMethod__ + | __IncomingTransactionsMethod__ + | __TransactionsMethod__ + | __UnspentOutputsMethod__ + | __DecreaseNativeTokenSupplyMethod__ + | __MinimumRequiredStorageDepositMethod__ + | __IncreaseNativeTokenSupplyMethod__ + | __MintNativeTokenMethod__ + | __MintNftsMethod__ + | __PrepareOutputMethod__ + | __PrepareSendAmountMethod__ + | __PrepareTransactionMethod__ + | __SendAmountMethod__ + | __SendMicroTransactionMethod__ + | __SendNativeTokensMethod__ + | __SendNftMethod__ + | __SendOutputsMethod__ + | __SetAliasMethod__ + | __SignTransactionEssenceMethod__ + | __SubmitAndStoreTransactionMethod__ + | __SyncAccountMethod__; + +export type __CallAccountMethodMessage__ = { + cmd: 'callAccountMethod'; + payload: { + accountId: AccountId; + method: __AccountMethod__; + }; +}; + +export type __Message__ = + | __BackupMessage__ + | __Bech32ToHex__ + | __CallAccountMethodMessage__ + | __ChangeStrongholdPasswordMessage__ + | __ClearStrongholdPasswordMessage__ + | __CreateAccountMessage__ + | __EmitTestEventMessage__ + | __GenerateMnemonicMessage__ + | __GetAccountMessage__ + | __GetAccountIndexesMessage__ + | __GetAccountsMessage__ + | __GetLedgerNanoStatusMessage__ + | __GetNodeInfoMessage__ + | __HexToBech32__ + | __IsStrongholdPasswordAvailableMessage__ + | __RecoverAccountsMessage__ + | __RemoveLatestAccountMessage__ + | __RestoreBackupMessage__ + | __SetClientOptionsMessage__ + | __SetStrongholdPasswordClearIntervalMessage__ + | __SetStrongholdPasswordMessage__ + | __StartBackgroundSyncMessage__ + | __StopBackgroundSyncMessage__ + | __StoreMnemonicMessage__ + | __VerifyMnemonicMessage__; diff --git a/bindings/capacitorjs/src/types/buildOutputData.ts b/bindings/capacitorjs/src/types/buildOutputData.ts new file mode 100644 index 0000000000..6998f17f25 --- /dev/null +++ b/bindings/capacitorjs/src/types/buildOutputData.ts @@ -0,0 +1,37 @@ +import type { + FeatureTypes, + INativeToken, + TokenSchemeTypes, + UnlockConditionTypes, +} from '@iota/types'; + +/** An alias output */ +export interface BuildAliasOutputData extends BuildBasicOutputData { + aliasId: string; + stateIndex?: number; + stateMetadata?: Uint8Array; + foundryCounter?: number; + immutableFeatures?: FeatureTypes[]; +} + +/** A basic output */ +export interface BuildBasicOutputData { + /** If not provided, minimum storage deposit will be used */ + amount?: string; + nativeTokens?: INativeToken; + unlockConditions: UnlockConditionTypes[]; + features?: FeatureTypes[]; +} + +/** A foundry output */ +export interface BuildFoundryOutputData extends BuildBasicOutputData { + serialNumber: number; + tokenScheme: TokenSchemeTypes; + immutableFeatures?: FeatureTypes[]; +} + +/** An nft output */ +export interface BuildNftOutputData extends BuildBasicOutputData { + nftId: string; + immutableFeatures?: FeatureTypes[]; +} diff --git a/bindings/capacitorjs/src/types/event.ts b/bindings/capacitorjs/src/types/event.ts new file mode 100644 index 0000000000..d3a0f4b2d6 --- /dev/null +++ b/bindings/capacitorjs/src/types/event.ts @@ -0,0 +1,28 @@ +import type { IOutputResponse, ITransactionPayload } from '@iota/types'; +import type { OutputData } from './output'; + +/** Wallet event types */ +export type EventType = + | '*' + | 'ConsolidationRequired' + | 'LedgerAddressGeneration' + | 'NewOutput' + | 'SpentOutput' + | 'TransactionInclusion' + | 'TransactionProgress'; + +export type NewOutputEvent = { + output: OutputData; + transaction?: ITransactionPayload; + transactionInputs?: IOutputResponse; +}; + +/** Wallet events */ +export enum WalletEvent { + ConsolidationRequired = 'ConsolidationRequired', + LedgerAddressGeneration = 'LedgerAddressGeneration', + NewOutput = 'NewOutput', + SpentOutput = 'SpentOutput', + TransactionInclusion = 'TransactionInclusion', + TransactionProgress = 'TransactionProgress', +} diff --git a/bindings/capacitorjs/src/types/incomingTransactionData.ts b/bindings/capacitorjs/src/types/incomingTransactionData.ts new file mode 100644 index 0000000000..e1bbb563e0 --- /dev/null +++ b/bindings/capacitorjs/src/types/incomingTransactionData.ts @@ -0,0 +1,3 @@ +import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; + +export type IncomingTransactionData = [ITransactionPayload, IOutputMetadataResponse[]] diff --git a/bindings/capacitorjs/src/types/index.ts b/bindings/capacitorjs/src/types/index.ts new file mode 100644 index 0000000000..d76593cce5 --- /dev/null +++ b/bindings/capacitorjs/src/types/index.ts @@ -0,0 +1,16 @@ +export * from './account'; +export * from './accountManager'; +export * from './address'; +export * from './bridge'; +export * from './buildOutputData'; +export * from './event'; +export * from './incomingTransactionData'; +export * from './loggerConfig'; +export * from './network'; +export * from './output'; +export * from './outputOptions'; +export * from './preparedTransactionData'; +export * from './secretManager'; +export * from './signedTransactionEssence'; +export * from './transaction'; +export * from './transactionOptions'; diff --git a/bindings/capacitorjs/src/types/loggerConfig.ts b/bindings/capacitorjs/src/types/loggerConfig.ts new file mode 100644 index 0000000000..e248d58658 --- /dev/null +++ b/bindings/capacitorjs/src/types/loggerConfig.ts @@ -0,0 +1,16 @@ +// Copyright 2021-2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +/** Logger output configuration. */ +export interface LoggerConfig { + /** Name of an output file, or `stdout` for standard output.*/ + name?: string; + /** Log level filter of an output.*/ + levelFilter?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace'; + /** Log target filters of an output.*/ + targetFilter?: string[]; + /** Log target exclusions of an output.*/ + targetExclusions?: string[]; + /** Color flag of an output.*/ + colorEnabled?: boolean; +} diff --git a/bindings/capacitorjs/src/types/network.ts b/bindings/capacitorjs/src/types/network.ts new file mode 100644 index 0000000000..a804af5e0d --- /dev/null +++ b/bindings/capacitorjs/src/types/network.ts @@ -0,0 +1,69 @@ +import type { INodeInfo, IRent } from '@iota/types'; + +/** Network types */ +export enum Network { + Mainnet, + Testnet, +} + +/** Basic Auth or JWT */ +export type Auth = { + jwt?: string; + username?: string; + password?: string; +}; + +/** Information about the network and client */ +export interface NetworkInfo { + network?: string; + networkId?: number; + bech32Hrp?: string; + minPowScore?: number; + localPow?: boolean; + fallbackToLocalPow?: boolean; + tipsInterval?: number; + rentStructure?: IRent; +} + +/** A node object for the client */ +export type Node = { + url: string; + auth?: Auth; + disabled?: boolean; +}; + +/** Options for the client builder */ +export interface ClientOptions { + apiTimeout?: number; + automaticDisconnect?: boolean; + fallbackToLocalPow?: boolean; + localPow?: boolean; + maxReconnectionAttempts?: number; + minQuorumSize?: number; + network?: string; + networkInfo?: NetworkInfo; + nodes?: Array; + nodeSyncEnabled?: boolean; + nodeSyncInterval?: number; + permanodes?: Array; + port?: number; + powWorkerCount?: number; + primaryNode?: string | Node; + primaryPowNode?: string | Node; + quorum?: boolean; + quorumThreshold?: boolean; + remotePowTimeout?: number; + // timeout in seconds + timeout?: number; + useWs?: boolean; +} + +/** + * NodeInfo wrapper which contains the node info and the url from the node (useful when multiple nodes are used) + */ +export interface NodeInfoWrapper { + /** The returned node info */ + nodeInfo: INodeInfo; + /** The url from the node which returned the node info */ + url: string; +} diff --git a/bindings/capacitorjs/src/types/output.ts b/bindings/capacitorjs/src/types/output.ts new file mode 100644 index 0000000000..68f353d98e --- /dev/null +++ b/bindings/capacitorjs/src/types/output.ts @@ -0,0 +1,40 @@ +import type { + AddressTypes, + OutputTypes, + IOutputMetadataResponse, +} from '@iota/types'; + +/** Output to claim */ +export enum OutputsToClaim { + None = 'None', + MicroTransactions = 'MicroTransactions', + NativeTokens = 'NativeTokens', + Nfts = 'Nfts', + All = 'All', +} + +/** An output with metadata */ +export interface OutputData { + /** The identifier of an Output */ + outputId: string; + /** The metadata of the output */ + metadata: IOutputMetadataResponse; + /** The actual Output */ + output: OutputTypes; + /** If an output is spent */ + isSpent: boolean; + /** Associated account address */ + address: AddressTypes; + /** Network ID */ + networkId: string; + /** Remainder */ + remainder: boolean; + /** BIP32 path */ + chain?: Segment[]; +} + +/** A Segment of the BIP32 path*/ +export interface Segment { + hardened: boolean; + bs: Uint8Array; +} diff --git a/bindings/capacitorjs/src/types/outputOptions.ts b/bindings/capacitorjs/src/types/outputOptions.ts new file mode 100644 index 0000000000..3546e28b92 --- /dev/null +++ b/bindings/capacitorjs/src/types/outputOptions.ts @@ -0,0 +1,43 @@ +import type { HexEncodedString, INativeToken } from '@iota/types'; + +/** Options for the creation of an output */ +export interface OutputOptions { + recipientAddress: string; + amount: string; + assets?: Assets; + features?: Features; + unlocks?: Unlocks; + storageDeposit?: StorageDeposit; +} + +/** Assets to include in the output */ +export interface Assets { + nativeTokens?: INativeToken[]; + nftId?: HexEncodedString; +} + +/** Features to include in the output */ +export interface Features { + tag?: HexEncodedString; + metadata?: HexEncodedString; + sender?: string; + issuer?: string; +} + +/** Time unlocks to include in the output */ +export interface Unlocks { + expirationUnixTime?: number; + timelockUnixTime?: number; +} + +/** Storage deposit strategy to be used for the output */ +export interface StorageDeposit { + returnStrategy?: ReturnStrategy; + useExcessIfLow?: boolean; +} + +/** Return strategy for the storage deposit */ +export enum ReturnStrategy { + Return = 'Return', + Gift = 'Gift', +} diff --git a/bindings/capacitorjs/src/types/preparedTransactionData.ts b/bindings/capacitorjs/src/types/preparedTransactionData.ts new file mode 100644 index 0000000000..7011466957 --- /dev/null +++ b/bindings/capacitorjs/src/types/preparedTransactionData.ts @@ -0,0 +1,66 @@ +import type { + AddressTypes, + IOutputMetadataResponse, + ITransactionEssence, + OutputTypes, +} from '@iota/types'; +import type { Segment } from './output'; + +/** + * Prepared transaction data, useful for offline signing. + */ +export interface PreparedTransactionData { + /** + * Transaction essence + */ + essence: ITransactionEssence; + /** + * Required address information for signing + */ + inputsData: InputSigningData[]; + /** + * Optional remainder output information + */ + remainder?: RemainderData; +} + +/** + * Data for transaction inputs for signing and ordering of unlock blocks + */ +export interface InputSigningData { + /** + * The output + */ + output: OutputTypes; + /** + * The output metadata + */ + outputMetaData: IOutputMetadataResponse; + /** + * The chain derived from seed, only for ed25519 addresses + */ + chain?: Segment[]; + /** + * The bech32 encoded address, required because of alias outputs where we have multiple possible unlock + * conditions, because we otherwise don't know which one we need + */ + bech32Address: string; +} + +/** + * Data for a remainder output, used for ledger nano + */ +export interface RemainderData { + /** + * The remainder output + */ + output: OutputTypes; + /** + * The chain derived from seed, for the remainder addresses + */ + chain?: Segment[]; + /** + * The remainder address + */ + address: AddressTypes; +} diff --git a/bindings/capacitorjs/src/types/secretManager.ts b/bindings/capacitorjs/src/types/secretManager.ts new file mode 100644 index 0000000000..3988bc212c --- /dev/null +++ b/bindings/capacitorjs/src/types/secretManager.ts @@ -0,0 +1,52 @@ +/** Secret manager that uses a Ledger Nano hardware wallet or Speculos simulator. */ +export interface LedgerNanoSecretManager { + /** boolean indicates whether it's a simulator or not. */ + ledgerNano: boolean; +} + +/** Secret manager that uses a mnemonic. */ +export interface MnemonicSecretManager { + mnemonic: string; +} + +/** Secret manager that uses a seed. */ +export interface SeedSecretManager { + hexSeed: string; +} + +/** Secret manager that uses Stronghold. */ +export interface StrongholdSecretManager { + stronghold: { + password?: string; + snapshotPath?: string; + }; +} + +/** The status of a Ledger Nano */ +export interface LedgerNanoStatus { + connected: boolean; + locked: boolean; + blindSigningEnabled: boolean; + app?: LedgerApp; + device?: LedgerDeviceType; + bufferSize?: number; +} + +/** The current opened app */ +export interface LedgerApp { + name: string; + version: string; +} + +/** The Ledger Device Type */ +export enum LedgerDeviceType { + LedgerNanoS = 'ledgerNanoS', + LedgerNanoX = 'ledgerNanoX', + LedgerNanoSPlus = 'ledgerNanoSPlus', +} + +/** Supported secret managers */ +export type SecretManager = + | LedgerNanoSecretManager + | MnemonicSecretManager + | StrongholdSecretManager; diff --git a/bindings/capacitorjs/src/types/signedTransactionEssence.ts b/bindings/capacitorjs/src/types/signedTransactionEssence.ts new file mode 100644 index 0000000000..b719509808 --- /dev/null +++ b/bindings/capacitorjs/src/types/signedTransactionEssence.ts @@ -0,0 +1,8 @@ +import type { ITransactionPayload } from '@iota/types'; +import type { InputSigningData } from './preparedTransactionData'; + +/** The signed transaction with inputs data */ +export interface SignedTransactionEssence { + transactionPayload: ITransactionPayload; + inputsData: InputSigningData; +} diff --git a/bindings/capacitorjs/src/types/transaction.ts b/bindings/capacitorjs/src/types/transaction.ts new file mode 100644 index 0000000000..b1e61e2186 --- /dev/null +++ b/bindings/capacitorjs/src/types/transaction.ts @@ -0,0 +1,40 @@ +import type { ITransactionPayload } from '@iota/types'; + +/** Possible InclusionStates of transactions sent with the wallet */ +export enum InclusionState { + /** The transaction is pending */ + Pending = 'Pending', + /** The transaction is confirmed */ + Confirmed = 'Confirmed', + /** The transaction is conflicting */ + Conflicting = 'Conflicting', + /** The transaction and its in- and outputs are pruned, so it's unknown if it got confirmed or was conflicting */ + UnknownPruned = 'UnknownPruned', +} + +/** A Transaction with metadata */ +export interface Transaction { + /** The transaction payload */ + payload: ITransactionPayload; + /** The block id in which the transaction payload was included */ + blockId?: string; + /** The inclusion state of the transaction */ + inclusionState: InclusionState; + /** The creation time */ + timestamp: string; + /** The transaction id */ + transactionId: string; + /** The network id in which the transaction was sent */ + networkId: string; + /** If the transaction was created by the wallet or someone else */ + incoming: boolean; + note?: string; +} + +/** The result of a minting operation */ +export interface MintTokenTransaction { + /** The token id of the minted token */ + tokenId: string; + /** The transaction which minted the token */ + transaction: Transaction; +} diff --git a/bindings/capacitorjs/src/types/transactionOptions.ts b/bindings/capacitorjs/src/types/transactionOptions.ts new file mode 100644 index 0000000000..2be4465ac3 --- /dev/null +++ b/bindings/capacitorjs/src/types/transactionOptions.ts @@ -0,0 +1,81 @@ +import type { ITaggedDataPayload, HexEncodedAmount } from '@iota/types'; + +/** Options for the transaction creation */ +export interface TransactionOptions { + remainderValueStrategy?: RemainderValueStrategy; + taggedDataPayload?: ITaggedDataPayload; + /** Custom inputs that should be used for the transaction */ + customInputs?: string[]; + /** Optional note, that is only stored locally */ + note?: string; +} + +/** The RemainderValueStrategy */ +export type RemainderValueStrategy = + | ChangeAddress + | ReuseAddress + | CustomAddress; + +/** ChangeAddress variant of RemainderValueStrategy */ +export type ChangeAddress = { + strategy: 'ChangeAddress'; + value: null; +}; + +/** ReuseAddress variant of RemainderValueStrategy */ +export type ReuseAddress = { + strategy: 'ReuseAddress'; + value: null; +}; + +/** CustomAddress variant of RemainderValueStrategy */ +export type CustomAddress = { + strategy: 'CustomAddress'; + value: string; +}; + +/** Native token options for minting more native tokens */ +export interface IncreaseNativeTokenSupplyOptions {} + +/** Native token options for minting */ +export interface NativeTokenOptions { + aliasId?: string; + /** Hex encoded number */ + circulatingSupply: HexEncodedAmount; + /** Hex encoded number */ + maximumSupply: HexEncodedAmount; + /** Hex encoded bytes */ + foundryMetadata?: string; +} + +/** Nft options for minting */ +export interface NftOptions { + /** Bech32 encoded address to which the Nft will be minted. Default will use the + * first address of the account + */ + address?: string; + /** Bech32 encoded sender address **/ + sender?: string; + /** Hex encoded bytes */ + metadata?: string; + /** Hex encoded bytes */ + tag?: string; + /** Bech32 encoded issuer address **/ + issuer?: string; + /** Hex encoded bytes */ + immutableMetadata?: string; +} + +/** Options for the alias output creation */ +export interface AliasOutputOptions { + /** Bech32 encoded address to which the Nft will be minted. Default will use the + * first address of the account + */ + address?: string; + /** Hex encoded bytes */ + immutableMetadata?: string; + /** Hex encoded bytes */ + metadata?: string; + /** Hex encoded bytes */ + stateMetadata?: string; +} From 974599c812cbee375ef77e18ca9455cfd7115fa9 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:51:12 +0100 Subject: [PATCH 008/197] chore: add tsconfig and package lock files --- bindings/capacitorjs/package-lock.json | 448 +++++++++++++++++++++++++ bindings/capacitorjs/tsconfig.json | 24 ++ 2 files changed, 472 insertions(+) create mode 100644 bindings/capacitorjs/package-lock.json create mode 100644 bindings/capacitorjs/tsconfig.json diff --git a/bindings/capacitorjs/package-lock.json b/bindings/capacitorjs/package-lock.json new file mode 100644 index 0000000000..bea324531a --- /dev/null +++ b/bindings/capacitorjs/package-lock.json @@ -0,0 +1,448 @@ +{ + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "@capacitor/core": "^3.4.1", + "@iota/types": "^1.0.0-beta.15" + }, + "devDependencies": { + "@capacitor/android": "^3.4.1", + "@capacitor/core": "^3.4.1", + "@capacitor/docgen": "^0.0.10", + "@capacitor/ios": "^3.4.1", + "rimraf": "^3.0.2", + "rollup": "^2.32.0", + "typescript": "~4.0.3" + }, + "peerDependencies": { + "@capacitor/core": "^3.4.1" + } + }, + "node_modules/@capacitor/android": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.9.0.tgz", + "integrity": "sha512-YTPyrh1NozEuYXWGtfqN27TLXUrLbZX9fggyd4JQ1yMaUZTmLPm5dCuznONhQ49aPkJnUJB02JfpHy/qGwa2Lw==", + "dev": true, + "peerDependencies": { + "@capacitor/core": "^3.9.0" + } + }, + "node_modules/@capacitor/core": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.9.0.tgz", + "integrity": "sha512-j1lL0+/7stY8YhIq1Lm6xixvUqIn89vtyH5ZpJNNmcZ0kwz6K9eLkcG6fvq1UWMDgSVZg9JrRGSFhb4LLoYOsw==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@capacitor/docgen": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@capacitor/docgen/-/docgen-0.0.10.tgz", + "integrity": "sha512-zHzWBDiidONOKipn1ZCc1Q8FvnmKDRXBl0NU/haiWXek9WhrhmGhN5Vbm9RK9LXkEKfkdJn6G+eht5wqVrJCsA==", + "dev": true, + "dependencies": { + "colorette": "^1.2.1", + "github-slugger": "^1.3.0", + "minimist": "^1.2.5", + "typescript": "^4.0.3" + }, + "bin": { + "docgen": "bin/docgen" + }, + "engines": { + "node": ">=14.5.0" + } + }, + "node_modules/@capacitor/ios": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-3.9.0.tgz", + "integrity": "sha512-GezPCJIujRHnF4wbrKJx6Q/mgFz0f9rmh/steTTXQZI+nEl6mHk6NWh8235p7YbhonYi5WD0rFNirrjGg1EaGw==", + "dev": true, + "peerDependencies": { + "@capacitor/core": "^3.9.0" + } + }, + "node_modules/@iota/types": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@iota/types/-/types-1.0.0-beta.15.tgz", + "integrity": "sha512-67DrzDO5bl2c7RIMpOdtjdOa27Bv1EmX/BHPTQD8c3RtPPAzJpSIpuI8JsIDl3U6Qe4zdLX3kRv9zGBXcr0fZA==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/github-slugger": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", + "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", + "dev": true + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true + }, + "node_modules/typescript": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", + "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + }, + "dependencies": { + "@capacitor/android": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.9.0.tgz", + "integrity": "sha512-YTPyrh1NozEuYXWGtfqN27TLXUrLbZX9fggyd4JQ1yMaUZTmLPm5dCuznONhQ49aPkJnUJB02JfpHy/qGwa2Lw==", + "dev": true, + "requires": {} + }, + "@capacitor/core": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.9.0.tgz", + "integrity": "sha512-j1lL0+/7stY8YhIq1Lm6xixvUqIn89vtyH5ZpJNNmcZ0kwz6K9eLkcG6fvq1UWMDgSVZg9JrRGSFhb4LLoYOsw==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "@capacitor/docgen": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@capacitor/docgen/-/docgen-0.0.10.tgz", + "integrity": "sha512-zHzWBDiidONOKipn1ZCc1Q8FvnmKDRXBl0NU/haiWXek9WhrhmGhN5Vbm9RK9LXkEKfkdJn6G+eht5wqVrJCsA==", + "dev": true, + "requires": { + "colorette": "^1.2.1", + "github-slugger": "^1.3.0", + "minimist": "^1.2.5", + "typescript": "^4.0.3" + } + }, + "@capacitor/ios": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-3.9.0.tgz", + "integrity": "sha512-GezPCJIujRHnF4wbrKJx6Q/mgFz0f9rmh/steTTXQZI+nEl6mHk6NWh8235p7YbhonYi5WD0rFNirrjGg1EaGw==", + "dev": true, + "requires": {} + }, + "@iota/types": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@iota/types/-/types-1.0.0-beta.15.tgz", + "integrity": "sha512-67DrzDO5bl2c7RIMpOdtjdOa27Bv1EmX/BHPTQD8c3RtPPAzJpSIpuI8JsIDl3U6Qe4zdLX3kRv9zGBXcr0fZA==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "github-slugger": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", + "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true + }, + "typescript": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", + "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + } +} diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json new file mode 100644 index 0000000000..c1c4b12738 --- /dev/null +++ b/bindings/capacitorjs/tsconfig.json @@ -0,0 +1,24 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +{ + "compilerOptions": { + "allowUnreachableCode": false, + "declaration": true, + "esModuleInterop": true, + "lib": ["dom", "es2017"], + "module": "esnext", + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "dist/esm", + "pretty": true, + "sourceMap": true, + "target": "es2017" + }, + "files": [ + "src/index.ts", + "src/definitions.ts" + ] +} From df71eb45d86ca419b3743f06d976090081742a26 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:55:40 +0100 Subject: [PATCH 009/197] chore: add iOS xcframework as a plugin internal dependency --- .../WalletFramework.xcframework/Info.plist | 39 +++++++++++++++++++ .../Headers/WalletFramework.h | 27 +++++++++++++ .../WalletFramework.framework/Info.plist | 22 +++++++++++ .../Modules/Modules.modulemap | 6 +++ .../Headers/WalletFramework.h | 27 +++++++++++++ .../WalletFramework.framework/Info.plist | 22 +++++++++++ .../Modules/Modules.modulemap | 6 +++ 7 files changed, 149 insertions(+) create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist new file mode 100644 index 0000000000..88169654de --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist @@ -0,0 +1,39 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64 + LibraryPath + WalletFramework.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-x86 + LibraryPath + WalletFramework.framework + SupportedArchitectures + + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h new file mode 100644 index 0000000000..c3853f0c1c --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -0,0 +1,27 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct iota_wallet_handle iota_wallet_handle_t; + +typedef void (*Callback)(const char* response, const char* error, void* context); + +// Initialise the fern logger. Level filter defaults to Debug if omitted +extern int8_t iota_init_logger(const char* file_name, const char* level_filter); +extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); +extern void iota_destroy(iota_wallet_handle_t*); +extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); +extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + + +#ifdef __cplusplus +} +#endif diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist new file mode 100644 index 0000000000..81e834bb06 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + WalletFramework + CFBundleIdentifier + org.iotafoundation.WalletFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + WalletFramework + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap new file mode 100644 index 0000000000..626bedcb21 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap @@ -0,0 +1,6 @@ +framework module WalletFramework { + umbrella header "WalletFramework.h" + + export * + module * { export * } +} diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h new file mode 100644 index 0000000000..c3853f0c1c --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -0,0 +1,27 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct iota_wallet_handle iota_wallet_handle_t; + +typedef void (*Callback)(const char* response, const char* error, void* context); + +// Initialise the fern logger. Level filter defaults to Debug if omitted +extern int8_t iota_init_logger(const char* file_name, const char* level_filter); +extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); +extern void iota_destroy(iota_wallet_handle_t*); +extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); +extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + + +#ifdef __cplusplus +} +#endif diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist new file mode 100644 index 0000000000..81e834bb06 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + WalletFramework + CFBundleIdentifier + org.iotafoundation.WalletFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + WalletFramework + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap new file mode 100644 index 0000000000..626bedcb21 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap @@ -0,0 +1,6 @@ +framework module WalletFramework { + umbrella header "WalletFramework.h" + + export * + module * { export * } +} From b4c59afe8a77d556887967810f649c6b57440327 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:57:49 +0100 Subject: [PATCH 010/197] chore: add iOS base project files --- bindings/capacitorjs/ios/.gitignore | 3 + .../ios/Plugin.xcodeproj/project.pbxproj | 619 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + bindings/capacitorjs/ios/Plugin/Info.plist | 24 + .../ios/Plugin/Libraries/libwallet.h | 4 + .../ios/Plugin/Libraries/module.modulemap | 4 + .../capacitorjs/ios/PluginTests/Info.plist | 22 + .../ios/PluginTests/PluginTests.swift | 26 + bindings/capacitorjs/ios/Podfile | 42 ++ bindings/capacitorjs/ios/Podfile.lock | 22 + 13 files changed, 799 insertions(+) create mode 100644 bindings/capacitorjs/ios/.gitignore create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata create mode 100644 bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 bindings/capacitorjs/ios/Plugin/Info.plist create mode 100644 bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h create mode 100644 bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap create mode 100644 bindings/capacitorjs/ios/PluginTests/Info.plist create mode 100644 bindings/capacitorjs/ios/PluginTests/PluginTests.swift create mode 100644 bindings/capacitorjs/ios/Podfile create mode 100644 bindings/capacitorjs/ios/Podfile.lock diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore new file mode 100644 index 0000000000..adb2bb7ed5 --- /dev/null +++ b/bindings/capacitorjs/ios/.gitignore @@ -0,0 +1,3 @@ +libwallet.a +Pods +._* \ No newline at end of file diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..2efac039af --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -0,0 +1,619 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */; }; + 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */; }; + 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFF88201F53D600D50D53 /* Plugin.framework */; }; + 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFF96201F53D600D50D53 /* PluginTests.swift */; }; + 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ADFF8B201F53D600D50D53 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFFA52020D75100D50D53 /* Capacitor.framework */; }; + 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFFA72020EE4F00D50D53 /* Plugin.m */; }; + 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E1A94720377CB70090CE1A /* Plugin.swift */; }; + 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 600FAB16252ED5A30039D358 /* libresolv.tbd */; }; + 60EDD785252F881300E05012 /* libwallet.h in Headers */ = {isa = PBXBuildFile; fileRef = 60EDD762252F826300E05012 /* libwallet.h */; }; + EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; + EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; + EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 50ADFF7F201F53D600D50D53 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 50ADFF87201F53D600D50D53; + remoteInfo = Plugin; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + EE52B7E129378C47003728DB /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF88201F53D600D50D53 /* Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF8B201F53D600D50D53 /* Plugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; }; + 50ADFF8C201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50ADFF91201F53D600D50D53 /* PluginTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PluginTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF96201F53D600D50D53 /* PluginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginTests.swift; sourceTree = ""; }; + 50ADFF98201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50ADFFA52020D75100D50D53 /* Capacitor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Capacitor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFFA72020EE4F00D50D53 /* Plugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Plugin.m; sourceTree = ""; }; + 50E1A94720377CB70090CE1A /* Plugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plugin.swift; sourceTree = ""; }; + 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig"; sourceTree = ""; }; + 600FAB16252ED5A30039D358 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libresolv.tbd; sourceTree = DEVELOPER_DIR; }; + 60EDD75F252F7EC400E05012 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; + 60EDD762252F826300E05012 /* libwallet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libwallet.h; sourceTree = ""; }; + 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; }; + 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; }; + EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = WalletFramework.xcframework; sourceTree = ""; }; + F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; }; + F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 50ADFF84201F53D600D50D53 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */, + 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */, + 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */, + 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8E201F53D600D50D53 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */, + EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */, + 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 50ADFF7E201F53D600D50D53 = { + isa = PBXGroup; + children = ( + 50ADFF8A201F53D600D50D53 /* Plugin */, + 50ADFF95201F53D600D50D53 /* PluginTests */, + 50ADFF89201F53D600D50D53 /* Products */, + 8C8E7744173064A9F6D438E3 /* Pods */, + A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */, + ); + sourceTree = ""; + }; + 50ADFF89201F53D600D50D53 /* Products */ = { + isa = PBXGroup; + children = ( + 50ADFF88201F53D600D50D53 /* Plugin.framework */, + 50ADFF91201F53D600D50D53 /* PluginTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 50ADFF8A201F53D600D50D53 /* Plugin */ = { + isa = PBXGroup; + children = ( + 60EDD770252F843100E05012 /* Libraries */, + 50E1A94720377CB70090CE1A /* Plugin.swift */, + 50ADFF8B201F53D600D50D53 /* Plugin.h */, + 50ADFFA72020EE4F00D50D53 /* Plugin.m */, + 50ADFF8C201F53D600D50D53 /* Info.plist */, + ); + path = Plugin; + sourceTree = ""; + }; + 50ADFF95201F53D600D50D53 /* PluginTests */ = { + isa = PBXGroup; + children = ( + 50ADFF96201F53D600D50D53 /* PluginTests.swift */, + 50ADFF98201F53D600D50D53 /* Info.plist */, + ); + path = PluginTests; + sourceTree = ""; + }; + 60EDD770252F843100E05012 /* Libraries */ = { + isa = PBXGroup; + children = ( + 60EDD762252F826300E05012 /* libwallet.h */, + 60EDD75F252F7EC400E05012 /* module.modulemap */, + ); + path = Libraries; + sourceTree = ""; + }; + 8C8E7744173064A9F6D438E3 /* Pods */ = { + isa = PBXGroup; + children = ( + 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */, + 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */, + 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */, + F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */, + 600FAB16252ED5A30039D358 /* libresolv.tbd */, + 50ADFFA52020D75100D50D53 /* Capacitor.framework */, + 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */, + F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 50ADFF85201F53D600D50D53 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */, + 60EDD785252F881300E05012 /* libwallet.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 50ADFF87201F53D600D50D53 /* Plugin */ = { + isa = PBXNativeTarget; + buildConfigurationList = 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */; + buildPhases = ( + AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */, + 50ADFF83201F53D600D50D53 /* Sources */, + 50ADFF84201F53D600D50D53 /* Frameworks */, + 50ADFF85201F53D600D50D53 /* Headers */, + 50ADFF86201F53D600D50D53 /* Resources */, + EE52B7E129378C47003728DB /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Plugin; + productName = Plugin; + productReference = 50ADFF88201F53D600D50D53 /* Plugin.framework */; + productType = "com.apple.product-type.framework"; + }; + 50ADFF90201F53D600D50D53 /* PluginTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */; + buildPhases = ( + 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */, + 50ADFF8D201F53D600D50D53 /* Sources */, + 50ADFF8E201F53D600D50D53 /* Frameworks */, + 50ADFF8F201F53D600D50D53 /* Resources */, + CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 50ADFF94201F53D600D50D53 /* PBXTargetDependency */, + ); + name = PluginTests; + productName = PluginTests; + productReference = 50ADFF91201F53D600D50D53 /* PluginTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 50ADFF7F201F53D600D50D53 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0920; + ORGANIZATIONNAME = "Max Lynch"; + TargetAttributes = { + 50ADFF87201F53D600D50D53 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + }; + 50ADFF90201F53D600D50D53 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 50ADFF7E201F53D600D50D53; + productRefGroup = 50ADFF89201F53D600D50D53 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 50ADFF87201F53D600D50D53 /* Plugin */, + 50ADFF90201F53D600D50D53 /* PluginTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 50ADFF86201F53D600D50D53 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8F201F53D600D50D53 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-PluginTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Plugin-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework", + "${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 50ADFF83201F53D600D50D53 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */, + 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8D201F53D600D50D53 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 50ADFF94201F53D600D50D53 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 50ADFF87201F53D600D50D53 /* Plugin */; + targetProxy = 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 50ADFF9A201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 50ADFF9B201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 50ADFF9D201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Plugin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + "$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)", + ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 50ADFF9E201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Plugin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + "$(FRAMEWORK_SEARCH_PATHS)", + ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 50ADFFA0201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = PluginTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 50ADFFA1201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = PluginTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFF9A201F53D600D50D53 /* Debug */, + 50ADFF9B201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFF9D201F53D600D50D53 /* Debug */, + 50ADFF9E201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFFA0201F53D600D50D53 /* Debug */, + 50ADFFA1201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 50ADFF7F201F53D600D50D53 /* Project object */; +} diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata b/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..afad624ec0 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/bindings/capacitorjs/ios/Plugin/Info.plist b/bindings/capacitorjs/ios/Plugin/Info.plist new file mode 100644 index 0000000000..1007fd9dd7 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h new file mode 100644 index 0000000000..5969c72bad --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h @@ -0,0 +1,4 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import \ No newline at end of file diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap b/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap new file mode 100644 index 0000000000..61b2ca0fc8 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap @@ -0,0 +1,4 @@ +module Wallet { + header "libwallet.h" + link "WalletFramework" +} diff --git a/bindings/capacitorjs/ios/PluginTests/Info.plist b/bindings/capacitorjs/ios/PluginTests/Info.plist new file mode 100644 index 0000000000..6c40a6cd0c --- /dev/null +++ b/bindings/capacitorjs/ios/PluginTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/bindings/capacitorjs/ios/PluginTests/PluginTests.swift b/bindings/capacitorjs/ios/PluginTests/PluginTests.swift new file mode 100644 index 0000000000..43621d491c --- /dev/null +++ b/bindings/capacitorjs/ios/PluginTests/PluginTests.swift @@ -0,0 +1,26 @@ +import XCTest +import Wallet +@testable import Plugin + +class WalletTests: XCTestCase { + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testEcho() { + // This is an example of a functional test case for a plugin. + // Use XCTAssert and related functions to verify your tests produce the correct results. + + let implementation = Wallet() + let value = "Hello, World!" + let result = implementation.echo(value) + + XCTAssertEqual(value, result) + } +} diff --git a/bindings/capacitorjs/ios/Podfile b/bindings/capacitorjs/ios/Podfile new file mode 100644 index 0000000000..8fdf8429d1 --- /dev/null +++ b/bindings/capacitorjs/ios/Podfile @@ -0,0 +1,42 @@ +platform :ios, '12.0' + +def capacitor_pods + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + pod 'Capacitor', :path => '../node_modules/@capacitor/ios' + pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios' + # pod 'IotaWalletInternal', :podspec => './packages/mobile/capacitor/plugins/iota-wallet/IotaWalletInternal.podspec' + +end + +target 'Plugin' do + capacitor_pods + # use_frameworks! + # pod 'IotaWalletInternal', :path => 'WalletFramework.xcframework/' +end + +target 'PluginTests' do + capacitor_pods +end + +# post_install do |installer| +# installer.pods_project.build_configurations.each do |config| +# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" +# end + +# # Add WalletFramework.xcframework as a dependency of IotaWalletMobile +# # Based on https://github.com/CocoaPods/Xcodeproj/issues/408#issuecomment-249347379 +# # and https://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project + +# # Get the PBXFileReference to the framework +# pods = installer.pods_project.groups.find { |group| group.name == 'Pods' } +# pod = pods.children.find { |child| child.name == 'ios/WalletFramework.xcframework' } +# frameworks = pod.children.find { |child| child.name == 'Frameworks' } +# framework_file_ref = frameworks.children.first + +# target = installer.pods_project.targets.find { |target| target.name == 'IotaWalletMobile' } + +# # Add the framework to "Link Binary with Libraries" +# frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' } +# frameworks_build_phase.add_file_reference(framework_file_ref) +# end diff --git a/bindings/capacitorjs/ios/Podfile.lock b/bindings/capacitorjs/ios/Podfile.lock new file mode 100644 index 0000000000..39b15a7035 --- /dev/null +++ b/bindings/capacitorjs/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Capacitor (3.9.0): + - CapacitorCordova + - CapacitorCordova (3.9.0) + +DEPENDENCIES: + - "Capacitor (from `../node_modules/@capacitor/ios`)" + - "CapacitorCordova (from `../node_modules/@capacitor/ios`)" + +EXTERNAL SOURCES: + Capacitor: + :path: "../node_modules/@capacitor/ios" + CapacitorCordova: + :path: "../node_modules/@capacitor/ios" + +SPEC CHECKSUMS: + Capacitor: 706895818151b183fd1ef099465e47ad33e9239f + CapacitorCordova: 3c768ee86bbedd4b99b68551a78ed24128bacb40 + +PODFILE CHECKSUM: ad2225bca6fdeaff079382c262064cd89b2e5a80 + +COCOAPODS: 1.11.2 From 0289ab32ba4de81d911878ea0e7f883e5eba8a83 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 12:50:57 +0100 Subject: [PATCH 011/197] feat: implement swift plugin code --- bindings/capacitorjs/ios/Plugin/Plugin.h | 16 ++ bindings/capacitorjs/ios/Plugin/Plugin.m | 13 ++ bindings/capacitorjs/ios/Plugin/Plugin.swift | 212 +++++++++++++++++++ 3 files changed, 241 insertions(+) create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.h create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.m create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.swift diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.h b/bindings/capacitorjs/ios/Plugin/Plugin.h new file mode 100644 index 0000000000..e20890f9b2 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.h @@ -0,0 +1,16 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import +// TODO remove then of full test +// to use the walllet-ios-internal 0.2.2 unhide next line +// #import "libwallet.h" + +//! Project version number for Plugin. +FOUNDATION_EXPORT double PluginVersionNumber; + +//! Project version string for Plugin. +FOUNDATION_EXPORT const unsigned char PluginVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m new file mode 100644 index 0000000000..a097f9fe70 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -0,0 +1,13 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import +#import + +CAP_PLUGIN(IotaWalletMobile, "IotaWalletMobile", + CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(initialize, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(cleanListeners, CAPPluginReturnPromise); +) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift new file mode 100644 index 0000000000..bd8ee54c21 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -0,0 +1,212 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import Foundation +import Capacitor +import Wallet + +@objc(IotaWalletMobile) +public class IotaWalletMobile: CAPPlugin { + + // override public func load() { + // let fm = FileManager.default + // let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! + // let path = documents.appendingPathComponent("database", isDirectory: true).path + // if !fm.fileExists(atPath: path) { + // try? fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + // } + + // let manager_options = """ + // { + // "storagePath": "\(path)", + // "clientOptions": { + // "nodes": ["https://api.testnet.shimmer.network"], + // "localPow": true + // }, + // "coinType": 4219, + // "secretManager": { + // "Stronghold": { + // "snapshotPath": "\(path)/iota_wallet.stronghold", + // "password": "yourpasswordistooweak" + // } + // } + // } + // """ + // let options = manager_options.cString(using: .utf8) + // let error_buffer: UnsafeMutablePointer? = nil + // let error_buffer_size = 0 + // let filename = "\(path)/iota_wallet.log" + // let file_name = filename.cString(using: .utf8) + // let level_filter = "debug" + // let filter = level_filter.cString(using: .utf8) + // iota_init_logger(file_name, filter) + // let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + // print(Int(bitPattern: handler)) + // } + + // private var isInitialized: Bool = false + + @objc func messageHandlerNew(_ call: CAPPluginCall) { + do { + // guard !isInitialized else { return } + guard let options = call.getObject("options") else { + return call.reject("options are required") + } + guard JSONSerialization.isValidJSONObject(options) else { + return call.reject("Invalid JSON object") + } + let jsonData = try? JSONSerialization.data(withJSONObject: options) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + + let fm = FileManager.default + let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! + let path = documents.appendingPathComponent("database", isDirectory: true).path + if !fm.fileExists(atPath: path) { + try fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + } + // Exclude folder from auto-backup + var urlPath = URL(fileURLWithPath: path, isDirectory: true) + var values = URLResourceValues() + values.isExcludedFromBackup = true + try urlPath.setResourceValues(values) + + // call.keepAlive = true + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + let filename = "\(path)/iota_wallet.log" + let level_filter = "debug" + iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) + let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) + + call.resolve(["messageHandler": Int(bitPattern: handler)]) + // isInitialized = true + } catch { + call.reject("failed to initialize messageHandlerNew") + } + } + + @objc func destroy(_ call: CAPPluginCall) { + // guard isInitialized else { + // call.resolve() + // return + // } + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + // https://stackoverflow.com/questions/70799271/how-to-initialize-opaquepointer-in-swift + iota_destroy(OpaquePointer(bitPattern: handler)) + // isInitialized = false + call.resolve() + // TODO: we need to release calls? verify if is automatically removed as are saved + } + + @objc func sendMessage(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + + guard let message = call.getObject("message") else { + return call.reject("message is required") + } + guard JSONSerialization.isValidJSONObject(message) else { + return call.reject("Invalid JSON object") + } + let jsonData = try? JSONSerialization.data(withJSONObject: message) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + + call.keepAlive = true + // class Result { + // var detail: OpaquePointer? + + // init(messageHandler: OpaquePointer?) { + // self.detail = messageHandler + // } + // } + // let object = Result(messageHandler: messageHandler) + + // let context = Unmanaged.passRetained(object).toOpaque() + // let callback: Callback = { response, error, context in + // guard let context = context else { + // return + // } + // let object = Unmanaged.fromOpaque(context).takeRetainedValue() + // self.notifyListeners("walletEvent", data: ["result": object.detail]) + // } + +// typealias cCallback = Optional<@convention(c) ( +// Optional>, +// Optional>, +// Optional +// ) -> ()> + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("walletEvent", data: ["result": data]) + } + + + iota_send_message(messageHandler, jsonString, callback, nil) + call.resolve() + } + + @objc func listen(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + guard let eventTypes = call.getArray("eventTypes") else { + return call.reject("eventTypes is required") + } + let eventChar = eventTypes.description.cString(using: .utf8) + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + call.keepAlive = true + + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("listen", data: ["result": data]) + } + + iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + call.resolve() + } + + @objc func cleanListeners(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + + guard let eventTypes = call.getArray("eventTypes") else { + return call.reject("eventTypes is required") + } + let eventChar = eventTypes.description.cString(using: .utf8) + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + call.keepAlive = true + + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("cleanListeners", data: ["result": data]) + } + + iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + call.resolve() + } +} From 91aa4106d7be8e74d62ab60d2f22af7a5fb05b5f Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:44:22 +0100 Subject: [PATCH 012/197] fix: add callbacks with context --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 144 +++++++++++++------ 1 file changed, 101 insertions(+), 43 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index bd8ee54c21..4b1014e644 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -40,8 +40,40 @@ public class IotaWalletMobile: CAPPlugin { // let level_filter = "debug" // let filter = level_filter.cString(using: .utf8) // iota_init_logger(file_name, filter) - // let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) - // print(Int(bitPattern: handler)) + // let handler = iota_initialize(options, error_buffer, error_buffer_size) + + + // let genMemonic = """ + // { + // "cmd": "generateMnemonic" + // } + // """ + + // func notifyLis(data: String) { + // notifyListeners("walletEvent", data: ["result": data]) + // } + // class ContextResult { + // var detail = "none" + // func notify(data: String) { + // notifyLis(data: data) + // } + // } + // let contextResult = ContextResult() + // let context = Unmanaged.passRetained(contextResult).toOpaque() + // let callback: Callback = { response, error, context in + // guard let context = context, + // let response = response else { return } + // let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + // if let error = error { + // contextResult.detail = String(cString: error) + // contextResult.notify(data: contextResult.detail) + // } + // contextResult.detail = String(cString: response) + // contextResult.notify(data: contextResult.detail) + // } + + // iota_send_message(handler, genMemonic, callback, context) + // } // private var isInitialized: Bool = false @@ -119,40 +151,33 @@ public class IotaWalletMobile: CAPPlugin { let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") call.keepAlive = true - // class Result { - // var detail: OpaquePointer? - - // init(messageHandler: OpaquePointer?) { - // self.detail = messageHandler - // } - // } - // let object = Result(messageHandler: messageHandler) - // let context = Unmanaged.passRetained(object).toOpaque() - // let callback: Callback = { response, error, context in - // guard let context = context else { - // return - // } - // let object = Unmanaged.fromOpaque(context).takeRetainedValue() - // self.notifyListeners("walletEvent", data: ["result": object.detail]) - // } - -// typealias cCallback = Optional<@convention(c) ( -// Optional>, -// Optional>, -// Optional -// ) -> ()> - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("walletEvent", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } - - iota_send_message(messageHandler, jsonString, callback, nil) - call.resolve() + iota_send_message(messageHandler, jsonString, callback, context) } @objc func listen(_ call: CAPPluginCall) { @@ -170,16 +195,32 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("listen", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) - call.resolve() } @objc func cleanListeners(_ call: CAPPluginCall) { @@ -198,12 +239,29 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("cleanListeners", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) From 5fc0a1a23221533bd723d266446aaa2933bcce30 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:44:51 +0100 Subject: [PATCH 013/197] fix: plugin definitions --- bindings/capacitorjs/src/definitions.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 404995ac0d..3986ea0fee 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -5,7 +5,6 @@ import { PluginListenerHandle } from "@capacitor/core" import { MessageHandler } from "./lib/MessageHandler" import type { EventType, - AccountManagerOptions, __Message__, __AccountMethod__, } from './types' @@ -13,21 +12,20 @@ import type { export * from './types' export interface IotaWalletMobileTypes { initLogger(path: string): Promise - messageHandlerNew(messageOptions: string): Promise - clearListeners( - eventTypes: EventType[], - messageHandler: any - ): void - initialize(options: AccountManagerOptions): Promise + messageHandlerNew(options: string): Promise + sendMessage( + message: string, + handler :MessageHandler, + callback: (error: Error, result: string) => void + ): PluginListenerHandle listen( eventTypes: EventType[], callback: (error: Error, result: string) => void, messageHandler: any ): void + clearListeners( + eventTypes: EventType[], + messageHandler: any + ): void destroy(messageHandler: any): void - sendMessage( - message: string, - handler :MessageHandler, - callback: (error: Error, result: string) => void - ): PluginListenerHandle } From a3e46ac155c7438ede570e2d1ae22ef350c34b8d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:50:29 +0100 Subject: [PATCH 014/197] chore: tidy up swift side --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 131 ++----------------- 1 file changed, 14 insertions(+), 117 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 4b1014e644..b3bb748767 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,79 +8,20 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // override public func load() { - // let fm = FileManager.default - // let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! - // let path = documents.appendingPathComponent("database", isDirectory: true).path - // if !fm.fileExists(atPath: path) { - // try? fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) - // } - - // let manager_options = """ - // { - // "storagePath": "\(path)", - // "clientOptions": { - // "nodes": ["https://api.testnet.shimmer.network"], - // "localPow": true - // }, - // "coinType": 4219, - // "secretManager": { - // "Stronghold": { - // "snapshotPath": "\(path)/iota_wallet.stronghold", - // "password": "yourpasswordistooweak" - // } - // } - // } - // """ - // let options = manager_options.cString(using: .utf8) - // let error_buffer: UnsafeMutablePointer? = nil - // let error_buffer_size = 0 - // let filename = "\(path)/iota_wallet.log" - // let file_name = filename.cString(using: .utf8) - // let level_filter = "debug" - // let filter = level_filter.cString(using: .utf8) - // iota_init_logger(file_name, filter) - // let handler = iota_initialize(options, error_buffer, error_buffer_size) - - - // let genMemonic = """ - // { - // "cmd": "generateMnemonic" - // } - // """ - - // func notifyLis(data: String) { - // notifyListeners("walletEvent", data: ["result": data]) - // } - // class ContextResult { - // var detail = "none" - // func notify(data: String) { - // notifyLis(data: data) - // } - // } - // let contextResult = ContextResult() - // let context = Unmanaged.passRetained(contextResult).toOpaque() - // let callback: Callback = { response, error, context in - // guard let context = context, - // let response = response else { return } - // let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - // if let error = error { - // contextResult.detail = String(cString: error) - // contextResult.notify(data: contextResult.detail) - // } - // contextResult.detail = String(cString: response) - // contextResult.notify(data: contextResult.detail) - // } - - // iota_send_message(handler, genMemonic, callback, context) - - // } - - // private var isInitialized: Bool = false - + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } + } + @objc func messageHandlerNew(_ call: CAPPluginCall) { do { - // guard !isInitialized else { return } guard let options = call.getObject("options") else { return call.reject("options are required") } @@ -103,8 +44,6 @@ public class IotaWalletMobile: CAPPlugin { values.isExcludedFromBackup = true try urlPath.setResourceValues(values) - // call.keepAlive = true - let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 let filename = "\(path)/iota_wallet.log" @@ -113,25 +52,17 @@ public class IotaWalletMobile: CAPPlugin { let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) call.resolve(["messageHandler": Int(bitPattern: handler)]) - // isInitialized = true } catch { call.reject("failed to initialize messageHandlerNew") } } @objc func destroy(_ call: CAPPluginCall) { - // guard isInitialized else { - // call.resolve() - // return - // } guard let handler = call.getInt("handler") else { return call.reject("handler is required") } - // https://stackoverflow.com/questions/70799271/how-to-initialize-opaquepointer-in-swift iota_destroy(OpaquePointer(bitPattern: handler)) - // isInitialized = false call.resolve() - // TODO: we need to release calls? verify if is automatically removed as are saved } @objc func sendMessage(_ call: CAPPluginCall) { @@ -152,17 +83,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -195,17 +115,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -220,7 +129,7 @@ public class IotaWalletMobile: CAPPlugin { contextResult.notify(data: contextResult.detail) } - iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) } @objc func cleanListeners(_ call: CAPPluginCall) { @@ -239,17 +148,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -264,7 +162,6 @@ public class IotaWalletMobile: CAPPlugin { contextResult.notify(data: contextResult.detail) } - iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) - call.resolve() + iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) } } From f457fff12a015023469caa4d31d56ead23e9a0a8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:19:32 +0100 Subject: [PATCH 015/197] fix: ios plugin code --- bindings/capacitorjs/ios/Plugin/Plugin.m | 7 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 196 ++++++++++++------- 2 files changed, 125 insertions(+), 78 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index a097f9fe70..b45f1e8500 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -5,9 +5,10 @@ #import CAP_PLUGIN(IotaWalletMobile, "IotaWalletMobile", + CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); + CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnCallback); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(initialize, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(cleanListeners, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index b3bb748767..2857de287d 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,57 +8,117 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { + // Handle the cross-lang pointers with a context object class ContextResult { - var detail = "none" + // details will hold the result string value from C++ + var detail = "" + // the call is used to send back the context response var call: CAPPluginCall init(_call: CAPPluginCall) { self.call = _call } - func notify(data: String) { + deinit { + print("Context result object \(detail) deinit") + } + func resolve(data: String) { + self.call.resolve(["result": data]) +// self.call.keepAlive = false + } + func listen(data: String) { self.call.resolve(["result": data]) - self.call.keepAlive = false +// self.call.keepAlive = false + } + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.resolve(data: contextResult.detail) + return + } + print(type(of: response), response) + contextResult.detail = String(cString: response) + contextResult.resolve(data: contextResult.detail) + return } } + // TODO: we really need pass this params from swift? + private let error_buffer: UnsafeMutablePointer? = nil + private let error_buffer_size = 0 + @objc func messageHandlerNew(_ call: CAPPluginCall) { do { - guard let options = call.getObject("options") else { - return call.reject("options are required") + print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) + guard let storagePath = call.getString("storagePath") else { + return call.reject("storagePath are required") } - guard JSONSerialization.isValidJSONObject(options) else { - return call.reject("Invalid JSON object") - } - let jsonData = try? JSONSerialization.data(withJSONObject: options) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? - let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") - + + // prepare the internal app directory path let fm = FileManager.default - let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! - let path = documents.appendingPathComponent("database", isDirectory: true).path + guard let documents = fm.urls( + for: .applicationSupportDirectory, + in: .userDomainMask + ).first else { + return call.reject("can not create the path") + } + let path = documents.appendingPathComponent( + storagePath, + isDirectory: true + ).path + if !fm.fileExists(atPath: path) { - try fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + try fm.createDirectory( + atPath: path, + withIntermediateDirectories: true, + attributes: nil + ) } + // Exclude folder from auto-backup var urlPath = URL(fileURLWithPath: path, isDirectory: true) var values = URLResourceValues() values.isExcludedFromBackup = true try urlPath.setResourceValues(values) + + // we need to modify the path on the JS object + let options = """ + { + "storagePath":"\(path)", + "clientOptions":{ + "nodes":[{ + "url":"https://api.testnet.shimmer.network", + "auth":{"username":"","password":""},"disabled":false + }] + }, + "coinType":4219, + "secretManager":{ + "stronghold":{ + "snapshotPath":"\(path)/wallet.stronghold" + }} + } + """ + print(options) - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 + // TODO: implement logger as a fn let filename = "\(path)/iota_wallet.log" let level_filter = "debug" iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) - let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) - + + // Keep the C++ handler / pointer of the messageHandler call result + let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + // Convert pointer to integer keeping bit pattern call.resolve(["messageHandler": Int(bitPattern: handler)]) + } catch { call.reject("failed to initialize messageHandlerNew") } } @objc func destroy(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + print("Capacitor call destroy received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } iota_destroy(OpaquePointer(bitPattern: handler)) @@ -66,42 +126,35 @@ public class IotaWalletMobile: CAPPlugin { } @objc func sendMessage(_ call: CAPPluginCall) { +// print("Capacitor call sendMessage received", call.jsObjectRepresentation) guard let handler = call.getInt("handler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) - guard let message = call.getObject("message") else { + // replacing for urls slashes since it's serialized on JS + guard let message = call.getString("message")? + .replacingOccurrences(of: "\\", with: "") else { return call.reject("message is required") } - guard JSONSerialization.isValidJSONObject(message) else { - return call.reject("Invalid JSON object") - } - let jsonData = try? JSONSerialization.data(withJSONObject: message) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? - let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") +// print(message) + // Keep the call awaiting the result, later inside the callback + // the passed call will send the result and disable keep alive call.keepAlive = true + // the object to be passed as a context data on their callback let contextResult = ContextResult(_call: call) + // context var to be passed on the object callback + // where it will be converted back to object type ready to use let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_send_message(messageHandler, jsonString, callback, context) + + iota_send_message(messageHandler, message, contextResult.callback, context) } @objc func listen(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + print("Capacitor call listen received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) @@ -109,31 +162,35 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("eventTypes is required") } let eventChar = eventTypes.description.cString(using: .utf8) - - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 call.keepAlive = true let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) +// let callback: Callback = { response, error, context in +// guard let context = context, +// let response = response else { return } +// let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() +// if let error = error { +// contextResult.detail = String(cString: error) +// contextResult.listen(data: contextResult.detail) +// return +// } +// print(type(of: response), response) +// contextResult.detail = String(cString: response) +// contextResult.listen(data: contextResult.detail) +// } + + let ret = iota_listen( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) + print("ret", ret) } - @objc func cleanListeners(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + @objc func clearListeners(_ call: CAPPluginCall) { + print("Capacitor call clearListeners received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) @@ -143,25 +200,14 @@ public class IotaWalletMobile: CAPPlugin { } let eventChar = eventTypes.description.cString(using: .utf8) - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 - call.keepAlive = true let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) + +// iota_clear_listeners( +// messageHandler, eventChar, contextResult.callback, context, +// error_buffer, error_buffer_size +// ) } } From 1c25bf3f0e4b469ba4b12b88d1bea111937b404e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:20:25 +0100 Subject: [PATCH 016/197] chore: update xcframework --- .../WalletFramework.framework/Headers/WalletFramework.h | 1 - .../ios-x86/WalletFramework.framework/Headers/WalletFramework.h | 1 - 2 files changed, 2 deletions(-) diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h index c3853f0c1c..bca40949e9 100644 --- a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -13,7 +13,6 @@ typedef struct iota_wallet_handle iota_wallet_handle_t; typedef void (*Callback)(const char* response, const char* error, void* context); -// Initialise the fern logger. Level filter defaults to Debug if omitted extern int8_t iota_init_logger(const char* file_name, const char* level_filter); extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); extern void iota_destroy(iota_wallet_handle_t*); diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h index c3853f0c1c..bca40949e9 100644 --- a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -13,7 +13,6 @@ typedef struct iota_wallet_handle iota_wallet_handle_t; typedef void (*Callback)(const char* response, const char* error, void* context); -// Initialise the fern logger. Level filter defaults to Debug if omitted extern int8_t iota_init_logger(const char* file_name, const char* level_filter); extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); extern void iota_destroy(iota_wallet_handle_t*); From 4d039ee0cfec386bdd5ca482d319517b20f10d74 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:21:14 +0100 Subject: [PATCH 017/197] chore: update plugin definitions --- bindings/capacitorjs/src/definitions.ts | 48 ++++++++++++++++--------- bindings/capacitorjs/src/index.ts | 21 +++++------ 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 3986ea0fee..dc1d530994 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,31 +1,47 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { PluginListenerHandle } from "@capacitor/core" -import { MessageHandler } from "./lib/MessageHandler" +// import { PluginListenerHandle } from "@capacitor/core" +// import type { MessageHandler } from "./lib/MessageHandler" import type { EventType, __Message__, __AccountMethod__, + // AccountManagerOptions, } from './types' -export * from './types' + export interface IotaWalletMobileTypes { initLogger(path: string): Promise - messageHandlerNew(options: string): Promise - sendMessage( + + messageHandlerNew(messageOptions: { + storagePath: string + }): Promise<{ messageHandler: number }> + + sendMessage(messageOptions: { message: string, - handler :MessageHandler, - callback: (error: Error, result: string) => void - ): PluginListenerHandle + handler : number, + }): Promise<{ result: string }> + listen( - eventTypes: EventType[], - callback: (error: Error, result: string) => void, - messageHandler: any - ): void - clearListeners( + options: { + eventTypes: EventType[]; + messageHandler: number; + }, + callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void + ): Promise; + + clearListeners(options: { eventTypes: EventType[], - messageHandler: any - ): void - destroy(messageHandler: any): void + messageHandler: number + }): Promise<{ result: string }> + + destroy(options: { + messageHandler: number + }): Promise; } diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts index 57be241602..38d0dd11d6 100644 --- a/bindings/capacitorjs/src/index.ts +++ b/bindings/capacitorjs/src/index.ts @@ -1,17 +1,12 @@ -// Copyright 2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 +import { registerPlugin } from '@capacitor/core' -import { internalInitLogger } from './lib/bindings' -import type { LoggerConfig } from './types' +import { IotaWalletMobileTypes } from './definitions' -export * from './lib/AccountManager' -export * from './lib/MessageHandler' -export * from './lib/Account' -// Moved to definitions.ts, TODO modify tsconfig to adapt it -// export * from './types' +const IotaWalletMobile = registerPlugin('IotaWalletMobile') -/** Function to create wallet logs */ -const initLogger = (config: LoggerConfig) => - internalInitLogger(JSON.stringify(config)) +// import * as WalletApi from './lib/index.js' -export { initLogger } +// IotaWalletMobile.WalletApi = WalletApi + +export * from './definitions' +export { IotaWalletMobile } From 7aa32fd4fc3fad1f3109f03b0e805ca72a665ad4 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 30 Dec 2022 22:41:38 +0100 Subject: [PATCH 018/197] chore: add android plugin Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/.gitignore | 72 ++++++++ bindings/capacitorjs/android/.npmignore | 1 + bindings/capacitorjs/android/build.gradle | 55 ++++++ .../capacitorjs/android/gradle.properties | 21 +++ .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + bindings/capacitorjs/android/gradlew | 160 ++++++++++++++++++ bindings/capacitorjs/android/gradlew.bat | 90 ++++++++++ .../capacitorjs/android/proguard-rules.pro | 21 +++ bindings/capacitorjs/android/settings.gradle | 2 + .../android/ExampleInstrumentedTest.java | 27 +++ .../android/src/main/AndroidManifest.xml | 5 + .../iotawalletmobile/IotaWalletMobile.java | 159 +++++++++++++++++ .../main/res/layout/bridge_layout_main.xml | 15 ++ .../android/src/main/res/values/colors.xml | 3 + .../android/src/main/res/values/strings.xml | 3 + .../android/src/main/res/values/styles.xml | 3 + .../com/getcapacitor/ExampleUnitTest.java | 17 ++ 18 files changed, 660 insertions(+) create mode 100644 bindings/capacitorjs/android/.gitignore create mode 100644 bindings/capacitorjs/android/.npmignore create mode 100644 bindings/capacitorjs/android/build.gradle create mode 100644 bindings/capacitorjs/android/gradle.properties create mode 100644 bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties create mode 100755 bindings/capacitorjs/android/gradlew create mode 100644 bindings/capacitorjs/android/gradlew.bat create mode 100644 bindings/capacitorjs/android/proguard-rules.pro create mode 100644 bindings/capacitorjs/android/settings.gradle create mode 100644 bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java create mode 100644 bindings/capacitorjs/android/src/main/AndroidManifest.xml create mode 100644 bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java create mode 100644 bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/colors.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/strings.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/styles.xml create mode 100644 bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java diff --git a/bindings/capacitorjs/android/.gitignore b/bindings/capacitorjs/android/.gitignore new file mode 100644 index 0000000000..028140319e --- /dev/null +++ b/bindings/capacitorjs/android/.gitignore @@ -0,0 +1,72 @@ +# NPM renames .gitignore to .npmignore +# In order to prevent that, we remove the initial "." +# And the CLI then renames it + +# Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore + +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Cordova plugins for Capacitor +capacitor-cordova-android-plugins + +# Copied web assets +app/src/main/assets/public \ No newline at end of file diff --git a/bindings/capacitorjs/android/.npmignore b/bindings/capacitorjs/android/.npmignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/bindings/capacitorjs/android/.npmignore @@ -0,0 +1 @@ +/build diff --git a/bindings/capacitorjs/android/build.gradle b/bindings/capacitorjs/android/build.gradle new file mode 100644 index 0000000000..d41a73100e --- /dev/null +++ b/bindings/capacitorjs/android/build.gradle @@ -0,0 +1,55 @@ +ext { + junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1' + androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2' + androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0' +} + +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.2.1' + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30 + defaultConfig { + minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21 + targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +repositories { + google() + jcenter() + mavenCentral() +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':capacitor-android') + testImplementation "junit:junit:$junitVersion" + androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" +} diff --git a/bindings/capacitorjs/android/gradle.properties b/bindings/capacitorjs/android/gradle.properties new file mode 100644 index 0000000000..2dbcb07109 --- /dev/null +++ b/bindings/capacitorjs/android/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 GIT binary patch literal 53636 zcmafaW0a=B^559DjdyHo$F^PVt zzd|cWgMz^T0YO0lQ8%TE1O06v|NZl~LH{LLQ58WtNjWhFP#}eWVO&eiP!jmdp!%24 z{&z-MK{-h=QDqf+S+Pgi=_wg$I{F28X*%lJ>A7Yl#$}fMhymMu?R9TEB?#6@|Q^e^AHhxcRL$z1gsc`-Q`3j+eYAd<4@z^{+?JM8bmu zSVlrVZ5-)SzLn&LU9GhXYG{{I+u(+6ES+tAtQUanYC0^6kWkks8cG;C&r1KGs)Cq}WZSd3k1c?lkzwLySimkP5z)T2Ox3pNs;PdQ=8JPDkT7#0L!cV? zzn${PZs;o7UjcCVd&DCDpFJvjI=h(KDmdByJuDYXQ|G@u4^Kf?7YkE67fWM97kj6F z973tGtv!k$k{<>jd~D&c(x5hVbJa`bILdy(00%lY5}HZ2N>)a|))3UZ&fUa5@uB`H z+LrYm@~t?g`9~@dFzW5l>=p0hG%rv0>(S}jEzqQg6-jImG%Pr%HPtqIV_Ym6yRydW z4L+)NhcyYp*g#vLH{1lK-hQQSScfvNiNx|?nSn-?cc8}-9~Z_0oxlr~(b^EiD`Mx< zlOL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^C-7uX*!myEym z#_#p^T!P~#Dx$%^K>Y_nj_3J*E_LwJ60-5Xu=LkJAwcP@|0;a&+|+ZX`Jbj9P5;T% z|KOc}4*#4o{U?09`9Hz`Xo-I!P=9XfIrr*MQ}y=$!qgv?_J38^bNb4kM&_OVg^_=Eu-qG5U(fw0KMgH){C8pazq~51rN97hf#20-7=aK0)N|UM H-+%o-(+5aQ literal 0 HcmV?d00001 diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..6047798096 --- /dev/null +++ b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Dec 01 12:41:00 CST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/bindings/capacitorjs/android/gradlew b/bindings/capacitorjs/android/gradlew new file mode 100755 index 0000000000..9d82f78915 --- /dev/null +++ b/bindings/capacitorjs/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/bindings/capacitorjs/android/gradlew.bat b/bindings/capacitorjs/android/gradlew.bat new file mode 100644 index 0000000000..aec99730b4 --- /dev/null +++ b/bindings/capacitorjs/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/bindings/capacitorjs/android/proguard-rules.pro b/bindings/capacitorjs/android/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/bindings/capacitorjs/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/bindings/capacitorjs/android/settings.gradle b/bindings/capacitorjs/android/settings.gradle new file mode 100644 index 0000000000..b6cd38dcd1 --- /dev/null +++ b/bindings/capacitorjs/android/settings.gradle @@ -0,0 +1,2 @@ +include ':capacitor-android' +project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') diff --git a/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java b/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java new file mode 100644 index 0000000000..64f83739d7 --- /dev/null +++ b/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.getcapacitor.android; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.getcapacitor.android", appContext.getPackageName()); + } +} diff --git a/bindings/capacitorjs/android/src/main/AndroidManifest.xml b/bindings/capacitorjs/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..7cd289dcd3 --- /dev/null +++ b/bindings/capacitorjs/android/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java new file mode 100644 index 0000000000..a009fcf55a --- /dev/null +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -0,0 +1,159 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +package org.iota.iotawalletmobile; + +import android.util.Log; + +import com.getcapacitor.JSArray; +import com.getcapacitor.JSObject; +import com.getcapacitor.Plugin; +import com.getcapacitor.PluginCall; +import com.getcapacitor.PluginMethod; +import com.getcapacitor.annotation.CapacitorPlugin; + +import java.util.Arrays; +import java.util.List; + +import org.iota.Wallet; +import org.iota.api.WalletCommand; +import org.iota.types.ClientConfig; +import org.iota.types.CoinType; +import org.iota.types.WalletConfig; +import org.iota.types.events.Event; +import org.iota.types.events.EventListener; +import org.iota.types.events.transaction.TransactionProgressEvent; +import org.iota.types.events.wallet.WalletEventType; +import org.iota.types.exceptions.WalletException; +import org.iota.types.secret.StrongholdSecretManager; +import org.json.JSONException; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import static org.iota.api.NativeApi.callBaseApi; + + +@CapacitorPlugin(name = "IotaWalletMobile") +public class IotaWalletMobile extends Plugin { + + Wallet wallet = null; + + @PluginMethod() + public void messageHandlerNew(final PluginCall call) { + + if (!call.getData().has("clientOptions") + || !call.getData().has("storagePath") + || !call.getData().has("coinType") + || !call.getData().has("secretManager")) { + call.reject("clientOptions, storagePath, coinType and secretManager are required"); + } + JSObject clientOptions = call.getObject("clientOptions"); + String storagePath = call.getString("storagePath"); + Integer coinType = call.getInt("coinType"); + JSObject secretManager = call.getObject("secretManager"); + String path = getContext().getFilesDir() + storagePath; + + try { + wallet = new Wallet(new WalletConfig() + .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) + .withStoragePath(path) + .withSecretManager( + new StrongholdSecretManager("", null, path + "/wallet.stronghold")) + .withCoinType(CoinType.Shimmer) + ); + JSObject ret = new JSObject(); + ret.put("messageHandler", 1); + call.resolve(ret); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @PluginMethod() + public void sendMessage(final PluginCall call) { + try { + if (!call.getData().has("message")) { + call.reject("message are required"); + } + String message = call.getString("message"); + if (message == null) { + return; + } + + JsonElement element = JsonParser.parseString(message); + JsonObject jsonObject = element.getAsJsonObject(); + WalletCommand walletCommand; + if (jsonObject.has("payload")) { + walletCommand = new WalletCommand( + jsonObject.get("cmd").getAsString(), + jsonObject.get("payload") + ); + } + else { + walletCommand = new WalletCommand(jsonObject.get("cmd").getAsString()); + + } + JsonElement jsonResponse = callBaseApi(walletCommand); + JSObject ret = new JSObject(); + if (jsonResponse != null) { + Log.d("jsonResponse", jsonResponse.toString()); + JsonObject clientResponse = new JsonObject(); + clientResponse.addProperty("type", jsonObject.get("cmd").getAsString()); + clientResponse.add("payload", jsonResponse); + ret.put("result", clientResponse.toString()); + } else { + ret.put("result", "Ok"); + } + call.resolve(ret); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + Log.d("sendMessage Error", ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + + @PluginMethod() + public void listen(final PluginCall call) throws WalletException, JSONException { + if (!call.getData().has("eventTypes")) { + call.reject("eventTypes and event are required"); + } + JSArray eventTypes = call.getArray("eventTypes"); + try { + wallet.listen(new EventListener() { + @Override + public void receive(Event event) { + JSObject walletResponse = new JSObject(); + System.out.println( + System.lineSeparator() + "Event receive: " + event.getEvent().getClass().getSimpleName()); + if (event.getEvent() instanceof TransactionProgressEvent) { + TransactionProgressEvent progress = (TransactionProgressEvent) event.getEvent(); + System.out.println(progress.toString()); + walletResponse.put("result", progress.toString()); + call.resolve(walletResponse); + } else { + System.out.println(event.getEvent().toString()); + walletResponse.put("result", event.getEvent().toString()); + call.resolve(walletResponse); + } + } + }); + } catch (WalletException e) { + e.printStackTrace(); + } + call.setKeepAlive(true); + call.resolve(); + } + + + @PluginMethod() + public void destroy(final PluginCall call) { + try { + wallet.destroy(); + call.release(bridge); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + +} diff --git a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml new file mode 100644 index 0000000000..56fec1546a --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/bindings/capacitorjs/android/src/main/res/values/colors.xml b/bindings/capacitorjs/android/src/main/res/values/colors.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/colors.xml @@ -0,0 +1,3 @@ + + + diff --git a/bindings/capacitorjs/android/src/main/res/values/strings.xml b/bindings/capacitorjs/android/src/main/res/values/strings.xml new file mode 100644 index 0000000000..6789e139cf --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Just a simple string + diff --git a/bindings/capacitorjs/android/src/main/res/values/styles.xml b/bindings/capacitorjs/android/src/main/res/values/styles.xml new file mode 100644 index 0000000000..f11f7450a8 --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/styles.xml @@ -0,0 +1,3 @@ + + + diff --git a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java new file mode 100644 index 0000000000..06806a7758 --- /dev/null +++ b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.getcapacitor; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file From e214e8b320b735ccaf65b95533584cf3d4f2610b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 9 Jan 2023 23:21:04 +0100 Subject: [PATCH 019/197] fix: Swift listen fn Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.m | 4 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 88 ++++++++------------ 2 files changed, 37 insertions(+), 55 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index b45f1e8500..dda97c8578 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -8,7 +8,7 @@ CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); - CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnCallback); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 2857de287d..cfcb0aeb99 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -17,17 +17,11 @@ public class IotaWalletMobile: CAPPlugin { init(_call: CAPPluginCall) { self.call = _call } - deinit { - print("Context result object \(detail) deinit") - } + func resolve(data: String) { self.call.resolve(["result": data]) -// self.call.keepAlive = false - } - func listen(data: String) { - self.call.resolve(["result": data]) -// self.call.keepAlive = false } + let callback: Callback = { response, error, context in guard let context = context, let response = response else { return } @@ -51,10 +45,23 @@ public class IotaWalletMobile: CAPPlugin { @objc func messageHandlerNew(_ call: CAPPluginCall) { do { print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) - guard let storagePath = call.getString("storagePath") else { - return call.reject("storagePath are required") + guard let storagePath = call.getString("storagePath"), + let clientOptions = call.getObject("clientOptions"), + let coinType = call.getInt("coinType"), + let secretManager = call.getObject("secretManager") else { + return call.reject("storagePath, clientOptions, coinType, and secretManager are required") } + guard JSONSerialization.isValidJSONObject(clientOptions), + JSONSerialization.isValidJSONObject(secretManager) else { + return call.reject("clientOptions or secretManager is an invalid JSON object") + } + let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) + let stringfiedSecretManager = String(data: SecretManager!, encoding: .utf8)! + print(stringfiedSecretManager) // prepare the internal app directory path let fm = FileManager.default guard let documents = fm.urls( @@ -86,13 +93,8 @@ public class IotaWalletMobile: CAPPlugin { let options = """ { "storagePath":"\(path)", - "clientOptions":{ - "nodes":[{ - "url":"https://api.testnet.shimmer.network", - "auth":{"username":"","password":""},"disabled":false - }] - }, - "coinType":4219, + "clientOptions":\(String(describing: stringfiedClientOptions)), + "coinType":\(coinType), "secretManager":{ "stronghold":{ "snapshotPath":"\(path)/wallet.stronghold" @@ -126,7 +128,6 @@ public class IotaWalletMobile: CAPPlugin { } @objc func sendMessage(_ call: CAPPluginCall) { -// print("Capacitor call sendMessage received", call.jsObjectRepresentation) guard let handler = call.getInt("handler") else { return call.reject("handler is required") } @@ -137,11 +138,6 @@ public class IotaWalletMobile: CAPPlugin { .replacingOccurrences(of: "\\", with: "") else { return call.reject("message is required") } -// print(message) - - // Keep the call awaiting the result, later inside the callback - // the passed call will send the result and disable keep alive - call.keepAlive = true // the object to be passed as a context data on their callback let contextResult = ContextResult(_call: call) @@ -161,31 +157,19 @@ public class IotaWalletMobile: CAPPlugin { guard let eventTypes = call.getArray("eventTypes") else { return call.reject("eventTypes is required") } - let eventChar = eventTypes.description.cString(using: .utf8) - call.keepAlive = true - - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() -// let callback: Callback = { response, error, context in -// guard let context = context, -// let response = response else { return } -// let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() -// if let error = error { -// contextResult.detail = String(cString: error) -// contextResult.listen(data: contextResult.detail) -// return -// } -// print(type(of: response), response) -// contextResult.detail = String(cString: response) -// contextResult.listen(data: contextResult.detail) -// } - - let ret = iota_listen( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - print("ret", ret) + for event in eventTypes { + let eventString = event as? String + let eventChar = eventString?.cString(using: .utf8) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + iota_listen( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) + } } @objc func clearListeners(_ call: CAPPluginCall) { @@ -200,14 +184,12 @@ public class IotaWalletMobile: CAPPlugin { } let eventChar = eventTypes.description.cString(using: .utf8) - call.keepAlive = true - let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() -// iota_clear_listeners( -// messageHandler, eventChar, contextResult.callback, context, -// error_buffer, error_buffer_size -// ) + iota_clear_listeners( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) } } From 73f58fa087dc2c01899dc8c6c3670db8d9c56ea0 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 11:49:43 +0100 Subject: [PATCH 020/197] fix: swift listen Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 57 +++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index cfcb0aeb99..3a16718d6f 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,10 +8,8 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handle the cross-lang pointers with a context object + // Handle the cross-lang pointers with a context object and Unmanaged class ContextResult { - // details will hold the result string value from C++ - var detail = "" // the call is used to send back the context response var call: CAPPluginCall init(_call: CAPPluginCall) { @@ -24,20 +22,29 @@ public class IotaWalletMobile: CAPPlugin { let callback: Callback = { response, error, context in guard let context = context, - let response = response else { return } + let response = response else { return } let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() if let error = error { - contextResult.detail = String(cString: error) - contextResult.resolve(data: contextResult.detail) + contextResult.resolve(data: String(cString: error)) return } - print(type(of: response), response) - contextResult.detail = String(cString: response) - contextResult.resolve(data: contextResult.detail) - return + contextResult.resolve(data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object for future messages. TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(data: String(cString: error)) + return + } + contextResult.resolve(data: String(cString: response)) } } - + // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -157,19 +164,21 @@ public class IotaWalletMobile: CAPPlugin { guard let eventTypes = call.getArray("eventTypes") else { return call.reject("eventTypes is required") } - - for event in eventTypes { - let eventString = event as? String - let eventChar = eventString?.cString(using: .utf8) - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 - iota_listen( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - } + + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + iota_listen( + messageHandler, eventTypes.description, + contextResult.callbackListen, context, + error_buffer, error_buffer_size + ) + + call.keepAlive = true + call.resolve() } @objc func clearListeners(_ call: CAPPluginCall) { From ecad7fd429b5a82fcbe05fb9533572f7ae39083e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 13:09:01 +0100 Subject: [PATCH 021/197] chore: update plugin definitions Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/definitions.ts | 67 ++++++++++++------------- bindings/capacitorjs/src/index.ts | 8 +-- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index dc1d530994..0d07c24a0b 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,47 +1,44 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import { PluginListenerHandle } from "@capacitor/core" -// import type { MessageHandler } from "./lib/MessageHandler" import type { EventType, __Message__, __AccountMethod__, - // AccountManagerOptions, + AccountManagerOptions, } from './types' export interface IotaWalletMobileTypes { - initLogger(path: string): Promise - - messageHandlerNew(messageOptions: { - storagePath: string - }): Promise<{ messageHandler: number }> - - sendMessage(messageOptions: { - message: string, - handler : number, - }): Promise<{ result: string }> - - listen( - options: { - eventTypes: EventType[]; - messageHandler: number; - }, - callback: (message: { - error: { - cause: unknown; - }; - result: string; - }) => void - ): Promise; - - clearListeners(options: { - eventTypes: EventType[], - messageHandler: number - }): Promise<{ result: string }> - - destroy(options: { - messageHandler: number - }): Promise; + initLogger(path: string): Promise; + messageHandlerNew(messageOptions: AccountManagerOptions): Promise<{ + messageHandler: number; + }>; + sendMessage(messageOptions: { + message: string; + handler: number; + }): Promise<{ + result: string; + }>; + listen(options: { + eventTypes: EventType[]; + messageHandler: number; + }, callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void): Promise; + clearListeners(options: { + eventTypes: EventType[]; + messageHandler: number; + }, callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void): Promise; + destroy(options: { + messageHandler: number; + }): Promise; } diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts index 38d0dd11d6..7d86aee928 100644 --- a/bindings/capacitorjs/src/index.ts +++ b/bindings/capacitorjs/src/index.ts @@ -1,12 +1,12 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + import { registerPlugin } from '@capacitor/core' import { IotaWalletMobileTypes } from './definitions' const IotaWalletMobile = registerPlugin('IotaWalletMobile') -// import * as WalletApi from './lib/index.js' - -// IotaWalletMobile.WalletApi = WalletApi - export * from './definitions' + export { IotaWalletMobile } From 9de9eaec9ce8e94cfc049bbc9da0735f83645521 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 13:40:03 +0100 Subject: [PATCH 022/197] fix: package.json Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index d990e17d1c..25978970c4 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -5,6 +5,7 @@ "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/esm/index.js", "module": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", "files": [ "android/src/main/", "android/build.gradle", @@ -12,12 +13,11 @@ "ios/Plugin/", "IotaWalletMobile.podspec" ], - "types": "dist/esm/index.d.ts", "scripts": { "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", - "build": "npm run clean && tsc && rollup -c rollup.config.js", + "build": "npm run clean && tsc && npx rollup -c rollup.config.js", "clean": "rm -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build" From 67d817ba82cc4890932b162d20fe39c5fe811579 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 22:33:52 +0100 Subject: [PATCH 023/197] fix: Swift plugin callback Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.m | 2 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 25 +++++++++++--------- bindings/capacitorjs/src/definitions.ts | 13 +++------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index dda97c8578..1f7c7a7e26 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -8,7 +8,7 @@ CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 3a16718d6f..2d342967db 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,40 +8,43 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handle the cross-lang pointers with a context object and Unmanaged + // Handles the Swift / C pointers with a context object using Unmanaged types class ContextResult { - // the call is used to send back the context response - var call: CAPPluginCall + // the `call` will send the context response back to Javascript + var call: CAPPluginCall? + init(_call: CAPPluginCall) { self.call = _call } - func resolve(data: String) { - self.call.resolve(["result": data]) + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) } - + // the needed `callback` to call C header functions let callback: Callback = { response, error, context in guard let context = context, let response = response else { return } + // Convert back into `ContextResult` Swift object type let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() if let error = error { - contextResult.resolve(data: String(cString: error)) + contextResult.resolve(type: "error", data: String(cString: error)) return } - contextResult.resolve(data: String(cString: response)) + contextResult.resolve(type: "result", data: String(cString: response)) } let callbackListen: Callback = { response, error, context in guard let context = context, let response = response else { return } - // retain of the object for future messages. TODO: verify it's released later + // retain of the object awaiting for the next message. + // TODO: verify it's released later let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() if let error = error { - contextResult.resolve(data: String(cString: error)) + contextResult.resolve(type: "error", data: String(cString: error)) return } - contextResult.resolve(data: String(cString: response)) + contextResult.resolve(type: "result", data: String(cString: response)) } } diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 0d07c24a0b..3b3bd674ae 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,14 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { - EventType, - __Message__, - __AccountMethod__, - AccountManagerOptions, -} from './types' - - +import type { EventType, AccountManagerOptions } from './types'; export interface IotaWalletMobileTypes { initLogger(path: string): Promise; messageHandlerNew(messageOptions: AccountManagerOptions): Promise<{ @@ -28,7 +21,7 @@ export interface IotaWalletMobileTypes { cause: unknown; }; result: string; - }) => void): Promise; + }) => void): Promise; clearListeners(options: { eventTypes: EventType[]; messageHandler: number; @@ -37,7 +30,7 @@ export interface IotaWalletMobileTypes { cause: unknown; }; result: string; - }) => void): Promise; + }) => void): Promise; destroy(options: { messageHandler: number; }): Promise; From 294f343c380af1650a1e66b2860e79756871dcde Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 00:12:59 +0100 Subject: [PATCH 024/197] update plugin java Signed-off-by: Amadeo Marchioni --- .../iotawalletmobile/IotaWalletMobile.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index a009fcf55a..c36a61fdec 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -33,6 +33,7 @@ import com.google.gson.JsonParser; import static org.iota.api.NativeApi.callBaseApi; +import static org.iota.api.NativeApi.callListen; @CapacitorPlugin(name = "IotaWalletMobile") @@ -49,11 +50,11 @@ public void messageHandlerNew(final PluginCall call) { || !call.getData().has("secretManager")) { call.reject("clientOptions, storagePath, coinType and secretManager are required"); } - JSObject clientOptions = call.getObject("clientOptions"); - String storagePath = call.getString("storagePath"); - Integer coinType = call.getInt("coinType"); - JSObject secretManager = call.getObject("secretManager"); - String path = getContext().getFilesDir() + storagePath; + JSObject _clientOptions = call.getObject("clientOptions"); + String _storagePath = call.getString("storagePath"); + Integer _coinType = call.getInt("coinType"); + JSObject _secretManager = call.getObject("secretManager"); + String path = getContext().getFilesDir() + _storagePath; try { wallet = new Wallet(new WalletConfig() @@ -113,36 +114,25 @@ public void sendMessage(final PluginCall call) { } } - @PluginMethod() + @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) public void listen(final PluginCall call) throws WalletException, JSONException { if (!call.getData().has("eventTypes")) { call.reject("eventTypes and event are required"); } JSArray eventTypes = call.getArray("eventTypes"); - try { - wallet.listen(new EventListener() { - @Override - public void receive(Event event) { - JSObject walletResponse = new JSObject(); - System.out.println( - System.lineSeparator() + "Event receive: " + event.getEvent().getClass().getSimpleName()); - if (event.getEvent() instanceof TransactionProgressEvent) { - TransactionProgressEvent progress = (TransactionProgressEvent) event.getEvent(); - System.out.println(progress.toString()); - walletResponse.put("result", progress.toString()); - call.resolve(walletResponse); - } else { - System.out.println(event.getEvent().toString()); - walletResponse.put("result", event.getEvent().toString()); - call.resolve(walletResponse); - } - } - }); - } catch (WalletException e) { - e.printStackTrace(); - } + try { + wallet.listen(new EventListener() { + @Override + public void receive(Event event) { + JSObject walletResponse = new JSObject(); + walletResponse.put("result", event.getEvent().toString()); + call.resolve(walletResponse); + } + }, WalletEventType.valueOf(eventTypes.getString(0))); + } catch (WalletException e) { + e.printStackTrace(); + } call.setKeepAlive(true); - call.resolve(); } @@ -156,4 +146,14 @@ public void destroy(final PluginCall call) { } } + @PluginMethod() + public void clearListeners(final PluginCall call) { + try { + wallet.clearListeners(); + call.release(bridge); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + } From 997143b40198d45e6e5c5bf99798ac3a1dd0f1dd Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 12:35:45 +0100 Subject: [PATCH 025/197] feat: add download script and preinstall script to package.json Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/add_libs.sh | 17 +++++++++++++++++ bindings/capacitorjs/package.json | 9 +++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 bindings/capacitorjs/add_libs.sh diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh new file mode 100755 index 0000000000..d2151242be --- /dev/null +++ b/bindings/capacitorjs/add_libs.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e +rm -rf tmp && mkdir tmp && cd tmp + +curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip +unzip iota-wallet.zip + +rm -rf ../android/src/main/jniLibs +cp -r jniLibs ../android/src/main/jniLibs + +curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar +rm -rf ../android/libs && mkdir -p ../android/libs +cp -r iota-wallet.jar ../android/libs + +cd .. && rm -rf tmp +echo "success!" \ No newline at end of file diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 25978970c4..37ee77e760 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -17,10 +17,11 @@ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", - "build": "npm run clean && tsc && npx rollup -c rollup.config.js", + "build": "npm run clean && tsc && rollup -c rollup.config.js", "clean": "rm -rf ./dist", "watch": "tsc --watch", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "preinstall": "npm run build && add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", @@ -33,7 +34,8 @@ }, "dependencies": { "@capacitor/core": "^3.4.1", - "@iota/types": "^1.0.0-beta.15" + "@iota/types": "^1.0.0-beta.15", + "rollup": "^2.29.0" }, "devDependencies": { "@capacitor/android": "^3.4.1", @@ -41,7 +43,6 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "rollup": "^2.32.0", "typescript": "~4.0.3" }, "peerDependencies": { From 65acece45cef63512ab267e02d22611d74b82b9e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 21:04:29 +0100 Subject: [PATCH 026/197] fix: script ./add_libs.sh Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 37ee77e760..1f882aed41 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rm -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && add_libs.sh" + "preinstall": "npm run build && ./add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From 251e6a889f311dc74ee20b9b2ee2deed4989e74d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 10:20:13 +0100 Subject: [PATCH 027/197] fix: android messageHandlerNew init values Signed-off-by: Amadeo Marchioni --- .../iotawalletmobile/IotaWalletMobile.java | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index c36a61fdec..602f641454 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -27,6 +27,7 @@ import org.iota.types.exceptions.WalletException; import org.iota.types.secret.StrongholdSecretManager; import org.json.JSONException; +import org.json.JSONObject; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -42,7 +43,7 @@ public class IotaWalletMobile extends Plugin { Wallet wallet = null; @PluginMethod() - public void messageHandlerNew(final PluginCall call) { + public void messageHandlerNew(final PluginCall call) throws JSONException { if (!call.getData().has("clientOptions") || !call.getData().has("storagePath") @@ -55,14 +56,32 @@ public void messageHandlerNew(final PluginCall call) { Integer _coinType = call.getInt("coinType"); JSObject _secretManager = call.getObject("secretManager"); String path = getContext().getFilesDir() + _storagePath; + Log.d("_clientOptions", _clientOptions.get("nodes").toString()); + + + JSONObject secretManager = _secretManager.getJSONObject("stronghold"); + Log.d("_storagePath", path + secretManager.get("snapshotPath")); + if (_coinType == null) { + return; + } + CoinType coinType = CoinType.Shimmer; + if (CoinType.Iota.getCoinTypeValue() == _coinType) { + coinType = CoinType.Iota; + } try { wallet = new Wallet(new WalletConfig() .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) .withStoragePath(path) .withSecretManager( - new StrongholdSecretManager("", null, path + "/wallet.stronghold")) - .withCoinType(CoinType.Shimmer) + new StrongholdSecretManager( + null, + null, +// path + secretManager.get("snapshotPath") + path + "/wallet.stronghold" + ) + ) + .withCoinType(coinType) ); JSObject ret = new JSObject(); ret.put("messageHandler", 1); @@ -116,23 +135,24 @@ public void sendMessage(final PluginCall call) { @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) public void listen(final PluginCall call) throws WalletException, JSONException { - if (!call.getData().has("eventTypes")) { - call.reject("eventTypes and event are required"); - } - JSArray eventTypes = call.getArray("eventTypes"); - try { - wallet.listen(new EventListener() { - @Override - public void receive(Event event) { - JSObject walletResponse = new JSObject(); - walletResponse.put("result", event.getEvent().toString()); - call.resolve(walletResponse); - } - }, WalletEventType.valueOf(eventTypes.getString(0))); - } catch (WalletException e) { - e.printStackTrace(); - } - call.setKeepAlive(true); + // if (!call.getData().has("eventTypes")) { + // call.reject("eventTypes and event are required"); + // } + // JSArray eventTypes = call.getArray("eventTypes"); + // try { + // wallet.listen(new EventListener() { + // @Override + // public void receive(Event event) { + // JSObject walletResponse = new JSObject(); + // walletResponse.put("result", event.getEvent().toString()); + // call.resolve(walletResponse); + // } + // }, WalletEventType.valueOf(eventTypes.getString(0))); + // } catch (WalletException e) { + // e.printStackTrace(); + // } + // call.setKeepAlive(true); + call.resolve(); } From d06c697be13a3efdebd2028d65086fc9a569eb62 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 11:53:40 +0100 Subject: [PATCH 028/197] chore: add JS API libs Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 113 ++- .../capacitorjs/src/lib/AccountManager.ts | 789 ++++++++++-------- .../capacitorjs/src/lib/MessageHandler.ts | 78 +- bindings/capacitorjs/src/lib/WalletApi.ts | 63 ++ bindings/capacitorjs/src/lib/bindings.ts | 28 +- bindings/capacitorjs/src/lib/index.ts | 17 + bindings/capacitorjs/src/types/account.ts | 47 +- bindings/capacitorjs/src/types/address.ts | 13 +- .../capacitorjs/src/types/bridge/account.js | 2 + .../capacitorjs/src/types/bridge/account.ts | 48 +- .../src/types/bridge/accountManager.js | 2 + .../src/types/bridge/accountManager.ts | 48 +- .../capacitorjs/src/types/bridge/index.js | 2 + .../capacitorjs/src/types/bridge/index.ts | 30 +- .../src/types/incomingTransactionData.ts | 5 +- bindings/capacitorjs/src/types/index.ts | 3 +- bindings/capacitorjs/src/types/output.ts | 4 +- .../capacitorjs/src/types/participation.ts | 69 ++ 18 files changed, 951 insertions(+), 410 deletions(-) create mode 100644 bindings/capacitorjs/src/lib/WalletApi.ts create mode 100644 bindings/capacitorjs/src/lib/index.ts create mode 100644 bindings/capacitorjs/src/types/bridge/account.js create mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.js create mode 100644 bindings/capacitorjs/src/types/bridge/index.js create mode 100644 bindings/capacitorjs/src/types/participation.ts diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index 6ee0575bab..db2b4b91ed 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,7 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { MessageHandler } from './MessageHandler'; +// import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, @@ -27,6 +27,7 @@ import type { Transaction, TransactionOptions, IncomingTransactionData, + ParticipationOverview, } from '../types'; import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; import type { @@ -48,9 +49,9 @@ import type { export class Account { // private because the data isn't updated private meta: AccountMeta; - private messageHandler: MessageHandler; + private messageHandler: any; - constructor(accountMeta: AccountMeta, messageHandler: MessageHandler) { + constructor(accountMeta: AccountMeta, messageHandler: any) { this.meta = accountMeta; this.messageHandler = messageHandler; } @@ -454,7 +455,9 @@ export class Account { * @param transactionId The ID of the transaction to get. * @returns The transaction. */ - async getIncomingTransactionData(transactionId: string): Promise { + async getIncomingTransactionData( + transactionId: string, + ): Promise { const response = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -532,9 +535,7 @@ export class Account { * List all incoming transactions of the account. * @returns The incoming transactions with their inputs. */ - async incomingTransactions(): Promise< - [string, IncomingTransactionData][] - > { + async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { const response = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -766,6 +767,29 @@ export class Account { return JSON.parse(response).payload; } + /** + * Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's + * included (referenced by a milestone). Returns the included block id. + */ + async retryTransactionUntilIncluded( + transactionId: string, + interval?: number, + maxAttempts?: number, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'retryTransactionUntilIncluded', + data: { + transactionId, + interval, + maxAttempts, + }, + }, + ); + return JSON.parse(response).payload; + } + /** * Send a transaction with amounts from input addresses. * @param addressesWithAmount Addresses with amounts. @@ -958,4 +982,77 @@ export class Account { ); return JSON.parse(resp).payload; } -} + + async vote(eventId?: string, answers?: number[]): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'vote', + data: { + eventId, + answers, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async stopParticipating(eventId: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'stopParticipating', + data: { + eventId, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async getVotingPower(): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getVotingPower', + }, + ); + return JSON.parse(resp).payload; + } + + async getParticipationOverview(): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getParticipationOverview', + }, + ); + return JSON.parse(resp).payload; + } + + async increaseVotingPower(amount: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'increaseVotingPower', + data: { + amount, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async decreaseVotingPower(amount: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'decreaseVotingPower', + data: { + amount, + }, + }, + ); + return JSON.parse(resp).payload; + } +} \ No newline at end of file diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 648fcf341f..87a4e0dd83 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -15,336 +15,471 @@ import type { AccountSyncOptions, WalletEvent, LedgerNanoStatus, + Event, + EventId, + Node, + EventStatus, + GenerateAddressOptions, } from '../types'; /** The AccountManager class. */ -export class AccountManager { - private messageHandler: MessageHandler; - - constructor(options: AccountManagerOptions) { - this.messageHandler = new MessageHandler(options); - } - - /** - * Backup the data to a Stronghold snapshot. - */ - async backup(destination: string, password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'backup', - payload: { - destination, - password, - }, - }); - } - - /** - * Transform a bech32 encoded address to a hex encoded address - */ - async bech32ToHex(bech32Address: string): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'bech32ToHex', - payload: bech32Address, - }); - return JSON.parse(response).payload; - } - - /** - * Change the Stronghold password. - */ - async changeStrongholdPassword( - currentPassword: string, - newPassword: string, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'changeStrongholdPassword', - payload: { - currentPassword, - newPassword, - }, - }); - } - - /** - * Clear the Stronghold password from memory. - */ - async clearStrongholdPassword(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'clearStrongholdPassword', - }); - } - - /** - * Create a new account. - */ - async createAccount(payload: CreateAccountPayload): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'createAccount', - payload, - }); - return new Account(JSON.parse(response).payload, this.messageHandler); - } - - /** - * Destroy the AccountManager and drop its database connection. - */ - destroy(): void { - this.messageHandler.destroy(); - } - - /** - * Emit a provided event for testing of the event system. - */ - async emitTestEvent(event: WalletEvent): Promise { - await this.messageHandler.sendMessage({ - cmd: 'emitTestEvent', - payload: event, - }); - } - - /** - * Generate a random BIP39 mnemonic. - */ - async generateMnemonic(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'generateMnemonic', - }); - return JSON.parse(response).payload; - } - - /** - * Get an account by its alias or index. - */ - async getAccount(accountId: AccountId): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccount', - payload: accountId, - }); - - const account = new Account( - JSON.parse(response).payload, - this.messageHandler, - ); - - return account; - } - - /** - * Get all account indexes. - */ - async getAccountIndexes(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccountIndexes', - }); - - return JSON.parse(response).payload; - } - - /** - * Get all accounts. - */ - async getAccounts(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccounts', - }); - - const { payload } = JSON.parse(response); - - const accounts: Account[] = []; - - for (const account of payload) { - accounts.push(new Account(account, this.messageHandler)); - } - return accounts; - } - - /** - * Get the node info. - */ - async getNodeInfo(url?: string, auth?: Auth): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getNodeInfo', - payload: { url, auth }, - }); - return JSON.parse(response).payload; - } - - /** - * Get the status for a Ledger Nano. - */ - async getLedgerNanoStatus(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getLedgerNanoStatus', - }); - return JSON.parse(response).payload; - } - - /** - * Transform hex encoded address to bech32 encoded address. If no bech32Hrp - * is provided, the AccountManager will attempt to retrieve it from the - * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. - */ - async hexToBech32(hex: string, bech32Hrp?: string): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'hexToBech32', - payload: { hex, bech32Hrp }, - }); - return JSON.parse(response).payload; - } - - /** - * Check if the Stronghold password has been set. - */ - async isStrongholdPasswordAvailable(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'isStrongholdPasswordAvailable', - }); - return JSON.parse(response).payload; - } - - /** - * Listen to wallet events with a callback. An empty array will listen to all possible events. - */ - listen( - eventTypes: EventType[], - callback: (error: Error, result: string) => void, - ): void { - return this.messageHandler.listen(eventTypes, callback); - } - - /** - * Clear the callbacks for provided events. An empty array will clear all listeners. - */ - clearListeners(eventTypes: EventType[]): void { - return this.messageHandler.clearListeners(eventTypes); - } - - /** - * Find accounts with unspent outputs. - */ - async recoverAccounts( - accountStartIndex: number, - accountGapLimit: number, - addressGapLimit: number, - syncOptions: AccountSyncOptions, - ): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'recoverAccounts', - payload: { - accountStartIndex, - accountGapLimit, - addressGapLimit, - syncOptions, - }, - }); - - const accounts: Account[] = []; - - for (const account of JSON.parse(response).payload) { - accounts.push(new Account(account, this.messageHandler)); +export async function AccountManager(options: AccountManagerOptions) { + + let id: AccountId = 0 + + let messageHandler = await MessageHandler(options); + + return { + id, + + /** + * Listen to wallet events with a callback. An empty array will listen to all possible events. + */ + async listen( + eventTypes: EventType[], + callback: (error: Error | undefined, result: string) => void, + ): Promise { + return messageHandler.listen(eventTypes, callback); + }, + + /** + * Clear the callbacks for provided events. An empty array will clear all listeners. + */ + clearListeners(eventTypes: EventType[]): Promise { + return messageHandler.clearListeners(eventTypes); + }, + + /** + * Backup the data to a Stronghold snapshot. + */ + async backup(destination: string, password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'backup', + payload: { + destination, + password, + }, + }); + }, + + /** + * Transform a bech32 encoded address to a hex encoded address + */ + async bech32ToHex(bech32Address: string): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'bech32ToHex', + payload: bech32Address, + }); + return JSON.parse(response).payload; + }, + + /** + * Change the Stronghold password. + */ + async changeStrongholdPassword( + currentPassword: string, + newPassword: string, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'changeStrongholdPassword', + payload: { + currentPassword, + newPassword, + }, + }); + }, + + /** + * Clear the Stronghold password from memory. + */ + async clearStrongholdPassword(): Promise { + await messageHandler.sendMessage({ + cmd: 'clearStrongholdPassword', + }); + }, + + /** + * Create a new account. + */ + async createAccount(payload: CreateAccountPayload): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'createAccount', + payload, + }); + return new Account(JSON.parse(response).payload, messageHandler); + }, + + /** + * Destroy the AccountManager and drop its database connection. + */ + destroy(): void { + messageHandler.destroy(); + }, + + async deregisterParticipationEvent(eventId: EventId): Promise { + await messageHandler.sendMessage({ + cmd: 'deregisterParticipationEvent', + payload: { + eventId, + }, + }); + }, + + /** + * Emit a provided event for testing of the event system. + */ + async emitTestEvent(event: WalletEvent): Promise { + await messageHandler.sendMessage({ + cmd: 'emitTestEvent', + payload: event, + }); + }, + + /** + * Generate a random BIP39 mnemonic. + */ + async generateMnemonic(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'generateMnemonic', + }); + return JSON.parse(response).payload; + }, + + /** + * Get an account by its alias or index. + */ + async getAccount(accountId: AccountId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccount', + payload: accountId, + }); + + const account = new Account( + JSON.parse(response).payload, + messageHandler, + ); + + return account; + }, + + /** + * Get all account indexes. + */ + async getAccountIndexes(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccountIndexes', + }); + + return JSON.parse(response).payload; + }, + + /** + * Get all accounts. + */ + async getAccounts(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccounts', + }); + + const { payload } = JSON.parse(response); + + const accounts: Account[] = []; + + for (const account of payload) { + accounts.push(new Account(account, messageHandler)); + } + return accounts; + }, + + /** + * Generate an address without storing it. + */ + async generateAddress( + accountIndex: number, + internal: boolean, + addressIndex: number, + options?: GenerateAddressOptions, + bech32Hrp?: string, + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'generateAddress', + payload: { + accountIndex, + internal, + addressIndex, + options, + bech32Hrp, + }, + }); + return JSON.parse(response).payload; + }, + + /** + * Get the node info. + */ + async getNodeInfo(url?: string, auth?: Auth): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getNodeInfo', + payload: { url, auth }, + }); + return JSON.parse(response).payload; + }, + + /** + * Get the status for a Ledger Nano. + */ + async getLedgerNanoStatus(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getLedgerNanoStatus', + }); + return JSON.parse(response).payload; + }, + + async getParticipationEvent(eventId: EventId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEvent', + payload: { + eventId, + }, + }); + return JSON.parse(response).payload; + }, + + async getParticipationEvents(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEvents', + }); + return JSON.parse(response).payload; + }, + + async getParticipationEventStatus(eventId: EventId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEventStatus', + payload: { + eventId, + }, + }); + return JSON.parse(response).payload; + }, + + /** + * Transform hex encoded address to bech32 e/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * ncoded address. If no bech32Hrp + * is provided, the AccountManager will attempt to retrieve it from the + * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. + */ + async hexToBech32(hex: string, bech32Hrp?: string): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'hexToBech32', + payload: { hex, bech32Hrp }, + }); + return JSON.parse(response).payload; + }, + + /** + * Check if the Stronghold password has been set. + */ + async isStrongholdPasswordAvailable(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'isStrongholdPasswordAvailable', + }); + return JSON.parse(response).payload; + }, + + /** + * Find accounts with unspent outputs. + */ + async recoverAccounts( + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions: AccountSyncOptions, + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'recoverAccounts', + payload: { + accountStartIndex, + accountGapLimit, + addressGapLimit, + syncOptions, + }, + }); + + const accounts: Account[] = []; + + for (const account of JSON.parse(response).payload) { + accounts.push(new Account(account, messageHandler)); + } + return accounts; + }, + + /** + * Delete the latest account. + */ + async removeLatestAccount(): Promise { + await messageHandler.sendMessage({ + cmd: 'removeLatestAccount', + }); + }, + + async registerParticipationEvent( + eventId: EventId, + nodes: Node[], + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'registerParticipationEvent', + payload: { + eventId, + nodes, + }, + }); + + return JSON.parse(response).payload; + }, + + /** + * Restore a backup from a Stronghold file + * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created + * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was + * stored, it will be gone. + */ + async restoreBackup(source: string, password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'restoreBackup', + payload: { + source, + password, + }, + }); + }, + + /** + * Set ClientOptions. + */ + async setClientOptions(options: ClientOptions): Promise { + await messageHandler.sendMessage({ + cmd: 'setClientOptions', + payload: options, + }); + }, + + /** + * Set the Stronghold password. + */ + async setStrongholdPassword(password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'setStrongholdPassword', + payload: password, + }); + }, + + /** + * Set the interval after which the Stronghold password gets cleared from memory. + */ + async setStrongholdPasswordClearInterval( + intervalInMilliseconds?: number, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'setStrongholdPasswordClearInterval', + payload: intervalInMilliseconds, + }); + }, + + /** + * Start the background syncing process for all accounts. + */ + async startBackgroundSync( + options?: AccountSyncOptions, + intervalInMilliseconds?: number, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'startBackgroundSync', + payload: { + options, + intervalInMilliseconds, + }, + }); + }, + + /** + * Stop the background syncing process for all accounts. + */ + async stopBackgroundSync(): Promise { + await messageHandler.sendMessage({ + cmd: 'stopBackgroundSync', + }); + }, + + /** + * Store a mnemonic in the Stronghold snapshot. + */ + async storeMnemonic(mnemonic: string): Promise { + await messageHandler.sendMessage({ + cmd: 'storeMnemonic', + payload: mnemonic, + }); + }, + + /** + * Verify if a mnemonic is a valid BIP39 mnemonic. + */ + async verifyMnemonic(mnemonic: string): Promise { + await messageHandler.sendMessage({ + cmd: 'verifyMnemonic', + payload: mnemonic, + }); } - return accounts; - } - - /** - * Delete the latest account. - */ - async removeLatestAccount(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'removeLatestAccount', - }); - } - - /** - * Restore a backup from a Stronghold file - * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created - * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was - * stored, it will be gone. - */ - async restoreBackup(source: string, password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'restoreBackup', - payload: { - source, - password, - }, - }); - } - - /** - * Set ClientOptions. - */ - async setClientOptions(options: ClientOptions): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setClientOptions', - payload: options, - }); - } - - /** - * Set the Stronghold password. - */ - async setStrongholdPassword(password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setStrongholdPassword', - payload: password, - }); - } - - /** - * Set the interval after which the Stronghold password gets cleared from memory. - */ - async setStrongholdPasswordClearInterval( - intervalInMilliseconds?: number, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setStrongholdPasswordClearInterval', - payload: intervalInMilliseconds, - }); - } - - /** - * Start the background syncing process for all accounts. - */ - async startBackgroundSync( - options?: AccountSyncOptions, - intervalInMilliseconds?: number, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'startBackgroundSync', - payload: { - options, - intervalInMilliseconds, - }, - }); - } - - /** - * Stop the background syncing process for all accounts. - */ - async stopBackgroundSync(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'stopBackgroundSync', - }); - } - - /** - * Store a mnemonic in the Stronghold snapshot. - */ - async storeMnemonic(mnemonic: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'storeMnemonic', - payload: mnemonic, - }); - } - - /** - * Verify if a mnemonic is a valid BIP39 mnemonic. - */ - async verifyMnemonic(mnemonic: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'verifyMnemonic', - payload: mnemonic, - }); } } diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts index 5f30b4efd5..59b2d2eb04 100644 --- a/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -4,9 +4,9 @@ import { sendMessageAsync, messageHandlerNew, - listen, - clearListeners, - destroy, + listen as _listen, + clearListeners as _clearListeners, + destroy as _destroy, } from './bindings'; import type { EventType, @@ -17,24 +17,22 @@ import type { } from '../types'; // The MessageHandler class interacts with messages with the rust bindings. -export class MessageHandler { - messageHandler: any; - - constructor(options?: AccountManagerOptions) { - const messageOptions = { +export async function MessageHandler(options?: AccountManagerOptions) { + + const messageOptions = { storagePath: options?.storagePath, clientOptions: options?.clientOptions, coinType: options?.coinType, - secretManager: options?.secretManager, - }; - - this.messageHandler = messageHandlerNew(JSON.stringify(messageOptions)); - } - - async sendMessage(message: __Message__): Promise { - return sendMessageAsync( + secretManager: options?.secretManager + }; + const { messageHandler } = await messageHandlerNew(messageOptions); + // messageHandler = messageHandler.messageHandler; + // console.error(messageHandler.messageHandler, 'received') + + async function sendMessage(message: __Message__): Promise { + return await sendMessageAsync( JSON.stringify(message), - this.messageHandler, + messageHandler, ).catch((error) => { try { error = JSON.parse(error).payload; @@ -43,11 +41,11 @@ export class MessageHandler { }); } - async callAccountMethod( + async function callAccountMethod( accountIndex: AccountId, method: __AccountMethod__, ): Promise { - return this.sendMessage({ + return sendMessage({ cmd: 'callAccountMethod', payload: { accountId: accountIndex, @@ -56,18 +54,44 @@ export class MessageHandler { }); } - listen( + async function listen( eventTypes: EventType[], - callback: (error: Error, result: string) => void, - ): void { - return listen(eventTypes, callback, this.messageHandler); + callback: (error: Error | undefined, result: string) => void, + ): Promise { + await _listen({ eventTypes, messageHandler }, ({ error, result }) => { + const Error = error ? { + name: error.toString(), + message: error.cause?.toString() || '' + } : undefined + callback( + Error, + result + ) + }); + } + + async function clearListeners( + eventTypes: EventType[] + ): Promise { + await _clearListeners({ eventTypes, messageHandler }, ({ error, result }) => { + const Error = error ? { + name: error.toString(), + message: error?.cause?.toString() + } : undefined + return Error || result + }); } - clearListeners(eventTypes: EventType[]): void { - return clearListeners(eventTypes, this.messageHandler); + function destroy(): void { + _destroy({ messageHandler }); } - destroy(): void { - return destroy(this.messageHandler); + return { + messageHandler, + sendMessage, + callAccountMethod, + listen, + clearListeners, + destroy } } diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts new file mode 100644 index 0000000000..290ae2a05b --- /dev/null +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -0,0 +1,63 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { Account } from './Account'; +import { AccountManager } from './AccountManager'; + +const profileManagers = {} +const WalletApi = { + async createAccountManager( + id: number, // Account.AccountId, + options: unknown, // Account.AccountManagerOptions + ) { + console.error({options}) + const manager = await AccountManager(options) + manager.id = id + console.error({manager}) + profileManagers[id] = manager + // bindMethodsAcrossContextBridge(WalletApi.AccountManager, manager) + return manager + }, + async createAccount(managerId, payload) { + const manager = profileManagers[managerId] + const account = await manager.createAccount(payload) + bindMethodsAcrossContextBridge(Account.prototype, account) + return account + }, + deleteAccountManager(id) { + if (id && id in profileManagers) { + delete profileManagers[id] + } + }, + async getAccount(managerId, index) { + const manager = profileManagers[managerId] + console.error({manager}) + const account = await manager.getAccount(index) + bindMethodsAcrossContextBridge(Account.prototype, account) + return account + }, + async getAccounts(managerId) { + const manager = profileManagers[managerId] + console.error({manager}) + const accounts = await manager.getAccounts() + accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) + return accounts + }, + async recoverAccounts(managerId, payload) { + const manager = profileManagers[managerId] + console.error({manager}) + const accounts = await manager.recoverAccounts(...Object.values(payload)) + accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) + return accounts + }, +} +function bindMethodsAcrossContextBridge(prototype, object) { + const prototypeProperties = Object.getOwnPropertyNames(prototype) + prototypeProperties.forEach((key) => { + if (key !== 'constructor') { + object[key] = object[key].bind(object) + } + }) +} + +export { WalletApi }; diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts index f90f2c11ae..bcf3ae3a9b 100644 --- a/bindings/capacitorjs/src/lib/bindings.ts +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -1,11 +1,13 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { MessageHandler } from './MessageHandler' -import { IotaWalletMobileTypes } from '../definitions' -import { registerPlugin } from '@capacitor/core' +// import type { MessageHandler } from './MessageHandler' +// import { IotaWalletMobileTypes } from "@iota/wallet-mobile" +// import { registerPlugin } from '@capacitor/core' -const IotaWalletMobile = registerPlugin('IotaWalletMobile') +// const IotaWalletMobile = registerPlugin('IotaWalletMobile') +import { IotaWalletMobile } from '../index' +// const IotaWalletMobile: IotaWalletMobileTypes const { initLogger, @@ -16,21 +18,13 @@ const { destroy, } = IotaWalletMobile -const sendMessageAsync = ( - message: string, - handler: MessageHandler, -): Promise => - new Promise((resolve, reject) => { - sendMessage(message, handler, (error: Error, result: string) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }); - }) +const sendMessageAsync = async (message: string, handler: number): Promise => { + const { result } = await sendMessage({ message, handler }) + return result +} export { + IotaWalletMobile, initLogger as internalInitLogger, sendMessageAsync, messageHandlerNew, diff --git a/bindings/capacitorjs/src/lib/index.ts b/bindings/capacitorjs/src/lib/index.ts new file mode 100644 index 0000000000..2f896eec25 --- /dev/null +++ b/bindings/capacitorjs/src/lib/index.ts @@ -0,0 +1,17 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { internalInitLogger } from './bindings' +import type { LoggerConfig } from '../types' + +export * from './AccountManager' +export * from './MessageHandler' +export * from './Account' +export * from './WalletApi' +export * from '../types/index' + +/** Function to create wallet logs */ +const initLogger = (config: LoggerConfig) => + internalInitLogger(JSON.stringify(config)) + +export { initLogger } diff --git a/bindings/capacitorjs/src/types/account.ts b/bindings/capacitorjs/src/types/account.ts index 9107152c92..c141d36b60 100644 --- a/bindings/capacitorjs/src/types/account.ts +++ b/bindings/capacitorjs/src/types/account.ts @@ -18,7 +18,7 @@ export interface AccountBalance { /** The balance of the base coin */ baseCoin: BaseCoinBalance; /** The required storage deposit for the outputs */ - requiredStorageDeposit: string; + requiredStorageDeposit: RequiredStorageDeposit; /** The balance of the native tokens */ nativeTokens: NativeTokenBalance[]; /** Nft outputs */ @@ -34,6 +34,29 @@ export interface AccountBalance { potentiallyLockedOutputs: { [outputId: string]: boolean }; } +/** The balance of the base coin */ +export interface BaseCoinBalance { + /** The total amount of the outputs */ + total: string; + /** The amount of the outputs that aren't used in a transaction */ + available: string; +} + +/** The required storage deposit per output type */ +export interface RequiredStorageDeposit { + alias: string; + basic: string; + foundry: string; + nft: string; +} + +/** The balance of a native token */ +export interface NativeTokenBalance { + tokenId: string; + total: HexEncodedAmount; + available: HexEncodedAmount; +} + /** Sync options for an account */ export interface AccountSyncOptions { /** @@ -100,21 +123,6 @@ export interface AccountMetadata { index: number; } -/** The balance of the base coin */ -export interface BaseCoinBalance { - /** The total amount of the outputs */ - total: string; - /** The amount of the outputs that aren't used in a transaction */ - available: string; -} - -/** The balance of a native token */ -export interface NativeTokenBalance { - tokenId: string; - total: HexEncodedAmount; - available: HexEncodedAmount; -} - /** IOTA and Shimmer coin types */ export enum CoinType { IOTA = 4218, @@ -124,12 +132,15 @@ export enum CoinType { /** Options for account creation */ export interface CreateAccountPayload { alias?: string; + bech32Hrp?: string; } /** Options to filter outputs */ export interface FilterOptions { /** Filter all outputs where the booked milestone index is below the specified timestamp */ - lowerBoundBookedTimestamp: number; + lowerBoundBookedTimestamp?: number; /** Filter all outputs where the booked milestone index is above the specified timestamp */ - upperBoundBookedTimestamp: number; + upperBoundBookedTimestamp?: number; + /** Filter all outputs for the provided types (Basic = 3, Alias = 4, Foundry = 5, NFT = 6) */ + outputTypes?: Uint8Array; } diff --git a/bindings/capacitorjs/src/types/address.ts b/bindings/capacitorjs/src/types/address.ts index 3fc0b1bbc1..d482b1e5cb 100644 --- a/bindings/capacitorjs/src/types/address.ts +++ b/bindings/capacitorjs/src/types/address.ts @@ -1,4 +1,4 @@ -import type { Network } from './network'; +// import type { Network } from './network'; import type { HexEncodedAmount } from '@iota/types'; /** Address Types */ @@ -52,14 +52,13 @@ export interface AddressNftId { nftId: string; } -/** Options for address generation, metadata is used only with a Ledger Nano SecretManager */ +/** Options for address generation, options is used only with a Ledger Nano SecretManager */ export interface AddressGenerationOptions { internal: boolean; - metadata: GenerateAddressMetadata; + options: GenerateAddressOptions; } -/** Metadata for address generation, useful with a Ledger Nano SecretManager */ -export interface GenerateAddressMetadata { - syncing: boolean; - network: Network; +/** Options for address generation, useful with a Ledger Nano SecretManager */ +export interface GenerateAddressOptions { + ledgerNanoPrompt: boolean; } diff --git a/bindings/capacitorjs/src/types/bridge/account.js b/bindings/capacitorjs/src/types/bridge/account.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/account.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/account.ts b/bindings/capacitorjs/src/types/bridge/account.ts index f66ca0bd0d..6b8190b0dc 100644 --- a/bindings/capacitorjs/src/types/bridge/account.ts +++ b/bindings/capacitorjs/src/types/bridge/account.ts @@ -125,7 +125,7 @@ export type __GetBalanceMethod__ = { export type __GetIncomingTransactionDataMethod__ = { name: 'getIncomingTransactionData'; data: { - transactionId: string, + transactionId: string; }; }; @@ -248,6 +248,15 @@ export type __PrepareTransactionMethod__ = { }; }; +export type __RetryTransactionUntilIncludedMethod__ = { + name: 'retryTransactionUntilIncluded'; + data: { + transactionId: string; + interval?: number; + maxAttempts?: number; + }; +}; + export type __SendAmountMethod__ = { name: 'sendAmount'; data: { @@ -315,3 +324,40 @@ export type __SyncAccountMethod__ = { options?: AccountSyncOptions; }; }; + +export type __VoteMethod__ = { + name: 'vote'; + data: { + eventId?: string; + answers?: number[]; + }; +}; + +export type __StopParticipatingMethod__ = { + name: 'stopParticipating'; + data: { + eventId: string; + }; +}; + +export type __GetVotingPowerMethod__ = { + name: 'getVotingPower'; +}; + +export type __GetParticipationOverviewMethod__ = { + name: 'getParticipationOverview'; +}; + +export type __IncreaseVotingPowerMethod__ = { + name: 'increaseVotingPower'; + data: { + amount: string; + }; +}; + +export type __DecreaseVotingPowerMethod__ = { + name: 'decreaseVotingPower'; + data: { + amount: string; + }; +}; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.js b/bindings/capacitorjs/src/types/bridge/accountManager.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/accountManager.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.ts b/bindings/capacitorjs/src/types/bridge/accountManager.ts index 7a9a720244..664eb12023 100644 --- a/bindings/capacitorjs/src/types/bridge/accountManager.ts +++ b/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -3,8 +3,10 @@ import type { AccountSyncOptions, CreateAccountPayload, } from '../account'; +import type { GenerateAddressOptions } from '../address'; import type { WalletEvent } from '../event'; -import type { Auth, ClientOptions } from '../network'; +import type { Auth, ClientOptions, Node } from '../network'; +import type { EventId } from '../participation'; export type __BackupMessage__ = { cmd: 'backup'; @@ -36,6 +38,13 @@ export type __CreateAccountMessage__ = { payload: CreateAccountPayload; }; +export type __DeregisterParticipationEvent__ = { + cmd: 'deregisterParticipationEvent'; + payload: { + eventId: EventId; + }; +}; + export type __EmitTestEventMessage__ = { cmd: 'emitTestEvent'; payload: WalletEvent; @@ -62,6 +71,17 @@ export type __GetLedgerNanoStatusMessage__ = { cmd: 'getLedgerNanoStatus'; }; +export type __GenerateAddressMessage__ = { + cmd: 'generateAddress'; + payload: { + accountIndex: number; + internal: boolean; + addressIndex: number; + options?: GenerateAddressOptions; + bech32Hrp?: string; + }; +}; + export type __GetNodeInfoMessage__ = { cmd: 'getNodeInfo'; payload: { @@ -70,6 +90,24 @@ export type __GetNodeInfoMessage__ = { }; }; +export type __GetParticipationEventMessage__ = { + cmd: 'getParticipationEvent'; + payload: { + eventId: EventId; + }; +}; + +export type __GetParticipationEventsMessage__ = { + cmd: 'getParticipationEvents'; +}; + +export type __GetParticipationEventStatusMessage__ = { + cmd: 'getParticipationEventStatus'; + payload: { + eventId: EventId; + }; +}; + export type __HexToBech32__ = { cmd: 'hexToBech32'; payload: { @@ -92,6 +130,14 @@ export type __RecoverAccountsMessage__ = { }; }; +export type __RegisterParticipationEventMessage__ = { + cmd: 'registerParticipationEvent'; + payload: { + eventId: EventId; + nodes: Node[]; + }; +}; + export type __RemoveLatestAccountMessage__ = { cmd: 'removeLatestAccount'; }; diff --git a/bindings/capacitorjs/src/types/bridge/index.js b/bindings/capacitorjs/src/types/bridge/index.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/index.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/index.ts b/bindings/capacitorjs/src/types/bridge/index.ts index 1ea2ad6ac9..ef1cc9d257 100644 --- a/bindings/capacitorjs/src/types/bridge/index.ts +++ b/bindings/capacitorjs/src/types/bridge/index.ts @@ -32,6 +32,7 @@ import type { __PrepareOutputMethod__, __PrepareSendAmountMethod__, __PrepareTransactionMethod__, + __RetryTransactionUntilIncludedMethod__, __SendAmountMethod__, __SendMicroTransactionMethod__, __SendNativeTokensMethod__, @@ -42,6 +43,12 @@ import type { __SubmitAndStoreTransactionMethod__, __SyncAccountMethod__, __GetIncomingTransactionDataMethod__, + __VoteMethod__, + __StopParticipatingMethod__, + __GetVotingPowerMethod__, + __GetParticipationOverviewMethod__, + __IncreaseVotingPowerMethod__, + __DecreaseVotingPowerMethod__, } from './account'; import type { __BackupMessage__, @@ -55,6 +62,7 @@ import type { __GetAccountIndexesMessage__, __GetAccountsMessage__, __GetLedgerNanoStatusMessage__, + __GenerateAddressMessage__, __GetNodeInfoMessage__, __HexToBech32__, __IsStrongholdPasswordAvailableMessage__, @@ -68,6 +76,11 @@ import type { __StopBackgroundSyncMessage__, __StoreMnemonicMessage__, __VerifyMnemonicMessage__, + __DeregisterParticipationEvent__, + __RegisterParticipationEventMessage__, + __GetParticipationEventMessage__, + __GetParticipationEventsMessage__, + __GetParticipationEventStatusMessage__, } from './accountManager'; export type __AccountMethod__ = @@ -104,6 +117,7 @@ export type __AccountMethod__ = | __PrepareOutputMethod__ | __PrepareSendAmountMethod__ | __PrepareTransactionMethod__ + | __RetryTransactionUntilIncludedMethod__ | __SendAmountMethod__ | __SendMicroTransactionMethod__ | __SendNativeTokensMethod__ @@ -112,7 +126,13 @@ export type __AccountMethod__ = | __SetAliasMethod__ | __SignTransactionEssenceMethod__ | __SubmitAndStoreTransactionMethod__ - | __SyncAccountMethod__; + | __SyncAccountMethod__ + | __VoteMethod__ + | __StopParticipatingMethod__ + | __GetVotingPowerMethod__ + | __GetParticipationOverviewMethod__ + | __IncreaseVotingPowerMethod__ + | __DecreaseVotingPowerMethod__; export type __CallAccountMethodMessage__ = { cmd: 'callAccountMethod'; @@ -129,16 +149,22 @@ export type __Message__ = | __ChangeStrongholdPasswordMessage__ | __ClearStrongholdPasswordMessage__ | __CreateAccountMessage__ + | __DeregisterParticipationEvent__ | __EmitTestEventMessage__ | __GenerateMnemonicMessage__ | __GetAccountMessage__ | __GetAccountIndexesMessage__ | __GetAccountsMessage__ | __GetLedgerNanoStatusMessage__ + | __GenerateAddressMessage__ | __GetNodeInfoMessage__ + | __GetParticipationEventMessage__ + | __GetParticipationEventsMessage__ + | __GetParticipationEventStatusMessage__ | __HexToBech32__ | __IsStrongholdPasswordAvailableMessage__ | __RecoverAccountsMessage__ + | __RegisterParticipationEventMessage__ | __RemoveLatestAccountMessage__ | __RestoreBackupMessage__ | __SetClientOptionsMessage__ @@ -148,3 +174,5 @@ export type __Message__ = | __StopBackgroundSyncMessage__ | __StoreMnemonicMessage__ | __VerifyMnemonicMessage__; + + \ No newline at end of file diff --git a/bindings/capacitorjs/src/types/incomingTransactionData.ts b/bindings/capacitorjs/src/types/incomingTransactionData.ts index e1bbb563e0..35c4ce0114 100644 --- a/bindings/capacitorjs/src/types/incomingTransactionData.ts +++ b/bindings/capacitorjs/src/types/incomingTransactionData.ts @@ -1,3 +1,6 @@ import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; -export type IncomingTransactionData = [ITransactionPayload, IOutputMetadataResponse[]] +export type IncomingTransactionData = [ + ITransactionPayload, + IOutputMetadataResponse[], +]; diff --git a/bindings/capacitorjs/src/types/index.ts b/bindings/capacitorjs/src/types/index.ts index d76593cce5..68a13c563f 100644 --- a/bindings/capacitorjs/src/types/index.ts +++ b/bindings/capacitorjs/src/types/index.ts @@ -1,7 +1,7 @@ export * from './account'; export * from './accountManager'; export * from './address'; -export * from './bridge'; +export * from './bridge/index'; export * from './buildOutputData'; export * from './event'; export * from './incomingTransactionData'; @@ -9,6 +9,7 @@ export * from './loggerConfig'; export * from './network'; export * from './output'; export * from './outputOptions'; +export * from './participation'; export * from './preparedTransactionData'; export * from './secretManager'; export * from './signedTransactionEssence'; diff --git a/bindings/capacitorjs/src/types/output.ts b/bindings/capacitorjs/src/types/output.ts index 68f353d98e..cd7316ab30 100644 --- a/bindings/capacitorjs/src/types/output.ts +++ b/bindings/capacitorjs/src/types/output.ts @@ -16,7 +16,7 @@ export enum OutputsToClaim { /** An output with metadata */ export interface OutputData { /** The identifier of an Output */ - outputId: string; + outputId: OutputId; /** The metadata of the output */ metadata: IOutputMetadataResponse; /** The actual Output */ @@ -38,3 +38,5 @@ export interface Segment { hardened: boolean; bs: Uint8Array; } + +export type OutputId = string; diff --git a/bindings/capacitorjs/src/types/participation.ts b/bindings/capacitorjs/src/types/participation.ts new file mode 100644 index 0000000000..ae273550d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/participation.ts @@ -0,0 +1,69 @@ +// import type { OutputId } from './output'; + +export interface ParticipationOverview { + participations: {[eventId: string]: { [outputId: string]: TrackedParticipationOverview }}; +} + +export interface TrackedParticipationOverview { + blockId: string; + amount: string; + startMilestoneIndex: number; + endMilestoneIndex: number; +} + +export interface Event { + id: EventId; + data: EventData; +} + +export type EventId = string; + +export interface EventStatus { + milestoneIndex: number; + status: string; + questions?: Answer[]; + checksum: string; +} + +export interface EventData { + name: string; + milestoneIndexCommence: number; + milestoneIndexStart: number; + milestoneIndexEnd: number; + payload: EventPayload; + additionalInfo: string; +} + +export type EventPayload = VotingEventPayload | StakingEventPayload; + +export interface VotingEventPayload { + type: ParticipationEventType.Voting; + questions: Question[]; +} + +export interface StakingEventPayload { + type: ParticipationEventType.Staking; + text: string; + symbol: string; + numerator: string; + denominator: string; + requiredMinimumRewards: string; + additionalInfo: string; +} + +export interface Question { + text: string; + answers: Answer[]; + additionalInfo: string; +} + +export interface Answer { + value: number; + text: string; + additionalInfo: string; +} + +export enum ParticipationEventType { + Voting = 0, + Staking = 1, +} From b7668c2d960a8ae33f1735973625d509cbe8a2a1 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 11:55:49 +0100 Subject: [PATCH 029/197] chore: update npm package build settings Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 6 ++---- bindings/capacitorjs/rollup.config.js | 19 ++++++++++++++++--- bindings/capacitorjs/tsconfig.json | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1f882aed41..220efc7c15 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -1,11 +1,9 @@ { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", - "main": "dist/esm/index.js", - "module": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", + "main": "dist/api.js", "files": [ "android/src/main/", "android/build.gradle", diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js index 3ee3206fc8..6d47a352f9 100644 --- a/bindings/capacitorjs/rollup.config.js +++ b/bindings/capacitorjs/rollup.config.js @@ -1,8 +1,8 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -export default { - input: 'dist/esm/index.js', +export default [{ + input: ['dist/esm/index.js'], output: [ { file: 'dist/plugin.js', @@ -16,4 +16,17 @@ export default { }, ], external: ['@capacitor/core'], -}; \ No newline at end of file +}, +{ + input: ['dist/esm/lib/index.js'], + output: [ + { + file: 'dist/api.js', + // format: 'iife', + // globals: { + // '@capacitor/core': 'capacitorExports', + // }, + }, + ], + external: ['@capacitor/core'], +}]; \ No newline at end of file diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json index c1c4b12738..2ba49621ba 100644 --- a/bindings/capacitorjs/tsconfig.json +++ b/bindings/capacitorjs/tsconfig.json @@ -3,7 +3,7 @@ { "compilerOptions": { - "allowUnreachableCode": false, + "allowUnreachableCode": true, "declaration": true, "esModuleInterop": true, "lib": ["dom", "es2017"], @@ -14,11 +14,19 @@ "noUnusedParameters": true, "outDir": "dist/esm", "pretty": true, - "sourceMap": true, + "sourceMap": false, "target": "es2017" }, "files": [ "src/index.ts", - "src/definitions.ts" - ] + "src/definitions.ts", + // "src/lib/index.ts", + // "src/lib/bindings.ts", + // "src/lib/AccountManager.ts", + // "src/lib/Account.ts", + // "src/lib/MessageHandler.ts", + // "src/types/index.ts" + ], + "include": ["src/*", "src/lib/**/*", "src/types/**/*"], + // "include": ["src/types"], } From aa7bc1e848ad65fdbef0bc2f0936062e21c6375e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 17 Jan 2023 12:34:52 +0100 Subject: [PATCH 030/197] fix: add clientOptions object with node urls on Java Signed-off-by: Amadeo Marchioni --- .../org/iota/iotawalletmobile/IotaWalletMobile.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index 602f641454..42de7744a5 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -26,9 +26,11 @@ import org.iota.types.events.wallet.WalletEventType; import org.iota.types.exceptions.WalletException; import org.iota.types.secret.StrongholdSecretManager; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -59,6 +61,13 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { Log.d("_clientOptions", _clientOptions.get("nodes").toString()); + JSONArray _nodes = _clientOptions.getJSONArray("nodes"); + String[] nodes = new String[_nodes.length()]; + for (int i = 0; i < _nodes.length(); i++) { + JSONObject _node = (JSONObject) _nodes.get(i); + nodes[i] = _node.get("url").toString(); + } + JSONObject secretManager = _secretManager.getJSONObject("stronghold"); Log.d("_storagePath", path + secretManager.get("snapshotPath")); if (_coinType == null) { @@ -71,13 +80,12 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { try { wallet = new Wallet(new WalletConfig() - .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) + .withClientOptions(new ClientConfig().withNodes(nodes)) .withStoragePath(path) .withSecretManager( new StrongholdSecretManager( null, null, -// path + secretManager.get("snapshotPath") path + "/wallet.stronghold" ) ) From b33488498d02d9a900fdac2dcee728d042e9d50e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 20 Jan 2023 12:10:48 +0100 Subject: [PATCH 031/197] chore: tidy up swift code --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 81 ++++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 2d342967db..e654272ab1 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,46 +8,6 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handles the Swift / C pointers with a context object using Unmanaged types - class ContextResult { - // the `call` will send the context response back to Javascript - var call: CAPPluginCall? - - init(_call: CAPPluginCall) { - self.call = _call - } - - func resolve(type: String, data: String) { - self.call?.resolve([type: data]) - } - // the needed `callback` to call C header functions - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // Convert back into `ContextResult` Swift object type - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - - let callbackListen: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // retain of the object awaiting for the next message. - // TODO: verify it's released later - let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() - - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - } - // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -66,7 +26,6 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("clientOptions or secretManager is an invalid JSON object") } let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) @@ -137,6 +96,46 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } + // Handles the Swift / C interop pointers with a context object using Unmanaged types + class ContextResult { + // the `call` will send the context response back to Javascript + let call: CAPPluginCall? + + init(_call: CAPPluginCall) { + self.call = _call + } + + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) + } + // the needed `callback` to call C header functions + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // Convert back into `ContextResult` Swift object type + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object awaiting for the next message. + // TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + } + @objc func sendMessage(_ call: CAPPluginCall) { guard let handler = call.getInt("handler") else { return call.reject("handler is required") From dda8cc78597c260fc65e605c06a75255d1ac06e0 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 20 Jan 2023 12:59:28 +0100 Subject: [PATCH 032/197] fix: swift plugin error Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 81 ++++++++++---------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index e654272ab1..e5ae117795 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,6 +8,46 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { + // Handles the Swift / C pointers with a context object using Unmanaged types + class ContextResult { + // the `call` will send the context response back to Javascript + let call: CAPPluginCall? + + init(_call: CAPPluginCall) { + self.call = _call + } + + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) + } + // the needed `callback` to call C header functions + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // Convert back into `ContextResult` Swift object type + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object awaiting for the next message. + // TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + } + // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -26,6 +66,7 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("clientOptions or secretManager is an invalid JSON object") } let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) @@ -96,46 +137,6 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } - // Handles the Swift / C interop pointers with a context object using Unmanaged types - class ContextResult { - // the `call` will send the context response back to Javascript - let call: CAPPluginCall? - - init(_call: CAPPluginCall) { - self.call = _call - } - - func resolve(type: String, data: String) { - self.call?.resolve([type: data]) - } - // the needed `callback` to call C header functions - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // Convert back into `ContextResult` Swift object type - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - - let callbackListen: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // retain of the object awaiting for the next message. - // TODO: verify it's released later - let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() - - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - } - @objc func sendMessage(_ call: CAPPluginCall) { guard let handler = call.getInt("handler") else { return call.reject("handler is required") From aa22e1e10af93bd00f2f0e6d121010565ee8d877 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 13:05:08 +0100 Subject: [PATCH 033/197] chore: clean js api code Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 1 - .../capacitorjs/src/lib/AccountManager.ts | 55 +------------------ 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index db2b4b91ed..47d5cfdf0e 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,7 +1,6 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 87a4e0dd83..9369e78031 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -263,60 +263,7 @@ export async function AccountManager(options: AccountManagerOptions) { }, /** - * Transform hex encoded address to bech32 e/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * ncoded address. If no bech32Hrp + * Transform hex encoded address to bech32 encoded address. If no bech32Hrp * is provided, the AccountManager will attempt to retrieve it from the * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. */ From bf2aaf75a083b702185ee804f9de356997a0ec0e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 15:52:17 +0100 Subject: [PATCH 034/197] chore: polish js wallet api Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/MessageHandler.ts | 2 -- bindings/capacitorjs/src/lib/bindings.ts | 6 ------ 2 files changed, 8 deletions(-) diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts index 59b2d2eb04..eff984e225 100644 --- a/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -26,8 +26,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { secretManager: options?.secretManager }; const { messageHandler } = await messageHandlerNew(messageOptions); - // messageHandler = messageHandler.messageHandler; - // console.error(messageHandler.messageHandler, 'received') async function sendMessage(message: __Message__): Promise { return await sendMessageAsync( diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts index bcf3ae3a9b..6a5bd11386 100644 --- a/bindings/capacitorjs/src/lib/bindings.ts +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -1,13 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import type { MessageHandler } from './MessageHandler' -// import { IotaWalletMobileTypes } from "@iota/wallet-mobile" -// import { registerPlugin } from '@capacitor/core' - -// const IotaWalletMobile = registerPlugin('IotaWalletMobile') import { IotaWalletMobile } from '../index' -// const IotaWalletMobile: IotaWalletMobileTypes const { initLogger, From 3b900853ff34a4c042c01ad7b248f7af831cb440 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 15:52:50 +0100 Subject: [PATCH 035/197] fix: add type definitions to package Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 220efc7c15..1f79e4eba3 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -4,6 +4,8 @@ "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/api.js", + "module": "dist/api.js", + "types": "dist/esm/lib/index.d.ts", "files": [ "android/src/main/", "android/build.gradle", From 34d5cd75d8346ecff9c0cc58e810184855663106 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:25:26 +0100 Subject: [PATCH 036/197] chore: add lacking types Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 10 ++++++---- bindings/capacitorjs/src/lib/AccountManager.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index 47d5cfdf0e..032ce65e0b 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,6 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, @@ -43,14 +44,15 @@ import type { INftOutput, OutputTypes, } from '@iota/types'; +type MessageHandlerType = Awaited> /** The Account class. */ export class Account { // private because the data isn't updated private meta: AccountMeta; - private messageHandler: any; + private messageHandler: MessageHandlerType; - constructor(accountMeta: AccountMeta, messageHandler: any) { + constructor(accountMeta: AccountMeta, messageHandler: MessageHandlerType) { this.meta = accountMeta; this.messageHandler = messageHandler; } @@ -982,7 +984,7 @@ export class Account { return JSON.parse(resp).payload; } - async vote(eventId?: string, answers?: number[]): Promise { + async vote(eventId: string, answers: number[]): Promise { const resp = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -1054,4 +1056,4 @@ export class Account { ); return JSON.parse(resp).payload; } -} \ No newline at end of file +} diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 9369e78031..b92b749727 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -25,7 +25,7 @@ import type { /** The AccountManager class. */ export async function AccountManager(options: AccountManagerOptions) { - let id: AccountId = 0 + let id: AccountId let messageHandler = await MessageHandler(options); From 7596d78d8cee6aae8244f87fcdccd4d8ae9ba77d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:27:32 +0100 Subject: [PATCH 037/197] chore: update typescript Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package-lock.json | 27 ++++++++++++-------------- bindings/capacitorjs/package.json | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bindings/capacitorjs/package-lock.json b/bindings/capacitorjs/package-lock.json index bea324531a..3464e886ef 100644 --- a/bindings/capacitorjs/package-lock.json +++ b/bindings/capacitorjs/package-lock.json @@ -1,16 +1,18 @@ { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@capacitor/core": "^3.4.1", - "@iota/types": "^1.0.0-beta.15" + "@iota/types": "^1.0.0-beta.15", + "rollup": "^2.29.0" }, "devDependencies": { "@capacitor/android": "^3.4.1", @@ -18,8 +20,7 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "rollup": "^2.32.0", - "typescript": "~4.0.3" + "typescript": "^4.9.4" }, "peerDependencies": { "@capacitor/core": "^3.4.1" @@ -113,7 +114,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -223,7 +223,6 @@ "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -241,9 +240,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", - "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -339,7 +338,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "optional": true }, "github-slugger": { @@ -421,7 +419,6 @@ "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, "requires": { "fsevents": "~2.3.2" } @@ -433,9 +430,9 @@ "dev": true }, "typescript": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", - "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true }, "wrappy": { diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1f79e4eba3..8889873276 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -43,7 +43,7 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "typescript": "~4.0.3" + "typescript": "^4.9.4" }, "peerDependencies": { "@capacitor/core": "^3.4.1" From e76f7ac873489aee012dbd4549849299de00a672 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:27:59 +0100 Subject: [PATCH 038/197] chore: add types to walletApi Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 290ae2a05b..73b5bd160f 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,56 +1,56 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +import { AccountId, CreateAccountPayload } from '../types/account'; +import { AccountManagerOptions } from '../types'; import { Account } from './Account'; import { AccountManager } from './AccountManager'; -const profileManagers = {} +type ProfileManager = Awaited> +type RecoverAccounts = ProfileManager['recoverAccounts'] +interface ProfileManagers { + [key: string]: ProfileManager +} +const profileManagers: ProfileManagers = {} + const WalletApi = { - async createAccountManager( - id: number, // Account.AccountId, - options: unknown, // Account.AccountManagerOptions - ) { - console.error({options}) + async createAccountManager(id: AccountId, options: AccountManagerOptions) { const manager = await AccountManager(options) manager.id = id - console.error({manager}) profileManagers[id] = manager - // bindMethodsAcrossContextBridge(WalletApi.AccountManager, manager) return manager }, - async createAccount(managerId, payload) { + async createAccount(managerId: AccountId, payload: CreateAccountPayload) { const manager = profileManagers[managerId] const account = await manager.createAccount(payload) bindMethodsAcrossContextBridge(Account.prototype, account) return account }, - deleteAccountManager(id) { - if (id && id in profileManagers) { - delete profileManagers[id] + deleteAccountManager(managerId: AccountId) { + if (managerId && managerId in profileManagers) { + delete profileManagers[managerId] } }, - async getAccount(managerId, index) { + async getAccount(managerId: AccountId, index: number) { const manager = profileManagers[managerId] - console.error({manager}) const account = await manager.getAccount(index) bindMethodsAcrossContextBridge(Account.prototype, account) return account }, - async getAccounts(managerId) { + async getAccounts(managerId: AccountId) { const manager = profileManagers[managerId] - console.error({manager}) const accounts = await manager.getAccounts() accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId, payload) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { const manager = profileManagers[managerId] - console.error({manager}) - const accounts = await manager.recoverAccounts(...Object.values(payload)) + const accounts = await manager.recoverAccounts(...Object.values(payload) as Parameters) accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, } + function bindMethodsAcrossContextBridge(prototype, object) { const prototypeProperties = Object.getOwnPropertyNames(prototype) prototypeProperties.forEach((key) => { From a4940616509df67af76899b4f64930729e41197c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 15:20:22 +0100 Subject: [PATCH 039/197] fix: js api types Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 73b5bd160f..7edfcc33ef 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,13 +1,19 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { AccountId, CreateAccountPayload } from '../types/account'; +import { AccountId, AccountSyncOptions, CreateAccountPayload } from '../types/account'; import { AccountManagerOptions } from '../types'; import { Account } from './Account'; import { AccountManager } from './AccountManager'; type ProfileManager = Awaited> -type RecoverAccounts = ProfileManager['recoverAccounts'] +type RecoverAccounts = Parameters +interface RecoverAccountsPayload { + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions?: AccountSyncOptions +} interface ProfileManagers { [key: string]: ProfileManager } @@ -43,9 +49,9 @@ const WalletApi = { accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccountsPayload) { const manager = profileManagers[managerId] - const accounts = await manager.recoverAccounts(...Object.values(payload) as Parameters) + const accounts = await manager.recoverAccounts(...Object.values(payload) as RecoverAccounts) accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, From 57740eddf2964b91d358b914382ca96db6187087 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 15:22:17 +0100 Subject: [PATCH 040/197] chore: add README Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bindings/capacitorjs/README.md diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md new file mode 100644 index 0000000000..03823e208f --- /dev/null +++ b/bindings/capacitorjs/README.md @@ -0,0 +1,24 @@ +# IOTA Wallet Library - Capacitor plugin binding + +## Requirements (only for building the binary yourself) + +[Android: Follow this guide](https://github.com/iotaledger/wallet.rs/tree/develop/bindings/java#instead-build-everything-from-scratch-yourself) + +[iOS: Follow this guide](https://github.com/iotaledger/wallet.rs/blob/develop/bindings/swift) + + +## Installation + +- Using NPM: + +```bash +npm install @iota/wallet-mobile +npx cap sync +``` + +## Building the @iota/wallet-mobile Capacitor plugin + +```sh +npm run build +``` +This command copy the already built libraries from Java and Swift bindings. \ No newline at end of file From fc9e4011de8af94ec8edcb06ea4427015bf54833 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 17:56:00 +0100 Subject: [PATCH 041/197] chore: upgrade gradle Signed-off-by: Amadeo Marchioni --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties index 6047798096..abaee84220 100644 --- a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties +++ b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip From 0186fab822fdd2b3f56c97ee78ab0c7f671609fe Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 12:41:08 +0100 Subject: [PATCH 042/197] updated build files for windows --- bindings/capacitorjs/.gitignore | 6 ++++-- bindings/capacitorjs/add_libs.sh | 2 +- bindings/capacitorjs/package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore index 2058c00f47..49f335a6a8 100644 --- a/bindings/capacitorjs/.gitignore +++ b/bindings/capacitorjs/.gitignore @@ -10,8 +10,6 @@ xcuserdata # macOS files .DS_Store - - # Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore # Built application files @@ -58,3 +56,7 @@ captures # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild + +# Copied jni libs +android/libs/ +android/src/main/jniLibs/ \ No newline at end of file diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh index d2151242be..6dae5658d9 100755 --- a/bindings/capacitorjs/add_libs.sh +++ b/bindings/capacitorjs/add_libs.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e rm -rf tmp && mkdir tmp && cd tmp diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 8889873276..49884629e3 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -18,7 +18,7 @@ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", "build": "npm run clean && tsc && rollup -c rollup.config.js", - "clean": "rm -rf ./dist", + "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", "preinstall": "npm run build && ./add_libs.sh" From e02c83b6e329ab1b1edbbbac41fa2492ef9e053c Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 15:34:59 +0100 Subject: [PATCH 043/197] revert sh removal --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 49884629e3..1fa4722fca 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && ./add_libs.sh" + "preinstall": "npm run build && sh ./add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From 58dcd45fce187fe5e34f22d55a5a977b3e5ebb67 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 15:41:18 +0100 Subject: [PATCH 044/197] messed up... --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1fa4722fca..36e89672ee 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && sh ./add_libs.sh" + "preinstall": "npm run build && bash add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From 394359b077aaeb9d2275a7f832d7d4c5657e0d8d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 30 Jan 2023 16:03:08 +0100 Subject: [PATCH 045/197] fix: Cargo.lock Signed-off-by: Amadeo Marchioni --- bindings/swift/Cargo.lock | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/bindings/swift/Cargo.lock b/bindings/swift/Cargo.lock index 24897f7e30..1613be2578 100644 --- a/bindings/swift/Cargo.lock +++ b/bindings/swift/Cargo.lock @@ -86,12 +86,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.7.2" @@ -211,7 +205,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.3", + "digest 0.10.6", ] [[package]] @@ -371,19 +365,19 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -name = "crossbeam-utils" -version = "0.8.14" +name = "cpufeatures" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if", + "libc", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -1313,9 +1307,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", "cfg-if", @@ -1873,7 +1867,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.6", ] [[package]] From e1076b1a3dae1be093fb2ca2c1d8d916662e7331 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 09:50:11 -0300 Subject: [PATCH 046/197] Update bindings/capacitorjs/README.md Co-authored-by: Rajiv Shah --- bindings/capacitorjs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md index 03823e208f..f6501eb32b 100644 --- a/bindings/capacitorjs/README.md +++ b/bindings/capacitorjs/README.md @@ -21,4 +21,4 @@ npx cap sync ```sh npm run build ``` -This command copy the already built libraries from Java and Swift bindings. \ No newline at end of file +This command copies the already built libraries from Java and Swift bindings. \ No newline at end of file From f96d23c4405d986d493c129df4ca95d61c6a4c48 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 14:03:10 +0100 Subject: [PATCH 047/197] Update bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj Co-authored-by: Rajiv Shah --- bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj index 2efac039af..7084a43f99 100644 --- a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -229,7 +229,7 @@ attributes = { LastSwiftUpdateCheck = 0920; LastUpgradeCheck = 0920; - ORGANIZATIONNAME = "Max Lynch"; + ORGANIZATIONNAME = "IOTA Stiftung"; TargetAttributes = { 50ADFF87201F53D600D50D53 = { CreatedOnToolsVersion = 9.2; From 33740c11f28aa8f68bc31776bc786e5795f468fe Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 13:06:15 +0000 Subject: [PATCH 048/197] fix: update ios .gitignore Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore index adb2bb7ed5..be5d3cce09 100644 --- a/bindings/capacitorjs/ios/.gitignore +++ b/bindings/capacitorjs/ios/.gitignore @@ -1,3 +1,3 @@ -libwallet.a +WalletFramework Pods ._* \ No newline at end of file From 93715c5299df417347c65665f73836714902ee5f Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 10:00:03 +0000 Subject: [PATCH 049/197] fix: change to wallet.rs repo at podspec Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/IotaWalletMobile.podspec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bindings/capacitorjs/IotaWalletMobile.podspec b/bindings/capacitorjs/IotaWalletMobile.podspec index c544913736..2df52e2290 100644 --- a/bindings/capacitorjs/IotaWalletMobile.podspec +++ b/bindings/capacitorjs/IotaWalletMobile.podspec @@ -4,11 +4,11 @@ s.version = '0.0.1' s.summary = 'Capacitor plugin binding to the wallet library' s.license = { :type => 'Apache-2.0' } - s.homepage = 'https://github.com/iotaledger/wallet.rs#readme' + s.homepage = 'https://github.com/iotaledger/wallet.rs/bindings/capacitorjs/#readme' s.author = 'IOTA Stiftung' - s.source = { :git => 'https://github.com/iotaledger/firefly.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/iotaledger/wallet.rs.git', :tag => s.version.to_s } s.source_files = ['ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/*.{h,m,swift}'] - s.ios.deployment_target = '12.0' + s.ios.deployment_target = '13.0' s.dependency 'Capacitor' s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lc++', @@ -18,8 +18,7 @@ } s.frameworks = 'WalletFramework' s.vendored_frameworks = 'ios/WalletFramework.xcframework' - - s.platform = :ios, "12.0" + s.platform = :ios, "13.0" s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => ['$(PODS_TARGET_SRCROOT)/ios/Plugin/Libraries', '$(PODS_TARGET_SRCROOT)/ios/WalletFramework.xcframework'] } s.preserve_paths = ['ios/Plugin/Libraries/module.modulemap'] s.preserve_paths = ['ios/WalletFramework.xcframework'] From 9fd362ac9691c372f045031e1d068bbad572be1c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 11:02:57 +0100 Subject: [PATCH 050/197] fix: update bindings/capacitorjs/README.md Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> --- bindings/capacitorjs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md index f6501eb32b..9e89a606c8 100644 --- a/bindings/capacitorjs/README.md +++ b/bindings/capacitorjs/README.md @@ -21,4 +21,4 @@ npx cap sync ```sh npm run build ``` -This command copies the already built libraries from Java and Swift bindings. \ No newline at end of file +This command copies the prebuilt libraries from Java and Swift bindings. \ No newline at end of file From 047431c02a0b71f1a73ac76668c30b69f11b1120 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 11:04:22 +0100 Subject: [PATCH 051/197] fix: remove unneeded echo at bindings/capacitorjs/add_libs.sh Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> --- bindings/capacitorjs/add_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh index 6dae5658d9..45b1f4e9bc 100755 --- a/bindings/capacitorjs/add_libs.sh +++ b/bindings/capacitorjs/add_libs.sh @@ -14,4 +14,4 @@ rm -rf ../android/libs && mkdir -p ../android/libs cp -r iota-wallet.jar ../android/libs cd .. && rm -rf tmp -echo "success!" \ No newline at end of file +echo "success!" From 0b8bcf621e6b882a5995fee614934bdb73638e56 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 15:26:24 +0000 Subject: [PATCH 052/197] chore: set minifyEnabled to true on android Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/build.gradle b/bindings/capacitorjs/android/build.gradle index d41a73100e..056534c653 100644 --- a/bindings/capacitorjs/android/build.gradle +++ b/bindings/capacitorjs/android/build.gradle @@ -27,7 +27,7 @@ android { } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } From 5a9fe73c37e6e0e1cdf7b8df7563e400aa898d52 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 15:46:40 +0000 Subject: [PATCH 053/197] chore: rename android package Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/src/main/AndroidManifest.xml | 6 ++---- .../IotaWalletMobile.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) rename bindings/capacitorjs/android/src/main/java/org/iota/{iotawalletmobile => IotaWalletMobile}/IotaWalletMobile.java (99%) diff --git a/bindings/capacitorjs/android/src/main/AndroidManifest.xml b/bindings/capacitorjs/android/src/main/AndroidManifest.xml index 7cd289dcd3..adad414568 100644 --- a/bindings/capacitorjs/android/src/main/AndroidManifest.xml +++ b/bindings/capacitorjs/android/src/main/AndroidManifest.xml @@ -1,5 +1,3 @@ - - - + diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java similarity index 99% rename from bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java rename to bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 42de7744a5..6957303ace 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -1,7 +1,7 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -package org.iota.iotawalletmobile; +package org.iota.IotaWalletMobile; import android.util.Log; From f64191d2aa82a77edda9fa5c0ea60f9052924991 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:42:05 +0100 Subject: [PATCH 054/197] Update bindings/capacitorjs/.gitignore --- bindings/capacitorjs/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore index 49f335a6a8..b091d115af 100644 --- a/bindings/capacitorjs/.gitignore +++ b/bindings/capacitorjs/.gitignore @@ -59,4 +59,4 @@ captures # Copied jni libs android/libs/ -android/src/main/jniLibs/ \ No newline at end of file +android/src/main/jniLibs/ From a3823012d879cf781f281b066623b84f035db153 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:42:36 +0100 Subject: [PATCH 055/197] Update bindings/capacitorjs/android/.gitignore --- bindings/capacitorjs/android/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/.gitignore b/bindings/capacitorjs/android/.gitignore index 028140319e..0a5554e177 100644 --- a/bindings/capacitorjs/android/.gitignore +++ b/bindings/capacitorjs/android/.gitignore @@ -69,4 +69,4 @@ fastlane/readme.md capacitor-cordova-android-plugins # Copied web assets -app/src/main/assets/public \ No newline at end of file +app/src/main/assets/public From d8c5bfc11b7aaadc795f68b8b3110a93e763e6b6 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:43:39 +0100 Subject: [PATCH 056/197] Update bindings/capacitorjs/android/gradle.properties --- bindings/capacitorjs/android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/gradle.properties b/bindings/capacitorjs/android/gradle.properties index 2dbcb07109..123de31e6d 100644 --- a/bindings/capacitorjs/android/gradle.properties +++ b/bindings/capacitorjs/android/gradle.properties @@ -18,4 +18,4 @@ org.gradle.jvmargs=-Xmx1536m # Supports AndroidX android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true From ed01e8505dedc84bacc7001f64a183d52a3df910 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:47:30 +0100 Subject: [PATCH 057/197] Update bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java --- .../android/src/test/java/com/getcapacitor/ExampleUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java index 06806a7758..5c8528f4c4 100644 --- a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +++ b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java @@ -14,4 +14,4 @@ public class ExampleUnitTest { public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } -} \ No newline at end of file +} From 7ff51d9bfe577ee52e226441c0a73b5a292a6b84 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:48:02 +0100 Subject: [PATCH 058/197] Update bindings/capacitorjs/ios/.gitignore --- bindings/capacitorjs/ios/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore index be5d3cce09..479c460e67 100644 --- a/bindings/capacitorjs/ios/.gitignore +++ b/bindings/capacitorjs/ios/.gitignore @@ -1,3 +1,3 @@ WalletFramework Pods -._* \ No newline at end of file +._* From 6cfbb0a5062d751ba66a7dcf92a874d3a45a90e6 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:49:16 +0100 Subject: [PATCH 059/197] Update bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h --- bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h index 5969c72bad..bb0ef660a3 100644 --- a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h +++ b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h @@ -1,4 +1,4 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#import \ No newline at end of file +#import From 05e4581d8b9f17631104c3c4fbc8ea008d86940e Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:49:43 +0100 Subject: [PATCH 060/197] Update bindings/capacitorjs/rollup.config.js --- bindings/capacitorjs/rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js index 6d47a352f9..99d9f6e1c3 100644 --- a/bindings/capacitorjs/rollup.config.js +++ b/bindings/capacitorjs/rollup.config.js @@ -29,4 +29,4 @@ export default [{ }, ], external: ['@capacitor/core'], -}]; \ No newline at end of file +}]; From ed2eef479a9fec29c84e4a10882c2cc5a2e2b9fb Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 12:18:16 +0000 Subject: [PATCH 061/197] chore: remove unneeded android files Signed-off-by: Amadeo Marchioni --- .../src/main/res/layout/bridge_layout_main.xml | 15 --------------- .../android/src/main/res/values/colors.xml | 3 --- .../android/src/main/res/values/strings.xml | 3 --- .../android/src/main/res/values/styles.xml | 3 --- 4 files changed, 24 deletions(-) delete mode 100644 bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/colors.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/strings.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/styles.xml diff --git a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml deleted file mode 100644 index 56fec1546a..0000000000 --- a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/bindings/capacitorjs/android/src/main/res/values/colors.xml b/bindings/capacitorjs/android/src/main/res/values/colors.xml deleted file mode 100644 index 045e125f3d..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/colors.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/bindings/capacitorjs/android/src/main/res/values/strings.xml b/bindings/capacitorjs/android/src/main/res/values/strings.xml deleted file mode 100644 index 6789e139cf..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Just a simple string - diff --git a/bindings/capacitorjs/android/src/main/res/values/styles.xml b/bindings/capacitorjs/android/src/main/res/values/styles.xml deleted file mode 100644 index f11f7450a8..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/styles.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - From f74e623daa9815c9ae0fad623f105fcb1d051b25 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:38:32 +0000 Subject: [PATCH 062/197] chore: remove ts compiled js files Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/types/bridge/account.js | 2 -- bindings/capacitorjs/src/types/bridge/accountManager.js | 2 -- bindings/capacitorjs/src/types/bridge/index.js | 2 -- 3 files changed, 6 deletions(-) delete mode 100644 bindings/capacitorjs/src/types/bridge/account.js delete mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.js delete mode 100644 bindings/capacitorjs/src/types/bridge/index.js diff --git a/bindings/capacitorjs/src/types/bridge/account.js b/bindings/capacitorjs/src/types/bridge/account.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/account.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.js b/bindings/capacitorjs/src/types/bridge/accountManager.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/accountManager.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/index.js b/bindings/capacitorjs/src/types/bridge/index.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; From ddb11b96fa974cacd0a83b5dff30affa65a76c9c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:39:25 +0000 Subject: [PATCH 063/197] chore: remove old comments Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/tsconfig.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json index 2ba49621ba..6c8b987e15 100644 --- a/bindings/capacitorjs/tsconfig.json +++ b/bindings/capacitorjs/tsconfig.json @@ -20,13 +20,6 @@ "files": [ "src/index.ts", "src/definitions.ts", - // "src/lib/index.ts", - // "src/lib/bindings.ts", - // "src/lib/AccountManager.ts", - // "src/lib/Account.ts", - // "src/lib/MessageHandler.ts", - // "src/types/index.ts" ], - "include": ["src/*", "src/lib/**/*", "src/types/**/*"], - // "include": ["src/types"], + "include": ["src/*", "src/lib/**/*", "src/types/**/*"] } From 311d7efe217537b9103ad1e52fbf39a86db058c4 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:54:42 +0000 Subject: [PATCH 064/197] chore: add name var to messageHandler pointer Signed-off-by: Amadeo Marchioni --- .../java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 6957303ace..b13a546db6 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -92,7 +92,10 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { .withCoinType(coinType) ); JSObject ret = new JSObject(); - ret.put("messageHandler", 1); + // 1 signals the id of the messageHandler returned by the rust side. + // This is irrelevant for the Java side, but required on the Swift and JS side + Integer messageHandlerPointer = 1; + ret.put("messageHandler", messageHandlerPointer); call.resolve(ret); } catch (Exception e) { e.printStackTrace(); From a6bba5006dd826a3c36c61f02aa4449eee65c34c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 14:16:53 +0000 Subject: [PATCH 065/197] chore: fix typo Signed-off-by: Amadeo Marchioni --- .../main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index b13a546db6..ffc57b2b0f 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -106,7 +106,7 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { public void sendMessage(final PluginCall call) { try { if (!call.getData().has("message")) { - call.reject("message are required"); + call.reject("message is required"); } String message = call.getString("message"); if (message == null) { From c6272a4a09c71d3538c92e4d398d34a5fa249554 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:16:18 -0300 Subject: [PATCH 066/197] added removeListeners and initLogger --- bindings/swift/Cargo.toml | 19 +++++++++++++++++++ wallet/bindings/swift/Cargo.lock | 23 +++++++++++++++++++---- wallet/bindings/swift/src/lib.rs | 2 ++ 3 files changed, 40 insertions(+), 4 deletions(-) create mode 100644 bindings/swift/Cargo.toml diff --git a/bindings/swift/Cargo.toml b/bindings/swift/Cargo.toml new file mode 100644 index 0000000000..024958208d --- /dev/null +++ b/bindings/swift/Cargo.toml @@ -0,0 +1,19 @@ +[package] +name = "iota-wallet" +version = "0.1.0" +edition = "2021" + +# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html + +[lib] +crate-type = [ "cdylib", "staticlib" ] # Creates dynamic lib + +[dependencies] +fern-logger = { version = "0.5.0", default-features = false } +futures = { version = "0.3.23", default-features = false } +iota-wallet = { path = "../../", features = ["message_interface", "events"] } +log = { version = "0.4.17", default-features = false } +once_cell = { version = "1.13.1", default-features = false } +serde = { version = "1.0.143", default-features = false, features = ["derive"] } +serde_json = { version = "1.0.83", default-features = false } +tokio = { version = "1.20.1", default-features = false} diff --git a/wallet/bindings/swift/Cargo.lock b/wallet/bindings/swift/Cargo.lock index 8b12bfe20e..373671d66a 100644 --- a/wallet/bindings/swift/Cargo.lock +++ b/wallet/bindings/swift/Cargo.lock @@ -86,6 +86,12 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" +[[package]] +name = "arrayref" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" + [[package]] name = "arrayvec" version = "0.7.2" @@ -206,7 +212,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.6", + "digest 0.10.3", ] [[package]] @@ -389,6 +395,15 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam-utils" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +dependencies = [ + "cfg-if", +] + [[package]] name = "crunchy" version = "0.2.2" @@ -1361,9 +1376,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.3" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" +checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" dependencies = [ "bitflags", "cfg-if", @@ -1940,7 +1955,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.6", + "digest 0.10.3", ] [[package]] diff --git a/wallet/bindings/swift/src/lib.rs b/wallet/bindings/swift/src/lib.rs index c0564d1bd7..58ba391b67 100644 --- a/wallet/bindings/swift/src/lib.rs +++ b/wallet/bindings/swift/src/lib.rs @@ -9,6 +9,7 @@ use iota_wallet::{ }; use std::{ + str::FromStr, ffi::{CStr, CString}, os::raw::{c_char, c_void}, }; @@ -16,6 +17,7 @@ use std::{ use once_cell::sync::OnceCell; use std::sync::Arc; use tokio::runtime::Runtime; +use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; type Callback = extern "C" fn(message: *const c_char, error: *const c_char, context: *mut c_void); type IotaWalletHandle = WalletMessageHandler; From a5f6ddd58f3af5021d67cce3ae22c73c5eb52c80 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:28:08 -0300 Subject: [PATCH 067/197] added xcode method and added iota_ prefix --- wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index 773a3b79cb..04425c37cf 100644 --- a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -+ (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) level_filter { ++ (BOOL) init_logger:(nullable NSString*) file_name level_filter: (nullable NSString*) { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } From eb3062c280088429e44bc3de4c754c2fdf84c0e4 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:28:25 -0300 Subject: [PATCH 068/197] fmt --- wallet/bindings/swift/src/lib.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/wallet/bindings/swift/src/lib.rs b/wallet/bindings/swift/src/lib.rs index 58ba391b67..c0564d1bd7 100644 --- a/wallet/bindings/swift/src/lib.rs +++ b/wallet/bindings/swift/src/lib.rs @@ -9,7 +9,6 @@ use iota_wallet::{ }; use std::{ - str::FromStr, ffi::{CStr, CString}, os::raw::{c_char, c_void}, }; @@ -17,7 +16,6 @@ use std::{ use once_cell::sync::OnceCell; use std::sync::Arc; use tokio::runtime::Runtime; -use fern_logger::{logger_init, LoggerConfig, LoggerOutputConfigBuilder}; type Callback = extern "C" fn(message: *const c_char, error: *const c_char, context: *mut c_void); type IotaWalletHandle = WalletMessageHandler; From 47f8fc06cac6a24a7ca48eb3f8659844ffcab300 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 17 Nov 2022 18:32:00 -0300 Subject: [PATCH 069/197] removed nullable and format on .h file --- wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- .../swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index 04425c37cf..4759d35d81 100644 --- a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -+ (BOOL) init_logger:(nullable NSString*) file_name level_filter: (nullable NSString*) { ++ (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } diff --git a/wallet/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h b/wallet/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h index fc1e417f1c..b855c7ea79 100644 --- a/wallet/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h +++ b/wallet/bindings/swift/xcode/IotaWallet/iota_wallet/iota_wallet_ffi.h @@ -20,7 +20,6 @@ extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); - #ifdef __cplusplus } #endif From 40e52cb90ede63d28c1aafcd2216b84fd18cb409 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 25 Nov 2022 14:41:25 +0100 Subject: [PATCH 070/197] added spaces for fancyness --- bindings/swift/Cargo.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/swift/Cargo.toml b/bindings/swift/Cargo.toml index 024958208d..35e50dd03d 100644 --- a/bindings/swift/Cargo.toml +++ b/bindings/swift/Cargo.toml @@ -11,9 +11,9 @@ crate-type = [ "cdylib", "staticlib" ] # Creates dynamic lib [dependencies] fern-logger = { version = "0.5.0", default-features = false } futures = { version = "0.3.23", default-features = false } -iota-wallet = { path = "../../", features = ["message_interface", "events"] } +iota-wallet = { path = "../../", features = [ "message_interface", "events" ] } log = { version = "0.4.17", default-features = false } once_cell = { version = "1.13.1", default-features = false } -serde = { version = "1.0.143", default-features = false, features = ["derive"] } +serde = { version = "1.0.143", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0.83", default-features = false } tokio = { version = "1.20.1", default-features = false} From be9c5fa40aeb8bc0ffc76479638c7bd1c037076b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:48:55 +0100 Subject: [PATCH 071/197] chore: define plugin basis --- bindings/capacitorjs/.gitignore | 60 +++++++++++++++++++ bindings/capacitorjs/IotaWalletMobile.podspec | 26 ++++++++ bindings/capacitorjs/package.json | 58 ++++++++++++++++++ bindings/capacitorjs/rollup.config.js | 19 ++++++ 4 files changed, 163 insertions(+) create mode 100644 bindings/capacitorjs/.gitignore create mode 100644 bindings/capacitorjs/IotaWalletMobile.podspec create mode 100644 bindings/capacitorjs/package.json create mode 100644 bindings/capacitorjs/rollup.config.js diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore new file mode 100644 index 0000000000..2058c00f47 --- /dev/null +++ b/bindings/capacitorjs/.gitignore @@ -0,0 +1,60 @@ +# node files +dist +node_modules + +# iOS files +Pods +Build +xcuserdata + +# macOS files +.DS_Store + + + +# Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore + +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin +gen +out + +# Gradle files +.gradle +build + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation + +# Android Studio captures folder +captures + +# IntelliJ +*.iml +.idea + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild diff --git a/bindings/capacitorjs/IotaWalletMobile.podspec b/bindings/capacitorjs/IotaWalletMobile.podspec new file mode 100644 index 0000000000..c544913736 --- /dev/null +++ b/bindings/capacitorjs/IotaWalletMobile.podspec @@ -0,0 +1,26 @@ + + Pod::Spec.new do |s| + s.name = 'IotaWalletMobile' + s.version = '0.0.1' + s.summary = 'Capacitor plugin binding to the wallet library' + s.license = { :type => 'Apache-2.0' } + s.homepage = 'https://github.com/iotaledger/wallet.rs#readme' + s.author = 'IOTA Stiftung' + s.source = { :git => 'https://github.com/iotaledger/firefly.git', :tag => s.version.to_s } + s.source_files = ['ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/*.{h,m,swift}'] + s.ios.deployment_target = '12.0' + s.dependency 'Capacitor' + s.pod_target_xcconfig = { + 'OTHER_LDFLAGS' => '-lc++', + 'ENABLE_BITCODE' => '$(ENABLE_BITCODE_$(CONFIGURATION))', + 'ENABLE_BITCODE_Release' => 'NO', + 'ENABLE_BITCODE_Debug' => 'YES' + } + s.frameworks = 'WalletFramework' + s.vendored_frameworks = 'ios/WalletFramework.xcframework' + + s.platform = :ios, "12.0" + s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => ['$(PODS_TARGET_SRCROOT)/ios/Plugin/Libraries', '$(PODS_TARGET_SRCROOT)/ios/WalletFramework.xcframework'] } + s.preserve_paths = ['ios/Plugin/Libraries/module.modulemap'] + s.preserve_paths = ['ios/WalletFramework.xcframework'] + end diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json new file mode 100644 index 0000000000..d990e17d1c --- /dev/null +++ b/bindings/capacitorjs/package.json @@ -0,0 +1,58 @@ +{ + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "description": "Capacitor plugin binding to the wallet library", + "homepage": "https://github.com/iotaledger/wallet.rs#readme", + "main": "dist/esm/index.js", + "module": "dist/esm/index.js", + "files": [ + "android/src/main/", + "android/build.gradle", + "dist/", + "ios/Plugin/", + "IotaWalletMobile.podspec" + ], + "types": "dist/esm/index.d.ts", + "scripts": { + "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", + "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", + "verify:android": "cd android && ./gradlew clean build test && cd ..", + "build": "npm run clean && tsc && rollup -c rollup.config.js", + "clean": "rm -rf ./dist", + "watch": "tsc --watch", + "prepublishOnly": "npm run build" + }, + "author": "IOTA Stiftung", + "license": "Apache-2.0", + "repository": { + "type": "git", + "url": "git+https://github.com/iotaledger/wallet.rs.git" + }, + "bugs": { + "url": "https://github.com/iotaledger/wallet.rs/issues" + }, + "dependencies": { + "@capacitor/core": "^3.4.1", + "@iota/types": "^1.0.0-beta.15" + }, + "devDependencies": { + "@capacitor/android": "^3.4.1", + "@capacitor/core": "^3.4.1", + "@capacitor/docgen": "^0.0.10", + "@capacitor/ios": "^3.4.1", + "rimraf": "^3.0.2", + "rollup": "^2.32.0", + "typescript": "~4.0.3" + }, + "peerDependencies": { + "@capacitor/core": "^3.4.1" + }, + "capacitor": { + "ios": { + "src": "ios" + }, + "android": { + "src": "android" + } + } +} diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js new file mode 100644 index 0000000000..3ee3206fc8 --- /dev/null +++ b/bindings/capacitorjs/rollup.config.js @@ -0,0 +1,19 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +export default { + input: 'dist/esm/index.js', + output: [ + { + file: 'dist/plugin.js', + format: 'iife', + name: 'capacitorPlugin', + globals: { + '@capacitor/core': 'capacitorExports', + }, + sourcemap: true, + inlineDynamicImports: true, + }, + ], + external: ['@capacitor/core'], +}; \ No newline at end of file From 351cff555e209b81ae78926fad4040f576dc8bbd Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:49:52 +0100 Subject: [PATCH 072/197] chore: adapt nodejs lib folder api --- bindings/capacitorjs/src/definitions.ts | 33 + bindings/capacitorjs/src/index.ts | 17 + bindings/capacitorjs/src/lib/Account.ts | 961 ++++++++++++++++++ .../capacitorjs/src/lib/AccountManager.ts | 350 +++++++ .../capacitorjs/src/lib/MessageHandler.ts | 73 ++ bindings/capacitorjs/src/lib/bindings.ts | 40 + bindings/capacitorjs/src/types/account.ts | 135 +++ .../capacitorjs/src/types/accountManager.ts | 11 + bindings/capacitorjs/src/types/address.ts | 65 ++ .../capacitorjs/src/types/bridge/account.ts | 317 ++++++ .../src/types/bridge/accountManager.ts | 142 +++ .../capacitorjs/src/types/bridge/index.ts | 150 +++ .../capacitorjs/src/types/buildOutputData.ts | 37 + bindings/capacitorjs/src/types/event.ts | 28 + .../src/types/incomingTransactionData.ts | 3 + bindings/capacitorjs/src/types/index.ts | 16 + .../capacitorjs/src/types/loggerConfig.ts | 16 + bindings/capacitorjs/src/types/network.ts | 69 ++ bindings/capacitorjs/src/types/output.ts | 40 + .../capacitorjs/src/types/outputOptions.ts | 43 + .../src/types/preparedTransactionData.ts | 66 ++ .../capacitorjs/src/types/secretManager.ts | 52 + .../src/types/signedTransactionEssence.ts | 8 + bindings/capacitorjs/src/types/transaction.ts | 40 + .../src/types/transactionOptions.ts | 81 ++ 25 files changed, 2793 insertions(+) create mode 100644 bindings/capacitorjs/src/definitions.ts create mode 100644 bindings/capacitorjs/src/index.ts create mode 100644 bindings/capacitorjs/src/lib/Account.ts create mode 100644 bindings/capacitorjs/src/lib/AccountManager.ts create mode 100644 bindings/capacitorjs/src/lib/MessageHandler.ts create mode 100644 bindings/capacitorjs/src/lib/bindings.ts create mode 100644 bindings/capacitorjs/src/types/account.ts create mode 100644 bindings/capacitorjs/src/types/accountManager.ts create mode 100644 bindings/capacitorjs/src/types/address.ts create mode 100644 bindings/capacitorjs/src/types/bridge/account.ts create mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.ts create mode 100644 bindings/capacitorjs/src/types/bridge/index.ts create mode 100644 bindings/capacitorjs/src/types/buildOutputData.ts create mode 100644 bindings/capacitorjs/src/types/event.ts create mode 100644 bindings/capacitorjs/src/types/incomingTransactionData.ts create mode 100644 bindings/capacitorjs/src/types/index.ts create mode 100644 bindings/capacitorjs/src/types/loggerConfig.ts create mode 100644 bindings/capacitorjs/src/types/network.ts create mode 100644 bindings/capacitorjs/src/types/output.ts create mode 100644 bindings/capacitorjs/src/types/outputOptions.ts create mode 100644 bindings/capacitorjs/src/types/preparedTransactionData.ts create mode 100644 bindings/capacitorjs/src/types/secretManager.ts create mode 100644 bindings/capacitorjs/src/types/signedTransactionEssence.ts create mode 100644 bindings/capacitorjs/src/types/transaction.ts create mode 100644 bindings/capacitorjs/src/types/transactionOptions.ts diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts new file mode 100644 index 0000000000..404995ac0d --- /dev/null +++ b/bindings/capacitorjs/src/definitions.ts @@ -0,0 +1,33 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { PluginListenerHandle } from "@capacitor/core" +import { MessageHandler } from "./lib/MessageHandler" +import type { + EventType, + AccountManagerOptions, + __Message__, + __AccountMethod__, +} from './types' + +export * from './types' +export interface IotaWalletMobileTypes { + initLogger(path: string): Promise + messageHandlerNew(messageOptions: string): Promise + clearListeners( + eventTypes: EventType[], + messageHandler: any + ): void + initialize(options: AccountManagerOptions): Promise + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + messageHandler: any + ): void + destroy(messageHandler: any): void + sendMessage( + message: string, + handler :MessageHandler, + callback: (error: Error, result: string) => void + ): PluginListenerHandle +} diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts new file mode 100644 index 0000000000..57be241602 --- /dev/null +++ b/bindings/capacitorjs/src/index.ts @@ -0,0 +1,17 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { internalInitLogger } from './lib/bindings' +import type { LoggerConfig } from './types' + +export * from './lib/AccountManager' +export * from './lib/MessageHandler' +export * from './lib/Account' +// Moved to definitions.ts, TODO modify tsconfig to adapt it +// export * from './types' + +/** Function to create wallet logs */ +const initLogger = (config: LoggerConfig) => + internalInitLogger(JSON.stringify(config)) + +export { initLogger } diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts new file mode 100644 index 0000000000..6ee0575bab --- /dev/null +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -0,0 +1,961 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import type { MessageHandler } from './MessageHandler'; +import type { + AccountBalance, + AccountMetadata, + AccountSyncOptions, + AccountMeta, + Address, + AddressWithAmount, + AddressWithMicroAmount, + AddressNativeTokens, + AddressNftId, + AddressGenerationOptions, + AddressWithUnspentOutputs, + AliasOutputOptions, + FilterOptions, + IncreaseNativeTokenSupplyOptions, + MintTokenTransaction, + NativeTokenOptions, + NftOptions, + OutputData, + OutputOptions, + OutputsToClaim, + PreparedTransactionData, + Transaction, + TransactionOptions, + IncomingTransactionData, +} from '../types'; +import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; +import type { + BuildAliasOutputData, + BuildBasicOutputData, + BuildFoundryOutputData, + BuildNftOutputData, +} from '../types/buildOutputData'; +import type { + HexEncodedAmount, + IAliasOutput, + IBasicOutput, + IFoundryOutput, + INftOutput, + OutputTypes, +} from '@iota/types'; + +/** The Account class. */ +export class Account { + // private because the data isn't updated + private meta: AccountMeta; + private messageHandler: MessageHandler; + + constructor(accountMeta: AccountMeta, messageHandler: MessageHandler) { + this.meta = accountMeta; + this.messageHandler = messageHandler; + } + + /** + * Build an `AliasOutput`. + * @param data Options for building an `AliasOutput`. + * @returns The built `AliasOutput`. + */ + async buildAliasOutput(data: BuildAliasOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildAliasOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build a `BasicOutput`. + * @param data Options for building a `BasicOutput`. + * @returns The built `BasicOutput`. + */ + async buildBasicOutput(data: BuildBasicOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildBasicOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build a `FoundryOutput`. + * @param data Options for building a `FoundryOutput`. + * @returns The built `FoundryOutput`. + */ + async buildFoundryOutput( + data: BuildFoundryOutputData, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildFoundryOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Build an `NftOutput`. + * @param data Options for building an `NftOutput`. + * @returns The built `NftOutput`. + */ + async buildNftOutput(data: BuildNftOutputData): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'buildNftOutput', + data, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Burn native tokens. This doesn't require the foundry output which minted them, but will not increase + * the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. Therefore it's + * recommended to use melting, if the foundry output is available. + * @param tokenId The native token id. + * @param burnAmount The to be burned amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNativeToken( + tokenId: string, + burnAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'burnNativeToken', + data: { + tokenId, + burnAmount, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Burn an nft output. Outputs controlled by it will be sweeped before if they don't have a storage + * deposit return, timelock or expiration unlock condition. This should be preferred over burning, because after + * burning, the foundry can never be destroyed anymore. + * @param nftId The NftId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNft( + nftId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'burnNft', + data: { + nftId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Claim basic or nft outputs that have additional unlock conditions + * to their `AddressUnlockCondition` from the account. + * @param outputIds The outputs to claim. + * @returns The resulting transaction. + */ + async claimOutputs(outputIds: string[]): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'claimOutputs', + data: { + outputIdsToClaim: outputIds, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Consolidate basic outputs with only an `AddressUnlockCondition` from an account + * by sending them to an own address again if the output amount is greater or + * equal to the output consolidation threshold. + * @param force Force consolidation on addresses where the threshold isn't met. + * @param outputConsolidationThreshold A default threshold is used if this is omitted. + * @returns The consolidation transaction. + */ + async consolidateOutputs( + force: boolean, + outputConsolidationThreshold?: number, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'consolidateOutputs', + data: { + force, + outputConsolidationThreshold, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * `createAliasOutput` creates an alias output + * @param aliasOutputOptions The alias output options. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns A transaction object. + */ + async createAliasOutput( + aliasOutputOptions?: AliasOutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'createAliasOutput', + data: { + aliasOutputOptions, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Melt native tokens. This happens with the foundry output which minted them, by increasing its + * `melted_tokens` field. + * @param tokenId The native token id. + * @param meltAmount To be melted amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async decreaseNativeTokenSupply( + tokenId: string, + meltAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'decreaseNativeTokenSupply', + data: { + tokenId, + meltAmount, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Destroy an alias output. Outputs controlled by it will be sweeped before if they don't have a + * storage deposit return, timelock or expiration unlock condition. The amount and possible native tokens will be + * sent to the governor address. + * @param aliasId The AliasId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyAlias( + aliasId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'destroyAlias', + data: { + aliasId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Function to destroy a foundry output with a circulating supply of 0. + * Native tokens in the foundry (minted by other foundries) will be transactioned to the controlling alias. + * @param foundryId The FoundryId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyFoundry( + foundryId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'destroyFoundry', + data: { + foundryId, + options: transactionOptions, + }, + }, + ); + return JSON.parse(resp).payload; + } + + /** + * Generate a new unused address. + * @param options Options for address generation. + * @returns The address. + */ + async generateAddress( + options?: AddressGenerationOptions, + ): Promise
{ + const addresses = await this.generateAddresses(1, options); + return addresses[0]; + } + + /** + * Generate new unused addresses. + * @param amount The amount of addresses to generate. + * @param options Options for address generation. + * @returns The addresses. + */ + async generateAddresses( + amount: number, + options?: AddressGenerationOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'generateAddresses', + data: { + amount, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get the account balance. + * @returns The account balance. + */ + async getBalance(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getBalance', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Get the data for an output. + * @param outputId The output to get. + * @returns The `OutputData`. + */ + async getOutput(outputId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getOutput', + data: { + outputId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get a `FoundryOutput` by native token ID. It will try to get the foundry from + * the account, if it isn't in the account it will try to get it from the node. + * @param tokenId The native token ID to get the foundry for. + * @returns The `FoundryOutput` that minted the token. + */ + async getFoundryOutput(tokenId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getFoundryOutput', + data: { + tokenId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get outputs with additional unlock conditions. + * @param outputs The type of outputs to claim. + * @returns The output IDs of the unlockable outputs. + */ + async getOutputsWithAdditionalUnlockConditions( + outputs: OutputsToClaim, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getOutputsWithAdditionalUnlockConditions', + data: { + outputsToClaim: outputs, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get a transaction stored in the account. + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getTransaction(transactionId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getTransaction', + data: { + transactionId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Get the transaction with inputs of an incoming transaction stored in the account + * List might not be complete, if the node pruned the data already + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getIncomingTransactionData(transactionId: string): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getIncomingTransactionData', + data: { + transactionId, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * List all the addresses of the account. + * @returns The addresses. + */ + async addresses(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'addresses', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List the addresses of the account with unspent outputs. + * @returns The addresses. + */ + async addressesWithUnspentOutputs(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'addressesWithUnspentOutputs', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async outputs(filterOptions?: FilterOptions): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'outputs', + data: { filterOptions }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the pending transactions of the account. + * @returns The transactions. + */ + async pendingTransactions(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'pendingTransactions', + }, + ); + return JSON.parse(response).payload; + } + + /** + * List all incoming transactions of the account. + * @returns The incoming transactions with their inputs. + */ + async incomingTransactions(): Promise< + [string, IncomingTransactionData][] + > { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'incomingTransactions', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the transactions of the account. + * @returns The transactions. + */ + async transactions(): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'transactions', + }, + ); + + return JSON.parse(response).payload; + } + + /** + * List all the unspent outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async unspentOutputs(filterOptions?: FilterOptions): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'unspentOutputs', + data: { filterOptions }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Get the accounts metadata. + * @returns The accounts metadata. + */ + getMetadata(): AccountMetadata { + return { + alias: this.meta.alias, + coinType: this.meta.coinType, + index: this.meta.index, + }; + } + + /** + * Calculate the minimum required storage deposit for an output. + * @param output output to calculate the deposit amount for. + * @returns The amount. + */ + async minimumRequiredStorageDeposit(output: OutputTypes): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'minimumRequiredStorageDeposit', + data: { + output, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Mint more native tokens. + * @param tokenId The native token id. + * @param mintAmount To be minted amount. + * @param increaseNativeTokenSupplyOptions Options for minting more tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async increaseNativeTokenSupply( + tokenId: string, + mintAmount: HexEncodedAmount, + increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'increaseNativeTokenSupply', + data: { + tokenId, + mintAmount, + increaseNativeTokenSupplyOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Mint native tokens. + * @param nativeTokenOptions The options for minting tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async mintNativeToken( + nativeTokenOptions: NativeTokenOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'mintNativeToken', + data: { + nativeTokenOptions: nativeTokenOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Mint nfts. + * @param nftsOptions The options for minting nfts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction. + */ + async mintNfts( + nftsOptions: NftOptions[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'mintNfts', + data: { + nftsOptions, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Prepare an output for sending, useful for offline signing. + * @param options The options for preparing an output. If the amount is + * below the minimum required storage deposit, by default the remaining + * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, + * when setting the `ReturnStrategy` to `gift`, the full minimum required + * storage deposit will be sent to the recipient. When the assets contain + * an nft id, the data from the existing `NftOutput` will be used, just with + * the address unlock conditions replaced. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared output. + */ + async prepareOutput( + options: OutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareOutput', + data: { + options, + transactionOptions, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Prepare a send amount transaction, useful for offline signing. + * @param addressesWithAmount Address with amounts to send. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareSendAmount( + addressesWithAmount: AddressWithAmount[], + options?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareSendAmount', + data: { + addressesWithAmount, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Prepare a transaction, useful for offline signing. + * @param outputs Outputs to use in the transaction. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareTransaction( + outputs: OutputTypes[], + options?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'prepareTransaction', + data: { + outputs, + options, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Send a transaction with amounts from input addresses. + * @param addressesWithAmount Addresses with amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendAmount( + addressesWithAmount: AddressWithAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendAmount', + data: { + addressesWithAmount, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send a micro transaction with amount below minimum storage deposit. + * @param addressesWithMicroAmount Addresses with micro amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendMicroTransaction( + addressesWithMicroAmount: AddressWithMicroAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendMicroTransaction', + data: { + addressesWithMicroAmount, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send native tokens. + * @param addressesNativeTokens Addresses amounts and native tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNativeTokens( + addressesNativeTokens: AddressNativeTokens[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendNativeTokens', + data: { + addressesNativeTokens, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send nft. + * @param addressesAndNftIds Addresses and nft ids. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNft( + addressesAndNftIds: AddressNftId[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendNft', + data: { + addressesAndNftIds, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + /** + * Send outputs in a transaction. + * @param outputs The outputs to send. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendOutputs( + outputs: OutputTypes[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'sendOutputs', + data: { + outputs, + options: transactionOptions, + }, + }, + ); + + return JSON.parse(response).payload; + } + + async setAlias(alias: string): Promise { + await this.messageHandler.callAccountMethod(this.meta.index, { + name: 'setAlias', + data: { + alias, + }, + }); + } + + /** + * Sign a prepared transaction, useful for offline signing. + * @param preparedTransactionData The prepared transaction data to sign. + * @returns The signed transaction essence. + */ + async signTransactionEssence( + preparedTransactionData: PreparedTransactionData, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'signTransactionEssence', + data: { + preparedTransactionData, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Validate the transaction, submit it to a node and store it in the account. + * @param signedTransactionData A signed transaction to submit and store. + * @returns The sent transaction. + */ + async submitAndStoreTransaction( + signedTransactionData: SignedTransactionEssence, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'submitAndStoreTransaction', + data: { + signedTransactionData, + }, + }, + ); + return JSON.parse(response).payload; + } + + /** + * Sync the account by fetching new information from the nodes. + * Will also retry pending transactions if necessary. + * @param options Optional synchronization options. + * @returns The account balance. + */ + async sync(options?: AccountSyncOptions): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'syncAccount', + data: { + options, + }, + }, + ); + return JSON.parse(resp).payload; + } +} diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts new file mode 100644 index 0000000000..648fcf341f --- /dev/null +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -0,0 +1,350 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { MessageHandler } from './MessageHandler'; +import { Account } from './Account'; + +import type { + AccountId, + Auth, + EventType, + AccountManagerOptions, + CreateAccountPayload, + NodeInfoWrapper, + ClientOptions, + AccountSyncOptions, + WalletEvent, + LedgerNanoStatus, +} from '../types'; + +/** The AccountManager class. */ +export class AccountManager { + private messageHandler: MessageHandler; + + constructor(options: AccountManagerOptions) { + this.messageHandler = new MessageHandler(options); + } + + /** + * Backup the data to a Stronghold snapshot. + */ + async backup(destination: string, password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'backup', + payload: { + destination, + password, + }, + }); + } + + /** + * Transform a bech32 encoded address to a hex encoded address + */ + async bech32ToHex(bech32Address: string): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'bech32ToHex', + payload: bech32Address, + }); + return JSON.parse(response).payload; + } + + /** + * Change the Stronghold password. + */ + async changeStrongholdPassword( + currentPassword: string, + newPassword: string, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'changeStrongholdPassword', + payload: { + currentPassword, + newPassword, + }, + }); + } + + /** + * Clear the Stronghold password from memory. + */ + async clearStrongholdPassword(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'clearStrongholdPassword', + }); + } + + /** + * Create a new account. + */ + async createAccount(payload: CreateAccountPayload): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'createAccount', + payload, + }); + return new Account(JSON.parse(response).payload, this.messageHandler); + } + + /** + * Destroy the AccountManager and drop its database connection. + */ + destroy(): void { + this.messageHandler.destroy(); + } + + /** + * Emit a provided event for testing of the event system. + */ + async emitTestEvent(event: WalletEvent): Promise { + await this.messageHandler.sendMessage({ + cmd: 'emitTestEvent', + payload: event, + }); + } + + /** + * Generate a random BIP39 mnemonic. + */ + async generateMnemonic(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'generateMnemonic', + }); + return JSON.parse(response).payload; + } + + /** + * Get an account by its alias or index. + */ + async getAccount(accountId: AccountId): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccount', + payload: accountId, + }); + + const account = new Account( + JSON.parse(response).payload, + this.messageHandler, + ); + + return account; + } + + /** + * Get all account indexes. + */ + async getAccountIndexes(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccountIndexes', + }); + + return JSON.parse(response).payload; + } + + /** + * Get all accounts. + */ + async getAccounts(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getAccounts', + }); + + const { payload } = JSON.parse(response); + + const accounts: Account[] = []; + + for (const account of payload) { + accounts.push(new Account(account, this.messageHandler)); + } + return accounts; + } + + /** + * Get the node info. + */ + async getNodeInfo(url?: string, auth?: Auth): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getNodeInfo', + payload: { url, auth }, + }); + return JSON.parse(response).payload; + } + + /** + * Get the status for a Ledger Nano. + */ + async getLedgerNanoStatus(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'getLedgerNanoStatus', + }); + return JSON.parse(response).payload; + } + + /** + * Transform hex encoded address to bech32 encoded address. If no bech32Hrp + * is provided, the AccountManager will attempt to retrieve it from the + * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. + */ + async hexToBech32(hex: string, bech32Hrp?: string): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'hexToBech32', + payload: { hex, bech32Hrp }, + }); + return JSON.parse(response).payload; + } + + /** + * Check if the Stronghold password has been set. + */ + async isStrongholdPasswordAvailable(): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'isStrongholdPasswordAvailable', + }); + return JSON.parse(response).payload; + } + + /** + * Listen to wallet events with a callback. An empty array will listen to all possible events. + */ + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + ): void { + return this.messageHandler.listen(eventTypes, callback); + } + + /** + * Clear the callbacks for provided events. An empty array will clear all listeners. + */ + clearListeners(eventTypes: EventType[]): void { + return this.messageHandler.clearListeners(eventTypes); + } + + /** + * Find accounts with unspent outputs. + */ + async recoverAccounts( + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions: AccountSyncOptions, + ): Promise { + const response = await this.messageHandler.sendMessage({ + cmd: 'recoverAccounts', + payload: { + accountStartIndex, + accountGapLimit, + addressGapLimit, + syncOptions, + }, + }); + + const accounts: Account[] = []; + + for (const account of JSON.parse(response).payload) { + accounts.push(new Account(account, this.messageHandler)); + } + return accounts; + } + + /** + * Delete the latest account. + */ + async removeLatestAccount(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'removeLatestAccount', + }); + } + + /** + * Restore a backup from a Stronghold file + * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created + * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was + * stored, it will be gone. + */ + async restoreBackup(source: string, password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'restoreBackup', + payload: { + source, + password, + }, + }); + } + + /** + * Set ClientOptions. + */ + async setClientOptions(options: ClientOptions): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setClientOptions', + payload: options, + }); + } + + /** + * Set the Stronghold password. + */ + async setStrongholdPassword(password: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setStrongholdPassword', + payload: password, + }); + } + + /** + * Set the interval after which the Stronghold password gets cleared from memory. + */ + async setStrongholdPasswordClearInterval( + intervalInMilliseconds?: number, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'setStrongholdPasswordClearInterval', + payload: intervalInMilliseconds, + }); + } + + /** + * Start the background syncing process for all accounts. + */ + async startBackgroundSync( + options?: AccountSyncOptions, + intervalInMilliseconds?: number, + ): Promise { + await this.messageHandler.sendMessage({ + cmd: 'startBackgroundSync', + payload: { + options, + intervalInMilliseconds, + }, + }); + } + + /** + * Stop the background syncing process for all accounts. + */ + async stopBackgroundSync(): Promise { + await this.messageHandler.sendMessage({ + cmd: 'stopBackgroundSync', + }); + } + + /** + * Store a mnemonic in the Stronghold snapshot. + */ + async storeMnemonic(mnemonic: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'storeMnemonic', + payload: mnemonic, + }); + } + + /** + * Verify if a mnemonic is a valid BIP39 mnemonic. + */ + async verifyMnemonic(mnemonic: string): Promise { + await this.messageHandler.sendMessage({ + cmd: 'verifyMnemonic', + payload: mnemonic, + }); + } +} diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts new file mode 100644 index 0000000000..5f30b4efd5 --- /dev/null +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -0,0 +1,73 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { + sendMessageAsync, + messageHandlerNew, + listen, + clearListeners, + destroy, +} from './bindings'; +import type { + EventType, + AccountManagerOptions, + __Message__, + __AccountMethod__, + AccountId, +} from '../types'; + +// The MessageHandler class interacts with messages with the rust bindings. +export class MessageHandler { + messageHandler: any; + + constructor(options?: AccountManagerOptions) { + const messageOptions = { + storagePath: options?.storagePath, + clientOptions: options?.clientOptions, + coinType: options?.coinType, + secretManager: options?.secretManager, + }; + + this.messageHandler = messageHandlerNew(JSON.stringify(messageOptions)); + } + + async sendMessage(message: __Message__): Promise { + return sendMessageAsync( + JSON.stringify(message), + this.messageHandler, + ).catch((error) => { + try { + error = JSON.parse(error).payload; + } catch (e) {} + return Promise.reject(error); + }); + } + + async callAccountMethod( + accountIndex: AccountId, + method: __AccountMethod__, + ): Promise { + return this.sendMessage({ + cmd: 'callAccountMethod', + payload: { + accountId: accountIndex, + method, + }, + }); + } + + listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + ): void { + return listen(eventTypes, callback, this.messageHandler); + } + + clearListeners(eventTypes: EventType[]): void { + return clearListeners(eventTypes, this.messageHandler); + } + + destroy(): void { + return destroy(this.messageHandler); + } +} diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts new file mode 100644 index 0000000000..f90f2c11ae --- /dev/null +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -0,0 +1,40 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import type { MessageHandler } from './MessageHandler' +import { IotaWalletMobileTypes } from '../definitions' +import { registerPlugin } from '@capacitor/core' + +const IotaWalletMobile = registerPlugin('IotaWalletMobile') + +const { + initLogger, + sendMessage, + messageHandlerNew, + listen, + clearListeners, + destroy, +} = IotaWalletMobile + +const sendMessageAsync = ( + message: string, + handler: MessageHandler, +): Promise => + new Promise((resolve, reject) => { + sendMessage(message, handler, (error: Error, result: string) => { + if (error) { + reject(error); + } else { + resolve(result); + } + }); + }) + +export { + initLogger as internalInitLogger, + sendMessageAsync, + messageHandlerNew, + listen, + clearListeners, + destroy, +} diff --git a/bindings/capacitorjs/src/types/account.ts b/bindings/capacitorjs/src/types/account.ts new file mode 100644 index 0000000000..9107152c92 --- /dev/null +++ b/bindings/capacitorjs/src/types/account.ts @@ -0,0 +1,135 @@ +import type { Address, AddressWithUnspentOutputs } from './address'; +import type { OutputData } from './output'; +import type { Transaction } from './transaction'; +import type { + HexEncodedAmount, + IOutputResponse, + ITransactionPayload, +} from '@iota/types'; + +/** + * Account identifier + * Could be the account index (number) or account alias (string) + */ +export type AccountId = number | string; + +/** The balance of an account */ +export interface AccountBalance { + /** The balance of the base coin */ + baseCoin: BaseCoinBalance; + /** The required storage deposit for the outputs */ + requiredStorageDeposit: string; + /** The balance of the native tokens */ + nativeTokens: NativeTokenBalance[]; + /** Nft outputs */ + nfts: string[]; + /** Alias outputs */ + aliases: string[]; + /** Foundry outputs */ + foundries: string[]; + /** + * Outputs with multiple unlock conditions and if they can currently be spent or not. If there is a + * TimelockUnlockCondition or ExpirationUnlockCondition this can change at any time + */ + potentiallyLockedOutputs: { [outputId: string]: boolean }; +} + +/** Sync options for an account */ +export interface AccountSyncOptions { + /** + * Specific Bech32 encoded addresses of the account to sync, if addresses are provided, + * then `address_start_index` will be ignored + */ + addresses?: string[]; + /** + * Address index from which to start syncing addresses. 0 by default, using a higher index will be faster because + * addresses with a lower index will be skipped, but could result in a wrong balance for that reason + */ + addressStartIndex?: number; + /** + * Address index from which to start syncing internal addresses. 0 by default, using a higher index will be faster + * because addresses with a lower index will be skipped, but could result in a wrong balance for that reason + */ + addressStartIndexInternal?: number; + /** + * Usually syncing is skipped if it's called in between 200ms, because there can only be new changes every + * milestone and calling it twice "at the same time" will not return new data + * When this to true, we will sync anyways, even if it's called 0ms after the las sync finished. Default: false. + */ + forceSyncing?: boolean; + /// Try to sync transactions from incoming outputs with their inputs. Some data may not be obtained if it has been + /// pruned. + syncIncomingTransactions?: boolean; + /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ + syncPendingTransactions?: boolean; + /** Specifies if only basic outputs should be synced or also alias and nft outputs. Default: true. */ + syncAliasesAndNfts?: boolean; + /** Specifies if only basic outputs with an AddressUnlockCondition alone should be synced, will overwrite + * `syncAliasesAndNfts`. Default: false. */ + syncOnlyMostBasicOutputs?: boolean; +} + +/** The account object */ +export interface AccountMeta { + index: number; + coinType: CoinType; + alias: string; + publicAddresses: Address[]; + internalAddresses: Address[]; + addressesWithUnspentOutputs: AddressWithUnspentOutputs[]; + outputs: { [outputId: string]: OutputData }; + /** Output IDs of unspent outputs that are currently used as input for transactions */ + lockedOutputs: Set; + unspentOutputs: { [outputId: string]: OutputData }; + transactions: { [transactionId: string]: Transaction }; + /** Transaction IDs of pending transactions */ + pendingTransactions: Set; + /** Incoming transactions with their inputs if available and not already pruned */ + incomingTransactions: { + [transactionId: string]: [ITransactionPayload, IOutputResponse[]]; + }; +} + +/** The account metadata */ +export interface AccountMetadata { + /** The account alias */ + alias: string; + /** The used coin type */ + coinType: CoinType; + /** The account index which will be used in the BIP32 path */ + index: number; +} + +/** The balance of the base coin */ +export interface BaseCoinBalance { + /** The total amount of the outputs */ + total: string; + /** The amount of the outputs that aren't used in a transaction */ + available: string; +} + +/** The balance of a native token */ +export interface NativeTokenBalance { + tokenId: string; + total: HexEncodedAmount; + available: HexEncodedAmount; +} + +/** IOTA and Shimmer coin types */ +export enum CoinType { + IOTA = 4218, + Shimmer = 4219, +} + +/** Options for account creation */ +export interface CreateAccountPayload { + alias?: string; +} + +/** Options to filter outputs */ +export interface FilterOptions { + /** Filter all outputs where the booked milestone index is below the specified timestamp */ + lowerBoundBookedTimestamp: number; + /** Filter all outputs where the booked milestone index is above the specified timestamp */ + upperBoundBookedTimestamp: number; +} diff --git a/bindings/capacitorjs/src/types/accountManager.ts b/bindings/capacitorjs/src/types/accountManager.ts new file mode 100644 index 0000000000..8827634050 --- /dev/null +++ b/bindings/capacitorjs/src/types/accountManager.ts @@ -0,0 +1,11 @@ +import type { CoinType } from './account'; +import type { ClientOptions } from './network'; +import type { SecretManager } from './secretManager'; + +/** Options for the AccountManager builder */ +export interface AccountManagerOptions { + storagePath?: string; + clientOptions?: ClientOptions; + coinType?: CoinType; + secretManager?: SecretManager; +} diff --git a/bindings/capacitorjs/src/types/address.ts b/bindings/capacitorjs/src/types/address.ts new file mode 100644 index 0000000000..3fc0b1bbc1 --- /dev/null +++ b/bindings/capacitorjs/src/types/address.ts @@ -0,0 +1,65 @@ +import type { Network } from './network'; +import type { HexEncodedAmount } from '@iota/types'; + +/** Address Types */ +export enum AddressType { + Ed25519 = 'Ed25519', + Alias = 'Alias', + Nft = 'Nft', +} + +/** An Address of the Account */ +export interface Address { + address: string; + keyIndex: number; + internal: boolean; + used: boolean; +} + +/** Address with a base token amount */ +export interface AddressWithAmount { + address: string; + amount: string; +} + +/** Address with unspent outputs */ +export interface AddressWithUnspentOutputs { + address: string; + keyIndex: number; + internal: boolean; + outputIds: string[]; +} + +/** Address with a base token amount for a micro transaction */ +export interface AddressWithMicroAmount { + address: string; + amount: string; + returnAddress?: string; + expiration?: number; +} + +/** Address with native tokens */ +export interface AddressNativeTokens { + address: string; + nativeTokens: [string, HexEncodedAmount][]; + returnAddress?: string; + expiration?: number; +} + +/** Address with an NftId */ +export interface AddressNftId { + address: string; + nftId: string; +} + +/** Options for address generation, metadata is used only with a Ledger Nano SecretManager */ +export interface AddressGenerationOptions { + internal: boolean; + metadata: GenerateAddressMetadata; +} + +/** Metadata for address generation, useful with a Ledger Nano SecretManager */ +export interface GenerateAddressMetadata { + syncing: boolean; + network: Network; +} diff --git a/bindings/capacitorjs/src/types/bridge/account.ts b/bindings/capacitorjs/src/types/bridge/account.ts new file mode 100644 index 0000000000..f66ca0bd0d --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/account.ts @@ -0,0 +1,317 @@ +import type { OutputTypes, HexEncodedAmount } from '@iota/types'; +import type { AccountSyncOptions, FilterOptions } from '../account'; +import type { + AddressWithAmount, + AddressWithMicroAmount, + AddressNativeTokens, + AddressNftId, + AddressGenerationOptions, +} from '../address'; +import type { + BuildAliasOutputData, + BuildBasicOutputData, + BuildFoundryOutputData, + BuildNftOutputData, +} from '../buildOutputData'; +import type { OutputOptions } from '../outputOptions'; +import type { OutputsToClaim } from '../output'; +import type { SignedTransactionEssence } from '../signedTransactionEssence'; +import type { PreparedTransactionData } from '../preparedTransactionData'; +import type { + AliasOutputOptions, + IncreaseNativeTokenSupplyOptions, + NativeTokenOptions, + TransactionOptions, + NftOptions, +} from '../transactionOptions'; + +export type __BuildAliasOutputMethod__ = { + name: 'buildAliasOutput'; + data: BuildAliasOutputData; +}; + +export type __BuildBasicOutputMethod__ = { + name: 'buildBasicOutput'; + data: BuildBasicOutputData; +}; + +export type __BuildFoundryOutputMethod__ = { + name: 'buildFoundryOutput'; + data: BuildFoundryOutputData; +}; + +export type __BuildNftOutputMethod__ = { + name: 'buildNftOutput'; + data: BuildNftOutputData; +}; + +export type __BurnNativeTokenMethod__ = { + name: 'burnNativeToken'; + data: { + tokenId: string; + burnAmount: HexEncodedAmount; + options?: TransactionOptions; + }; +}; + +export type __BurnNftMethod__ = { + name: 'burnNft'; + data: { + nftId: string; + options?: TransactionOptions; + }; +}; + +export type __ClaimOutputsMethod__ = { + name: 'claimOutputs'; + data: { + outputIdsToClaim: string[]; + }; +}; + +export type __ConsolidateOutputsMethod__ = { + name: 'consolidateOutputs'; + data: { + force: boolean; + outputConsolidationThreshold?: number; + }; +}; + +export type __CreateAliasOutputMethod__ = { + name: 'createAliasOutput'; + data: { + aliasOutputOptions?: AliasOutputOptions; + options?: TransactionOptions; + }; +}; + +export type __DecreaseNativeTokenSupplyMethod__ = { + name: 'decreaseNativeTokenSupply'; + data: { + tokenId: string; + meltAmount: HexEncodedAmount; + options?: TransactionOptions; + }; +}; + +export type __DestroyAliasMethod__ = { + name: 'destroyAlias'; + data: { + aliasId: string; + options?: TransactionOptions; + }; +}; + +export type __DestroyFoundryMethod__ = { + name: 'destroyFoundry'; + data: { + foundryId: string; + options?: TransactionOptions; + }; +}; + +export type __GenerateAddressesMethod__ = { + name: 'generateAddresses'; + data: { + amount: number; + options?: AddressGenerationOptions; + }; +}; + +export type __GetBalanceMethod__ = { + name: 'getBalance'; +}; + +export type __GetIncomingTransactionDataMethod__ = { + name: 'getIncomingTransactionData'; + data: { + transactionId: string, + }; +}; + +export type __GetOutputMethod__ = { + name: 'getOutput'; + data: { + outputId: string; + }; +}; + +export type __GetFoundryOutputMethod__ = { + name: 'getFoundryOutput'; + data: { + tokenId: string; + }; +}; + +export type __GetOutputsWithAdditionalUnlockConditionsMethod__ = { + name: 'getOutputsWithAdditionalUnlockConditions'; + data: { + outputsToClaim: OutputsToClaim; + }; +}; + +export type __GetTransactionMethod__ = { + name: 'getTransaction'; + data: { + transactionId: string; + }; +}; + +export type __AddressesMethod__ = { + name: 'addresses'; +}; + +export type __AddressesWithUnspentOutputsMethod__ = { + name: 'addressesWithUnspentOutputs'; +}; + +export type __OutputsMethod__ = { + name: 'outputs'; + data: { + filterOptions?: FilterOptions; + }; +}; + +export type __PendingTransactionsMethod__ = { + name: 'pendingTransactions'; +}; + +export type __IncomingTransactionsMethod__ = { + name: 'incomingTransactions'; +}; + +export type __TransactionsMethod__ = { + name: 'transactions'; +}; + +export type __UnspentOutputsMethod__ = { + name: 'unspentOutputs'; + data: { + filterOptions?: FilterOptions; + }; +}; + +export type __MinimumRequiredStorageDepositMethod__ = { + name: 'minimumRequiredStorageDeposit'; + data: { + output: OutputTypes; + }; +}; + +export type __IncreaseNativeTokenSupplyMethod__ = { + name: 'increaseNativeTokenSupply'; + data: { + tokenId: string; + mintAmount: HexEncodedAmount; + increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions; + options?: TransactionOptions; + }; +}; + +export type __MintNativeTokenMethod__ = { + name: 'mintNativeToken'; + data: { + nativeTokenOptions: NativeTokenOptions; + options?: TransactionOptions; + }; +}; + +export type __MintNftsMethod__ = { + name: 'mintNfts'; + data: { + nftsOptions: NftOptions[]; + options?: TransactionOptions; + }; +}; + +export type __PrepareOutputMethod__ = { + name: 'prepareOutput'; + data: { + options: OutputOptions; + transactionOptions?: TransactionOptions; + }; +}; + +export type __PrepareSendAmountMethod__ = { + name: 'prepareSendAmount'; + data: { + addressesWithAmount: AddressWithAmount[]; + options?: TransactionOptions; + }; +}; + +export type __PrepareTransactionMethod__ = { + name: 'prepareTransaction'; + data: { + outputs: OutputTypes[]; + options?: TransactionOptions; + }; +}; + +export type __SendAmountMethod__ = { + name: 'sendAmount'; + data: { + addressesWithAmount: AddressWithAmount[]; + options?: TransactionOptions; + }; +}; + +export type __SendMicroTransactionMethod__ = { + name: 'sendMicroTransaction'; + data: { + addressesWithMicroAmount: AddressWithMicroAmount[]; + options?: TransactionOptions; + }; +}; + +export type __SendNativeTokensMethod__ = { + name: 'sendNativeTokens'; + data: { + addressesNativeTokens: AddressNativeTokens[]; + options?: TransactionOptions; + }; +}; + +export type __SendNftMethod__ = { + name: 'sendNft'; + data: { + addressesAndNftIds: AddressNftId[]; + options?: TransactionOptions; + }; +}; + +export type __SendOutputsMethod__ = { + name: 'sendOutputs'; + data: { + outputs: OutputTypes[]; + options?: TransactionOptions; + }; +}; + +export type __SetAliasMethod__ = { + name: 'setAlias'; + data: { + alias: string; + }; +}; + +export type __SignTransactionEssenceMethod__ = { + name: 'signTransactionEssence'; + data: { + preparedTransactionData: PreparedTransactionData; + }; +}; + +export type __SubmitAndStoreTransactionMethod__ = { + name: 'submitAndStoreTransaction'; + data: { + signedTransactionData: SignedTransactionEssence; + }; +}; + +export type __SyncAccountMethod__ = { + name: 'syncAccount'; + data: { + options?: AccountSyncOptions; + }; +}; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.ts b/bindings/capacitorjs/src/types/bridge/accountManager.ts new file mode 100644 index 0000000000..7a9a720244 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -0,0 +1,142 @@ +import type { + AccountId, + AccountSyncOptions, + CreateAccountPayload, +} from '../account'; +import type { WalletEvent } from '../event'; +import type { Auth, ClientOptions } from '../network'; + +export type __BackupMessage__ = { + cmd: 'backup'; + payload: { + destination: string; + password: string; + }; +}; + +export type __Bech32ToHex__ = { + cmd: 'bech32ToHex'; + payload: string; +}; + +export type __ChangeStrongholdPasswordMessage__ = { + cmd: 'changeStrongholdPassword'; + payload: { + currentPassword: string; + newPassword: string; + }; +}; + +export type __ClearStrongholdPasswordMessage__ = { + cmd: 'clearStrongholdPassword'; +}; + +export type __CreateAccountMessage__ = { + cmd: 'createAccount'; + payload: CreateAccountPayload; +}; + +export type __EmitTestEventMessage__ = { + cmd: 'emitTestEvent'; + payload: WalletEvent; +}; + +export type __GenerateMnemonicMessage__ = { + cmd: 'generateMnemonic'; +}; + +export type __GetAccountIndexesMessage__ = { + cmd: 'getAccountIndexes'; +}; + +export type __GetAccountsMessage__ = { + cmd: 'getAccounts'; +}; + +export type __GetAccountMessage__ = { + cmd: 'getAccount'; + payload: AccountId; +}; + +export type __GetLedgerNanoStatusMessage__ = { + cmd: 'getLedgerNanoStatus'; +}; + +export type __GetNodeInfoMessage__ = { + cmd: 'getNodeInfo'; + payload: { + url?: string; + auth?: Auth; + }; +}; + +export type __HexToBech32__ = { + cmd: 'hexToBech32'; + payload: { + hex: string; + bech32Hrp?: string; + }; +}; + +export type __IsStrongholdPasswordAvailableMessage__ = { + cmd: 'isStrongholdPasswordAvailable'; +}; + +export type __RecoverAccountsMessage__ = { + cmd: 'recoverAccounts'; + payload: { + accountStartIndex: number; + accountGapLimit: number; + addressGapLimit: number; + syncOptions?: AccountSyncOptions; + }; +}; + +export type __RemoveLatestAccountMessage__ = { + cmd: 'removeLatestAccount'; +}; + +export type __RestoreBackupMessage__ = { + cmd: 'restoreBackup'; + payload: { + source: string; + password: string; + }; +}; + +export type __SetClientOptionsMessage__ = { + cmd: 'setClientOptions'; + payload: ClientOptions; +}; + +export type __SetStrongholdPasswordMessage__ = { + cmd: 'setStrongholdPassword'; + payload: string; +}; + +export type __SetStrongholdPasswordClearIntervalMessage__ = { + cmd: 'setStrongholdPasswordClearInterval'; + payload?: number; +}; + +export type __StartBackgroundSyncMessage__ = { + cmd: 'startBackgroundSync'; + payload: { + options?: AccountSyncOptions; + intervalInMilliseconds?: number; + }; +}; + +export type __StopBackgroundSyncMessage__ = { + cmd: 'stopBackgroundSync'; +}; + +export type __StoreMnemonicMessage__ = { + cmd: 'storeMnemonic'; + payload: string; +}; + +export type __VerifyMnemonicMessage__ = { + cmd: 'verifyMnemonic'; + payload: string; +}; diff --git a/bindings/capacitorjs/src/types/bridge/index.ts b/bindings/capacitorjs/src/types/bridge/index.ts new file mode 100644 index 0000000000..1ea2ad6ac9 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/index.ts @@ -0,0 +1,150 @@ +import type { AccountId } from '../account'; +import type { + __BuildAliasOutputMethod__, + __BuildBasicOutputMethod__, + __BuildFoundryOutputMethod__, + __BuildNftOutputMethod__, + __BurnNativeTokenMethod__, + __BurnNftMethod__, + __ClaimOutputsMethod__, + __ConsolidateOutputsMethod__, + __CreateAliasOutputMethod__, + __DecreaseNativeTokenSupplyMethod__, + __DestroyAliasMethod__, + __DestroyFoundryMethod__, + __GenerateAddressesMethod__, + __GetBalanceMethod__, + __GetOutputMethod__, + __GetFoundryOutputMethod__, + __GetOutputsWithAdditionalUnlockConditionsMethod__, + __GetTransactionMethod__, + __AddressesMethod__, + __AddressesWithUnspentOutputsMethod__, + __OutputsMethod__, + __PendingTransactionsMethod__, + __IncomingTransactionsMethod__, + __TransactionsMethod__, + __UnspentOutputsMethod__, + __MinimumRequiredStorageDepositMethod__, + __IncreaseNativeTokenSupplyMethod__, + __MintNativeTokenMethod__, + __MintNftsMethod__, + __PrepareOutputMethod__, + __PrepareSendAmountMethod__, + __PrepareTransactionMethod__, + __SendAmountMethod__, + __SendMicroTransactionMethod__, + __SendNativeTokensMethod__, + __SendNftMethod__, + __SendOutputsMethod__, + __SetAliasMethod__, + __SignTransactionEssenceMethod__, + __SubmitAndStoreTransactionMethod__, + __SyncAccountMethod__, + __GetIncomingTransactionDataMethod__, +} from './account'; +import type { + __BackupMessage__, + __Bech32ToHex__, + __ChangeStrongholdPasswordMessage__, + __ClearStrongholdPasswordMessage__, + __CreateAccountMessage__, + __EmitTestEventMessage__, + __GenerateMnemonicMessage__, + __GetAccountMessage__, + __GetAccountIndexesMessage__, + __GetAccountsMessage__, + __GetLedgerNanoStatusMessage__, + __GetNodeInfoMessage__, + __HexToBech32__, + __IsStrongholdPasswordAvailableMessage__, + __RecoverAccountsMessage__, + __RemoveLatestAccountMessage__, + __RestoreBackupMessage__, + __SetClientOptionsMessage__, + __SetStrongholdPasswordClearIntervalMessage__, + __SetStrongholdPasswordMessage__, + __StartBackgroundSyncMessage__, + __StopBackgroundSyncMessage__, + __StoreMnemonicMessage__, + __VerifyMnemonicMessage__, +} from './accountManager'; + +export type __AccountMethod__ = + | __BuildAliasOutputMethod__ + | __BuildBasicOutputMethod__ + | __BuildFoundryOutputMethod__ + | __BuildNftOutputMethod__ + | __BurnNativeTokenMethod__ + | __BurnNftMethod__ + | __ClaimOutputsMethod__ + | __ConsolidateOutputsMethod__ + | __CreateAliasOutputMethod__ + | __DestroyAliasMethod__ + | __DestroyFoundryMethod__ + | __GenerateAddressesMethod__ + | __GetBalanceMethod__ + | __GetOutputMethod__ + | __GetIncomingTransactionDataMethod__ + | __GetFoundryOutputMethod__ + | __GetOutputsWithAdditionalUnlockConditionsMethod__ + | __GetTransactionMethod__ + | __AddressesMethod__ + | __AddressesWithUnspentOutputsMethod__ + | __OutputsMethod__ + | __PendingTransactionsMethod__ + | __IncomingTransactionsMethod__ + | __TransactionsMethod__ + | __UnspentOutputsMethod__ + | __DecreaseNativeTokenSupplyMethod__ + | __MinimumRequiredStorageDepositMethod__ + | __IncreaseNativeTokenSupplyMethod__ + | __MintNativeTokenMethod__ + | __MintNftsMethod__ + | __PrepareOutputMethod__ + | __PrepareSendAmountMethod__ + | __PrepareTransactionMethod__ + | __SendAmountMethod__ + | __SendMicroTransactionMethod__ + | __SendNativeTokensMethod__ + | __SendNftMethod__ + | __SendOutputsMethod__ + | __SetAliasMethod__ + | __SignTransactionEssenceMethod__ + | __SubmitAndStoreTransactionMethod__ + | __SyncAccountMethod__; + +export type __CallAccountMethodMessage__ = { + cmd: 'callAccountMethod'; + payload: { + accountId: AccountId; + method: __AccountMethod__; + }; +}; + +export type __Message__ = + | __BackupMessage__ + | __Bech32ToHex__ + | __CallAccountMethodMessage__ + | __ChangeStrongholdPasswordMessage__ + | __ClearStrongholdPasswordMessage__ + | __CreateAccountMessage__ + | __EmitTestEventMessage__ + | __GenerateMnemonicMessage__ + | __GetAccountMessage__ + | __GetAccountIndexesMessage__ + | __GetAccountsMessage__ + | __GetLedgerNanoStatusMessage__ + | __GetNodeInfoMessage__ + | __HexToBech32__ + | __IsStrongholdPasswordAvailableMessage__ + | __RecoverAccountsMessage__ + | __RemoveLatestAccountMessage__ + | __RestoreBackupMessage__ + | __SetClientOptionsMessage__ + | __SetStrongholdPasswordClearIntervalMessage__ + | __SetStrongholdPasswordMessage__ + | __StartBackgroundSyncMessage__ + | __StopBackgroundSyncMessage__ + | __StoreMnemonicMessage__ + | __VerifyMnemonicMessage__; diff --git a/bindings/capacitorjs/src/types/buildOutputData.ts b/bindings/capacitorjs/src/types/buildOutputData.ts new file mode 100644 index 0000000000..6998f17f25 --- /dev/null +++ b/bindings/capacitorjs/src/types/buildOutputData.ts @@ -0,0 +1,37 @@ +import type { + FeatureTypes, + INativeToken, + TokenSchemeTypes, + UnlockConditionTypes, +} from '@iota/types'; + +/** An alias output */ +export interface BuildAliasOutputData extends BuildBasicOutputData { + aliasId: string; + stateIndex?: number; + stateMetadata?: Uint8Array; + foundryCounter?: number; + immutableFeatures?: FeatureTypes[]; +} + +/** A basic output */ +export interface BuildBasicOutputData { + /** If not provided, minimum storage deposit will be used */ + amount?: string; + nativeTokens?: INativeToken; + unlockConditions: UnlockConditionTypes[]; + features?: FeatureTypes[]; +} + +/** A foundry output */ +export interface BuildFoundryOutputData extends BuildBasicOutputData { + serialNumber: number; + tokenScheme: TokenSchemeTypes; + immutableFeatures?: FeatureTypes[]; +} + +/** An nft output */ +export interface BuildNftOutputData extends BuildBasicOutputData { + nftId: string; + immutableFeatures?: FeatureTypes[]; +} diff --git a/bindings/capacitorjs/src/types/event.ts b/bindings/capacitorjs/src/types/event.ts new file mode 100644 index 0000000000..d3a0f4b2d6 --- /dev/null +++ b/bindings/capacitorjs/src/types/event.ts @@ -0,0 +1,28 @@ +import type { IOutputResponse, ITransactionPayload } from '@iota/types'; +import type { OutputData } from './output'; + +/** Wallet event types */ +export type EventType = + | '*' + | 'ConsolidationRequired' + | 'LedgerAddressGeneration' + | 'NewOutput' + | 'SpentOutput' + | 'TransactionInclusion' + | 'TransactionProgress'; + +export type NewOutputEvent = { + output: OutputData; + transaction?: ITransactionPayload; + transactionInputs?: IOutputResponse; +}; + +/** Wallet events */ +export enum WalletEvent { + ConsolidationRequired = 'ConsolidationRequired', + LedgerAddressGeneration = 'LedgerAddressGeneration', + NewOutput = 'NewOutput', + SpentOutput = 'SpentOutput', + TransactionInclusion = 'TransactionInclusion', + TransactionProgress = 'TransactionProgress', +} diff --git a/bindings/capacitorjs/src/types/incomingTransactionData.ts b/bindings/capacitorjs/src/types/incomingTransactionData.ts new file mode 100644 index 0000000000..e1bbb563e0 --- /dev/null +++ b/bindings/capacitorjs/src/types/incomingTransactionData.ts @@ -0,0 +1,3 @@ +import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; + +export type IncomingTransactionData = [ITransactionPayload, IOutputMetadataResponse[]] diff --git a/bindings/capacitorjs/src/types/index.ts b/bindings/capacitorjs/src/types/index.ts new file mode 100644 index 0000000000..d76593cce5 --- /dev/null +++ b/bindings/capacitorjs/src/types/index.ts @@ -0,0 +1,16 @@ +export * from './account'; +export * from './accountManager'; +export * from './address'; +export * from './bridge'; +export * from './buildOutputData'; +export * from './event'; +export * from './incomingTransactionData'; +export * from './loggerConfig'; +export * from './network'; +export * from './output'; +export * from './outputOptions'; +export * from './preparedTransactionData'; +export * from './secretManager'; +export * from './signedTransactionEssence'; +export * from './transaction'; +export * from './transactionOptions'; diff --git a/bindings/capacitorjs/src/types/loggerConfig.ts b/bindings/capacitorjs/src/types/loggerConfig.ts new file mode 100644 index 0000000000..e248d58658 --- /dev/null +++ b/bindings/capacitorjs/src/types/loggerConfig.ts @@ -0,0 +1,16 @@ +// Copyright 2021-2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +/** Logger output configuration. */ +export interface LoggerConfig { + /** Name of an output file, or `stdout` for standard output.*/ + name?: string; + /** Log level filter of an output.*/ + levelFilter?: 'off' | 'error' | 'warn' | 'info' | 'debug' | 'trace'; + /** Log target filters of an output.*/ + targetFilter?: string[]; + /** Log target exclusions of an output.*/ + targetExclusions?: string[]; + /** Color flag of an output.*/ + colorEnabled?: boolean; +} diff --git a/bindings/capacitorjs/src/types/network.ts b/bindings/capacitorjs/src/types/network.ts new file mode 100644 index 0000000000..a804af5e0d --- /dev/null +++ b/bindings/capacitorjs/src/types/network.ts @@ -0,0 +1,69 @@ +import type { INodeInfo, IRent } from '@iota/types'; + +/** Network types */ +export enum Network { + Mainnet, + Testnet, +} + +/** Basic Auth or JWT */ +export type Auth = { + jwt?: string; + username?: string; + password?: string; +}; + +/** Information about the network and client */ +export interface NetworkInfo { + network?: string; + networkId?: number; + bech32Hrp?: string; + minPowScore?: number; + localPow?: boolean; + fallbackToLocalPow?: boolean; + tipsInterval?: number; + rentStructure?: IRent; +} + +/** A node object for the client */ +export type Node = { + url: string; + auth?: Auth; + disabled?: boolean; +}; + +/** Options for the client builder */ +export interface ClientOptions { + apiTimeout?: number; + automaticDisconnect?: boolean; + fallbackToLocalPow?: boolean; + localPow?: boolean; + maxReconnectionAttempts?: number; + minQuorumSize?: number; + network?: string; + networkInfo?: NetworkInfo; + nodes?: Array; + nodeSyncEnabled?: boolean; + nodeSyncInterval?: number; + permanodes?: Array; + port?: number; + powWorkerCount?: number; + primaryNode?: string | Node; + primaryPowNode?: string | Node; + quorum?: boolean; + quorumThreshold?: boolean; + remotePowTimeout?: number; + // timeout in seconds + timeout?: number; + useWs?: boolean; +} + +/** + * NodeInfo wrapper which contains the node info and the url from the node (useful when multiple nodes are used) + */ +export interface NodeInfoWrapper { + /** The returned node info */ + nodeInfo: INodeInfo; + /** The url from the node which returned the node info */ + url: string; +} diff --git a/bindings/capacitorjs/src/types/output.ts b/bindings/capacitorjs/src/types/output.ts new file mode 100644 index 0000000000..68f353d98e --- /dev/null +++ b/bindings/capacitorjs/src/types/output.ts @@ -0,0 +1,40 @@ +import type { + AddressTypes, + OutputTypes, + IOutputMetadataResponse, +} from '@iota/types'; + +/** Output to claim */ +export enum OutputsToClaim { + None = 'None', + MicroTransactions = 'MicroTransactions', + NativeTokens = 'NativeTokens', + Nfts = 'Nfts', + All = 'All', +} + +/** An output with metadata */ +export interface OutputData { + /** The identifier of an Output */ + outputId: string; + /** The metadata of the output */ + metadata: IOutputMetadataResponse; + /** The actual Output */ + output: OutputTypes; + /** If an output is spent */ + isSpent: boolean; + /** Associated account address */ + address: AddressTypes; + /** Network ID */ + networkId: string; + /** Remainder */ + remainder: boolean; + /** BIP32 path */ + chain?: Segment[]; +} + +/** A Segment of the BIP32 path*/ +export interface Segment { + hardened: boolean; + bs: Uint8Array; +} diff --git a/bindings/capacitorjs/src/types/outputOptions.ts b/bindings/capacitorjs/src/types/outputOptions.ts new file mode 100644 index 0000000000..3546e28b92 --- /dev/null +++ b/bindings/capacitorjs/src/types/outputOptions.ts @@ -0,0 +1,43 @@ +import type { HexEncodedString, INativeToken } from '@iota/types'; + +/** Options for the creation of an output */ +export interface OutputOptions { + recipientAddress: string; + amount: string; + assets?: Assets; + features?: Features; + unlocks?: Unlocks; + storageDeposit?: StorageDeposit; +} + +/** Assets to include in the output */ +export interface Assets { + nativeTokens?: INativeToken[]; + nftId?: HexEncodedString; +} + +/** Features to include in the output */ +export interface Features { + tag?: HexEncodedString; + metadata?: HexEncodedString; + sender?: string; + issuer?: string; +} + +/** Time unlocks to include in the output */ +export interface Unlocks { + expirationUnixTime?: number; + timelockUnixTime?: number; +} + +/** Storage deposit strategy to be used for the output */ +export interface StorageDeposit { + returnStrategy?: ReturnStrategy; + useExcessIfLow?: boolean; +} + +/** Return strategy for the storage deposit */ +export enum ReturnStrategy { + Return = 'Return', + Gift = 'Gift', +} diff --git a/bindings/capacitorjs/src/types/preparedTransactionData.ts b/bindings/capacitorjs/src/types/preparedTransactionData.ts new file mode 100644 index 0000000000..7011466957 --- /dev/null +++ b/bindings/capacitorjs/src/types/preparedTransactionData.ts @@ -0,0 +1,66 @@ +import type { + AddressTypes, + IOutputMetadataResponse, + ITransactionEssence, + OutputTypes, +} from '@iota/types'; +import type { Segment } from './output'; + +/** + * Prepared transaction data, useful for offline signing. + */ +export interface PreparedTransactionData { + /** + * Transaction essence + */ + essence: ITransactionEssence; + /** + * Required address information for signing + */ + inputsData: InputSigningData[]; + /** + * Optional remainder output information + */ + remainder?: RemainderData; +} + +/** + * Data for transaction inputs for signing and ordering of unlock blocks + */ +export interface InputSigningData { + /** + * The output + */ + output: OutputTypes; + /** + * The output metadata + */ + outputMetaData: IOutputMetadataResponse; + /** + * The chain derived from seed, only for ed25519 addresses + */ + chain?: Segment[]; + /** + * The bech32 encoded address, required because of alias outputs where we have multiple possible unlock + * conditions, because we otherwise don't know which one we need + */ + bech32Address: string; +} + +/** + * Data for a remainder output, used for ledger nano + */ +export interface RemainderData { + /** + * The remainder output + */ + output: OutputTypes; + /** + * The chain derived from seed, for the remainder addresses + */ + chain?: Segment[]; + /** + * The remainder address + */ + address: AddressTypes; +} diff --git a/bindings/capacitorjs/src/types/secretManager.ts b/bindings/capacitorjs/src/types/secretManager.ts new file mode 100644 index 0000000000..3988bc212c --- /dev/null +++ b/bindings/capacitorjs/src/types/secretManager.ts @@ -0,0 +1,52 @@ +/** Secret manager that uses a Ledger Nano hardware wallet or Speculos simulator. */ +export interface LedgerNanoSecretManager { + /** boolean indicates whether it's a simulator or not. */ + ledgerNano: boolean; +} + +/** Secret manager that uses a mnemonic. */ +export interface MnemonicSecretManager { + mnemonic: string; +} + +/** Secret manager that uses a seed. */ +export interface SeedSecretManager { + hexSeed: string; +} + +/** Secret manager that uses Stronghold. */ +export interface StrongholdSecretManager { + stronghold: { + password?: string; + snapshotPath?: string; + }; +} + +/** The status of a Ledger Nano */ +export interface LedgerNanoStatus { + connected: boolean; + locked: boolean; + blindSigningEnabled: boolean; + app?: LedgerApp; + device?: LedgerDeviceType; + bufferSize?: number; +} + +/** The current opened app */ +export interface LedgerApp { + name: string; + version: string; +} + +/** The Ledger Device Type */ +export enum LedgerDeviceType { + LedgerNanoS = 'ledgerNanoS', + LedgerNanoX = 'ledgerNanoX', + LedgerNanoSPlus = 'ledgerNanoSPlus', +} + +/** Supported secret managers */ +export type SecretManager = + | LedgerNanoSecretManager + | MnemonicSecretManager + | StrongholdSecretManager; diff --git a/bindings/capacitorjs/src/types/signedTransactionEssence.ts b/bindings/capacitorjs/src/types/signedTransactionEssence.ts new file mode 100644 index 0000000000..b719509808 --- /dev/null +++ b/bindings/capacitorjs/src/types/signedTransactionEssence.ts @@ -0,0 +1,8 @@ +import type { ITransactionPayload } from '@iota/types'; +import type { InputSigningData } from './preparedTransactionData'; + +/** The signed transaction with inputs data */ +export interface SignedTransactionEssence { + transactionPayload: ITransactionPayload; + inputsData: InputSigningData; +} diff --git a/bindings/capacitorjs/src/types/transaction.ts b/bindings/capacitorjs/src/types/transaction.ts new file mode 100644 index 0000000000..b1e61e2186 --- /dev/null +++ b/bindings/capacitorjs/src/types/transaction.ts @@ -0,0 +1,40 @@ +import type { ITransactionPayload } from '@iota/types'; + +/** Possible InclusionStates of transactions sent with the wallet */ +export enum InclusionState { + /** The transaction is pending */ + Pending = 'Pending', + /** The transaction is confirmed */ + Confirmed = 'Confirmed', + /** The transaction is conflicting */ + Conflicting = 'Conflicting', + /** The transaction and its in- and outputs are pruned, so it's unknown if it got confirmed or was conflicting */ + UnknownPruned = 'UnknownPruned', +} + +/** A Transaction with metadata */ +export interface Transaction { + /** The transaction payload */ + payload: ITransactionPayload; + /** The block id in which the transaction payload was included */ + blockId?: string; + /** The inclusion state of the transaction */ + inclusionState: InclusionState; + /** The creation time */ + timestamp: string; + /** The transaction id */ + transactionId: string; + /** The network id in which the transaction was sent */ + networkId: string; + /** If the transaction was created by the wallet or someone else */ + incoming: boolean; + note?: string; +} + +/** The result of a minting operation */ +export interface MintTokenTransaction { + /** The token id of the minted token */ + tokenId: string; + /** The transaction which minted the token */ + transaction: Transaction; +} diff --git a/bindings/capacitorjs/src/types/transactionOptions.ts b/bindings/capacitorjs/src/types/transactionOptions.ts new file mode 100644 index 0000000000..2be4465ac3 --- /dev/null +++ b/bindings/capacitorjs/src/types/transactionOptions.ts @@ -0,0 +1,81 @@ +import type { ITaggedDataPayload, HexEncodedAmount } from '@iota/types'; + +/** Options for the transaction creation */ +export interface TransactionOptions { + remainderValueStrategy?: RemainderValueStrategy; + taggedDataPayload?: ITaggedDataPayload; + /** Custom inputs that should be used for the transaction */ + customInputs?: string[]; + /** Optional note, that is only stored locally */ + note?: string; +} + +/** The RemainderValueStrategy */ +export type RemainderValueStrategy = + | ChangeAddress + | ReuseAddress + | CustomAddress; + +/** ChangeAddress variant of RemainderValueStrategy */ +export type ChangeAddress = { + strategy: 'ChangeAddress'; + value: null; +}; + +/** ReuseAddress variant of RemainderValueStrategy */ +export type ReuseAddress = { + strategy: 'ReuseAddress'; + value: null; +}; + +/** CustomAddress variant of RemainderValueStrategy */ +export type CustomAddress = { + strategy: 'CustomAddress'; + value: string; +}; + +/** Native token options for minting more native tokens */ +export interface IncreaseNativeTokenSupplyOptions {} + +/** Native token options for minting */ +export interface NativeTokenOptions { + aliasId?: string; + /** Hex encoded number */ + circulatingSupply: HexEncodedAmount; + /** Hex encoded number */ + maximumSupply: HexEncodedAmount; + /** Hex encoded bytes */ + foundryMetadata?: string; +} + +/** Nft options for minting */ +export interface NftOptions { + /** Bech32 encoded address to which the Nft will be minted. Default will use the + * first address of the account + */ + address?: string; + /** Bech32 encoded sender address **/ + sender?: string; + /** Hex encoded bytes */ + metadata?: string; + /** Hex encoded bytes */ + tag?: string; + /** Bech32 encoded issuer address **/ + issuer?: string; + /** Hex encoded bytes */ + immutableMetadata?: string; +} + +/** Options for the alias output creation */ +export interface AliasOutputOptions { + /** Bech32 encoded address to which the Nft will be minted. Default will use the + * first address of the account + */ + address?: string; + /** Hex encoded bytes */ + immutableMetadata?: string; + /** Hex encoded bytes */ + metadata?: string; + /** Hex encoded bytes */ + stateMetadata?: string; +} From 75bd921169a0261af9c2284a153741e21974a983 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:51:12 +0100 Subject: [PATCH 073/197] chore: add tsconfig and package lock files --- bindings/capacitorjs/package-lock.json | 448 +++++++++++++++++++++++++ bindings/capacitorjs/tsconfig.json | 24 ++ 2 files changed, 472 insertions(+) create mode 100644 bindings/capacitorjs/package-lock.json create mode 100644 bindings/capacitorjs/tsconfig.json diff --git a/bindings/capacitorjs/package-lock.json b/bindings/capacitorjs/package-lock.json new file mode 100644 index 0000000000..bea324531a --- /dev/null +++ b/bindings/capacitorjs/package-lock.json @@ -0,0 +1,448 @@ +{ + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "lockfileVersion": 2, + "requires": true, + "packages": { + "": { + "name": "@iota/wallet-mobile", + "version": "0.0.1", + "license": "Apache-2.0", + "dependencies": { + "@capacitor/core": "^3.4.1", + "@iota/types": "^1.0.0-beta.15" + }, + "devDependencies": { + "@capacitor/android": "^3.4.1", + "@capacitor/core": "^3.4.1", + "@capacitor/docgen": "^0.0.10", + "@capacitor/ios": "^3.4.1", + "rimraf": "^3.0.2", + "rollup": "^2.32.0", + "typescript": "~4.0.3" + }, + "peerDependencies": { + "@capacitor/core": "^3.4.1" + } + }, + "node_modules/@capacitor/android": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.9.0.tgz", + "integrity": "sha512-YTPyrh1NozEuYXWGtfqN27TLXUrLbZX9fggyd4JQ1yMaUZTmLPm5dCuznONhQ49aPkJnUJB02JfpHy/qGwa2Lw==", + "dev": true, + "peerDependencies": { + "@capacitor/core": "^3.9.0" + } + }, + "node_modules/@capacitor/core": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.9.0.tgz", + "integrity": "sha512-j1lL0+/7stY8YhIq1Lm6xixvUqIn89vtyH5ZpJNNmcZ0kwz6K9eLkcG6fvq1UWMDgSVZg9JrRGSFhb4LLoYOsw==", + "dev": true, + "dependencies": { + "tslib": "^2.1.0" + } + }, + "node_modules/@capacitor/docgen": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@capacitor/docgen/-/docgen-0.0.10.tgz", + "integrity": "sha512-zHzWBDiidONOKipn1ZCc1Q8FvnmKDRXBl0NU/haiWXek9WhrhmGhN5Vbm9RK9LXkEKfkdJn6G+eht5wqVrJCsA==", + "dev": true, + "dependencies": { + "colorette": "^1.2.1", + "github-slugger": "^1.3.0", + "minimist": "^1.2.5", + "typescript": "^4.0.3" + }, + "bin": { + "docgen": "bin/docgen" + }, + "engines": { + "node": ">=14.5.0" + } + }, + "node_modules/@capacitor/ios": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-3.9.0.tgz", + "integrity": "sha512-GezPCJIujRHnF4wbrKJx6Q/mgFz0f9rmh/steTTXQZI+nEl6mHk6NWh8235p7YbhonYi5WD0rFNirrjGg1EaGw==", + "dev": true, + "peerDependencies": { + "@capacitor/core": "^3.9.0" + } + }, + "node_modules/@iota/types": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@iota/types/-/types-1.0.0-beta.15.tgz", + "integrity": "sha512-67DrzDO5bl2c7RIMpOdtjdOa27Bv1EmX/BHPTQD8c3RtPPAzJpSIpuI8JsIDl3U6Qe4zdLX3kRv9zGBXcr0fZA==" + }, + "node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, + "node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "node_modules/fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "hasInstallScript": true, + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/github-slugger": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", + "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", + "dev": true + }, + "node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "dependencies": { + "glob": "^7.1.3" + }, + "bin": { + "rimraf": "bin.js" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=10.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true + }, + "node_modules/typescript": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", + "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "dev": true, + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=4.2.0" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + }, + "dependencies": { + "@capacitor/android": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/android/-/android-3.9.0.tgz", + "integrity": "sha512-YTPyrh1NozEuYXWGtfqN27TLXUrLbZX9fggyd4JQ1yMaUZTmLPm5dCuznONhQ49aPkJnUJB02JfpHy/qGwa2Lw==", + "dev": true, + "requires": {} + }, + "@capacitor/core": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/core/-/core-3.9.0.tgz", + "integrity": "sha512-j1lL0+/7stY8YhIq1Lm6xixvUqIn89vtyH5ZpJNNmcZ0kwz6K9eLkcG6fvq1UWMDgSVZg9JrRGSFhb4LLoYOsw==", + "dev": true, + "requires": { + "tslib": "^2.1.0" + } + }, + "@capacitor/docgen": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/@capacitor/docgen/-/docgen-0.0.10.tgz", + "integrity": "sha512-zHzWBDiidONOKipn1ZCc1Q8FvnmKDRXBl0NU/haiWXek9WhrhmGhN5Vbm9RK9LXkEKfkdJn6G+eht5wqVrJCsA==", + "dev": true, + "requires": { + "colorette": "^1.2.1", + "github-slugger": "^1.3.0", + "minimist": "^1.2.5", + "typescript": "^4.0.3" + } + }, + "@capacitor/ios": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/@capacitor/ios/-/ios-3.9.0.tgz", + "integrity": "sha512-GezPCJIujRHnF4wbrKJx6Q/mgFz0f9rmh/steTTXQZI+nEl6mHk6NWh8235p7YbhonYi5WD0rFNirrjGg1EaGw==", + "dev": true, + "requires": {} + }, + "@iota/types": { + "version": "1.0.0-beta.15", + "resolved": "https://registry.npmjs.org/@iota/types/-/types-1.0.0-beta.15.tgz", + "integrity": "sha512-67DrzDO5bl2c7RIMpOdtjdOa27Bv1EmX/BHPTQD8c3RtPPAzJpSIpuI8JsIDl3U6Qe4zdLX3kRv9zGBXcr0fZA==" + }, + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", + "dev": true + }, + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dev": true, + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "colorette": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colorette/-/colorette-1.4.0.tgz", + "integrity": "sha512-Y2oEozpomLn7Q3HFP7dpww7AtMJplbM9lGZP6RDfHqmbeRjiwRg4n6VM6j4KLmRke85uWEI7JqF17f3pqdRA0g==", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", + "dev": true + }, + "fsevents": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", + "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "dev": true, + "optional": true + }, + "github-slugger": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/github-slugger/-/github-slugger-1.5.0.tgz", + "integrity": "sha512-wIh+gKBI9Nshz2o46B0B3f5k/W+WI9ZAv6y5Dn5WJ5SK1t0TnDimB4WE5rmTD05ZAIn8HALCZVmCsvj0w0v0lw==", + "dev": true + }, + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dev": true, + "requires": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dev": true, + "requires": { + "brace-expansion": "^1.1.7" + } + }, + "minimist": { + "version": "1.2.7", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz", + "integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dev": true, + "requires": { + "wrappy": "1" + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "rimraf": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-3.0.2.tgz", + "integrity": "sha512-JZkJMZkAGFFPP2YqXZXPbMlMBgsxzE8ILs4lMIX/2o0L9UBw9O/Y3o6wFw/i9YLapcUJWwqbi3kdxIPdC62TIA==", + "dev": true, + "requires": { + "glob": "^7.1.3" + } + }, + "rollup": { + "version": "2.79.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", + "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", + "dev": true, + "requires": { + "fsevents": "~2.3.2" + } + }, + "tslib": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.1.tgz", + "integrity": "sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==", + "dev": true + }, + "typescript": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", + "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "dev": true + }, + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "dev": true + } + } +} diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json new file mode 100644 index 0000000000..c1c4b12738 --- /dev/null +++ b/bindings/capacitorjs/tsconfig.json @@ -0,0 +1,24 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +{ + "compilerOptions": { + "allowUnreachableCode": false, + "declaration": true, + "esModuleInterop": true, + "lib": ["dom", "es2017"], + "module": "esnext", + "moduleResolution": "node", + "noFallthroughCasesInSwitch": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "dist/esm", + "pretty": true, + "sourceMap": true, + "target": "es2017" + }, + "files": [ + "src/index.ts", + "src/definitions.ts" + ] +} From cd231c3a422009da31c47d0f129f289508b8b5ec Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:55:40 +0100 Subject: [PATCH 074/197] chore: add iOS xcframework as a plugin internal dependency --- .../WalletFramework.xcframework/Info.plist | 39 +++++++++++++++++++ .../Headers/WalletFramework.h | 27 +++++++++++++ .../WalletFramework.framework/Info.plist | 22 +++++++++++ .../Modules/Modules.modulemap | 6 +++ .../Headers/WalletFramework.h | 27 +++++++++++++ .../WalletFramework.framework/Info.plist | 22 +++++++++++ .../Modules/Modules.modulemap | 6 +++ 7 files changed, 149 insertions(+) create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist create mode 100644 bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist new file mode 100644 index 0000000000..88169654de --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist @@ -0,0 +1,39 @@ + + + + + AvailableLibraries + + + LibraryIdentifier + ios-arm64 + LibraryPath + WalletFramework.framework + SupportedArchitectures + + arm64 + + SupportedPlatform + ios + + + LibraryIdentifier + ios-x86 + LibraryPath + WalletFramework.framework + SupportedArchitectures + + x86_64 + + SupportedPlatform + ios + SupportedPlatformVariant + simulator + + + CFBundlePackageType + XFWK + XCFrameworkFormatVersion + 1.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h new file mode 100644 index 0000000000..c3853f0c1c --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -0,0 +1,27 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct iota_wallet_handle iota_wallet_handle_t; + +typedef void (*Callback)(const char* response, const char* error, void* context); + +// Initialise the fern logger. Level filter defaults to Debug if omitted +extern int8_t iota_init_logger(const char* file_name, const char* level_filter); +extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); +extern void iota_destroy(iota_wallet_handle_t*); +extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); +extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + + +#ifdef __cplusplus +} +#endif diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist new file mode 100644 index 0000000000..81e834bb06 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + WalletFramework + CFBundleIdentifier + org.iotafoundation.WalletFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + WalletFramework + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap new file mode 100644 index 0000000000..626bedcb21 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap @@ -0,0 +1,6 @@ +framework module WalletFramework { + umbrella header "WalletFramework.h" + + export * + module * { export * } +} diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h new file mode 100644 index 0000000000..c3853f0c1c --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -0,0 +1,27 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct iota_wallet_handle iota_wallet_handle_t; + +typedef void (*Callback)(const char* response, const char* error, void* context); + +// Initialise the fern logger. Level filter defaults to Debug if omitted +extern int8_t iota_init_logger(const char* file_name, const char* level_filter); +extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); +extern void iota_destroy(iota_wallet_handle_t*); +extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); +extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); +extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); + + +#ifdef __cplusplus +} +#endif diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist new file mode 100644 index 0000000000..81e834bb06 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + WalletFramework + CFBundleIdentifier + org.iotafoundation.WalletFramework + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + WalletFramework + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1.0.0 + + diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap new file mode 100644 index 0000000000..626bedcb21 --- /dev/null +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap @@ -0,0 +1,6 @@ +framework module WalletFramework { + umbrella header "WalletFramework.h" + + export * + module * { export * } +} From ec242226714c66c597dc3d908f14fc8ecca65dd8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 5 Dec 2022 12:57:49 +0100 Subject: [PATCH 075/197] chore: add iOS base project files --- bindings/capacitorjs/ios/.gitignore | 3 + .../ios/Plugin.xcodeproj/project.pbxproj | 619 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + .../contents.xcworkspacedata | 10 + .../xcshareddata/IDEWorkspaceChecks.plist | 8 + bindings/capacitorjs/ios/Plugin/Info.plist | 24 + .../ios/Plugin/Libraries/libwallet.h | 4 + .../ios/Plugin/Libraries/module.modulemap | 4 + .../capacitorjs/ios/PluginTests/Info.plist | 22 + .../ios/PluginTests/PluginTests.swift | 26 + bindings/capacitorjs/ios/Podfile | 42 ++ bindings/capacitorjs/ios/Podfile.lock | 22 + 13 files changed, 799 insertions(+) create mode 100644 bindings/capacitorjs/ios/.gitignore create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata create mode 100644 bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist create mode 100644 bindings/capacitorjs/ios/Plugin/Info.plist create mode 100644 bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h create mode 100644 bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap create mode 100644 bindings/capacitorjs/ios/PluginTests/Info.plist create mode 100644 bindings/capacitorjs/ios/PluginTests/PluginTests.swift create mode 100644 bindings/capacitorjs/ios/Podfile create mode 100644 bindings/capacitorjs/ios/Podfile.lock diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore new file mode 100644 index 0000000000..adb2bb7ed5 --- /dev/null +++ b/bindings/capacitorjs/ios/.gitignore @@ -0,0 +1,3 @@ +libwallet.a +Pods +._* \ No newline at end of file diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj new file mode 100644 index 0000000000..2efac039af --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -0,0 +1,619 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 52; + objects = { + +/* Begin PBXBuildFile section */ + 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */; }; + 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */; }; + 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFF88201F53D600D50D53 /* Plugin.framework */; }; + 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFF96201F53D600D50D53 /* PluginTests.swift */; }; + 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 50ADFF8B201F53D600D50D53 /* Plugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 50ADFFA52020D75100D50D53 /* Capacitor.framework */; }; + 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 50ADFFA72020EE4F00D50D53 /* Plugin.m */; }; + 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */ = {isa = PBXBuildFile; fileRef = 50E1A94720377CB70090CE1A /* Plugin.swift */; }; + 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 600FAB16252ED5A30039D358 /* libresolv.tbd */; }; + 60EDD785252F881300E05012 /* libwallet.h in Headers */ = {isa = PBXBuildFile; fileRef = 60EDD762252F826300E05012 /* libwallet.h */; }; + EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; + EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; + EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 50ADFF7F201F53D600D50D53 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 50ADFF87201F53D600D50D53; + remoteInfo = Plugin; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + EE52B7E129378C47003728DB /* Embed Frameworks */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 2147483647; + dstPath = ""; + dstSubfolderSpec = 10; + files = ( + EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */, + ); + name = "Embed Frameworks"; + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF88201F53D600D50D53 /* Plugin.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Plugin.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF8B201F53D600D50D53 /* Plugin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Plugin.h; sourceTree = ""; }; + 50ADFF8C201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50ADFF91201F53D600D50D53 /* PluginTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = PluginTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFF96201F53D600D50D53 /* PluginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PluginTests.swift; sourceTree = ""; }; + 50ADFF98201F53D600D50D53 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + 50ADFFA52020D75100D50D53 /* Capacitor.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = Capacitor.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 50ADFFA72020EE4F00D50D53 /* Plugin.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = Plugin.m; sourceTree = ""; }; + 50E1A94720377CB70090CE1A /* Plugin.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Plugin.swift; sourceTree = ""; }; + 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.debug.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.debug.xcconfig"; sourceTree = ""; }; + 600FAB16252ED5A30039D358 /* libresolv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libresolv.tbd; path = Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/usr/lib/libresolv.tbd; sourceTree = DEVELOPER_DIR; }; + 60EDD75F252F7EC400E05012 /* module.modulemap */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; + 60EDD762252F826300E05012 /* libwallet.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = libwallet.h; sourceTree = ""; }; + 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; }; + 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; }; + EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = WalletFramework.xcframework; sourceTree = ""; }; + F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; }; + F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 50ADFF84201F53D600D50D53 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */, + 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */, + 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */, + 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8E201F53D600D50D53 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF92201F53D600D50D53 /* Plugin.framework in Frameworks */, + EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */, + 20C0B05DCFC8E3958A738AF2 /* Pods_PluginTests.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 50ADFF7E201F53D600D50D53 = { + isa = PBXGroup; + children = ( + 50ADFF8A201F53D600D50D53 /* Plugin */, + 50ADFF95201F53D600D50D53 /* PluginTests */, + 50ADFF89201F53D600D50D53 /* Products */, + 8C8E7744173064A9F6D438E3 /* Pods */, + A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */, + ); + sourceTree = ""; + }; + 50ADFF89201F53D600D50D53 /* Products */ = { + isa = PBXGroup; + children = ( + 50ADFF88201F53D600D50D53 /* Plugin.framework */, + 50ADFF91201F53D600D50D53 /* PluginTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 50ADFF8A201F53D600D50D53 /* Plugin */ = { + isa = PBXGroup; + children = ( + 60EDD770252F843100E05012 /* Libraries */, + 50E1A94720377CB70090CE1A /* Plugin.swift */, + 50ADFF8B201F53D600D50D53 /* Plugin.h */, + 50ADFFA72020EE4F00D50D53 /* Plugin.m */, + 50ADFF8C201F53D600D50D53 /* Info.plist */, + ); + path = Plugin; + sourceTree = ""; + }; + 50ADFF95201F53D600D50D53 /* PluginTests */ = { + isa = PBXGroup; + children = ( + 50ADFF96201F53D600D50D53 /* PluginTests.swift */, + 50ADFF98201F53D600D50D53 /* Info.plist */, + ); + path = PluginTests; + sourceTree = ""; + }; + 60EDD770252F843100E05012 /* Libraries */ = { + isa = PBXGroup; + children = ( + 60EDD762252F826300E05012 /* libwallet.h */, + 60EDD75F252F7EC400E05012 /* module.modulemap */, + ); + path = Libraries; + sourceTree = ""; + }; + 8C8E7744173064A9F6D438E3 /* Pods */ = { + isa = PBXGroup; + children = ( + 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */, + 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */, + 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */, + F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = { + isa = PBXGroup; + children = ( + EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */, + 600FAB16252ED5A30039D358 /* libresolv.tbd */, + 50ADFFA52020D75100D50D53 /* Capacitor.framework */, + 3B2A61DA5A1F2DD4F959604D /* Pods_Plugin.framework */, + F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 50ADFF85201F53D600D50D53 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF99201F53D600D50D53 /* Plugin.h in Headers */, + 60EDD785252F881300E05012 /* libwallet.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 50ADFF87201F53D600D50D53 /* Plugin */ = { + isa = PBXNativeTarget; + buildConfigurationList = 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */; + buildPhases = ( + AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */, + 50ADFF83201F53D600D50D53 /* Sources */, + 50ADFF84201F53D600D50D53 /* Frameworks */, + 50ADFF85201F53D600D50D53 /* Headers */, + 50ADFF86201F53D600D50D53 /* Resources */, + EE52B7E129378C47003728DB /* Embed Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = Plugin; + productName = Plugin; + productReference = 50ADFF88201F53D600D50D53 /* Plugin.framework */; + productType = "com.apple.product-type.framework"; + }; + 50ADFF90201F53D600D50D53 /* PluginTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */; + buildPhases = ( + 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */, + 50ADFF8D201F53D600D50D53 /* Sources */, + 50ADFF8E201F53D600D50D53 /* Frameworks */, + 50ADFF8F201F53D600D50D53 /* Resources */, + CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 50ADFF94201F53D600D50D53 /* PBXTargetDependency */, + ); + name = PluginTests; + productName = PluginTests; + productReference = 50ADFF91201F53D600D50D53 /* PluginTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 50ADFF7F201F53D600D50D53 /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0920; + LastUpgradeCheck = 0920; + ORGANIZATIONNAME = "Max Lynch"; + TargetAttributes = { + 50ADFF87201F53D600D50D53 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + }; + 50ADFF90201F53D600D50D53 = { + CreatedOnToolsVersion = 9.2; + LastSwiftMigration = 1100; + ProvisioningStyle = Automatic; + }; + }; + }; + buildConfigurationList = 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */; + compatibilityVersion = "Xcode 8.0"; + developmentRegion = en; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 50ADFF7E201F53D600D50D53; + productRefGroup = 50ADFF89201F53D600D50D53 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 50ADFF87201F53D600D50D53 /* Plugin */, + 50ADFF90201F53D600D50D53 /* PluginTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 50ADFF86201F53D600D50D53 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8F201F53D600D50D53 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 0596884F929ED6F1DE134961 /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-PluginTests-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + AB5B3E54B4E897F32C2279DA /* [CP] Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_PODFILE_DIR_PATH}/Podfile.lock", + "${PODS_ROOT}/Manifest.lock", + ); + name = "[CP] Check Pods Manifest.lock"; + outputPaths = ( + "$(DERIVED_FILE_DIR)/Pods-Plugin-checkManifestLockResult.txt", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; + showEnvVarsInLog = 0; + }; + CCA81D3B7E26D0D727D24C84 /* [CP] Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh", + "${BUILT_PRODUCTS_DIR}/Capacitor/Capacitor.framework", + "${BUILT_PRODUCTS_DIR}/CapacitorCordova/Cordova.framework", + ); + name = "[CP] Embed Pods Frameworks"; + outputPaths = ( + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Capacitor.framework", + "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Cordova.framework", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-PluginTests/Pods-PluginTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 50ADFF83201F53D600D50D53 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 50E1A94820377CB70090CE1A /* Plugin.swift in Sources */, + 50ADFFA82020EE4F00D50D53 /* Plugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 50ADFF8D201F53D600D50D53 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 50ADFF97201F53D600D50D53 /* PluginTests.swift in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 50ADFF94201F53D600D50D53 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 50ADFF87201F53D600D50D53 /* Plugin */; + targetProxy = 50ADFF93201F53D600D50D53 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 50ADFF9A201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Debug; + }; + 50ADFF9B201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_COMMA = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; + CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; + CLANG_WARN_STRICT_PROTOTYPES = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGN_IDENTITY = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu11; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + SWIFT_COMPILATION_MODE = wholemodule; + SWIFT_OPTIMIZATION_LEVEL = "-O"; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + }; + name = Release; + }; + 50ADFF9D201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 5E23F77F099397094342571A /* Pods-Plugin.debug.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Plugin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + "$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)\n$(FRAMEWORK_SEARCH_PATHS)", + ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 50ADFF9E201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */; + buildSettings = { + CLANG_ENABLE_MODULES = YES; + CODE_SIGN_IDENTITY = ""; + CODE_SIGN_STYLE = Automatic; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = Plugin/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 12.0; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + "$(FRAMEWORK_SEARCH_PATHS)", + ); + LIBRARY_SEARCH_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + ONLY_ACTIVE_ARCH = NO; + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.Plugin; + PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; + SKIP_INSTALL = YES; + SUPPORTS_MACCATALYST = NO; + SWIFT_INCLUDE_PATHS = "$(PROJECT_DIR)/Plugin/Libraries"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + 50ADFFA0201F53D600D50D53 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = PluginTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 50ADFFA1201F53D600D50D53 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */; + buildSettings = { + ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; + CODE_SIGN_STYLE = Automatic; + INFOPLIST_FILE = PluginTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = ( + "$(inherited)", + "@executable_path/Frameworks", + "@loader_path/Frameworks", + ); + PRODUCT_BUNDLE_IDENTIFIER = com.getcapacitor.PluginTests; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_VERSION = 5.0; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 50ADFF82201F53D600D50D53 /* Build configuration list for PBXProject "Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFF9A201F53D600D50D53 /* Debug */, + 50ADFF9B201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 50ADFF9C201F53D600D50D53 /* Build configuration list for PBXNativeTarget "Plugin" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFF9D201F53D600D50D53 /* Debug */, + 50ADFF9E201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 50ADFF9F201F53D600D50D53 /* Build configuration list for PBXNativeTarget "PluginTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 50ADFFA0201F53D600D50D53 /* Debug */, + 50ADFFA1201F53D600D50D53 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 50ADFF7F201F53D600D50D53 /* Project object */; +} diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..919434a625 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata b/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000000..afad624ec0 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,10 @@ + + + + + + + diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + diff --git a/bindings/capacitorjs/ios/Plugin/Info.plist b/bindings/capacitorjs/ios/Plugin/Info.plist new file mode 100644 index 0000000000..1007fd9dd7 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleVersion + $(CURRENT_PROJECT_VERSION) + NSPrincipalClass + + + diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h new file mode 100644 index 0000000000..5969c72bad --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h @@ -0,0 +1,4 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import \ No newline at end of file diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap b/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap new file mode 100644 index 0000000000..61b2ca0fc8 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap @@ -0,0 +1,4 @@ +module Wallet { + header "libwallet.h" + link "WalletFramework" +} diff --git a/bindings/capacitorjs/ios/PluginTests/Info.plist b/bindings/capacitorjs/ios/PluginTests/Info.plist new file mode 100644 index 0000000000..6c40a6cd0c --- /dev/null +++ b/bindings/capacitorjs/ios/PluginTests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + + diff --git a/bindings/capacitorjs/ios/PluginTests/PluginTests.swift b/bindings/capacitorjs/ios/PluginTests/PluginTests.swift new file mode 100644 index 0000000000..43621d491c --- /dev/null +++ b/bindings/capacitorjs/ios/PluginTests/PluginTests.swift @@ -0,0 +1,26 @@ +import XCTest +import Wallet +@testable import Plugin + +class WalletTests: XCTestCase { + override func setUp() { + super.setUp() + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDown() { + // Put teardown code here. This method is called after the invocation of each test method in the class. + super.tearDown() + } + + func testEcho() { + // This is an example of a functional test case for a plugin. + // Use XCTAssert and related functions to verify your tests produce the correct results. + + let implementation = Wallet() + let value = "Hello, World!" + let result = implementation.echo(value) + + XCTAssertEqual(value, result) + } +} diff --git a/bindings/capacitorjs/ios/Podfile b/bindings/capacitorjs/ios/Podfile new file mode 100644 index 0000000000..8fdf8429d1 --- /dev/null +++ b/bindings/capacitorjs/ios/Podfile @@ -0,0 +1,42 @@ +platform :ios, '12.0' + +def capacitor_pods + # Comment the next line if you're not using Swift and don't want to use dynamic frameworks + use_frameworks! + pod 'Capacitor', :path => '../node_modules/@capacitor/ios' + pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios' + # pod 'IotaWalletInternal', :podspec => './packages/mobile/capacitor/plugins/iota-wallet/IotaWalletInternal.podspec' + +end + +target 'Plugin' do + capacitor_pods + # use_frameworks! + # pod 'IotaWalletInternal', :path => 'WalletFramework.xcframework/' +end + +target 'PluginTests' do + capacitor_pods +end + +# post_install do |installer| +# installer.pods_project.build_configurations.each do |config| +# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" +# end + +# # Add WalletFramework.xcframework as a dependency of IotaWalletMobile +# # Based on https://github.com/CocoaPods/Xcodeproj/issues/408#issuecomment-249347379 +# # and https://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project + +# # Get the PBXFileReference to the framework +# pods = installer.pods_project.groups.find { |group| group.name == 'Pods' } +# pod = pods.children.find { |child| child.name == 'ios/WalletFramework.xcframework' } +# frameworks = pod.children.find { |child| child.name == 'Frameworks' } +# framework_file_ref = frameworks.children.first + +# target = installer.pods_project.targets.find { |target| target.name == 'IotaWalletMobile' } + +# # Add the framework to "Link Binary with Libraries" +# frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' } +# frameworks_build_phase.add_file_reference(framework_file_ref) +# end diff --git a/bindings/capacitorjs/ios/Podfile.lock b/bindings/capacitorjs/ios/Podfile.lock new file mode 100644 index 0000000000..39b15a7035 --- /dev/null +++ b/bindings/capacitorjs/ios/Podfile.lock @@ -0,0 +1,22 @@ +PODS: + - Capacitor (3.9.0): + - CapacitorCordova + - CapacitorCordova (3.9.0) + +DEPENDENCIES: + - "Capacitor (from `../node_modules/@capacitor/ios`)" + - "CapacitorCordova (from `../node_modules/@capacitor/ios`)" + +EXTERNAL SOURCES: + Capacitor: + :path: "../node_modules/@capacitor/ios" + CapacitorCordova: + :path: "../node_modules/@capacitor/ios" + +SPEC CHECKSUMS: + Capacitor: 706895818151b183fd1ef099465e47ad33e9239f + CapacitorCordova: 3c768ee86bbedd4b99b68551a78ed24128bacb40 + +PODFILE CHECKSUM: ad2225bca6fdeaff079382c262064cd89b2e5a80 + +COCOAPODS: 1.11.2 From 12318ae2cf166eafd3c623a8d2d30e4d20e87321 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 12:50:57 +0100 Subject: [PATCH 076/197] feat: implement swift plugin code --- bindings/capacitorjs/ios/Plugin/Plugin.h | 16 ++ bindings/capacitorjs/ios/Plugin/Plugin.m | 13 ++ bindings/capacitorjs/ios/Plugin/Plugin.swift | 212 +++++++++++++++++++ 3 files changed, 241 insertions(+) create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.h create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.m create mode 100644 bindings/capacitorjs/ios/Plugin/Plugin.swift diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.h b/bindings/capacitorjs/ios/Plugin/Plugin.h new file mode 100644 index 0000000000..e20890f9b2 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.h @@ -0,0 +1,16 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import +// TODO remove then of full test +// to use the walllet-ios-internal 0.2.2 unhide next line +// #import "libwallet.h" + +//! Project version number for Plugin. +FOUNDATION_EXPORT double PluginVersionNumber; + +//! Project version string for Plugin. +FOUNDATION_EXPORT const unsigned char PluginVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m new file mode 100644 index 0000000000..a097f9fe70 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -0,0 +1,13 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +#import +#import + +CAP_PLUGIN(IotaWalletMobile, "IotaWalletMobile", + CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(initialize, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(cleanListeners, CAPPluginReturnPromise); +) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift new file mode 100644 index 0000000000..bd8ee54c21 --- /dev/null +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -0,0 +1,212 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import Foundation +import Capacitor +import Wallet + +@objc(IotaWalletMobile) +public class IotaWalletMobile: CAPPlugin { + + // override public func load() { + // let fm = FileManager.default + // let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! + // let path = documents.appendingPathComponent("database", isDirectory: true).path + // if !fm.fileExists(atPath: path) { + // try? fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + // } + + // let manager_options = """ + // { + // "storagePath": "\(path)", + // "clientOptions": { + // "nodes": ["https://api.testnet.shimmer.network"], + // "localPow": true + // }, + // "coinType": 4219, + // "secretManager": { + // "Stronghold": { + // "snapshotPath": "\(path)/iota_wallet.stronghold", + // "password": "yourpasswordistooweak" + // } + // } + // } + // """ + // let options = manager_options.cString(using: .utf8) + // let error_buffer: UnsafeMutablePointer? = nil + // let error_buffer_size = 0 + // let filename = "\(path)/iota_wallet.log" + // let file_name = filename.cString(using: .utf8) + // let level_filter = "debug" + // let filter = level_filter.cString(using: .utf8) + // iota_init_logger(file_name, filter) + // let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + // print(Int(bitPattern: handler)) + // } + + // private var isInitialized: Bool = false + + @objc func messageHandlerNew(_ call: CAPPluginCall) { + do { + // guard !isInitialized else { return } + guard let options = call.getObject("options") else { + return call.reject("options are required") + } + guard JSONSerialization.isValidJSONObject(options) else { + return call.reject("Invalid JSON object") + } + let jsonData = try? JSONSerialization.data(withJSONObject: options) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + + let fm = FileManager.default + let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! + let path = documents.appendingPathComponent("database", isDirectory: true).path + if !fm.fileExists(atPath: path) { + try fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + } + // Exclude folder from auto-backup + var urlPath = URL(fileURLWithPath: path, isDirectory: true) + var values = URLResourceValues() + values.isExcludedFromBackup = true + try urlPath.setResourceValues(values) + + // call.keepAlive = true + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + let filename = "\(path)/iota_wallet.log" + let level_filter = "debug" + iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) + let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) + + call.resolve(["messageHandler": Int(bitPattern: handler)]) + // isInitialized = true + } catch { + call.reject("failed to initialize messageHandlerNew") + } + } + + @objc func destroy(_ call: CAPPluginCall) { + // guard isInitialized else { + // call.resolve() + // return + // } + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + // https://stackoverflow.com/questions/70799271/how-to-initialize-opaquepointer-in-swift + iota_destroy(OpaquePointer(bitPattern: handler)) + // isInitialized = false + call.resolve() + // TODO: we need to release calls? verify if is automatically removed as are saved + } + + @objc func sendMessage(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + + guard let message = call.getObject("message") else { + return call.reject("message is required") + } + guard JSONSerialization.isValidJSONObject(message) else { + return call.reject("Invalid JSON object") + } + let jsonData = try? JSONSerialization.data(withJSONObject: message) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + + call.keepAlive = true + // class Result { + // var detail: OpaquePointer? + + // init(messageHandler: OpaquePointer?) { + // self.detail = messageHandler + // } + // } + // let object = Result(messageHandler: messageHandler) + + // let context = Unmanaged.passRetained(object).toOpaque() + // let callback: Callback = { response, error, context in + // guard let context = context else { + // return + // } + // let object = Unmanaged.fromOpaque(context).takeRetainedValue() + // self.notifyListeners("walletEvent", data: ["result": object.detail]) + // } + +// typealias cCallback = Optional<@convention(c) ( +// Optional>, +// Optional>, +// Optional +// ) -> ()> + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("walletEvent", data: ["result": data]) + } + + + iota_send_message(messageHandler, jsonString, callback, nil) + call.resolve() + } + + @objc func listen(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + guard let eventTypes = call.getArray("eventTypes") else { + return call.reject("eventTypes is required") + } + let eventChar = eventTypes.description.cString(using: .utf8) + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + call.keepAlive = true + + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("listen", data: ["result": data]) + } + + iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + call.resolve() + } + + @objc func cleanListeners(_ call: CAPPluginCall) { + guard let handler = call.getInt("handler") else { + return call.reject("handler is required") + } + let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) + + guard let eventTypes = call.getArray("eventTypes") else { + return call.reject("eventTypes is required") + } + let eventChar = eventTypes.description.cString(using: .utf8) + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + call.keepAlive = true + + func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { + return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + } + let callback: Callback = cFunction { response, error, context in + let data: String = String(cString: response!) + self.notifyListeners("cleanListeners", data: ["result": data]) + } + + iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + call.resolve() + } +} From 0461c4ebd3d1fff5a0e357f5430bed464d5463b4 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:44:22 +0100 Subject: [PATCH 077/197] fix: add callbacks with context --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 144 +++++++++++++------ 1 file changed, 101 insertions(+), 43 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index bd8ee54c21..4b1014e644 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -40,8 +40,40 @@ public class IotaWalletMobile: CAPPlugin { // let level_filter = "debug" // let filter = level_filter.cString(using: .utf8) // iota_init_logger(file_name, filter) - // let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) - // print(Int(bitPattern: handler)) + // let handler = iota_initialize(options, error_buffer, error_buffer_size) + + + // let genMemonic = """ + // { + // "cmd": "generateMnemonic" + // } + // """ + + // func notifyLis(data: String) { + // notifyListeners("walletEvent", data: ["result": data]) + // } + // class ContextResult { + // var detail = "none" + // func notify(data: String) { + // notifyLis(data: data) + // } + // } + // let contextResult = ContextResult() + // let context = Unmanaged.passRetained(contextResult).toOpaque() + // let callback: Callback = { response, error, context in + // guard let context = context, + // let response = response else { return } + // let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + // if let error = error { + // contextResult.detail = String(cString: error) + // contextResult.notify(data: contextResult.detail) + // } + // contextResult.detail = String(cString: response) + // contextResult.notify(data: contextResult.detail) + // } + + // iota_send_message(handler, genMemonic, callback, context) + // } // private var isInitialized: Bool = false @@ -119,40 +151,33 @@ public class IotaWalletMobile: CAPPlugin { let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") call.keepAlive = true - // class Result { - // var detail: OpaquePointer? - - // init(messageHandler: OpaquePointer?) { - // self.detail = messageHandler - // } - // } - // let object = Result(messageHandler: messageHandler) - // let context = Unmanaged.passRetained(object).toOpaque() - // let callback: Callback = { response, error, context in - // guard let context = context else { - // return - // } - // let object = Unmanaged.fromOpaque(context).takeRetainedValue() - // self.notifyListeners("walletEvent", data: ["result": object.detail]) - // } - -// typealias cCallback = Optional<@convention(c) ( -// Optional>, -// Optional>, -// Optional -// ) -> ()> - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("walletEvent", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } - - iota_send_message(messageHandler, jsonString, callback, nil) - call.resolve() + iota_send_message(messageHandler, jsonString, callback, context) } @objc func listen(_ call: CAPPluginCall) { @@ -170,16 +195,32 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("listen", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) - call.resolve() } @objc func cleanListeners(_ call: CAPPluginCall) { @@ -198,12 +239,29 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - func cFunction(_ block: (@escaping @convention(block) (Optional>, Optional>, Optional) -> ())) -> (Callback) { - return unsafeBitCast(imp_implementationWithBlock(block), to: (Callback).self) + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } } - let callback: Callback = cFunction { response, error, context in - let data: String = String(cString: response!) - self.notifyListeners("cleanListeners", data: ["result": data]) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.notify(data: contextResult.detail) + } + contextResult.detail = String(cString: response) + contextResult.notify(data: contextResult.detail) } iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) From 42fc6afaab313a980a0d305313879ec73c494757 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:44:51 +0100 Subject: [PATCH 078/197] fix: plugin definitions --- bindings/capacitorjs/src/definitions.ts | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 404995ac0d..3986ea0fee 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -5,7 +5,6 @@ import { PluginListenerHandle } from "@capacitor/core" import { MessageHandler } from "./lib/MessageHandler" import type { EventType, - AccountManagerOptions, __Message__, __AccountMethod__, } from './types' @@ -13,21 +12,20 @@ import type { export * from './types' export interface IotaWalletMobileTypes { initLogger(path: string): Promise - messageHandlerNew(messageOptions: string): Promise - clearListeners( - eventTypes: EventType[], - messageHandler: any - ): void - initialize(options: AccountManagerOptions): Promise + messageHandlerNew(options: string): Promise + sendMessage( + message: string, + handler :MessageHandler, + callback: (error: Error, result: string) => void + ): PluginListenerHandle listen( eventTypes: EventType[], callback: (error: Error, result: string) => void, messageHandler: any ): void + clearListeners( + eventTypes: EventType[], + messageHandler: any + ): void destroy(messageHandler: any): void - sendMessage( - message: string, - handler :MessageHandler, - callback: (error: Error, result: string) => void - ): PluginListenerHandle } From 4ffc66f3aeb975eeb16480641caf79e51e83835a Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 6 Dec 2022 23:50:29 +0100 Subject: [PATCH 079/197] chore: tidy up swift side --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 131 ++----------------- 1 file changed, 14 insertions(+), 117 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 4b1014e644..b3bb748767 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,79 +8,20 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // override public func load() { - // let fm = FileManager.default - // let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! - // let path = documents.appendingPathComponent("database", isDirectory: true).path - // if !fm.fileExists(atPath: path) { - // try? fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) - // } - - // let manager_options = """ - // { - // "storagePath": "\(path)", - // "clientOptions": { - // "nodes": ["https://api.testnet.shimmer.network"], - // "localPow": true - // }, - // "coinType": 4219, - // "secretManager": { - // "Stronghold": { - // "snapshotPath": "\(path)/iota_wallet.stronghold", - // "password": "yourpasswordistooweak" - // } - // } - // } - // """ - // let options = manager_options.cString(using: .utf8) - // let error_buffer: UnsafeMutablePointer? = nil - // let error_buffer_size = 0 - // let filename = "\(path)/iota_wallet.log" - // let file_name = filename.cString(using: .utf8) - // let level_filter = "debug" - // let filter = level_filter.cString(using: .utf8) - // iota_init_logger(file_name, filter) - // let handler = iota_initialize(options, error_buffer, error_buffer_size) - - - // let genMemonic = """ - // { - // "cmd": "generateMnemonic" - // } - // """ - - // func notifyLis(data: String) { - // notifyListeners("walletEvent", data: ["result": data]) - // } - // class ContextResult { - // var detail = "none" - // func notify(data: String) { - // notifyLis(data: data) - // } - // } - // let contextResult = ContextResult() - // let context = Unmanaged.passRetained(contextResult).toOpaque() - // let callback: Callback = { response, error, context in - // guard let context = context, - // let response = response else { return } - // let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - // if let error = error { - // contextResult.detail = String(cString: error) - // contextResult.notify(data: contextResult.detail) - // } - // contextResult.detail = String(cString: response) - // contextResult.notify(data: contextResult.detail) - // } - - // iota_send_message(handler, genMemonic, callback, context) - - // } - - // private var isInitialized: Bool = false - + class ContextResult { + var detail = "none" + var call: CAPPluginCall + init(_call: CAPPluginCall) { + self.call = _call + } + func notify(data: String) { + self.call.resolve(["result": data]) + self.call.keepAlive = false + } + } + @objc func messageHandlerNew(_ call: CAPPluginCall) { do { - // guard !isInitialized else { return } guard let options = call.getObject("options") else { return call.reject("options are required") } @@ -103,8 +44,6 @@ public class IotaWalletMobile: CAPPlugin { values.isExcludedFromBackup = true try urlPath.setResourceValues(values) - // call.keepAlive = true - let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 let filename = "\(path)/iota_wallet.log" @@ -113,25 +52,17 @@ public class IotaWalletMobile: CAPPlugin { let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) call.resolve(["messageHandler": Int(bitPattern: handler)]) - // isInitialized = true } catch { call.reject("failed to initialize messageHandlerNew") } } @objc func destroy(_ call: CAPPluginCall) { - // guard isInitialized else { - // call.resolve() - // return - // } guard let handler = call.getInt("handler") else { return call.reject("handler is required") } - // https://stackoverflow.com/questions/70799271/how-to-initialize-opaquepointer-in-swift iota_destroy(OpaquePointer(bitPattern: handler)) - // isInitialized = false call.resolve() - // TODO: we need to release calls? verify if is automatically removed as are saved } @objc func sendMessage(_ call: CAPPluginCall) { @@ -152,17 +83,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -195,17 +115,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -220,7 +129,7 @@ public class IotaWalletMobile: CAPPlugin { contextResult.notify(data: contextResult.detail) } - iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) + iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) } @objc func cleanListeners(_ call: CAPPluginCall) { @@ -239,17 +148,6 @@ public class IotaWalletMobile: CAPPlugin { call.keepAlive = true - class ContextResult { - var detail = "none" - var call: CAPPluginCall - init(_call: CAPPluginCall) { - self.call = _call - } - func notify(data: String) { - self.call.resolve(["result": data]) - self.call.keepAlive = false - } - } let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() let callback: Callback = { response, error, context in @@ -264,7 +162,6 @@ public class IotaWalletMobile: CAPPlugin { contextResult.notify(data: contextResult.detail) } - iota_listen(messageHandler, eventChar, callback, nil, error_buffer, error_buffer_size) - call.resolve() + iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) } } From 5050489696e0c1da167ace1a7106a9841469e125 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:19:32 +0100 Subject: [PATCH 080/197] fix: ios plugin code --- bindings/capacitorjs/ios/Plugin/Plugin.m | 7 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 196 ++++++++++++------- 2 files changed, 125 insertions(+), 78 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index a097f9fe70..b45f1e8500 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -5,9 +5,10 @@ #import CAP_PLUGIN(IotaWalletMobile, "IotaWalletMobile", + CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); + CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnCallback); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(initialize, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(cleanListeners, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index b3bb748767..2857de287d 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,57 +8,117 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { + // Handle the cross-lang pointers with a context object class ContextResult { - var detail = "none" + // details will hold the result string value from C++ + var detail = "" + // the call is used to send back the context response var call: CAPPluginCall init(_call: CAPPluginCall) { self.call = _call } - func notify(data: String) { + deinit { + print("Context result object \(detail) deinit") + } + func resolve(data: String) { + self.call.resolve(["result": data]) +// self.call.keepAlive = false + } + func listen(data: String) { self.call.resolve(["result": data]) - self.call.keepAlive = false +// self.call.keepAlive = false + } + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.detail = String(cString: error) + contextResult.resolve(data: contextResult.detail) + return + } + print(type(of: response), response) + contextResult.detail = String(cString: response) + contextResult.resolve(data: contextResult.detail) + return } } + // TODO: we really need pass this params from swift? + private let error_buffer: UnsafeMutablePointer? = nil + private let error_buffer_size = 0 + @objc func messageHandlerNew(_ call: CAPPluginCall) { do { - guard let options = call.getObject("options") else { - return call.reject("options are required") + print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) + guard let storagePath = call.getString("storagePath") else { + return call.reject("storagePath are required") } - guard JSONSerialization.isValidJSONObject(options) else { - return call.reject("Invalid JSON object") - } - let jsonData = try? JSONSerialization.data(withJSONObject: options) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? - let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") - + + // prepare the internal app directory path let fm = FileManager.default - let documents = fm.urls(for: .applicationSupportDirectory, in: .userDomainMask).first! - let path = documents.appendingPathComponent("database", isDirectory: true).path + guard let documents = fm.urls( + for: .applicationSupportDirectory, + in: .userDomainMask + ).first else { + return call.reject("can not create the path") + } + let path = documents.appendingPathComponent( + storagePath, + isDirectory: true + ).path + if !fm.fileExists(atPath: path) { - try fm.createDirectory(atPath: path, withIntermediateDirectories: true, attributes: nil) + try fm.createDirectory( + atPath: path, + withIntermediateDirectories: true, + attributes: nil + ) } + // Exclude folder from auto-backup var urlPath = URL(fileURLWithPath: path, isDirectory: true) var values = URLResourceValues() values.isExcludedFromBackup = true try urlPath.setResourceValues(values) + + // we need to modify the path on the JS object + let options = """ + { + "storagePath":"\(path)", + "clientOptions":{ + "nodes":[{ + "url":"https://api.testnet.shimmer.network", + "auth":{"username":"","password":""},"disabled":false + }] + }, + "coinType":4219, + "secretManager":{ + "stronghold":{ + "snapshotPath":"\(path)/wallet.stronghold" + }} + } + """ + print(options) - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 + // TODO: implement logger as a fn let filename = "\(path)/iota_wallet.log" let level_filter = "debug" iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) - let handler: OpaquePointer? = iota_initialize(jsonString.cString(using: .utf8), error_buffer, error_buffer_size) - + + // Keep the C++ handler / pointer of the messageHandler call result + let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + // Convert pointer to integer keeping bit pattern call.resolve(["messageHandler": Int(bitPattern: handler)]) + } catch { call.reject("failed to initialize messageHandlerNew") } } @objc func destroy(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + print("Capacitor call destroy received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } iota_destroy(OpaquePointer(bitPattern: handler)) @@ -66,42 +126,35 @@ public class IotaWalletMobile: CAPPlugin { } @objc func sendMessage(_ call: CAPPluginCall) { +// print("Capacitor call sendMessage received", call.jsObjectRepresentation) guard let handler = call.getInt("handler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) - guard let message = call.getObject("message") else { + // replacing for urls slashes since it's serialized on JS + guard let message = call.getString("message")? + .replacingOccurrences(of: "\\", with: "") else { return call.reject("message is required") } - guard JSONSerialization.isValidJSONObject(message) else { - return call.reject("Invalid JSON object") - } - let jsonData = try? JSONSerialization.data(withJSONObject: message) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? - let jsonString = String(data: jsonData!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") +// print(message) + // Keep the call awaiting the result, later inside the callback + // the passed call will send the result and disable keep alive call.keepAlive = true + // the object to be passed as a context data on their callback let contextResult = ContextResult(_call: call) + // context var to be passed on the object callback + // where it will be converted back to object type ready to use let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_send_message(messageHandler, jsonString, callback, context) + + iota_send_message(messageHandler, message, contextResult.callback, context) } @objc func listen(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + print("Capacitor call listen received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) @@ -109,31 +162,35 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("eventTypes is required") } let eventChar = eventTypes.description.cString(using: .utf8) - - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 call.keepAlive = true let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) +// let callback: Callback = { response, error, context in +// guard let context = context, +// let response = response else { return } +// let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() +// if let error = error { +// contextResult.detail = String(cString: error) +// contextResult.listen(data: contextResult.detail) +// return +// } +// print(type(of: response), response) +// contextResult.detail = String(cString: response) +// contextResult.listen(data: contextResult.detail) +// } + + let ret = iota_listen( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) + print("ret", ret) } - @objc func cleanListeners(_ call: CAPPluginCall) { - guard let handler = call.getInt("handler") else { + @objc func clearListeners(_ call: CAPPluginCall) { + print("Capacitor call clearListeners received", call.jsObjectRepresentation) + guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) @@ -143,25 +200,14 @@ public class IotaWalletMobile: CAPPlugin { } let eventChar = eventTypes.description.cString(using: .utf8) - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 - call.keepAlive = true let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.detail = String(cString: error) - contextResult.notify(data: contextResult.detail) - } - contextResult.detail = String(cString: response) - contextResult.notify(data: contextResult.detail) - } - - iota_listen(messageHandler, eventChar, callback, context, error_buffer, error_buffer_size) + +// iota_clear_listeners( +// messageHandler, eventChar, contextResult.callback, context, +// error_buffer, error_buffer_size +// ) } } From 6cea33e697c7c878c282d5b80cbd989ff03d1183 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:20:25 +0100 Subject: [PATCH 081/197] chore: update xcframework --- .../WalletFramework.framework/Headers/WalletFramework.h | 1 - .../ios-x86/WalletFramework.framework/Headers/WalletFramework.h | 1 - 2 files changed, 2 deletions(-) diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h index c3853f0c1c..bca40949e9 100644 --- a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -13,7 +13,6 @@ typedef struct iota_wallet_handle iota_wallet_handle_t; typedef void (*Callback)(const char* response, const char* error, void* context); -// Initialise the fern logger. Level filter defaults to Debug if omitted extern int8_t iota_init_logger(const char* file_name, const char* level_filter); extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); extern void iota_destroy(iota_wallet_handle_t*); diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h index c3853f0c1c..bca40949e9 100644 --- a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h +++ b/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -13,7 +13,6 @@ typedef struct iota_wallet_handle iota_wallet_handle_t; typedef void (*Callback)(const char* response, const char* error, void* context); -// Initialise the fern logger. Level filter defaults to Debug if omitted extern int8_t iota_init_logger(const char* file_name, const char* level_filter); extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* error_buffer, size_t error_buffer_size); extern void iota_destroy(iota_wallet_handle_t*); From 51c61e53cb2855ab169d1d3d3936e4f4237d5658 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 21 Dec 2022 15:21:14 +0100 Subject: [PATCH 082/197] chore: update plugin definitions --- bindings/capacitorjs/src/definitions.ts | 48 ++++++++++++++++--------- bindings/capacitorjs/src/index.ts | 21 +++++------ 2 files changed, 40 insertions(+), 29 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 3986ea0fee..dc1d530994 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,31 +1,47 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { PluginListenerHandle } from "@capacitor/core" -import { MessageHandler } from "./lib/MessageHandler" +// import { PluginListenerHandle } from "@capacitor/core" +// import type { MessageHandler } from "./lib/MessageHandler" import type { EventType, __Message__, __AccountMethod__, + // AccountManagerOptions, } from './types' -export * from './types' + export interface IotaWalletMobileTypes { initLogger(path: string): Promise - messageHandlerNew(options: string): Promise - sendMessage( + + messageHandlerNew(messageOptions: { + storagePath: string + }): Promise<{ messageHandler: number }> + + sendMessage(messageOptions: { message: string, - handler :MessageHandler, - callback: (error: Error, result: string) => void - ): PluginListenerHandle + handler : number, + }): Promise<{ result: string }> + listen( - eventTypes: EventType[], - callback: (error: Error, result: string) => void, - messageHandler: any - ): void - clearListeners( + options: { + eventTypes: EventType[]; + messageHandler: number; + }, + callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void + ): Promise; + + clearListeners(options: { eventTypes: EventType[], - messageHandler: any - ): void - destroy(messageHandler: any): void + messageHandler: number + }): Promise<{ result: string }> + + destroy(options: { + messageHandler: number + }): Promise; } diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts index 57be241602..38d0dd11d6 100644 --- a/bindings/capacitorjs/src/index.ts +++ b/bindings/capacitorjs/src/index.ts @@ -1,17 +1,12 @@ -// Copyright 2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 +import { registerPlugin } from '@capacitor/core' -import { internalInitLogger } from './lib/bindings' -import type { LoggerConfig } from './types' +import { IotaWalletMobileTypes } from './definitions' -export * from './lib/AccountManager' -export * from './lib/MessageHandler' -export * from './lib/Account' -// Moved to definitions.ts, TODO modify tsconfig to adapt it -// export * from './types' +const IotaWalletMobile = registerPlugin('IotaWalletMobile') -/** Function to create wallet logs */ -const initLogger = (config: LoggerConfig) => - internalInitLogger(JSON.stringify(config)) +// import * as WalletApi from './lib/index.js' -export { initLogger } +// IotaWalletMobile.WalletApi = WalletApi + +export * from './definitions' +export { IotaWalletMobile } From a0a8e32844ef08fc7680b3ac18870c5ec445e9af Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 30 Dec 2022 22:41:38 +0100 Subject: [PATCH 083/197] chore: add android plugin Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/.gitignore | 72 ++++++++ bindings/capacitorjs/android/.npmignore | 1 + bindings/capacitorjs/android/build.gradle | 55 ++++++ .../capacitorjs/android/gradle.properties | 21 +++ .../android/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 53636 bytes .../gradle/wrapper/gradle-wrapper.properties | 6 + bindings/capacitorjs/android/gradlew | 160 ++++++++++++++++++ bindings/capacitorjs/android/gradlew.bat | 90 ++++++++++ .../capacitorjs/android/proguard-rules.pro | 21 +++ bindings/capacitorjs/android/settings.gradle | 2 + .../android/ExampleInstrumentedTest.java | 27 +++ .../android/src/main/AndroidManifest.xml | 5 + .../iotawalletmobile/IotaWalletMobile.java | 159 +++++++++++++++++ .../main/res/layout/bridge_layout_main.xml | 15 ++ .../android/src/main/res/values/colors.xml | 3 + .../android/src/main/res/values/strings.xml | 3 + .../android/src/main/res/values/styles.xml | 3 + .../com/getcapacitor/ExampleUnitTest.java | 17 ++ 18 files changed, 660 insertions(+) create mode 100644 bindings/capacitorjs/android/.gitignore create mode 100644 bindings/capacitorjs/android/.npmignore create mode 100644 bindings/capacitorjs/android/build.gradle create mode 100644 bindings/capacitorjs/android/gradle.properties create mode 100644 bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar create mode 100644 bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties create mode 100755 bindings/capacitorjs/android/gradlew create mode 100644 bindings/capacitorjs/android/gradlew.bat create mode 100644 bindings/capacitorjs/android/proguard-rules.pro create mode 100644 bindings/capacitorjs/android/settings.gradle create mode 100644 bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java create mode 100644 bindings/capacitorjs/android/src/main/AndroidManifest.xml create mode 100644 bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java create mode 100644 bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/colors.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/strings.xml create mode 100644 bindings/capacitorjs/android/src/main/res/values/styles.xml create mode 100644 bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java diff --git a/bindings/capacitorjs/android/.gitignore b/bindings/capacitorjs/android/.gitignore new file mode 100644 index 0000000000..028140319e --- /dev/null +++ b/bindings/capacitorjs/android/.gitignore @@ -0,0 +1,72 @@ +# NPM renames .gitignore to .npmignore +# In order to prevent that, we remove the initial "." +# And the CLI then renames it + +# Using Android gitignore template: https://github.com/github/gitignore/blob/master/Android.gitignore + +# Built application files +*.apk +*.ap_ + +# Files for the ART/Dalvik VM +*.dex + +# Java class files +*.class + +# Generated files +bin/ +gen/ +out/ + +# Gradle files +.gradle/ +build/ + +# Local configuration file (sdk path, etc) +local.properties + +# Proguard folder generated by Eclipse +proguard/ + +# Log Files +*.log + +# Android Studio Navigation editor temp files +.navigation/ + +# Android Studio captures folder +captures/ + +# IntelliJ +*.iml +.idea/workspace.xml +.idea/tasks.xml +.idea/gradle.xml +.idea/dictionaries +.idea/libraries + +# Keystore files +# Uncomment the following line if you do not want to check your keystore files in. +#*.jks + +# External native build folder generated in Android Studio 2.2 and later +.externalNativeBuild + +# Freeline +freeline.py +freeline/ +freeline_project_description.json + +# fastlane +fastlane/report.xml +fastlane/Preview.html +fastlane/screenshots +fastlane/test_output +fastlane/readme.md + +# Cordova plugins for Capacitor +capacitor-cordova-android-plugins + +# Copied web assets +app/src/main/assets/public \ No newline at end of file diff --git a/bindings/capacitorjs/android/.npmignore b/bindings/capacitorjs/android/.npmignore new file mode 100644 index 0000000000..796b96d1c4 --- /dev/null +++ b/bindings/capacitorjs/android/.npmignore @@ -0,0 +1 @@ +/build diff --git a/bindings/capacitorjs/android/build.gradle b/bindings/capacitorjs/android/build.gradle new file mode 100644 index 0000000000..d41a73100e --- /dev/null +++ b/bindings/capacitorjs/android/build.gradle @@ -0,0 +1,55 @@ +ext { + junitVersion = project.hasProperty('junitVersion') ? rootProject.ext.junitVersion : '4.13.1' + androidxJunitVersion = project.hasProperty('androidxJunitVersion') ? rootProject.ext.androidxJunitVersion : '1.1.2' + androidxEspressoCoreVersion = project.hasProperty('androidxEspressoCoreVersion') ? rootProject.ext.androidxEspressoCoreVersion : '3.3.0' +} + +buildscript { + repositories { + google() + jcenter() + } + dependencies { + classpath 'com.android.tools.build:gradle:4.2.1' + } +} + +apply plugin: 'com.android.library' + +android { + compileSdkVersion project.hasProperty('compileSdkVersion') ? rootProject.ext.compileSdkVersion : 30 + defaultConfig { + minSdkVersion project.hasProperty('minSdkVersion') ? rootProject.ext.minSdkVersion : 21 + targetSdkVersion project.hasProperty('targetSdkVersion') ? rootProject.ext.targetSdkVersion : 30 + versionCode 1 + versionName "1.0" + testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" + } + buildTypes { + release { + minifyEnabled false + proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + } + } + lintOptions { + abortOnError false + } + compileOptions { + sourceCompatibility JavaVersion.VERSION_1_8 + targetCompatibility JavaVersion.VERSION_1_8 + } +} + +repositories { + google() + jcenter() + mavenCentral() +} + +dependencies { + implementation fileTree(dir: 'libs', include: ['*.jar']) + implementation project(':capacitor-android') + testImplementation "junit:junit:$junitVersion" + androidTestImplementation "androidx.test.ext:junit:$androidxJunitVersion" + androidTestImplementation "androidx.test.espresso:espresso-core:$androidxEspressoCoreVersion" +} diff --git a/bindings/capacitorjs/android/gradle.properties b/bindings/capacitorjs/android/gradle.properties new file mode 100644 index 0000000000..2dbcb07109 --- /dev/null +++ b/bindings/capacitorjs/android/gradle.properties @@ -0,0 +1,21 @@ +# Project-wide Gradle settings. + +# IDE (e.g. Android Studio) users: +# Gradle settings configured through the IDE *will override* +# any settings specified in this file. + +# For more details on how to configure your build environment visit +# http://www.gradle.org/docs/current/userguide/build_environment.html + +# Specifies the JVM arguments used for the daemon process. +# The setting is particularly useful for tweaking memory settings. +org.gradle.jvmargs=-Xmx1536m + +# When configured, Gradle will run in incubating parallel mode. +# This option should only be used with decoupled projects. More details, visit +# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects +# org.gradle.parallel=true + +# Supports AndroidX +android.useAndroidX=true +android.enableJetifier=true \ No newline at end of file diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..13372aef5e24af05341d49695ee84e5f9b594659 GIT binary patch literal 53636 zcmafaW0a=B^559DjdyHo$F^PVt zzd|cWgMz^T0YO0lQ8%TE1O06v|NZl~LH{LLQ58WtNjWhFP#}eWVO&eiP!jmdp!%24 z{&z-MK{-h=QDqf+S+Pgi=_wg$I{F28X*%lJ>A7Yl#$}fMhymMu?R9TEB?#6@|Q^e^AHhxcRL$z1gsc`-Q`3j+eYAd<4@z^{+?JM8bmu zSVlrVZ5-)SzLn&LU9GhXYG{{I+u(+6ES+tAtQUanYC0^6kWkks8cG;C&r1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20+WQ79T9&cqT>=I_U% z{=8~^Isg(Nzo~`4iQfIb_#CVCD>#5h>=-Z#5dH}WxYzn%0)GAm6L2WdUdP=0_h>7f z(jh&7%1i(ZOn+}D8$iGK4Vs{pmHl_w4Qm-46H9>4^{3dz^DZDh+dw)6Xd@CpQNK$j z{CU;-cmpK=egplZ3y3%y=sEnCJ^eYVKXzV8H2_r*fJ*%*B;a1_lOpt6)IT1IAK2eB z{rie|uDJUrbgfUE>~C>@RO|m5ex55F{=~Bb4Cucp{ok7Yf9V}QuZ`#Gc|WaqsQlK- zKaV)iMRR__&Ak2Z=IM9R9g5$WM4u{a^C-7uX*!myEym z#_#p^T!P~#Dx$%^K>Y_nj_3J*E_LwJ60-5Xu=LkJAwcP@|0;a&+|+ZX`Jbj9P5;T% z|KOc}4*#4o{U?09`9Hz`Xo-I!P=9XfIrr*MQ}y=$!qgv?_J38^bNb4kM&_OVg^_=Eu-qG5U(fw0KMgH){C8pazq~51rN97hf#20-7=aK0)N|UM H-+%o-(+5aQ literal 0 HcmV?d00001 diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000000..6047798096 --- /dev/null +++ b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,6 @@ +#Fri Dec 01 12:41:00 CST 2017 +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip diff --git a/bindings/capacitorjs/android/gradlew b/bindings/capacitorjs/android/gradlew new file mode 100755 index 0000000000..9d82f78915 --- /dev/null +++ b/bindings/capacitorjs/android/gradlew @@ -0,0 +1,160 @@ +#!/usr/bin/env bash + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn ( ) { + echo "$*" +} + +die ( ) { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; +esac + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules +function splitJvmOpts() { + JVM_OPTS=("$@") +} +eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS +JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" + +exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/bindings/capacitorjs/android/gradlew.bat b/bindings/capacitorjs/android/gradlew.bat new file mode 100644 index 0000000000..aec99730b4 --- /dev/null +++ b/bindings/capacitorjs/android/gradlew.bat @@ -0,0 +1,90 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windowz variants + +if not "%OS%" == "Windows_NT" goto win9xME_args +if "%@eval[2+2]" == "4" goto 4NT_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* +goto execute + +:4NT_args +@rem Get arguments from the 4NT Shell from JP Software +set CMD_LINE_ARGS=%$ + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/bindings/capacitorjs/android/proguard-rules.pro b/bindings/capacitorjs/android/proguard-rules.pro new file mode 100644 index 0000000000..f1b424510d --- /dev/null +++ b/bindings/capacitorjs/android/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/bindings/capacitorjs/android/settings.gradle b/bindings/capacitorjs/android/settings.gradle new file mode 100644 index 0000000000..b6cd38dcd1 --- /dev/null +++ b/bindings/capacitorjs/android/settings.gradle @@ -0,0 +1,2 @@ +include ':capacitor-android' +project(':capacitor-android').projectDir = new File('../node_modules/@capacitor/android/capacitor') diff --git a/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java b/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java new file mode 100644 index 0000000000..64f83739d7 --- /dev/null +++ b/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java @@ -0,0 +1,27 @@ +package com.getcapacitor.android; + +import android.content.Context; + +import androidx.test.platform.app.InstrumentationRegistry; +import androidx.test.ext.junit.runners.AndroidJUnit4; + +import org.junit.Test; +import org.junit.runner.RunWith; + +import static org.junit.Assert.*; + +/** + * Instrumented test, which will execute on an Android device. + * + * @see Testing documentation + */ +@RunWith(AndroidJUnit4.class) +public class ExampleInstrumentedTest { + @Test + public void useAppContext() throws Exception { + // Context of the app under test. + Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); + + assertEquals("com.getcapacitor.android", appContext.getPackageName()); + } +} diff --git a/bindings/capacitorjs/android/src/main/AndroidManifest.xml b/bindings/capacitorjs/android/src/main/AndroidManifest.xml new file mode 100644 index 0000000000..7cd289dcd3 --- /dev/null +++ b/bindings/capacitorjs/android/src/main/AndroidManifest.xml @@ -0,0 +1,5 @@ + + + + diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java new file mode 100644 index 0000000000..a009fcf55a --- /dev/null +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -0,0 +1,159 @@ +// Copyright 2022 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +package org.iota.iotawalletmobile; + +import android.util.Log; + +import com.getcapacitor.JSArray; +import com.getcapacitor.JSObject; +import com.getcapacitor.Plugin; +import com.getcapacitor.PluginCall; +import com.getcapacitor.PluginMethod; +import com.getcapacitor.annotation.CapacitorPlugin; + +import java.util.Arrays; +import java.util.List; + +import org.iota.Wallet; +import org.iota.api.WalletCommand; +import org.iota.types.ClientConfig; +import org.iota.types.CoinType; +import org.iota.types.WalletConfig; +import org.iota.types.events.Event; +import org.iota.types.events.EventListener; +import org.iota.types.events.transaction.TransactionProgressEvent; +import org.iota.types.events.wallet.WalletEventType; +import org.iota.types.exceptions.WalletException; +import org.iota.types.secret.StrongholdSecretManager; +import org.json.JSONException; + +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParser; + +import static org.iota.api.NativeApi.callBaseApi; + + +@CapacitorPlugin(name = "IotaWalletMobile") +public class IotaWalletMobile extends Plugin { + + Wallet wallet = null; + + @PluginMethod() + public void messageHandlerNew(final PluginCall call) { + + if (!call.getData().has("clientOptions") + || !call.getData().has("storagePath") + || !call.getData().has("coinType") + || !call.getData().has("secretManager")) { + call.reject("clientOptions, storagePath, coinType and secretManager are required"); + } + JSObject clientOptions = call.getObject("clientOptions"); + String storagePath = call.getString("storagePath"); + Integer coinType = call.getInt("coinType"); + JSObject secretManager = call.getObject("secretManager"); + String path = getContext().getFilesDir() + storagePath; + + try { + wallet = new Wallet(new WalletConfig() + .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) + .withStoragePath(path) + .withSecretManager( + new StrongholdSecretManager("", null, path + "/wallet.stronghold")) + .withCoinType(CoinType.Shimmer) + ); + JSObject ret = new JSObject(); + ret.put("messageHandler", 1); + call.resolve(ret); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @PluginMethod() + public void sendMessage(final PluginCall call) { + try { + if (!call.getData().has("message")) { + call.reject("message are required"); + } + String message = call.getString("message"); + if (message == null) { + return; + } + + JsonElement element = JsonParser.parseString(message); + JsonObject jsonObject = element.getAsJsonObject(); + WalletCommand walletCommand; + if (jsonObject.has("payload")) { + walletCommand = new WalletCommand( + jsonObject.get("cmd").getAsString(), + jsonObject.get("payload") + ); + } + else { + walletCommand = new WalletCommand(jsonObject.get("cmd").getAsString()); + + } + JsonElement jsonResponse = callBaseApi(walletCommand); + JSObject ret = new JSObject(); + if (jsonResponse != null) { + Log.d("jsonResponse", jsonResponse.toString()); + JsonObject clientResponse = new JsonObject(); + clientResponse.addProperty("type", jsonObject.get("cmd").getAsString()); + clientResponse.add("payload", jsonResponse); + ret.put("result", clientResponse.toString()); + } else { + ret.put("result", "Ok"); + } + call.resolve(ret); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + Log.d("sendMessage Error", ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + + @PluginMethod() + public void listen(final PluginCall call) throws WalletException, JSONException { + if (!call.getData().has("eventTypes")) { + call.reject("eventTypes and event are required"); + } + JSArray eventTypes = call.getArray("eventTypes"); + try { + wallet.listen(new EventListener() { + @Override + public void receive(Event event) { + JSObject walletResponse = new JSObject(); + System.out.println( + System.lineSeparator() + "Event receive: " + event.getEvent().getClass().getSimpleName()); + if (event.getEvent() instanceof TransactionProgressEvent) { + TransactionProgressEvent progress = (TransactionProgressEvent) event.getEvent(); + System.out.println(progress.toString()); + walletResponse.put("result", progress.toString()); + call.resolve(walletResponse); + } else { + System.out.println(event.getEvent().toString()); + walletResponse.put("result", event.getEvent().toString()); + call.resolve(walletResponse); + } + } + }); + } catch (WalletException e) { + e.printStackTrace(); + } + call.setKeepAlive(true); + call.resolve(); + } + + + @PluginMethod() + public void destroy(final PluginCall call) { + try { + wallet.destroy(); + call.release(bridge); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + +} diff --git a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml new file mode 100644 index 0000000000..56fec1546a --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml @@ -0,0 +1,15 @@ + + + + + + diff --git a/bindings/capacitorjs/android/src/main/res/values/colors.xml b/bindings/capacitorjs/android/src/main/res/values/colors.xml new file mode 100644 index 0000000000..045e125f3d --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/colors.xml @@ -0,0 +1,3 @@ + + + diff --git a/bindings/capacitorjs/android/src/main/res/values/strings.xml b/bindings/capacitorjs/android/src/main/res/values/strings.xml new file mode 100644 index 0000000000..6789e139cf --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/strings.xml @@ -0,0 +1,3 @@ + + Just a simple string + diff --git a/bindings/capacitorjs/android/src/main/res/values/styles.xml b/bindings/capacitorjs/android/src/main/res/values/styles.xml new file mode 100644 index 0000000000..f11f7450a8 --- /dev/null +++ b/bindings/capacitorjs/android/src/main/res/values/styles.xml @@ -0,0 +1,3 @@ + + + diff --git a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java new file mode 100644 index 0000000000..06806a7758 --- /dev/null +++ b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java @@ -0,0 +1,17 @@ +package com.getcapacitor; + +import org.junit.Test; + +import static org.junit.Assert.*; + +/** + * Example local unit test, which will execute on the development machine (host). + * + * @see Testing documentation + */ +public class ExampleUnitTest { + @Test + public void addition_isCorrect() throws Exception { + assertEquals(4, 2 + 2); + } +} \ No newline at end of file From 50c78454205241fb302b058e32d406a32559fbdd Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 9 Jan 2023 23:21:04 +0100 Subject: [PATCH 084/197] fix: Swift listen fn Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.m | 4 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 88 ++++++++------------ 2 files changed, 37 insertions(+), 55 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index b45f1e8500..dda97c8578 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -8,7 +8,7 @@ CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); - CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnCallback); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 2857de287d..cfcb0aeb99 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -17,17 +17,11 @@ public class IotaWalletMobile: CAPPlugin { init(_call: CAPPluginCall) { self.call = _call } - deinit { - print("Context result object \(detail) deinit") - } + func resolve(data: String) { self.call.resolve(["result": data]) -// self.call.keepAlive = false - } - func listen(data: String) { - self.call.resolve(["result": data]) -// self.call.keepAlive = false } + let callback: Callback = { response, error, context in guard let context = context, let response = response else { return } @@ -51,10 +45,23 @@ public class IotaWalletMobile: CAPPlugin { @objc func messageHandlerNew(_ call: CAPPluginCall) { do { print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) - guard let storagePath = call.getString("storagePath") else { - return call.reject("storagePath are required") + guard let storagePath = call.getString("storagePath"), + let clientOptions = call.getObject("clientOptions"), + let coinType = call.getInt("coinType"), + let secretManager = call.getObject("secretManager") else { + return call.reject("storagePath, clientOptions, coinType, and secretManager are required") } + guard JSONSerialization.isValidJSONObject(clientOptions), + JSONSerialization.isValidJSONObject(secretManager) else { + return call.reject("clientOptions or secretManager is an invalid JSON object") + } + let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? + let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") + let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) + let stringfiedSecretManager = String(data: SecretManager!, encoding: .utf8)! + print(stringfiedSecretManager) // prepare the internal app directory path let fm = FileManager.default guard let documents = fm.urls( @@ -86,13 +93,8 @@ public class IotaWalletMobile: CAPPlugin { let options = """ { "storagePath":"\(path)", - "clientOptions":{ - "nodes":[{ - "url":"https://api.testnet.shimmer.network", - "auth":{"username":"","password":""},"disabled":false - }] - }, - "coinType":4219, + "clientOptions":\(String(describing: stringfiedClientOptions)), + "coinType":\(coinType), "secretManager":{ "stronghold":{ "snapshotPath":"\(path)/wallet.stronghold" @@ -126,7 +128,6 @@ public class IotaWalletMobile: CAPPlugin { } @objc func sendMessage(_ call: CAPPluginCall) { -// print("Capacitor call sendMessage received", call.jsObjectRepresentation) guard let handler = call.getInt("handler") else { return call.reject("handler is required") } @@ -137,11 +138,6 @@ public class IotaWalletMobile: CAPPlugin { .replacingOccurrences(of: "\\", with: "") else { return call.reject("message is required") } -// print(message) - - // Keep the call awaiting the result, later inside the callback - // the passed call will send the result and disable keep alive - call.keepAlive = true // the object to be passed as a context data on their callback let contextResult = ContextResult(_call: call) @@ -161,31 +157,19 @@ public class IotaWalletMobile: CAPPlugin { guard let eventTypes = call.getArray("eventTypes") else { return call.reject("eventTypes is required") } - let eventChar = eventTypes.description.cString(using: .utf8) - call.keepAlive = true - - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() -// let callback: Callback = { response, error, context in -// guard let context = context, -// let response = response else { return } -// let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() -// if let error = error { -// contextResult.detail = String(cString: error) -// contextResult.listen(data: contextResult.detail) -// return -// } -// print(type(of: response), response) -// contextResult.detail = String(cString: response) -// contextResult.listen(data: contextResult.detail) -// } - - let ret = iota_listen( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - print("ret", ret) + for event in eventTypes { + let eventString = event as? String + let eventChar = eventString?.cString(using: .utf8) + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + iota_listen( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) + } } @objc func clearListeners(_ call: CAPPluginCall) { @@ -200,14 +184,12 @@ public class IotaWalletMobile: CAPPlugin { } let eventChar = eventTypes.description.cString(using: .utf8) - call.keepAlive = true - let contextResult = ContextResult(_call: call) let context = Unmanaged.passRetained(contextResult).toOpaque() -// iota_clear_listeners( -// messageHandler, eventChar, contextResult.callback, context, -// error_buffer, error_buffer_size -// ) + iota_clear_listeners( + messageHandler, eventChar, contextResult.callback, context, + error_buffer, error_buffer_size + ) } } From 5ca13d61f3ebbe77421c872abf70415fc70514a7 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 11:49:43 +0100 Subject: [PATCH 085/197] fix: swift listen Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 57 +++++++++++--------- 1 file changed, 33 insertions(+), 24 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index cfcb0aeb99..3a16718d6f 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,10 +8,8 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handle the cross-lang pointers with a context object + // Handle the cross-lang pointers with a context object and Unmanaged class ContextResult { - // details will hold the result string value from C++ - var detail = "" // the call is used to send back the context response var call: CAPPluginCall init(_call: CAPPluginCall) { @@ -24,20 +22,29 @@ public class IotaWalletMobile: CAPPlugin { let callback: Callback = { response, error, context in guard let context = context, - let response = response else { return } + let response = response else { return } let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() if let error = error { - contextResult.detail = String(cString: error) - contextResult.resolve(data: contextResult.detail) + contextResult.resolve(data: String(cString: error)) return } - print(type(of: response), response) - contextResult.detail = String(cString: response) - contextResult.resolve(data: contextResult.detail) - return + contextResult.resolve(data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object for future messages. TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(data: String(cString: error)) + return + } + contextResult.resolve(data: String(cString: response)) } } - + // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -157,19 +164,21 @@ public class IotaWalletMobile: CAPPlugin { guard let eventTypes = call.getArray("eventTypes") else { return call.reject("eventTypes is required") } - - for event in eventTypes { - let eventString = event as? String - let eventChar = eventString?.cString(using: .utf8) - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 - iota_listen( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - } + + let contextResult = ContextResult(_call: call) + let context = Unmanaged.passRetained(contextResult).toOpaque() + + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + + iota_listen( + messageHandler, eventTypes.description, + contextResult.callbackListen, context, + error_buffer, error_buffer_size + ) + + call.keepAlive = true + call.resolve() } @objc func clearListeners(_ call: CAPPluginCall) { From 0f58a9d7a9196c1b994bc96aca9a5363aee7099b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 13:09:01 +0100 Subject: [PATCH 086/197] chore: update plugin definitions Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/definitions.ts | 67 ++++++++++++------------- bindings/capacitorjs/src/index.ts | 8 +-- 2 files changed, 36 insertions(+), 39 deletions(-) diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index dc1d530994..0d07c24a0b 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,47 +1,44 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import { PluginListenerHandle } from "@capacitor/core" -// import type { MessageHandler } from "./lib/MessageHandler" import type { EventType, __Message__, __AccountMethod__, - // AccountManagerOptions, + AccountManagerOptions, } from './types' export interface IotaWalletMobileTypes { - initLogger(path: string): Promise - - messageHandlerNew(messageOptions: { - storagePath: string - }): Promise<{ messageHandler: number }> - - sendMessage(messageOptions: { - message: string, - handler : number, - }): Promise<{ result: string }> - - listen( - options: { - eventTypes: EventType[]; - messageHandler: number; - }, - callback: (message: { - error: { - cause: unknown; - }; - result: string; - }) => void - ): Promise; - - clearListeners(options: { - eventTypes: EventType[], - messageHandler: number - }): Promise<{ result: string }> - - destroy(options: { - messageHandler: number - }): Promise; + initLogger(path: string): Promise; + messageHandlerNew(messageOptions: AccountManagerOptions): Promise<{ + messageHandler: number; + }>; + sendMessage(messageOptions: { + message: string; + handler: number; + }): Promise<{ + result: string; + }>; + listen(options: { + eventTypes: EventType[]; + messageHandler: number; + }, callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void): Promise; + clearListeners(options: { + eventTypes: EventType[]; + messageHandler: number; + }, callback: (message: { + error: { + cause: unknown; + }; + result: string; + }) => void): Promise; + destroy(options: { + messageHandler: number; + }): Promise; } diff --git a/bindings/capacitorjs/src/index.ts b/bindings/capacitorjs/src/index.ts index 38d0dd11d6..7d86aee928 100644 --- a/bindings/capacitorjs/src/index.ts +++ b/bindings/capacitorjs/src/index.ts @@ -1,12 +1,12 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + import { registerPlugin } from '@capacitor/core' import { IotaWalletMobileTypes } from './definitions' const IotaWalletMobile = registerPlugin('IotaWalletMobile') -// import * as WalletApi from './lib/index.js' - -// IotaWalletMobile.WalletApi = WalletApi - export * from './definitions' + export { IotaWalletMobile } From be7665675baa1a3e2a34c5567ebc29f5ede0d37b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 13:40:03 +0100 Subject: [PATCH 087/197] fix: package.json Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index d990e17d1c..25978970c4 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -5,6 +5,7 @@ "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/esm/index.js", "module": "dist/esm/index.js", + "types": "dist/esm/index.d.ts", "files": [ "android/src/main/", "android/build.gradle", @@ -12,12 +13,11 @@ "ios/Plugin/", "IotaWalletMobile.podspec" ], - "types": "dist/esm/index.d.ts", "scripts": { "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", - "build": "npm run clean && tsc && rollup -c rollup.config.js", + "build": "npm run clean && tsc && npx rollup -c rollup.config.js", "clean": "rm -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build" From 07fbbe4ff0231a8f310a52746f062d54380c4d86 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 11 Jan 2023 22:33:52 +0100 Subject: [PATCH 088/197] fix: Swift plugin callback Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.m | 2 +- bindings/capacitorjs/ios/Plugin/Plugin.swift | 25 +++++++++++--------- bindings/capacitorjs/src/definitions.ts | 13 +++------- 3 files changed, 18 insertions(+), 22 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/bindings/capacitorjs/ios/Plugin/Plugin.m index dda97c8578..1f7c7a7e26 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -8,7 +8,7 @@ CAP_PLUGIN_METHOD(initLogger, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); - CAP_PLUGIN_METHOD(listen, CAPPluginReturnPromise); + CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 3a16718d6f..2d342967db 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,40 +8,43 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handle the cross-lang pointers with a context object and Unmanaged + // Handles the Swift / C pointers with a context object using Unmanaged types class ContextResult { - // the call is used to send back the context response - var call: CAPPluginCall + // the `call` will send the context response back to Javascript + var call: CAPPluginCall? + init(_call: CAPPluginCall) { self.call = _call } - func resolve(data: String) { - self.call.resolve(["result": data]) + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) } - + // the needed `callback` to call C header functions let callback: Callback = { response, error, context in guard let context = context, let response = response else { return } + // Convert back into `ContextResult` Swift object type let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() if let error = error { - contextResult.resolve(data: String(cString: error)) + contextResult.resolve(type: "error", data: String(cString: error)) return } - contextResult.resolve(data: String(cString: response)) + contextResult.resolve(type: "result", data: String(cString: response)) } let callbackListen: Callback = { response, error, context in guard let context = context, let response = response else { return } - // retain of the object for future messages. TODO: verify it's released later + // retain of the object awaiting for the next message. + // TODO: verify it's released later let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() if let error = error { - contextResult.resolve(data: String(cString: error)) + contextResult.resolve(type: "error", data: String(cString: error)) return } - contextResult.resolve(data: String(cString: response)) + contextResult.resolve(type: "result", data: String(cString: response)) } } diff --git a/bindings/capacitorjs/src/definitions.ts b/bindings/capacitorjs/src/definitions.ts index 0d07c24a0b..3b3bd674ae 100644 --- a/bindings/capacitorjs/src/definitions.ts +++ b/bindings/capacitorjs/src/definitions.ts @@ -1,14 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { - EventType, - __Message__, - __AccountMethod__, - AccountManagerOptions, -} from './types' - - +import type { EventType, AccountManagerOptions } from './types'; export interface IotaWalletMobileTypes { initLogger(path: string): Promise; messageHandlerNew(messageOptions: AccountManagerOptions): Promise<{ @@ -28,7 +21,7 @@ export interface IotaWalletMobileTypes { cause: unknown; }; result: string; - }) => void): Promise; + }) => void): Promise; clearListeners(options: { eventTypes: EventType[]; messageHandler: number; @@ -37,7 +30,7 @@ export interface IotaWalletMobileTypes { cause: unknown; }; result: string; - }) => void): Promise; + }) => void): Promise; destroy(options: { messageHandler: number; }): Promise; From 971701c7c337125da271cc41a12c504d1f4ee8de Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 00:12:59 +0100 Subject: [PATCH 089/197] update plugin java Signed-off-by: Amadeo Marchioni --- .../iotawalletmobile/IotaWalletMobile.java | 58 +++++++++---------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index a009fcf55a..c36a61fdec 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -33,6 +33,7 @@ import com.google.gson.JsonParser; import static org.iota.api.NativeApi.callBaseApi; +import static org.iota.api.NativeApi.callListen; @CapacitorPlugin(name = "IotaWalletMobile") @@ -49,11 +50,11 @@ public void messageHandlerNew(final PluginCall call) { || !call.getData().has("secretManager")) { call.reject("clientOptions, storagePath, coinType and secretManager are required"); } - JSObject clientOptions = call.getObject("clientOptions"); - String storagePath = call.getString("storagePath"); - Integer coinType = call.getInt("coinType"); - JSObject secretManager = call.getObject("secretManager"); - String path = getContext().getFilesDir() + storagePath; + JSObject _clientOptions = call.getObject("clientOptions"); + String _storagePath = call.getString("storagePath"); + Integer _coinType = call.getInt("coinType"); + JSObject _secretManager = call.getObject("secretManager"); + String path = getContext().getFilesDir() + _storagePath; try { wallet = new Wallet(new WalletConfig() @@ -113,36 +114,25 @@ public void sendMessage(final PluginCall call) { } } - @PluginMethod() + @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) public void listen(final PluginCall call) throws WalletException, JSONException { if (!call.getData().has("eventTypes")) { call.reject("eventTypes and event are required"); } JSArray eventTypes = call.getArray("eventTypes"); - try { - wallet.listen(new EventListener() { - @Override - public void receive(Event event) { - JSObject walletResponse = new JSObject(); - System.out.println( - System.lineSeparator() + "Event receive: " + event.getEvent().getClass().getSimpleName()); - if (event.getEvent() instanceof TransactionProgressEvent) { - TransactionProgressEvent progress = (TransactionProgressEvent) event.getEvent(); - System.out.println(progress.toString()); - walletResponse.put("result", progress.toString()); - call.resolve(walletResponse); - } else { - System.out.println(event.getEvent().toString()); - walletResponse.put("result", event.getEvent().toString()); - call.resolve(walletResponse); - } - } - }); - } catch (WalletException e) { - e.printStackTrace(); - } + try { + wallet.listen(new EventListener() { + @Override + public void receive(Event event) { + JSObject walletResponse = new JSObject(); + walletResponse.put("result", event.getEvent().toString()); + call.resolve(walletResponse); + } + }, WalletEventType.valueOf(eventTypes.getString(0))); + } catch (WalletException e) { + e.printStackTrace(); + } call.setKeepAlive(true); - call.resolve(); } @@ -156,4 +146,14 @@ public void destroy(final PluginCall call) { } } + @PluginMethod() + public void clearListeners(final PluginCall call) { + try { + wallet.clearListeners(); + call.release(bridge); + } catch (Exception ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + } + } From 9f90405e62ccc4cb04f13a9d5a7ec33cf5a393a8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 12:35:45 +0100 Subject: [PATCH 090/197] feat: add download script and preinstall script to package.json Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/add_libs.sh | 17 +++++++++++++++++ bindings/capacitorjs/package.json | 9 +++++---- 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100755 bindings/capacitorjs/add_libs.sh diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh new file mode 100755 index 0000000000..d2151242be --- /dev/null +++ b/bindings/capacitorjs/add_libs.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e +rm -rf tmp && mkdir tmp && cd tmp + +curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip +unzip iota-wallet.zip + +rm -rf ../android/src/main/jniLibs +cp -r jniLibs ../android/src/main/jniLibs + +curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar +rm -rf ../android/libs && mkdir -p ../android/libs +cp -r iota-wallet.jar ../android/libs + +cd .. && rm -rf tmp +echo "success!" \ No newline at end of file diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 25978970c4..37ee77e760 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -17,10 +17,11 @@ "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", - "build": "npm run clean && tsc && npx rollup -c rollup.config.js", + "build": "npm run clean && tsc && rollup -c rollup.config.js", "clean": "rm -rf ./dist", "watch": "tsc --watch", - "prepublishOnly": "npm run build" + "prepublishOnly": "npm run build", + "preinstall": "npm run build && add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", @@ -33,7 +34,8 @@ }, "dependencies": { "@capacitor/core": "^3.4.1", - "@iota/types": "^1.0.0-beta.15" + "@iota/types": "^1.0.0-beta.15", + "rollup": "^2.29.0" }, "devDependencies": { "@capacitor/android": "^3.4.1", @@ -41,7 +43,6 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "rollup": "^2.32.0", "typescript": "~4.0.3" }, "peerDependencies": { From 80208d0b26333501e85f3914044ef8790361f803 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 12 Jan 2023 21:04:29 +0100 Subject: [PATCH 091/197] fix: script ./add_libs.sh Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 37ee77e760..1f882aed41 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rm -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && add_libs.sh" + "preinstall": "npm run build && ./add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From 9f3554cd3d9e0aca4f5339f85efab8d377421a3e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 10:20:13 +0100 Subject: [PATCH 092/197] fix: android messageHandlerNew init values Signed-off-by: Amadeo Marchioni --- .../iotawalletmobile/IotaWalletMobile.java | 60 ++++++++++++------- 1 file changed, 40 insertions(+), 20 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index c36a61fdec..602f641454 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -27,6 +27,7 @@ import org.iota.types.exceptions.WalletException; import org.iota.types.secret.StrongholdSecretManager; import org.json.JSONException; +import org.json.JSONObject; import com.google.gson.JsonElement; import com.google.gson.JsonObject; @@ -42,7 +43,7 @@ public class IotaWalletMobile extends Plugin { Wallet wallet = null; @PluginMethod() - public void messageHandlerNew(final PluginCall call) { + public void messageHandlerNew(final PluginCall call) throws JSONException { if (!call.getData().has("clientOptions") || !call.getData().has("storagePath") @@ -55,14 +56,32 @@ public void messageHandlerNew(final PluginCall call) { Integer _coinType = call.getInt("coinType"); JSObject _secretManager = call.getObject("secretManager"); String path = getContext().getFilesDir() + _storagePath; + Log.d("_clientOptions", _clientOptions.get("nodes").toString()); + + + JSONObject secretManager = _secretManager.getJSONObject("stronghold"); + Log.d("_storagePath", path + secretManager.get("snapshotPath")); + if (_coinType == null) { + return; + } + CoinType coinType = CoinType.Shimmer; + if (CoinType.Iota.getCoinTypeValue() == _coinType) { + coinType = CoinType.Iota; + } try { wallet = new Wallet(new WalletConfig() .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) .withStoragePath(path) .withSecretManager( - new StrongholdSecretManager("", null, path + "/wallet.stronghold")) - .withCoinType(CoinType.Shimmer) + new StrongholdSecretManager( + null, + null, +// path + secretManager.get("snapshotPath") + path + "/wallet.stronghold" + ) + ) + .withCoinType(coinType) ); JSObject ret = new JSObject(); ret.put("messageHandler", 1); @@ -116,23 +135,24 @@ public void sendMessage(final PluginCall call) { @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) public void listen(final PluginCall call) throws WalletException, JSONException { - if (!call.getData().has("eventTypes")) { - call.reject("eventTypes and event are required"); - } - JSArray eventTypes = call.getArray("eventTypes"); - try { - wallet.listen(new EventListener() { - @Override - public void receive(Event event) { - JSObject walletResponse = new JSObject(); - walletResponse.put("result", event.getEvent().toString()); - call.resolve(walletResponse); - } - }, WalletEventType.valueOf(eventTypes.getString(0))); - } catch (WalletException e) { - e.printStackTrace(); - } - call.setKeepAlive(true); + // if (!call.getData().has("eventTypes")) { + // call.reject("eventTypes and event are required"); + // } + // JSArray eventTypes = call.getArray("eventTypes"); + // try { + // wallet.listen(new EventListener() { + // @Override + // public void receive(Event event) { + // JSObject walletResponse = new JSObject(); + // walletResponse.put("result", event.getEvent().toString()); + // call.resolve(walletResponse); + // } + // }, WalletEventType.valueOf(eventTypes.getString(0))); + // } catch (WalletException e) { + // e.printStackTrace(); + // } + // call.setKeepAlive(true); + call.resolve(); } From d28f7a2cf0e543c48afd361e9d87d51b1ed54192 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 11:53:40 +0100 Subject: [PATCH 093/197] chore: add JS API libs Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 113 ++- .../capacitorjs/src/lib/AccountManager.ts | 789 ++++++++++-------- .../capacitorjs/src/lib/MessageHandler.ts | 78 +- bindings/capacitorjs/src/lib/WalletApi.ts | 63 ++ bindings/capacitorjs/src/lib/bindings.ts | 28 +- bindings/capacitorjs/src/lib/index.ts | 17 + bindings/capacitorjs/src/types/account.ts | 47 +- bindings/capacitorjs/src/types/address.ts | 13 +- .../capacitorjs/src/types/bridge/account.js | 2 + .../capacitorjs/src/types/bridge/account.ts | 48 +- .../src/types/bridge/accountManager.js | 2 + .../src/types/bridge/accountManager.ts | 48 +- .../capacitorjs/src/types/bridge/index.js | 2 + .../capacitorjs/src/types/bridge/index.ts | 30 +- .../src/types/incomingTransactionData.ts | 5 +- bindings/capacitorjs/src/types/index.ts | 3 +- bindings/capacitorjs/src/types/output.ts | 4 +- .../capacitorjs/src/types/participation.ts | 69 ++ 18 files changed, 951 insertions(+), 410 deletions(-) create mode 100644 bindings/capacitorjs/src/lib/WalletApi.ts create mode 100644 bindings/capacitorjs/src/lib/index.ts create mode 100644 bindings/capacitorjs/src/types/bridge/account.js create mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.js create mode 100644 bindings/capacitorjs/src/types/bridge/index.js create mode 100644 bindings/capacitorjs/src/types/participation.ts diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index 6ee0575bab..db2b4b91ed 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,7 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { MessageHandler } from './MessageHandler'; +// import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, @@ -27,6 +27,7 @@ import type { Transaction, TransactionOptions, IncomingTransactionData, + ParticipationOverview, } from '../types'; import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; import type { @@ -48,9 +49,9 @@ import type { export class Account { // private because the data isn't updated private meta: AccountMeta; - private messageHandler: MessageHandler; + private messageHandler: any; - constructor(accountMeta: AccountMeta, messageHandler: MessageHandler) { + constructor(accountMeta: AccountMeta, messageHandler: any) { this.meta = accountMeta; this.messageHandler = messageHandler; } @@ -454,7 +455,9 @@ export class Account { * @param transactionId The ID of the transaction to get. * @returns The transaction. */ - async getIncomingTransactionData(transactionId: string): Promise { + async getIncomingTransactionData( + transactionId: string, + ): Promise { const response = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -532,9 +535,7 @@ export class Account { * List all incoming transactions of the account. * @returns The incoming transactions with their inputs. */ - async incomingTransactions(): Promise< - [string, IncomingTransactionData][] - > { + async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { const response = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -766,6 +767,29 @@ export class Account { return JSON.parse(response).payload; } + /** + * Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's + * included (referenced by a milestone). Returns the included block id. + */ + async retryTransactionUntilIncluded( + transactionId: string, + interval?: number, + maxAttempts?: number, + ): Promise { + const response = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'retryTransactionUntilIncluded', + data: { + transactionId, + interval, + maxAttempts, + }, + }, + ); + return JSON.parse(response).payload; + } + /** * Send a transaction with amounts from input addresses. * @param addressesWithAmount Addresses with amounts. @@ -958,4 +982,77 @@ export class Account { ); return JSON.parse(resp).payload; } -} + + async vote(eventId?: string, answers?: number[]): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'vote', + data: { + eventId, + answers, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async stopParticipating(eventId: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'stopParticipating', + data: { + eventId, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async getVotingPower(): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getVotingPower', + }, + ); + return JSON.parse(resp).payload; + } + + async getParticipationOverview(): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'getParticipationOverview', + }, + ); + return JSON.parse(resp).payload; + } + + async increaseVotingPower(amount: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'increaseVotingPower', + data: { + amount, + }, + }, + ); + return JSON.parse(resp).payload; + } + + async decreaseVotingPower(amount: string): Promise { + const resp = await this.messageHandler.callAccountMethod( + this.meta.index, + { + name: 'decreaseVotingPower', + data: { + amount, + }, + }, + ); + return JSON.parse(resp).payload; + } +} \ No newline at end of file diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 648fcf341f..87a4e0dd83 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -15,336 +15,471 @@ import type { AccountSyncOptions, WalletEvent, LedgerNanoStatus, + Event, + EventId, + Node, + EventStatus, + GenerateAddressOptions, } from '../types'; /** The AccountManager class. */ -export class AccountManager { - private messageHandler: MessageHandler; - - constructor(options: AccountManagerOptions) { - this.messageHandler = new MessageHandler(options); - } - - /** - * Backup the data to a Stronghold snapshot. - */ - async backup(destination: string, password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'backup', - payload: { - destination, - password, - }, - }); - } - - /** - * Transform a bech32 encoded address to a hex encoded address - */ - async bech32ToHex(bech32Address: string): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'bech32ToHex', - payload: bech32Address, - }); - return JSON.parse(response).payload; - } - - /** - * Change the Stronghold password. - */ - async changeStrongholdPassword( - currentPassword: string, - newPassword: string, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'changeStrongholdPassword', - payload: { - currentPassword, - newPassword, - }, - }); - } - - /** - * Clear the Stronghold password from memory. - */ - async clearStrongholdPassword(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'clearStrongholdPassword', - }); - } - - /** - * Create a new account. - */ - async createAccount(payload: CreateAccountPayload): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'createAccount', - payload, - }); - return new Account(JSON.parse(response).payload, this.messageHandler); - } - - /** - * Destroy the AccountManager and drop its database connection. - */ - destroy(): void { - this.messageHandler.destroy(); - } - - /** - * Emit a provided event for testing of the event system. - */ - async emitTestEvent(event: WalletEvent): Promise { - await this.messageHandler.sendMessage({ - cmd: 'emitTestEvent', - payload: event, - }); - } - - /** - * Generate a random BIP39 mnemonic. - */ - async generateMnemonic(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'generateMnemonic', - }); - return JSON.parse(response).payload; - } - - /** - * Get an account by its alias or index. - */ - async getAccount(accountId: AccountId): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccount', - payload: accountId, - }); - - const account = new Account( - JSON.parse(response).payload, - this.messageHandler, - ); - - return account; - } - - /** - * Get all account indexes. - */ - async getAccountIndexes(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccountIndexes', - }); - - return JSON.parse(response).payload; - } - - /** - * Get all accounts. - */ - async getAccounts(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getAccounts', - }); - - const { payload } = JSON.parse(response); - - const accounts: Account[] = []; - - for (const account of payload) { - accounts.push(new Account(account, this.messageHandler)); - } - return accounts; - } - - /** - * Get the node info. - */ - async getNodeInfo(url?: string, auth?: Auth): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getNodeInfo', - payload: { url, auth }, - }); - return JSON.parse(response).payload; - } - - /** - * Get the status for a Ledger Nano. - */ - async getLedgerNanoStatus(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'getLedgerNanoStatus', - }); - return JSON.parse(response).payload; - } - - /** - * Transform hex encoded address to bech32 encoded address. If no bech32Hrp - * is provided, the AccountManager will attempt to retrieve it from the - * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. - */ - async hexToBech32(hex: string, bech32Hrp?: string): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'hexToBech32', - payload: { hex, bech32Hrp }, - }); - return JSON.parse(response).payload; - } - - /** - * Check if the Stronghold password has been set. - */ - async isStrongholdPasswordAvailable(): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'isStrongholdPasswordAvailable', - }); - return JSON.parse(response).payload; - } - - /** - * Listen to wallet events with a callback. An empty array will listen to all possible events. - */ - listen( - eventTypes: EventType[], - callback: (error: Error, result: string) => void, - ): void { - return this.messageHandler.listen(eventTypes, callback); - } - - /** - * Clear the callbacks for provided events. An empty array will clear all listeners. - */ - clearListeners(eventTypes: EventType[]): void { - return this.messageHandler.clearListeners(eventTypes); - } - - /** - * Find accounts with unspent outputs. - */ - async recoverAccounts( - accountStartIndex: number, - accountGapLimit: number, - addressGapLimit: number, - syncOptions: AccountSyncOptions, - ): Promise { - const response = await this.messageHandler.sendMessage({ - cmd: 'recoverAccounts', - payload: { - accountStartIndex, - accountGapLimit, - addressGapLimit, - syncOptions, - }, - }); - - const accounts: Account[] = []; - - for (const account of JSON.parse(response).payload) { - accounts.push(new Account(account, this.messageHandler)); +export async function AccountManager(options: AccountManagerOptions) { + + let id: AccountId = 0 + + let messageHandler = await MessageHandler(options); + + return { + id, + + /** + * Listen to wallet events with a callback. An empty array will listen to all possible events. + */ + async listen( + eventTypes: EventType[], + callback: (error: Error | undefined, result: string) => void, + ): Promise { + return messageHandler.listen(eventTypes, callback); + }, + + /** + * Clear the callbacks for provided events. An empty array will clear all listeners. + */ + clearListeners(eventTypes: EventType[]): Promise { + return messageHandler.clearListeners(eventTypes); + }, + + /** + * Backup the data to a Stronghold snapshot. + */ + async backup(destination: string, password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'backup', + payload: { + destination, + password, + }, + }); + }, + + /** + * Transform a bech32 encoded address to a hex encoded address + */ + async bech32ToHex(bech32Address: string): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'bech32ToHex', + payload: bech32Address, + }); + return JSON.parse(response).payload; + }, + + /** + * Change the Stronghold password. + */ + async changeStrongholdPassword( + currentPassword: string, + newPassword: string, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'changeStrongholdPassword', + payload: { + currentPassword, + newPassword, + }, + }); + }, + + /** + * Clear the Stronghold password from memory. + */ + async clearStrongholdPassword(): Promise { + await messageHandler.sendMessage({ + cmd: 'clearStrongholdPassword', + }); + }, + + /** + * Create a new account. + */ + async createAccount(payload: CreateAccountPayload): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'createAccount', + payload, + }); + return new Account(JSON.parse(response).payload, messageHandler); + }, + + /** + * Destroy the AccountManager and drop its database connection. + */ + destroy(): void { + messageHandler.destroy(); + }, + + async deregisterParticipationEvent(eventId: EventId): Promise { + await messageHandler.sendMessage({ + cmd: 'deregisterParticipationEvent', + payload: { + eventId, + }, + }); + }, + + /** + * Emit a provided event for testing of the event system. + */ + async emitTestEvent(event: WalletEvent): Promise { + await messageHandler.sendMessage({ + cmd: 'emitTestEvent', + payload: event, + }); + }, + + /** + * Generate a random BIP39 mnemonic. + */ + async generateMnemonic(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'generateMnemonic', + }); + return JSON.parse(response).payload; + }, + + /** + * Get an account by its alias or index. + */ + async getAccount(accountId: AccountId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccount', + payload: accountId, + }); + + const account = new Account( + JSON.parse(response).payload, + messageHandler, + ); + + return account; + }, + + /** + * Get all account indexes. + */ + async getAccountIndexes(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccountIndexes', + }); + + return JSON.parse(response).payload; + }, + + /** + * Get all accounts. + */ + async getAccounts(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getAccounts', + }); + + const { payload } = JSON.parse(response); + + const accounts: Account[] = []; + + for (const account of payload) { + accounts.push(new Account(account, messageHandler)); + } + return accounts; + }, + + /** + * Generate an address without storing it. + */ + async generateAddress( + accountIndex: number, + internal: boolean, + addressIndex: number, + options?: GenerateAddressOptions, + bech32Hrp?: string, + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'generateAddress', + payload: { + accountIndex, + internal, + addressIndex, + options, + bech32Hrp, + }, + }); + return JSON.parse(response).payload; + }, + + /** + * Get the node info. + */ + async getNodeInfo(url?: string, auth?: Auth): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getNodeInfo', + payload: { url, auth }, + }); + return JSON.parse(response).payload; + }, + + /** + * Get the status for a Ledger Nano. + */ + async getLedgerNanoStatus(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getLedgerNanoStatus', + }); + return JSON.parse(response).payload; + }, + + async getParticipationEvent(eventId: EventId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEvent', + payload: { + eventId, + }, + }); + return JSON.parse(response).payload; + }, + + async getParticipationEvents(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEvents', + }); + return JSON.parse(response).payload; + }, + + async getParticipationEventStatus(eventId: EventId): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'getParticipationEventStatus', + payload: { + eventId, + }, + }); + return JSON.parse(response).payload; + }, + + /** + * Transform hex encoded address to bech32 e/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * +/** + * ncoded address. If no bech32Hrp + * is provided, the AccountManager will attempt to retrieve it from the + * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. + */ + async hexToBech32(hex: string, bech32Hrp?: string): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'hexToBech32', + payload: { hex, bech32Hrp }, + }); + return JSON.parse(response).payload; + }, + + /** + * Check if the Stronghold password has been set. + */ + async isStrongholdPasswordAvailable(): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'isStrongholdPasswordAvailable', + }); + return JSON.parse(response).payload; + }, + + /** + * Find accounts with unspent outputs. + */ + async recoverAccounts( + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions: AccountSyncOptions, + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'recoverAccounts', + payload: { + accountStartIndex, + accountGapLimit, + addressGapLimit, + syncOptions, + }, + }); + + const accounts: Account[] = []; + + for (const account of JSON.parse(response).payload) { + accounts.push(new Account(account, messageHandler)); + } + return accounts; + }, + + /** + * Delete the latest account. + */ + async removeLatestAccount(): Promise { + await messageHandler.sendMessage({ + cmd: 'removeLatestAccount', + }); + }, + + async registerParticipationEvent( + eventId: EventId, + nodes: Node[], + ): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'registerParticipationEvent', + payload: { + eventId, + nodes, + }, + }); + + return JSON.parse(response).payload; + }, + + /** + * Restore a backup from a Stronghold file + * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created + * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was + * stored, it will be gone. + */ + async restoreBackup(source: string, password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'restoreBackup', + payload: { + source, + password, + }, + }); + }, + + /** + * Set ClientOptions. + */ + async setClientOptions(options: ClientOptions): Promise { + await messageHandler.sendMessage({ + cmd: 'setClientOptions', + payload: options, + }); + }, + + /** + * Set the Stronghold password. + */ + async setStrongholdPassword(password: string): Promise { + await messageHandler.sendMessage({ + cmd: 'setStrongholdPassword', + payload: password, + }); + }, + + /** + * Set the interval after which the Stronghold password gets cleared from memory. + */ + async setStrongholdPasswordClearInterval( + intervalInMilliseconds?: number, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'setStrongholdPasswordClearInterval', + payload: intervalInMilliseconds, + }); + }, + + /** + * Start the background syncing process for all accounts. + */ + async startBackgroundSync( + options?: AccountSyncOptions, + intervalInMilliseconds?: number, + ): Promise { + await messageHandler.sendMessage({ + cmd: 'startBackgroundSync', + payload: { + options, + intervalInMilliseconds, + }, + }); + }, + + /** + * Stop the background syncing process for all accounts. + */ + async stopBackgroundSync(): Promise { + await messageHandler.sendMessage({ + cmd: 'stopBackgroundSync', + }); + }, + + /** + * Store a mnemonic in the Stronghold snapshot. + */ + async storeMnemonic(mnemonic: string): Promise { + await messageHandler.sendMessage({ + cmd: 'storeMnemonic', + payload: mnemonic, + }); + }, + + /** + * Verify if a mnemonic is a valid BIP39 mnemonic. + */ + async verifyMnemonic(mnemonic: string): Promise { + await messageHandler.sendMessage({ + cmd: 'verifyMnemonic', + payload: mnemonic, + }); } - return accounts; - } - - /** - * Delete the latest account. - */ - async removeLatestAccount(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'removeLatestAccount', - }); - } - - /** - * Restore a backup from a Stronghold file - * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created - * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was - * stored, it will be gone. - */ - async restoreBackup(source: string, password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'restoreBackup', - payload: { - source, - password, - }, - }); - } - - /** - * Set ClientOptions. - */ - async setClientOptions(options: ClientOptions): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setClientOptions', - payload: options, - }); - } - - /** - * Set the Stronghold password. - */ - async setStrongholdPassword(password: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setStrongholdPassword', - payload: password, - }); - } - - /** - * Set the interval after which the Stronghold password gets cleared from memory. - */ - async setStrongholdPasswordClearInterval( - intervalInMilliseconds?: number, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'setStrongholdPasswordClearInterval', - payload: intervalInMilliseconds, - }); - } - - /** - * Start the background syncing process for all accounts. - */ - async startBackgroundSync( - options?: AccountSyncOptions, - intervalInMilliseconds?: number, - ): Promise { - await this.messageHandler.sendMessage({ - cmd: 'startBackgroundSync', - payload: { - options, - intervalInMilliseconds, - }, - }); - } - - /** - * Stop the background syncing process for all accounts. - */ - async stopBackgroundSync(): Promise { - await this.messageHandler.sendMessage({ - cmd: 'stopBackgroundSync', - }); - } - - /** - * Store a mnemonic in the Stronghold snapshot. - */ - async storeMnemonic(mnemonic: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'storeMnemonic', - payload: mnemonic, - }); - } - - /** - * Verify if a mnemonic is a valid BIP39 mnemonic. - */ - async verifyMnemonic(mnemonic: string): Promise { - await this.messageHandler.sendMessage({ - cmd: 'verifyMnemonic', - payload: mnemonic, - }); } } diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts index 5f30b4efd5..59b2d2eb04 100644 --- a/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -4,9 +4,9 @@ import { sendMessageAsync, messageHandlerNew, - listen, - clearListeners, - destroy, + listen as _listen, + clearListeners as _clearListeners, + destroy as _destroy, } from './bindings'; import type { EventType, @@ -17,24 +17,22 @@ import type { } from '../types'; // The MessageHandler class interacts with messages with the rust bindings. -export class MessageHandler { - messageHandler: any; - - constructor(options?: AccountManagerOptions) { - const messageOptions = { +export async function MessageHandler(options?: AccountManagerOptions) { + + const messageOptions = { storagePath: options?.storagePath, clientOptions: options?.clientOptions, coinType: options?.coinType, - secretManager: options?.secretManager, - }; - - this.messageHandler = messageHandlerNew(JSON.stringify(messageOptions)); - } - - async sendMessage(message: __Message__): Promise { - return sendMessageAsync( + secretManager: options?.secretManager + }; + const { messageHandler } = await messageHandlerNew(messageOptions); + // messageHandler = messageHandler.messageHandler; + // console.error(messageHandler.messageHandler, 'received') + + async function sendMessage(message: __Message__): Promise { + return await sendMessageAsync( JSON.stringify(message), - this.messageHandler, + messageHandler, ).catch((error) => { try { error = JSON.parse(error).payload; @@ -43,11 +41,11 @@ export class MessageHandler { }); } - async callAccountMethod( + async function callAccountMethod( accountIndex: AccountId, method: __AccountMethod__, ): Promise { - return this.sendMessage({ + return sendMessage({ cmd: 'callAccountMethod', payload: { accountId: accountIndex, @@ -56,18 +54,44 @@ export class MessageHandler { }); } - listen( + async function listen( eventTypes: EventType[], - callback: (error: Error, result: string) => void, - ): void { - return listen(eventTypes, callback, this.messageHandler); + callback: (error: Error | undefined, result: string) => void, + ): Promise { + await _listen({ eventTypes, messageHandler }, ({ error, result }) => { + const Error = error ? { + name: error.toString(), + message: error.cause?.toString() || '' + } : undefined + callback( + Error, + result + ) + }); + } + + async function clearListeners( + eventTypes: EventType[] + ): Promise { + await _clearListeners({ eventTypes, messageHandler }, ({ error, result }) => { + const Error = error ? { + name: error.toString(), + message: error?.cause?.toString() + } : undefined + return Error || result + }); } - clearListeners(eventTypes: EventType[]): void { - return clearListeners(eventTypes, this.messageHandler); + function destroy(): void { + _destroy({ messageHandler }); } - destroy(): void { - return destroy(this.messageHandler); + return { + messageHandler, + sendMessage, + callAccountMethod, + listen, + clearListeners, + destroy } } diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts new file mode 100644 index 0000000000..290ae2a05b --- /dev/null +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -0,0 +1,63 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { Account } from './Account'; +import { AccountManager } from './AccountManager'; + +const profileManagers = {} +const WalletApi = { + async createAccountManager( + id: number, // Account.AccountId, + options: unknown, // Account.AccountManagerOptions + ) { + console.error({options}) + const manager = await AccountManager(options) + manager.id = id + console.error({manager}) + profileManagers[id] = manager + // bindMethodsAcrossContextBridge(WalletApi.AccountManager, manager) + return manager + }, + async createAccount(managerId, payload) { + const manager = profileManagers[managerId] + const account = await manager.createAccount(payload) + bindMethodsAcrossContextBridge(Account.prototype, account) + return account + }, + deleteAccountManager(id) { + if (id && id in profileManagers) { + delete profileManagers[id] + } + }, + async getAccount(managerId, index) { + const manager = profileManagers[managerId] + console.error({manager}) + const account = await manager.getAccount(index) + bindMethodsAcrossContextBridge(Account.prototype, account) + return account + }, + async getAccounts(managerId) { + const manager = profileManagers[managerId] + console.error({manager}) + const accounts = await manager.getAccounts() + accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) + return accounts + }, + async recoverAccounts(managerId, payload) { + const manager = profileManagers[managerId] + console.error({manager}) + const accounts = await manager.recoverAccounts(...Object.values(payload)) + accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) + return accounts + }, +} +function bindMethodsAcrossContextBridge(prototype, object) { + const prototypeProperties = Object.getOwnPropertyNames(prototype) + prototypeProperties.forEach((key) => { + if (key !== 'constructor') { + object[key] = object[key].bind(object) + } + }) +} + +export { WalletApi }; diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts index f90f2c11ae..bcf3ae3a9b 100644 --- a/bindings/capacitorjs/src/lib/bindings.ts +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -1,11 +1,13 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { MessageHandler } from './MessageHandler' -import { IotaWalletMobileTypes } from '../definitions' -import { registerPlugin } from '@capacitor/core' +// import type { MessageHandler } from './MessageHandler' +// import { IotaWalletMobileTypes } from "@iota/wallet-mobile" +// import { registerPlugin } from '@capacitor/core' -const IotaWalletMobile = registerPlugin('IotaWalletMobile') +// const IotaWalletMobile = registerPlugin('IotaWalletMobile') +import { IotaWalletMobile } from '../index' +// const IotaWalletMobile: IotaWalletMobileTypes const { initLogger, @@ -16,21 +18,13 @@ const { destroy, } = IotaWalletMobile -const sendMessageAsync = ( - message: string, - handler: MessageHandler, -): Promise => - new Promise((resolve, reject) => { - sendMessage(message, handler, (error: Error, result: string) => { - if (error) { - reject(error); - } else { - resolve(result); - } - }); - }) +const sendMessageAsync = async (message: string, handler: number): Promise => { + const { result } = await sendMessage({ message, handler }) + return result +} export { + IotaWalletMobile, initLogger as internalInitLogger, sendMessageAsync, messageHandlerNew, diff --git a/bindings/capacitorjs/src/lib/index.ts b/bindings/capacitorjs/src/lib/index.ts new file mode 100644 index 0000000000..2f896eec25 --- /dev/null +++ b/bindings/capacitorjs/src/lib/index.ts @@ -0,0 +1,17 @@ +// Copyright 2021 IOTA Stiftung +// SPDX-License-Identifier: Apache-2.0 + +import { internalInitLogger } from './bindings' +import type { LoggerConfig } from '../types' + +export * from './AccountManager' +export * from './MessageHandler' +export * from './Account' +export * from './WalletApi' +export * from '../types/index' + +/** Function to create wallet logs */ +const initLogger = (config: LoggerConfig) => + internalInitLogger(JSON.stringify(config)) + +export { initLogger } diff --git a/bindings/capacitorjs/src/types/account.ts b/bindings/capacitorjs/src/types/account.ts index 9107152c92..c141d36b60 100644 --- a/bindings/capacitorjs/src/types/account.ts +++ b/bindings/capacitorjs/src/types/account.ts @@ -18,7 +18,7 @@ export interface AccountBalance { /** The balance of the base coin */ baseCoin: BaseCoinBalance; /** The required storage deposit for the outputs */ - requiredStorageDeposit: string; + requiredStorageDeposit: RequiredStorageDeposit; /** The balance of the native tokens */ nativeTokens: NativeTokenBalance[]; /** Nft outputs */ @@ -34,6 +34,29 @@ export interface AccountBalance { potentiallyLockedOutputs: { [outputId: string]: boolean }; } +/** The balance of the base coin */ +export interface BaseCoinBalance { + /** The total amount of the outputs */ + total: string; + /** The amount of the outputs that aren't used in a transaction */ + available: string; +} + +/** The required storage deposit per output type */ +export interface RequiredStorageDeposit { + alias: string; + basic: string; + foundry: string; + nft: string; +} + +/** The balance of a native token */ +export interface NativeTokenBalance { + tokenId: string; + total: HexEncodedAmount; + available: HexEncodedAmount; +} + /** Sync options for an account */ export interface AccountSyncOptions { /** @@ -100,21 +123,6 @@ export interface AccountMetadata { index: number; } -/** The balance of the base coin */ -export interface BaseCoinBalance { - /** The total amount of the outputs */ - total: string; - /** The amount of the outputs that aren't used in a transaction */ - available: string; -} - -/** The balance of a native token */ -export interface NativeTokenBalance { - tokenId: string; - total: HexEncodedAmount; - available: HexEncodedAmount; -} - /** IOTA and Shimmer coin types */ export enum CoinType { IOTA = 4218, @@ -124,12 +132,15 @@ export enum CoinType { /** Options for account creation */ export interface CreateAccountPayload { alias?: string; + bech32Hrp?: string; } /** Options to filter outputs */ export interface FilterOptions { /** Filter all outputs where the booked milestone index is below the specified timestamp */ - lowerBoundBookedTimestamp: number; + lowerBoundBookedTimestamp?: number; /** Filter all outputs where the booked milestone index is above the specified timestamp */ - upperBoundBookedTimestamp: number; + upperBoundBookedTimestamp?: number; + /** Filter all outputs for the provided types (Basic = 3, Alias = 4, Foundry = 5, NFT = 6) */ + outputTypes?: Uint8Array; } diff --git a/bindings/capacitorjs/src/types/address.ts b/bindings/capacitorjs/src/types/address.ts index 3fc0b1bbc1..d482b1e5cb 100644 --- a/bindings/capacitorjs/src/types/address.ts +++ b/bindings/capacitorjs/src/types/address.ts @@ -1,4 +1,4 @@ -import type { Network } from './network'; +// import type { Network } from './network'; import type { HexEncodedAmount } from '@iota/types'; /** Address Types */ @@ -52,14 +52,13 @@ export interface AddressNftId { nftId: string; } -/** Options for address generation, metadata is used only with a Ledger Nano SecretManager */ +/** Options for address generation, options is used only with a Ledger Nano SecretManager */ export interface AddressGenerationOptions { internal: boolean; - metadata: GenerateAddressMetadata; + options: GenerateAddressOptions; } -/** Metadata for address generation, useful with a Ledger Nano SecretManager */ -export interface GenerateAddressMetadata { - syncing: boolean; - network: Network; +/** Options for address generation, useful with a Ledger Nano SecretManager */ +export interface GenerateAddressOptions { + ledgerNanoPrompt: boolean; } diff --git a/bindings/capacitorjs/src/types/bridge/account.js b/bindings/capacitorjs/src/types/bridge/account.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/account.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/account.ts b/bindings/capacitorjs/src/types/bridge/account.ts index f66ca0bd0d..6b8190b0dc 100644 --- a/bindings/capacitorjs/src/types/bridge/account.ts +++ b/bindings/capacitorjs/src/types/bridge/account.ts @@ -125,7 +125,7 @@ export type __GetBalanceMethod__ = { export type __GetIncomingTransactionDataMethod__ = { name: 'getIncomingTransactionData'; data: { - transactionId: string, + transactionId: string; }; }; @@ -248,6 +248,15 @@ export type __PrepareTransactionMethod__ = { }; }; +export type __RetryTransactionUntilIncludedMethod__ = { + name: 'retryTransactionUntilIncluded'; + data: { + transactionId: string; + interval?: number; + maxAttempts?: number; + }; +}; + export type __SendAmountMethod__ = { name: 'sendAmount'; data: { @@ -315,3 +324,40 @@ export type __SyncAccountMethod__ = { options?: AccountSyncOptions; }; }; + +export type __VoteMethod__ = { + name: 'vote'; + data: { + eventId?: string; + answers?: number[]; + }; +}; + +export type __StopParticipatingMethod__ = { + name: 'stopParticipating'; + data: { + eventId: string; + }; +}; + +export type __GetVotingPowerMethod__ = { + name: 'getVotingPower'; +}; + +export type __GetParticipationOverviewMethod__ = { + name: 'getParticipationOverview'; +}; + +export type __IncreaseVotingPowerMethod__ = { + name: 'increaseVotingPower'; + data: { + amount: string; + }; +}; + +export type __DecreaseVotingPowerMethod__ = { + name: 'decreaseVotingPower'; + data: { + amount: string; + }; +}; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.js b/bindings/capacitorjs/src/types/bridge/accountManager.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/accountManager.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.ts b/bindings/capacitorjs/src/types/bridge/accountManager.ts index 7a9a720244..664eb12023 100644 --- a/bindings/capacitorjs/src/types/bridge/accountManager.ts +++ b/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -3,8 +3,10 @@ import type { AccountSyncOptions, CreateAccountPayload, } from '../account'; +import type { GenerateAddressOptions } from '../address'; import type { WalletEvent } from '../event'; -import type { Auth, ClientOptions } from '../network'; +import type { Auth, ClientOptions, Node } from '../network'; +import type { EventId } from '../participation'; export type __BackupMessage__ = { cmd: 'backup'; @@ -36,6 +38,13 @@ export type __CreateAccountMessage__ = { payload: CreateAccountPayload; }; +export type __DeregisterParticipationEvent__ = { + cmd: 'deregisterParticipationEvent'; + payload: { + eventId: EventId; + }; +}; + export type __EmitTestEventMessage__ = { cmd: 'emitTestEvent'; payload: WalletEvent; @@ -62,6 +71,17 @@ export type __GetLedgerNanoStatusMessage__ = { cmd: 'getLedgerNanoStatus'; }; +export type __GenerateAddressMessage__ = { + cmd: 'generateAddress'; + payload: { + accountIndex: number; + internal: boolean; + addressIndex: number; + options?: GenerateAddressOptions; + bech32Hrp?: string; + }; +}; + export type __GetNodeInfoMessage__ = { cmd: 'getNodeInfo'; payload: { @@ -70,6 +90,24 @@ export type __GetNodeInfoMessage__ = { }; }; +export type __GetParticipationEventMessage__ = { + cmd: 'getParticipationEvent'; + payload: { + eventId: EventId; + }; +}; + +export type __GetParticipationEventsMessage__ = { + cmd: 'getParticipationEvents'; +}; + +export type __GetParticipationEventStatusMessage__ = { + cmd: 'getParticipationEventStatus'; + payload: { + eventId: EventId; + }; +}; + export type __HexToBech32__ = { cmd: 'hexToBech32'; payload: { @@ -92,6 +130,14 @@ export type __RecoverAccountsMessage__ = { }; }; +export type __RegisterParticipationEventMessage__ = { + cmd: 'registerParticipationEvent'; + payload: { + eventId: EventId; + nodes: Node[]; + }; +}; + export type __RemoveLatestAccountMessage__ = { cmd: 'removeLatestAccount'; }; diff --git a/bindings/capacitorjs/src/types/bridge/index.js b/bindings/capacitorjs/src/types/bridge/index.js new file mode 100644 index 0000000000..0e345787d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/bridge/index.js @@ -0,0 +1,2 @@ +"use strict"; +exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/index.ts b/bindings/capacitorjs/src/types/bridge/index.ts index 1ea2ad6ac9..ef1cc9d257 100644 --- a/bindings/capacitorjs/src/types/bridge/index.ts +++ b/bindings/capacitorjs/src/types/bridge/index.ts @@ -32,6 +32,7 @@ import type { __PrepareOutputMethod__, __PrepareSendAmountMethod__, __PrepareTransactionMethod__, + __RetryTransactionUntilIncludedMethod__, __SendAmountMethod__, __SendMicroTransactionMethod__, __SendNativeTokensMethod__, @@ -42,6 +43,12 @@ import type { __SubmitAndStoreTransactionMethod__, __SyncAccountMethod__, __GetIncomingTransactionDataMethod__, + __VoteMethod__, + __StopParticipatingMethod__, + __GetVotingPowerMethod__, + __GetParticipationOverviewMethod__, + __IncreaseVotingPowerMethod__, + __DecreaseVotingPowerMethod__, } from './account'; import type { __BackupMessage__, @@ -55,6 +62,7 @@ import type { __GetAccountIndexesMessage__, __GetAccountsMessage__, __GetLedgerNanoStatusMessage__, + __GenerateAddressMessage__, __GetNodeInfoMessage__, __HexToBech32__, __IsStrongholdPasswordAvailableMessage__, @@ -68,6 +76,11 @@ import type { __StopBackgroundSyncMessage__, __StoreMnemonicMessage__, __VerifyMnemonicMessage__, + __DeregisterParticipationEvent__, + __RegisterParticipationEventMessage__, + __GetParticipationEventMessage__, + __GetParticipationEventsMessage__, + __GetParticipationEventStatusMessage__, } from './accountManager'; export type __AccountMethod__ = @@ -104,6 +117,7 @@ export type __AccountMethod__ = | __PrepareOutputMethod__ | __PrepareSendAmountMethod__ | __PrepareTransactionMethod__ + | __RetryTransactionUntilIncludedMethod__ | __SendAmountMethod__ | __SendMicroTransactionMethod__ | __SendNativeTokensMethod__ @@ -112,7 +126,13 @@ export type __AccountMethod__ = | __SetAliasMethod__ | __SignTransactionEssenceMethod__ | __SubmitAndStoreTransactionMethod__ - | __SyncAccountMethod__; + | __SyncAccountMethod__ + | __VoteMethod__ + | __StopParticipatingMethod__ + | __GetVotingPowerMethod__ + | __GetParticipationOverviewMethod__ + | __IncreaseVotingPowerMethod__ + | __DecreaseVotingPowerMethod__; export type __CallAccountMethodMessage__ = { cmd: 'callAccountMethod'; @@ -129,16 +149,22 @@ export type __Message__ = | __ChangeStrongholdPasswordMessage__ | __ClearStrongholdPasswordMessage__ | __CreateAccountMessage__ + | __DeregisterParticipationEvent__ | __EmitTestEventMessage__ | __GenerateMnemonicMessage__ | __GetAccountMessage__ | __GetAccountIndexesMessage__ | __GetAccountsMessage__ | __GetLedgerNanoStatusMessage__ + | __GenerateAddressMessage__ | __GetNodeInfoMessage__ + | __GetParticipationEventMessage__ + | __GetParticipationEventsMessage__ + | __GetParticipationEventStatusMessage__ | __HexToBech32__ | __IsStrongholdPasswordAvailableMessage__ | __RecoverAccountsMessage__ + | __RegisterParticipationEventMessage__ | __RemoveLatestAccountMessage__ | __RestoreBackupMessage__ | __SetClientOptionsMessage__ @@ -148,3 +174,5 @@ export type __Message__ = | __StopBackgroundSyncMessage__ | __StoreMnemonicMessage__ | __VerifyMnemonicMessage__; + + \ No newline at end of file diff --git a/bindings/capacitorjs/src/types/incomingTransactionData.ts b/bindings/capacitorjs/src/types/incomingTransactionData.ts index e1bbb563e0..35c4ce0114 100644 --- a/bindings/capacitorjs/src/types/incomingTransactionData.ts +++ b/bindings/capacitorjs/src/types/incomingTransactionData.ts @@ -1,3 +1,6 @@ import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; -export type IncomingTransactionData = [ITransactionPayload, IOutputMetadataResponse[]] +export type IncomingTransactionData = [ + ITransactionPayload, + IOutputMetadataResponse[], +]; diff --git a/bindings/capacitorjs/src/types/index.ts b/bindings/capacitorjs/src/types/index.ts index d76593cce5..68a13c563f 100644 --- a/bindings/capacitorjs/src/types/index.ts +++ b/bindings/capacitorjs/src/types/index.ts @@ -1,7 +1,7 @@ export * from './account'; export * from './accountManager'; export * from './address'; -export * from './bridge'; +export * from './bridge/index'; export * from './buildOutputData'; export * from './event'; export * from './incomingTransactionData'; @@ -9,6 +9,7 @@ export * from './loggerConfig'; export * from './network'; export * from './output'; export * from './outputOptions'; +export * from './participation'; export * from './preparedTransactionData'; export * from './secretManager'; export * from './signedTransactionEssence'; diff --git a/bindings/capacitorjs/src/types/output.ts b/bindings/capacitorjs/src/types/output.ts index 68f353d98e..cd7316ab30 100644 --- a/bindings/capacitorjs/src/types/output.ts +++ b/bindings/capacitorjs/src/types/output.ts @@ -16,7 +16,7 @@ export enum OutputsToClaim { /** An output with metadata */ export interface OutputData { /** The identifier of an Output */ - outputId: string; + outputId: OutputId; /** The metadata of the output */ metadata: IOutputMetadataResponse; /** The actual Output */ @@ -38,3 +38,5 @@ export interface Segment { hardened: boolean; bs: Uint8Array; } + +export type OutputId = string; diff --git a/bindings/capacitorjs/src/types/participation.ts b/bindings/capacitorjs/src/types/participation.ts new file mode 100644 index 0000000000..ae273550d2 --- /dev/null +++ b/bindings/capacitorjs/src/types/participation.ts @@ -0,0 +1,69 @@ +// import type { OutputId } from './output'; + +export interface ParticipationOverview { + participations: {[eventId: string]: { [outputId: string]: TrackedParticipationOverview }}; +} + +export interface TrackedParticipationOverview { + blockId: string; + amount: string; + startMilestoneIndex: number; + endMilestoneIndex: number; +} + +export interface Event { + id: EventId; + data: EventData; +} + +export type EventId = string; + +export interface EventStatus { + milestoneIndex: number; + status: string; + questions?: Answer[]; + checksum: string; +} + +export interface EventData { + name: string; + milestoneIndexCommence: number; + milestoneIndexStart: number; + milestoneIndexEnd: number; + payload: EventPayload; + additionalInfo: string; +} + +export type EventPayload = VotingEventPayload | StakingEventPayload; + +export interface VotingEventPayload { + type: ParticipationEventType.Voting; + questions: Question[]; +} + +export interface StakingEventPayload { + type: ParticipationEventType.Staking; + text: string; + symbol: string; + numerator: string; + denominator: string; + requiredMinimumRewards: string; + additionalInfo: string; +} + +export interface Question { + text: string; + answers: Answer[]; + additionalInfo: string; +} + +export interface Answer { + value: number; + text: string; + additionalInfo: string; +} + +export enum ParticipationEventType { + Voting = 0, + Staking = 1, +} From b915320e47c0a95dd1fd976d7ec48d15a8abafc1 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 16 Jan 2023 11:55:49 +0100 Subject: [PATCH 094/197] chore: update npm package build settings Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 6 ++---- bindings/capacitorjs/rollup.config.js | 19 ++++++++++++++++--- bindings/capacitorjs/tsconfig.json | 16 ++++++++++++---- 3 files changed, 30 insertions(+), 11 deletions(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1f882aed41..220efc7c15 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -1,11 +1,9 @@ { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", - "main": "dist/esm/index.js", - "module": "dist/esm/index.js", - "types": "dist/esm/index.d.ts", + "main": "dist/api.js", "files": [ "android/src/main/", "android/build.gradle", diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js index 3ee3206fc8..6d47a352f9 100644 --- a/bindings/capacitorjs/rollup.config.js +++ b/bindings/capacitorjs/rollup.config.js @@ -1,8 +1,8 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -export default { - input: 'dist/esm/index.js', +export default [{ + input: ['dist/esm/index.js'], output: [ { file: 'dist/plugin.js', @@ -16,4 +16,17 @@ export default { }, ], external: ['@capacitor/core'], -}; \ No newline at end of file +}, +{ + input: ['dist/esm/lib/index.js'], + output: [ + { + file: 'dist/api.js', + // format: 'iife', + // globals: { + // '@capacitor/core': 'capacitorExports', + // }, + }, + ], + external: ['@capacitor/core'], +}]; \ No newline at end of file diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json index c1c4b12738..2ba49621ba 100644 --- a/bindings/capacitorjs/tsconfig.json +++ b/bindings/capacitorjs/tsconfig.json @@ -3,7 +3,7 @@ { "compilerOptions": { - "allowUnreachableCode": false, + "allowUnreachableCode": true, "declaration": true, "esModuleInterop": true, "lib": ["dom", "es2017"], @@ -14,11 +14,19 @@ "noUnusedParameters": true, "outDir": "dist/esm", "pretty": true, - "sourceMap": true, + "sourceMap": false, "target": "es2017" }, "files": [ "src/index.ts", - "src/definitions.ts" - ] + "src/definitions.ts", + // "src/lib/index.ts", + // "src/lib/bindings.ts", + // "src/lib/AccountManager.ts", + // "src/lib/Account.ts", + // "src/lib/MessageHandler.ts", + // "src/types/index.ts" + ], + "include": ["src/*", "src/lib/**/*", "src/types/**/*"], + // "include": ["src/types"], } From ad97d94bec8867cac806514be92c6e812ac479d4 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 17 Jan 2023 12:34:52 +0100 Subject: [PATCH 095/197] fix: add clientOptions object with node urls on Java Signed-off-by: Amadeo Marchioni --- .../org/iota/iotawalletmobile/IotaWalletMobile.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java index 602f641454..42de7744a5 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java @@ -26,9 +26,11 @@ import org.iota.types.events.wallet.WalletEventType; import org.iota.types.exceptions.WalletException; import org.iota.types.secret.StrongholdSecretManager; +import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; +import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; @@ -59,6 +61,13 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { Log.d("_clientOptions", _clientOptions.get("nodes").toString()); + JSONArray _nodes = _clientOptions.getJSONArray("nodes"); + String[] nodes = new String[_nodes.length()]; + for (int i = 0; i < _nodes.length(); i++) { + JSONObject _node = (JSONObject) _nodes.get(i); + nodes[i] = _node.get("url").toString(); + } + JSONObject secretManager = _secretManager.getJSONObject("stronghold"); Log.d("_storagePath", path + secretManager.get("snapshotPath")); if (_coinType == null) { @@ -71,13 +80,12 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { try { wallet = new Wallet(new WalletConfig() - .withClientOptions(new ClientConfig().withNodes("https://api.testnet.shimmer.network")) + .withClientOptions(new ClientConfig().withNodes(nodes)) .withStoragePath(path) .withSecretManager( new StrongholdSecretManager( null, null, -// path + secretManager.get("snapshotPath") path + "/wallet.stronghold" ) ) From 00d6e5c4dc7241f3ad7b37631f1c9c1d157735f9 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 20 Jan 2023 12:10:48 +0100 Subject: [PATCH 096/197] chore: tidy up swift code --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 81 ++++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index 2d342967db..e654272ab1 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,46 +8,6 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { - // Handles the Swift / C pointers with a context object using Unmanaged types - class ContextResult { - // the `call` will send the context response back to Javascript - var call: CAPPluginCall? - - init(_call: CAPPluginCall) { - self.call = _call - } - - func resolve(type: String, data: String) { - self.call?.resolve([type: data]) - } - // the needed `callback` to call C header functions - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // Convert back into `ContextResult` Swift object type - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - - let callbackListen: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // retain of the object awaiting for the next message. - // TODO: verify it's released later - let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() - - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - } - // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -66,7 +26,6 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("clientOptions or secretManager is an invalid JSON object") } let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) @@ -137,6 +96,46 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } + // Handles the Swift / C interop pointers with a context object using Unmanaged types + class ContextResult { + // the `call` will send the context response back to Javascript + let call: CAPPluginCall? + + init(_call: CAPPluginCall) { + self.call = _call + } + + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) + } + // the needed `callback` to call C header functions + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // Convert back into `ContextResult` Swift object type + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object awaiting for the next message. + // TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + } + @objc func sendMessage(_ call: CAPPluginCall) { guard let handler = call.getInt("handler") else { return call.reject("handler is required") From 92edb9dbb74ecff61eedb475232870085a9f7204 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 20 Jan 2023 12:59:28 +0100 Subject: [PATCH 097/197] fix: swift plugin error Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/Plugin/Plugin.swift | 81 ++++++++++---------- 1 file changed, 41 insertions(+), 40 deletions(-) diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/bindings/capacitorjs/ios/Plugin/Plugin.swift index e654272ab1..e5ae117795 100644 --- a/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -8,6 +8,46 @@ import Wallet @objc(IotaWalletMobile) public class IotaWalletMobile: CAPPlugin { + // Handles the Swift / C pointers with a context object using Unmanaged types + class ContextResult { + // the `call` will send the context response back to Javascript + let call: CAPPluginCall? + + init(_call: CAPPluginCall) { + self.call = _call + } + + func resolve(type: String, data: String) { + self.call?.resolve([type: data]) + } + // the needed `callback` to call C header functions + let callback: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // Convert back into `ContextResult` Swift object type + let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + + let callbackListen: Callback = { response, error, context in + guard let context = context, + let response = response else { return } + // retain of the object awaiting for the next message. + // TODO: verify it's released later + let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() + + if let error = error { + contextResult.resolve(type: "error", data: String(cString: error)) + return + } + contextResult.resolve(type: "result", data: String(cString: response)) + } + } + // TODO: we really need pass this params from swift? private let error_buffer: UnsafeMutablePointer? = nil private let error_buffer_size = 0 @@ -26,6 +66,7 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("clientOptions or secretManager is an invalid JSON object") } let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) + // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) @@ -96,46 +137,6 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } - // Handles the Swift / C interop pointers with a context object using Unmanaged types - class ContextResult { - // the `call` will send the context response back to Javascript - let call: CAPPluginCall? - - init(_call: CAPPluginCall) { - self.call = _call - } - - func resolve(type: String, data: String) { - self.call?.resolve([type: data]) - } - // the needed `callback` to call C header functions - let callback: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // Convert back into `ContextResult` Swift object type - let contextResult = Unmanaged.fromOpaque(context).takeRetainedValue() - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - - let callbackListen: Callback = { response, error, context in - guard let context = context, - let response = response else { return } - // retain of the object awaiting for the next message. - // TODO: verify it's released later - let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() - - if let error = error { - contextResult.resolve(type: "error", data: String(cString: error)) - return - } - contextResult.resolve(type: "result", data: String(cString: response)) - } - } - @objc func sendMessage(_ call: CAPPluginCall) { guard let handler = call.getInt("handler") else { return call.reject("handler is required") From d1e515940f4efcef1cddc4dd839f8f1865ffa22f Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 13:05:08 +0100 Subject: [PATCH 098/197] chore: clean js api code Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 1 - .../capacitorjs/src/lib/AccountManager.ts | 55 +------------------ 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index db2b4b91ed..47d5cfdf0e 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,7 +1,6 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 87a4e0dd83..9369e78031 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -263,60 +263,7 @@ export async function AccountManager(options: AccountManagerOptions) { }, /** - * Transform hex encoded address to bech32 e/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * -/** - * ncoded address. If no bech32Hrp + * Transform hex encoded address to bech32 encoded address. If no bech32Hrp * is provided, the AccountManager will attempt to retrieve it from the * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. */ From 176ab3b9a04cdac70b14a4a7a742075cb72b687b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 15:52:17 +0100 Subject: [PATCH 099/197] chore: polish js wallet api Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/MessageHandler.ts | 2 -- bindings/capacitorjs/src/lib/bindings.ts | 6 ------ 2 files changed, 8 deletions(-) diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/bindings/capacitorjs/src/lib/MessageHandler.ts index 59b2d2eb04..eff984e225 100644 --- a/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -26,8 +26,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { secretManager: options?.secretManager }; const { messageHandler } = await messageHandlerNew(messageOptions); - // messageHandler = messageHandler.messageHandler; - // console.error(messageHandler.messageHandler, 'received') async function sendMessage(message: __Message__): Promise { return await sendMessageAsync( diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/bindings/capacitorjs/src/lib/bindings.ts index bcf3ae3a9b..6a5bd11386 100644 --- a/bindings/capacitorjs/src/lib/bindings.ts +++ b/bindings/capacitorjs/src/lib/bindings.ts @@ -1,13 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -// import type { MessageHandler } from './MessageHandler' -// import { IotaWalletMobileTypes } from "@iota/wallet-mobile" -// import { registerPlugin } from '@capacitor/core' - -// const IotaWalletMobile = registerPlugin('IotaWalletMobile') import { IotaWalletMobile } from '../index' -// const IotaWalletMobile: IotaWalletMobileTypes const { initLogger, From d782fbe426c013b30ed2c3689a6f45c605cb1e79 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 15:52:50 +0100 Subject: [PATCH 100/197] fix: add type definitions to package Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 220efc7c15..1f79e4eba3 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -4,6 +4,8 @@ "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/api.js", + "module": "dist/api.js", + "types": "dist/esm/lib/index.d.ts", "files": [ "android/src/main/", "android/build.gradle", From 60c60a8343790866122cb376d5d4236ffbfda3f9 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:25:26 +0100 Subject: [PATCH 101/197] chore: add lacking types Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 10 ++++++---- bindings/capacitorjs/src/lib/AccountManager.ts | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index 47d5cfdf0e..032ce65e0b 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,6 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +import type { MessageHandler } from './MessageHandler'; import type { AccountBalance, AccountMetadata, @@ -43,14 +44,15 @@ import type { INftOutput, OutputTypes, } from '@iota/types'; +type MessageHandlerType = Awaited> /** The Account class. */ export class Account { // private because the data isn't updated private meta: AccountMeta; - private messageHandler: any; + private messageHandler: MessageHandlerType; - constructor(accountMeta: AccountMeta, messageHandler: any) { + constructor(accountMeta: AccountMeta, messageHandler: MessageHandlerType) { this.meta = accountMeta; this.messageHandler = messageHandler; } @@ -982,7 +984,7 @@ export class Account { return JSON.parse(resp).payload; } - async vote(eventId?: string, answers?: number[]): Promise { + async vote(eventId: string, answers: number[]): Promise { const resp = await this.messageHandler.callAccountMethod( this.meta.index, { @@ -1054,4 +1056,4 @@ export class Account { ); return JSON.parse(resp).payload; } -} \ No newline at end of file +} diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/AccountManager.ts index 9369e78031..b92b749727 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/AccountManager.ts @@ -25,7 +25,7 @@ import type { /** The AccountManager class. */ export async function AccountManager(options: AccountManagerOptions) { - let id: AccountId = 0 + let id: AccountId let messageHandler = await MessageHandler(options); From 4775c461b895c93e460519e1265e0f76c23cdc51 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:27:32 +0100 Subject: [PATCH 102/197] chore: update typescript Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/package-lock.json | 27 ++++++++++++-------------- bindings/capacitorjs/package.json | 2 +- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/bindings/capacitorjs/package-lock.json b/bindings/capacitorjs/package-lock.json index bea324531a..3464e886ef 100644 --- a/bindings/capacitorjs/package-lock.json +++ b/bindings/capacitorjs/package-lock.json @@ -1,16 +1,18 @@ { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@iota/wallet-mobile", - "version": "0.0.1", + "version": "2.0.0-alpha.0", + "hasInstallScript": true, "license": "Apache-2.0", "dependencies": { "@capacitor/core": "^3.4.1", - "@iota/types": "^1.0.0-beta.15" + "@iota/types": "^1.0.0-beta.15", + "rollup": "^2.29.0" }, "devDependencies": { "@capacitor/android": "^3.4.1", @@ -18,8 +20,7 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "rollup": "^2.32.0", - "typescript": "~4.0.3" + "typescript": "^4.9.4" }, "peerDependencies": { "@capacitor/core": "^3.4.1" @@ -113,7 +114,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "hasInstallScript": true, "optional": true, "os": [ @@ -223,7 +223,6 @@ "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, "bin": { "rollup": "dist/bin/rollup" }, @@ -241,9 +240,9 @@ "dev": true }, "node_modules/typescript": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", - "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -339,7 +338,6 @@ "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, "optional": true }, "github-slugger": { @@ -421,7 +419,6 @@ "version": "2.79.1", "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.79.1.tgz", "integrity": "sha512-uKxbd0IhMZOhjAiD5oAFp7BqvkA4Dv47qpOCtaNvng4HBwdbWtdOh8f5nZNuk2rp51PMGk3bzfWu5oayNEuYnw==", - "dev": true, "requires": { "fsevents": "~2.3.2" } @@ -433,9 +430,9 @@ "dev": true }, "typescript": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.0.8.tgz", - "integrity": "sha512-oz1765PN+imfz1MlZzSZPtC/tqcwsCyIYA8L47EkRnRW97ztRk83SzMiWLrnChC0vqoYxSU1fcFUDA5gV/ZiPg==", + "version": "4.9.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.4.tgz", + "integrity": "sha512-Uz+dTXYzxXXbsFpM86Wh3dKCxrQqUcVMxwU54orwlJjOpO3ao8L7j5lH+dWfTwgCwIuM9GQ2kvVotzYJMXTBZg==", "dev": true }, "wrappy": { diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1f79e4eba3..8889873276 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -43,7 +43,7 @@ "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", "rimraf": "^3.0.2", - "typescript": "~4.0.3" + "typescript": "^4.9.4" }, "peerDependencies": { "@capacitor/core": "^3.4.1" From 6105852ecbf0ffdbd340950549836ece24b00ef1 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 25 Jan 2023 21:27:59 +0100 Subject: [PATCH 103/197] chore: add types to walletApi Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 38 +++++++++++------------ 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 290ae2a05b..73b5bd160f 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,56 +1,56 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +import { AccountId, CreateAccountPayload } from '../types/account'; +import { AccountManagerOptions } from '../types'; import { Account } from './Account'; import { AccountManager } from './AccountManager'; -const profileManagers = {} +type ProfileManager = Awaited> +type RecoverAccounts = ProfileManager['recoverAccounts'] +interface ProfileManagers { + [key: string]: ProfileManager +} +const profileManagers: ProfileManagers = {} + const WalletApi = { - async createAccountManager( - id: number, // Account.AccountId, - options: unknown, // Account.AccountManagerOptions - ) { - console.error({options}) + async createAccountManager(id: AccountId, options: AccountManagerOptions) { const manager = await AccountManager(options) manager.id = id - console.error({manager}) profileManagers[id] = manager - // bindMethodsAcrossContextBridge(WalletApi.AccountManager, manager) return manager }, - async createAccount(managerId, payload) { + async createAccount(managerId: AccountId, payload: CreateAccountPayload) { const manager = profileManagers[managerId] const account = await manager.createAccount(payload) bindMethodsAcrossContextBridge(Account.prototype, account) return account }, - deleteAccountManager(id) { - if (id && id in profileManagers) { - delete profileManagers[id] + deleteAccountManager(managerId: AccountId) { + if (managerId && managerId in profileManagers) { + delete profileManagers[managerId] } }, - async getAccount(managerId, index) { + async getAccount(managerId: AccountId, index: number) { const manager = profileManagers[managerId] - console.error({manager}) const account = await manager.getAccount(index) bindMethodsAcrossContextBridge(Account.prototype, account) return account }, - async getAccounts(managerId) { + async getAccounts(managerId: AccountId) { const manager = profileManagers[managerId] - console.error({manager}) const accounts = await manager.getAccounts() accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId, payload) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { const manager = profileManagers[managerId] - console.error({manager}) - const accounts = await manager.recoverAccounts(...Object.values(payload)) + const accounts = await manager.recoverAccounts(...Object.values(payload) as Parameters) accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, } + function bindMethodsAcrossContextBridge(prototype, object) { const prototypeProperties = Object.getOwnPropertyNames(prototype) prototypeProperties.forEach((key) => { From 6d59bd6e58559599dc9ef08c92eda357a8e03d2f Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 15:20:22 +0100 Subject: [PATCH 104/197] fix: js api types Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 73b5bd160f..7edfcc33ef 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,13 +1,19 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { AccountId, CreateAccountPayload } from '../types/account'; +import { AccountId, AccountSyncOptions, CreateAccountPayload } from '../types/account'; import { AccountManagerOptions } from '../types'; import { Account } from './Account'; import { AccountManager } from './AccountManager'; type ProfileManager = Awaited> -type RecoverAccounts = ProfileManager['recoverAccounts'] +type RecoverAccounts = Parameters +interface RecoverAccountsPayload { + accountStartIndex: number, + accountGapLimit: number, + addressGapLimit: number, + syncOptions?: AccountSyncOptions +} interface ProfileManagers { [key: string]: ProfileManager } @@ -43,9 +49,9 @@ const WalletApi = { accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccountsPayload) { const manager = profileManagers[managerId] - const accounts = await manager.recoverAccounts(...Object.values(payload) as Parameters) + const accounts = await manager.recoverAccounts(...Object.values(payload) as RecoverAccounts) accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, From 242b1700c14c697ec36a74d778f1cf6608274b83 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 15:22:17 +0100 Subject: [PATCH 105/197] chore: add README Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/README.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 bindings/capacitorjs/README.md diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md new file mode 100644 index 0000000000..03823e208f --- /dev/null +++ b/bindings/capacitorjs/README.md @@ -0,0 +1,24 @@ +# IOTA Wallet Library - Capacitor plugin binding + +## Requirements (only for building the binary yourself) + +[Android: Follow this guide](https://github.com/iotaledger/wallet.rs/tree/develop/bindings/java#instead-build-everything-from-scratch-yourself) + +[iOS: Follow this guide](https://github.com/iotaledger/wallet.rs/blob/develop/bindings/swift) + + +## Installation + +- Using NPM: + +```bash +npm install @iota/wallet-mobile +npx cap sync +``` + +## Building the @iota/wallet-mobile Capacitor plugin + +```sh +npm run build +``` +This command copy the already built libraries from Java and Swift bindings. \ No newline at end of file From 0f5215161b182472f31a73b76d3a9008fa1e11f0 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 26 Jan 2023 17:56:00 +0100 Subject: [PATCH 106/197] chore: upgrade gradle Signed-off-by: Amadeo Marchioni --- .../android/gradle/wrapper/gradle-wrapper.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties index 6047798096..abaee84220 100644 --- a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties +++ b/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip From c41bf5b09ffd8edf5138d8b89ba788d05eefebba Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 12:41:08 +0100 Subject: [PATCH 107/197] updated build files for windows --- bindings/capacitorjs/.gitignore | 6 ++++-- bindings/capacitorjs/add_libs.sh | 2 +- bindings/capacitorjs/package.json | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore index 2058c00f47..49f335a6a8 100644 --- a/bindings/capacitorjs/.gitignore +++ b/bindings/capacitorjs/.gitignore @@ -10,8 +10,6 @@ xcuserdata # macOS files .DS_Store - - # Based on Android gitignore template: https://github.com/github/gitignore/blob/HEAD/Android.gitignore # Built application files @@ -58,3 +56,7 @@ captures # External native build folder generated in Android Studio 2.2 and later .externalNativeBuild + +# Copied jni libs +android/libs/ +android/src/main/jniLibs/ \ No newline at end of file diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh index d2151242be..6dae5658d9 100755 --- a/bindings/capacitorjs/add_libs.sh +++ b/bindings/capacitorjs/add_libs.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -e rm -rf tmp && mkdir tmp && cd tmp diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 8889873276..49884629e3 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -18,7 +18,7 @@ "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", "build": "npm run clean && tsc && rollup -c rollup.config.js", - "clean": "rm -rf ./dist", + "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", "preinstall": "npm run build && ./add_libs.sh" From 5e5ab11bfdfb270b2b678ac4168872c23e9d509e Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 15:34:59 +0100 Subject: [PATCH 108/197] revert sh removal --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 49884629e3..1fa4722fca 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && ./add_libs.sh" + "preinstall": "npm run build && sh ./add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From e1fbde715d4aa727bbae3695aac6e0a11bf781e6 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 27 Jan 2023 15:41:18 +0100 Subject: [PATCH 109/197] messed up... --- bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/package.json b/bindings/capacitorjs/package.json index 1fa4722fca..36e89672ee 100644 --- a/bindings/capacitorjs/package.json +++ b/bindings/capacitorjs/package.json @@ -21,7 +21,7 @@ "clean": "rimraf -rf ./dist", "watch": "tsc --watch", "prepublishOnly": "npm run build", - "preinstall": "npm run build && sh ./add_libs.sh" + "preinstall": "npm run build && bash add_libs.sh" }, "author": "IOTA Stiftung", "license": "Apache-2.0", From 9d6e5f2a42ce7e23e454cce485be74b00f857cb8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 30 Jan 2023 16:03:08 +0100 Subject: [PATCH 110/197] fix: Cargo.lock Signed-off-by: Amadeo Marchioni --- wallet/bindings/swift/Cargo.lock | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/wallet/bindings/swift/Cargo.lock b/wallet/bindings/swift/Cargo.lock index 373671d66a..ba734aedbe 100644 --- a/wallet/bindings/swift/Cargo.lock +++ b/wallet/bindings/swift/Cargo.lock @@ -86,12 +86,6 @@ version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - [[package]] name = "arrayvec" version = "0.7.2" @@ -212,7 +206,7 @@ version = "0.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" dependencies = [ - "digest 0.10.3", + "digest 0.10.6", ] [[package]] @@ -372,6 +366,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] +<<<<<<< HEAD:wallet/bindings/swift/Cargo.lock name = "constant_time_eq" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -389,17 +384,21 @@ dependencies = [ [[package]] name = "crossbeam-utils" version = "0.8.14" +======= +name = "cpufeatures" +version = "0.2.5" +>>>>>>> 394359b0 (fix: Cargo.lock):bindings/swift/Cargo.lock source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" +checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" dependencies = [ - "cfg-if", + "libc", ] [[package]] name = "crossbeam-utils" -version = "0.8.12" +version = "0.8.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edbafec5fa1f196ca66527c1b12c2ec4745ca14b50f1ad8f9f6f720b55d11fac" +checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" dependencies = [ "cfg-if", ] @@ -1376,9 +1375,9 @@ dependencies = [ [[package]] name = "nix" -version = "0.24.2" +version = "0.24.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "195cdbc1741b8134346d515b3a56a1c94b0912758009cfd53f99ea0f57b065fc" +checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" dependencies = [ "bitflags", "cfg-if", @@ -1955,7 +1954,7 @@ checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" dependencies = [ "cfg-if", "cpufeatures", - "digest 0.10.3", + "digest 0.10.6", ] [[package]] From a2c0761774bd4a69daba35968393e6d2a4d4a6df Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 09:50:11 -0300 Subject: [PATCH 111/197] Update bindings/capacitorjs/README.md Co-authored-by: Rajiv Shah --- bindings/capacitorjs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md index 03823e208f..f6501eb32b 100644 --- a/bindings/capacitorjs/README.md +++ b/bindings/capacitorjs/README.md @@ -21,4 +21,4 @@ npx cap sync ```sh npm run build ``` -This command copy the already built libraries from Java and Swift bindings. \ No newline at end of file +This command copies the already built libraries from Java and Swift bindings. \ No newline at end of file From 68b3f9d1ee2339fbc5a8b5631474392b3a1365fd Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 14:03:10 +0100 Subject: [PATCH 112/197] Update bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj Co-authored-by: Rajiv Shah --- bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj index 2efac039af..7084a43f99 100644 --- a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj +++ b/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -229,7 +229,7 @@ attributes = { LastSwiftUpdateCheck = 0920; LastUpgradeCheck = 0920; - ORGANIZATIONNAME = "Max Lynch"; + ORGANIZATIONNAME = "IOTA Stiftung"; TargetAttributes = { 50ADFF87201F53D600D50D53 = { CreatedOnToolsVersion = 9.2; From 70097f6579d1c6f05189b0e7f95c5103980d92b9 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 2 Feb 2023 13:06:15 +0000 Subject: [PATCH 113/197] fix: update ios .gitignore Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/ios/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore index adb2bb7ed5..be5d3cce09 100644 --- a/bindings/capacitorjs/ios/.gitignore +++ b/bindings/capacitorjs/ios/.gitignore @@ -1,3 +1,3 @@ -libwallet.a +WalletFramework Pods ._* \ No newline at end of file From 7e1411024ac545161a1788b8bc4e63d2be58b819 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 10:00:03 +0000 Subject: [PATCH 114/197] fix: change to wallet.rs repo at podspec Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/IotaWalletMobile.podspec | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bindings/capacitorjs/IotaWalletMobile.podspec b/bindings/capacitorjs/IotaWalletMobile.podspec index c544913736..2df52e2290 100644 --- a/bindings/capacitorjs/IotaWalletMobile.podspec +++ b/bindings/capacitorjs/IotaWalletMobile.podspec @@ -4,11 +4,11 @@ s.version = '0.0.1' s.summary = 'Capacitor plugin binding to the wallet library' s.license = { :type => 'Apache-2.0' } - s.homepage = 'https://github.com/iotaledger/wallet.rs#readme' + s.homepage = 'https://github.com/iotaledger/wallet.rs/bindings/capacitorjs/#readme' s.author = 'IOTA Stiftung' - s.source = { :git => 'https://github.com/iotaledger/firefly.git', :tag => s.version.to_s } + s.source = { :git => 'https://github.com/iotaledger/wallet.rs.git', :tag => s.version.to_s } s.source_files = ['ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/*.{h,m,swift}'] - s.ios.deployment_target = '12.0' + s.ios.deployment_target = '13.0' s.dependency 'Capacitor' s.pod_target_xcconfig = { 'OTHER_LDFLAGS' => '-lc++', @@ -18,8 +18,7 @@ } s.frameworks = 'WalletFramework' s.vendored_frameworks = 'ios/WalletFramework.xcframework' - - s.platform = :ios, "12.0" + s.platform = :ios, "13.0" s.xcconfig = { 'SWIFT_INCLUDE_PATHS' => ['$(PODS_TARGET_SRCROOT)/ios/Plugin/Libraries', '$(PODS_TARGET_SRCROOT)/ios/WalletFramework.xcframework'] } s.preserve_paths = ['ios/Plugin/Libraries/module.modulemap'] s.preserve_paths = ['ios/WalletFramework.xcframework'] From 3124f3b8043bc264d016a12dd3a16447893ee481 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 11:02:57 +0100 Subject: [PATCH 115/197] fix: update bindings/capacitorjs/README.md Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> --- bindings/capacitorjs/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/README.md b/bindings/capacitorjs/README.md index f6501eb32b..9e89a606c8 100644 --- a/bindings/capacitorjs/README.md +++ b/bindings/capacitorjs/README.md @@ -21,4 +21,4 @@ npx cap sync ```sh npm run build ``` -This command copies the already built libraries from Java and Swift bindings. \ No newline at end of file +This command copies the prebuilt libraries from Java and Swift bindings. \ No newline at end of file From d1dba52ea93668e94c65ee1a90df9a61f6496627 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 11:04:22 +0100 Subject: [PATCH 116/197] fix: remove unneeded echo at bindings/capacitorjs/add_libs.sh Co-authored-by: Tuditi <45079109+Tuditi@users.noreply.github.com> --- bindings/capacitorjs/add_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/add_libs.sh b/bindings/capacitorjs/add_libs.sh index 6dae5658d9..45b1f4e9bc 100755 --- a/bindings/capacitorjs/add_libs.sh +++ b/bindings/capacitorjs/add_libs.sh @@ -14,4 +14,4 @@ rm -rf ../android/libs && mkdir -p ../android/libs cp -r iota-wallet.jar ../android/libs cd .. && rm -rf tmp -echo "success!" \ No newline at end of file +echo "success!" From 9d32541fbb29719fb06c685843416ed577a2dd2e Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 15:26:24 +0000 Subject: [PATCH 117/197] chore: set minifyEnabled to true on android Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/build.gradle b/bindings/capacitorjs/android/build.gradle index d41a73100e..056534c653 100644 --- a/bindings/capacitorjs/android/build.gradle +++ b/bindings/capacitorjs/android/build.gradle @@ -27,7 +27,7 @@ android { } buildTypes { release { - minifyEnabled false + minifyEnabled true proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' } } From 07925c86599d65a1a8bbe968f1bd872035e8a704 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Feb 2023 15:46:40 +0000 Subject: [PATCH 118/197] chore: rename android package Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/android/src/main/AndroidManifest.xml | 6 ++---- .../IotaWalletMobile.java | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) rename bindings/capacitorjs/android/src/main/java/org/iota/{iotawalletmobile => IotaWalletMobile}/IotaWalletMobile.java (99%) diff --git a/bindings/capacitorjs/android/src/main/AndroidManifest.xml b/bindings/capacitorjs/android/src/main/AndroidManifest.xml index 7cd289dcd3..adad414568 100644 --- a/bindings/capacitorjs/android/src/main/AndroidManifest.xml +++ b/bindings/capacitorjs/android/src/main/AndroidManifest.xml @@ -1,5 +1,3 @@ - - - + diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java similarity index 99% rename from bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java rename to bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 42de7744a5..6957303ace 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/iotawalletmobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -1,7 +1,7 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -package org.iota.iotawalletmobile; +package org.iota.IotaWalletMobile; import android.util.Log; From 94b309ce826c7a17f4083d81954500f4efd6ba09 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:42:05 +0100 Subject: [PATCH 119/197] Update bindings/capacitorjs/.gitignore --- bindings/capacitorjs/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/.gitignore b/bindings/capacitorjs/.gitignore index 49f335a6a8..b091d115af 100644 --- a/bindings/capacitorjs/.gitignore +++ b/bindings/capacitorjs/.gitignore @@ -59,4 +59,4 @@ captures # Copied jni libs android/libs/ -android/src/main/jniLibs/ \ No newline at end of file +android/src/main/jniLibs/ From bab153d654fe09d4b3da0c7e7f58845a49b7efc4 Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:42:36 +0100 Subject: [PATCH 120/197] Update bindings/capacitorjs/android/.gitignore --- bindings/capacitorjs/android/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/.gitignore b/bindings/capacitorjs/android/.gitignore index 028140319e..0a5554e177 100644 --- a/bindings/capacitorjs/android/.gitignore +++ b/bindings/capacitorjs/android/.gitignore @@ -69,4 +69,4 @@ fastlane/readme.md capacitor-cordova-android-plugins # Copied web assets -app/src/main/assets/public \ No newline at end of file +app/src/main/assets/public From b43b406e5ac20e1defde3c9cd54511b26e678beb Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:43:39 +0100 Subject: [PATCH 121/197] Update bindings/capacitorjs/android/gradle.properties --- bindings/capacitorjs/android/gradle.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/gradle.properties b/bindings/capacitorjs/android/gradle.properties index 2dbcb07109..123de31e6d 100644 --- a/bindings/capacitorjs/android/gradle.properties +++ b/bindings/capacitorjs/android/gradle.properties @@ -18,4 +18,4 @@ org.gradle.jvmargs=-Xmx1536m # Supports AndroidX android.useAndroidX=true -android.enableJetifier=true \ No newline at end of file +android.enableJetifier=true From 1ec581930357c703a2c90f2229defb35580a341c Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:47:30 +0100 Subject: [PATCH 122/197] Update bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java --- .../android/src/test/java/com/getcapacitor/ExampleUnitTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java index 06806a7758..5c8528f4c4 100644 --- a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java +++ b/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java @@ -14,4 +14,4 @@ public class ExampleUnitTest { public void addition_isCorrect() throws Exception { assertEquals(4, 2 + 2); } -} \ No newline at end of file +} From 96d2e2f518f259d3235f6220a363ab77f303b92e Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:48:02 +0100 Subject: [PATCH 123/197] Update bindings/capacitorjs/ios/.gitignore --- bindings/capacitorjs/ios/.gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/.gitignore b/bindings/capacitorjs/ios/.gitignore index be5d3cce09..479c460e67 100644 --- a/bindings/capacitorjs/ios/.gitignore +++ b/bindings/capacitorjs/ios/.gitignore @@ -1,3 +1,3 @@ WalletFramework Pods -._* \ No newline at end of file +._* From 04e4fd940d88b511b1752edd7a0988411ee0179c Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:49:16 +0100 Subject: [PATCH 124/197] Update bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h --- bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h index 5969c72bad..bb0ef660a3 100644 --- a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h +++ b/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h @@ -1,4 +1,4 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#import \ No newline at end of file +#import From b61f7d684167097f7dacbe3f2eb661413c4611fb Mon Sep 17 00:00:00 2001 From: Tuditi <45079109+Tuditi@users.noreply.github.com> Date: Tue, 7 Feb 2023 09:49:43 +0100 Subject: [PATCH 125/197] Update bindings/capacitorjs/rollup.config.js --- bindings/capacitorjs/rollup.config.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/rollup.config.js b/bindings/capacitorjs/rollup.config.js index 6d47a352f9..99d9f6e1c3 100644 --- a/bindings/capacitorjs/rollup.config.js +++ b/bindings/capacitorjs/rollup.config.js @@ -29,4 +29,4 @@ export default [{ }, ], external: ['@capacitor/core'], -}]; \ No newline at end of file +}]; From 96d62abe89e8597c954c316a21bffe6f10e81d24 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 12:18:16 +0000 Subject: [PATCH 126/197] chore: remove unneeded android files Signed-off-by: Amadeo Marchioni --- .../src/main/res/layout/bridge_layout_main.xml | 15 --------------- .../android/src/main/res/values/colors.xml | 3 --- .../android/src/main/res/values/strings.xml | 3 --- .../android/src/main/res/values/styles.xml | 3 --- 4 files changed, 24 deletions(-) delete mode 100644 bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/colors.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/strings.xml delete mode 100644 bindings/capacitorjs/android/src/main/res/values/styles.xml diff --git a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml b/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml deleted file mode 100644 index 56fec1546a..0000000000 --- a/bindings/capacitorjs/android/src/main/res/layout/bridge_layout_main.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - diff --git a/bindings/capacitorjs/android/src/main/res/values/colors.xml b/bindings/capacitorjs/android/src/main/res/values/colors.xml deleted file mode 100644 index 045e125f3d..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/colors.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/bindings/capacitorjs/android/src/main/res/values/strings.xml b/bindings/capacitorjs/android/src/main/res/values/strings.xml deleted file mode 100644 index 6789e139cf..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/strings.xml +++ /dev/null @@ -1,3 +0,0 @@ - - Just a simple string - diff --git a/bindings/capacitorjs/android/src/main/res/values/styles.xml b/bindings/capacitorjs/android/src/main/res/values/styles.xml deleted file mode 100644 index f11f7450a8..0000000000 --- a/bindings/capacitorjs/android/src/main/res/values/styles.xml +++ /dev/null @@ -1,3 +0,0 @@ - - - From 4872194405dc4cab2e6a201a4b61db2a47ee52f3 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:38:32 +0000 Subject: [PATCH 127/197] chore: remove ts compiled js files Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/types/bridge/account.js | 2 -- bindings/capacitorjs/src/types/bridge/accountManager.js | 2 -- bindings/capacitorjs/src/types/bridge/index.js | 2 -- 3 files changed, 6 deletions(-) delete mode 100644 bindings/capacitorjs/src/types/bridge/account.js delete mode 100644 bindings/capacitorjs/src/types/bridge/accountManager.js delete mode 100644 bindings/capacitorjs/src/types/bridge/index.js diff --git a/bindings/capacitorjs/src/types/bridge/account.js b/bindings/capacitorjs/src/types/bridge/account.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/account.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.js b/bindings/capacitorjs/src/types/bridge/accountManager.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/accountManager.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; diff --git a/bindings/capacitorjs/src/types/bridge/index.js b/bindings/capacitorjs/src/types/bridge/index.js deleted file mode 100644 index 0e345787d2..0000000000 --- a/bindings/capacitorjs/src/types/bridge/index.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -exports.__esModule = true; From f00692f277762ecc46b489dfb3035f60cc64a298 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:39:25 +0000 Subject: [PATCH 128/197] chore: remove old comments Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/tsconfig.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/bindings/capacitorjs/tsconfig.json b/bindings/capacitorjs/tsconfig.json index 2ba49621ba..6c8b987e15 100644 --- a/bindings/capacitorjs/tsconfig.json +++ b/bindings/capacitorjs/tsconfig.json @@ -20,13 +20,6 @@ "files": [ "src/index.ts", "src/definitions.ts", - // "src/lib/index.ts", - // "src/lib/bindings.ts", - // "src/lib/AccountManager.ts", - // "src/lib/Account.ts", - // "src/lib/MessageHandler.ts", - // "src/types/index.ts" ], - "include": ["src/*", "src/lib/**/*", "src/types/**/*"], - // "include": ["src/types"], + "include": ["src/*", "src/lib/**/*", "src/types/**/*"] } From 0dd538acb60cc23a3b533fbc89dae92ad155832c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 13:54:42 +0000 Subject: [PATCH 129/197] chore: add name var to messageHandler pointer Signed-off-by: Amadeo Marchioni --- .../java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 6957303ace..b13a546db6 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -92,7 +92,10 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { .withCoinType(coinType) ); JSObject ret = new JSObject(); - ret.put("messageHandler", 1); + // 1 signals the id of the messageHandler returned by the rust side. + // This is irrelevant for the Java side, but required on the Swift and JS side + Integer messageHandlerPointer = 1; + ret.put("messageHandler", messageHandlerPointer); call.resolve(ret); } catch (Exception e) { e.printStackTrace(); From a1613e778a86b44b618dbdf6661d87f3cc0aa476 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 9 Feb 2023 14:16:53 +0000 Subject: [PATCH 130/197] chore: fix typo Signed-off-by: Amadeo Marchioni --- .../main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index b13a546db6..ffc57b2b0f 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -106,7 +106,7 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { public void sendMessage(final PluginCall call) { try { if (!call.getData().has("message")) { - call.reject("message are required"); + call.reject("message is required"); } String message = call.getString("message"); if (message == null) { From 03d7f531c66526f574cc5b03f8adb3203b39901d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 22 Feb 2023 15:01:37 +0000 Subject: [PATCH 131/197] chore: convert `Account` to factory function Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/Account.ts | 1952 +++++++++++------------ 1 file changed, 973 insertions(+), 979 deletions(-) diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/Account.ts index 032ce65e0b..5e30deb3ec 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/Account.ts @@ -1,7 +1,7 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import type { MessageHandler } from './MessageHandler'; +import type { MessageHandler } from './MessageHandler' import type { AccountBalance, AccountMetadata, @@ -28,14 +28,14 @@ import type { TransactionOptions, IncomingTransactionData, ParticipationOverview, -} from '../types'; -import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; +} from '../types' +import type { SignedTransactionEssence } from '../types/signedTransactionEssence' import type { BuildAliasOutputData, BuildBasicOutputData, BuildFoundryOutputData, BuildNftOutputData, -} from '../types/buildOutputData'; +} from '../types/buildOutputData' import type { HexEncodedAmount, IAliasOutput, @@ -43,1017 +43,1011 @@ import type { IFoundryOutput, INftOutput, OutputTypes, -} from '@iota/types'; -type MessageHandlerType = Awaited> - -/** The Account class. */ -export class Account { - // private because the data isn't updated - private meta: AccountMeta; - private messageHandler: MessageHandlerType; - - constructor(accountMeta: AccountMeta, messageHandler: MessageHandlerType) { - this.meta = accountMeta; - this.messageHandler = messageHandler; - } - - /** - * Build an `AliasOutput`. - * @param data Options for building an `AliasOutput`. - * @returns The built `AliasOutput`. - */ - async buildAliasOutput(data: BuildAliasOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildAliasOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build a `BasicOutput`. - * @param data Options for building a `BasicOutput`. - * @returns The built `BasicOutput`. - */ - async buildBasicOutput(data: BuildBasicOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildBasicOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build a `FoundryOutput`. - * @param data Options for building a `FoundryOutput`. - * @returns The built `FoundryOutput`. - */ - async buildFoundryOutput( - data: BuildFoundryOutputData, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildFoundryOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build an `NftOutput`. - * @param data Options for building an `NftOutput`. - * @returns The built `NftOutput`. - */ - async buildNftOutput(data: BuildNftOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildNftOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Burn native tokens. This doesn't require the foundry output which minted them, but will not increase - * the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. Therefore it's - * recommended to use melting, if the foundry output is available. - * @param tokenId The native token id. - * @param burnAmount The to be burned amount. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async burnNativeToken( - tokenId: string, - burnAmount: HexEncodedAmount, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'burnNativeToken', - data: { - tokenId, - burnAmount, - options: transactionOptions, +} from '@iota/types' +type MessageHandler = Awaited> + +/** The Account factory function. */ +export function Account(accountMeta: AccountMeta, messageHandler: MessageHandler) { + + return { + /** + * Build an `AliasOutput`. + * @param data Options for building an `AliasOutput`. + * @returns The built `AliasOutput`. + */ + async buildAliasOutput(data: BuildAliasOutputData): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'buildAliasOutput', + data, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Burn an nft output. Outputs controlled by it will be sweeped before if they don't have a storage - * deposit return, timelock or expiration unlock condition. This should be preferred over burning, because after - * burning, the foundry can never be destroyed anymore. - * @param nftId The NftId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async burnNft( - nftId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'burnNft', - data: { - nftId, - options: transactionOptions, + ) + return JSON.parse(resp).payload + }, + + /** + * Build a `BasicOutput`. + * @param data Options for building a `BasicOutput`. + * @returns The built `BasicOutput`. + */ + async buildBasicOutput(data: BuildBasicOutputData): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'buildBasicOutput', + data, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Claim basic or nft outputs that have additional unlock conditions - * to their `AddressUnlockCondition` from the account. - * @param outputIds The outputs to claim. - * @returns The resulting transaction. - */ - async claimOutputs(outputIds: string[]): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'claimOutputs', - data: { - outputIdsToClaim: outputIds, + ) + return JSON.parse(resp).payload + }, + + /** + * Build a `FoundryOutput`. + * @param data Options for building a `FoundryOutput`. + * @returns The built `FoundryOutput`. + */ + async buildFoundryOutput( + data: BuildFoundryOutputData, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'buildFoundryOutput', + data, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Consolidate basic outputs with only an `AddressUnlockCondition` from an account - * by sending them to an own address again if the output amount is greater or - * equal to the output consolidation threshold. - * @param force Force consolidation on addresses where the threshold isn't met. - * @param outputConsolidationThreshold A default threshold is used if this is omitted. - * @returns The consolidation transaction. - */ - async consolidateOutputs( - force: boolean, - outputConsolidationThreshold?: number, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'consolidateOutputs', - data: { - force, - outputConsolidationThreshold, + ) + return JSON.parse(resp).payload + }, + + /** + * Build an `NftOutput`. + * @param data Options for building an `NftOutput`. + * @returns The built `NftOutput`. + */ + async buildNftOutput(data: BuildNftOutputData): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'buildNftOutput', + data, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * `createAliasOutput` creates an alias output - * @param aliasOutputOptions The alias output options. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns A transaction object. - */ - async createAliasOutput( - aliasOutputOptions?: AliasOutputOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'createAliasOutput', - data: { - aliasOutputOptions, - options: transactionOptions, + ) + return JSON.parse(resp).payload + }, + + /** + * Burn native tokens. This doesn't require the foundry output which minted them, but will not increase + * the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. Therefore it's + * recommended to use melting, if the foundry output is available. + * @param tokenId The native token id. + * @param burnAmount The to be burned amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNativeToken( + tokenId: string, + burnAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'burnNativeToken', + data: { + tokenId, + burnAmount, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Melt native tokens. This happens with the foundry output which minted them, by increasing its - * `melted_tokens` field. - * @param tokenId The native token id. - * @param meltAmount To be melted amount. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async decreaseNativeTokenSupply( - tokenId: string, - meltAmount: HexEncodedAmount, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'decreaseNativeTokenSupply', - data: { - tokenId, - meltAmount, - options: transactionOptions, + ) + return JSON.parse(resp).payload + }, + + /** + * Burn an nft output. Outputs controlled by it will be sweeped before if they don't have a storage + * deposit return, timelock or expiration unlock condition. This should be preferred over burning, because after + * burning, the foundry can never be destroyed anymore. + * @param nftId The NftId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async burnNft( + nftId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'burnNft', + data: { + nftId, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Destroy an alias output. Outputs controlled by it will be sweeped before if they don't have a - * storage deposit return, timelock or expiration unlock condition. The amount and possible native tokens will be - * sent to the governor address. - * @param aliasId The AliasId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async destroyAlias( - aliasId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'destroyAlias', - data: { - aliasId, - options: transactionOptions, + ) + return JSON.parse(resp).payload + }, + + /** + * Claim basic or nft outputs that have additional unlock conditions + * to their `AddressUnlockCondition` from the account. + * @param outputIds The outputs to claim. + * @returns The resulting transaction. + */ + async claimOutputs(outputIds: string[]): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'claimOutputs', + data: { + outputIdsToClaim: outputIds, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Function to destroy a foundry output with a circulating supply of 0. - * Native tokens in the foundry (minted by other foundries) will be transactioned to the controlling alias. - * @param foundryId The FoundryId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async destroyFoundry( - foundryId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'destroyFoundry', - data: { - foundryId, - options: transactionOptions, + ) + return JSON.parse(resp).payload + }, + + /** + * Consolidate basic outputs with only an `AddressUnlockCondition` from an account + * by sending them to an own address again if the output amount is greater or + * equal to the output consolidation threshold. + * @param force Force consolidation on addresses where the threshold isn't met. + * @param outputConsolidationThreshold A default threshold is used if this is omitted. + * @returns The consolidation transaction. + */ + async consolidateOutputs( + force: boolean, + outputConsolidationThreshold?: number, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'consolidateOutputs', + data: { + force, + outputConsolidationThreshold, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Generate a new unused address. - * @param options Options for address generation. - * @returns The address. - */ - async generateAddress( - options?: AddressGenerationOptions, - ): Promise
{ - const addresses = await this.generateAddresses(1, options); - return addresses[0]; - } - - /** - * Generate new unused addresses. - * @param amount The amount of addresses to generate. - * @param options Options for address generation. - * @returns The addresses. - */ - async generateAddresses( - amount: number, - options?: AddressGenerationOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'generateAddresses', - data: { - amount, - options, + ) + return JSON.parse(resp).payload + }, + + /** + * `createAliasOutput` creates an alias output + * @param aliasOutputOptions The alias output options. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns A transaction object. + */ + async createAliasOutput( + aliasOutputOptions?: AliasOutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'createAliasOutput', + data: { + aliasOutputOptions, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get the account balance. - * @returns The account balance. - */ - async getBalance(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getBalance', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Get the data for an output. - * @param outputId The output to get. - * @returns The `OutputData`. - */ - async getOutput(outputId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getOutput', - data: { - outputId, + ) + return JSON.parse(resp).payload + }, + + /** + * Melt native tokens. This happens with the foundry output which minted them, by increasing its + * `melted_tokens` field. + * @param tokenId The native token id. + * @param meltAmount To be melted amount. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async decreaseNativeTokenSupply( + tokenId: string, + meltAmount: HexEncodedAmount, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'decreaseNativeTokenSupply', + data: { + tokenId, + meltAmount, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get a `FoundryOutput` by native token ID. It will try to get the foundry from - * the account, if it isn't in the account it will try to get it from the node. - * @param tokenId The native token ID to get the foundry for. - * @returns The `FoundryOutput` that minted the token. - */ - async getFoundryOutput(tokenId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getFoundryOutput', - data: { - tokenId, + ) + return JSON.parse(resp).payload + }, + + /** + * Destroy an alias output. Outputs controlled by it will be sweeped before if they don't have a + * storage deposit return, timelock or expiration unlock condition. The amount and possible native tokens will be + * sent to the governor address. + * @param aliasId The AliasId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyAlias( + aliasId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'destroyAlias', + data: { + aliasId, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get outputs with additional unlock conditions. - * @param outputs The type of outputs to claim. - * @returns The output IDs of the unlockable outputs. - */ - async getOutputsWithAdditionalUnlockConditions( - outputs: OutputsToClaim, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getOutputsWithAdditionalUnlockConditions', - data: { - outputsToClaim: outputs, + ) + return JSON.parse(resp).payload + }, + + /** + * Function to destroy a foundry output with a circulating supply of 0. + * Native tokens in the foundry (minted by other foundries) will be transactioned to the controlling alias. + * @param foundryId The FoundryId. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The transaction. + */ + async destroyFoundry( + foundryId: string, + transactionOptions?: TransactionOptions, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'destroyFoundry', + data: { + foundryId, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get a transaction stored in the account. - * @param transactionId The ID of the transaction to get. - * @returns The transaction. - */ - async getTransaction(transactionId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getTransaction', - data: { - transactionId, + ) + return JSON.parse(resp).payload + }, + + /** + * Generate a new unused address. + * @param options Options for address generation. + * @returns The address. + */ + async generateAddress( + options?: AddressGenerationOptions, + ): Promise
{ + const addresses = await this.generateAddresses(1, options) + return addresses[0] + }, + + /** + * Generate new unused addresses. + * @param amount The amount of addresses to generate. + * @param options Options for address generation. + * @returns The addresses. + */ + async generateAddresses( + amount: number, + options?: AddressGenerationOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'generateAddresses', + data: { + amount, + options, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get the transaction with inputs of an incoming transaction stored in the account - * List might not be complete, if the node pruned the data already - * @param transactionId The ID of the transaction to get. - * @returns The transaction. - */ - async getIncomingTransactionData( - transactionId: string, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getIncomingTransactionData', - data: { - transactionId, + ) + return JSON.parse(response).payload + }, + + /** + * Get the account balance. + * @returns The account balance. + */ + async getBalance(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getBalance', }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * List all the addresses of the account. - * @returns The addresses. - */ - async addresses(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'addresses', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List the addresses of the account with unspent outputs. - * @returns The addresses. - */ - async addressesWithUnspentOutputs(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'addressesWithUnspentOutputs', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all outputs of the account. - * @param filterOptions Options to filter the to be returned outputs. - * @returns The outputs with metadata. - */ - async outputs(filterOptions?: FilterOptions): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'outputs', - data: { filterOptions }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the pending transactions of the account. - * @returns The transactions. - */ - async pendingTransactions(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'pendingTransactions', - }, - ); - return JSON.parse(response).payload; - } - - /** - * List all incoming transactions of the account. - * @returns The incoming transactions with their inputs. - */ - async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'incomingTransactions', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the transactions of the account. - * @returns The transactions. - */ - async transactions(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'transactions', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the unspent outputs of the account. - * @param filterOptions Options to filter the to be returned outputs. - * @returns The outputs with metadata. - */ - async unspentOutputs(filterOptions?: FilterOptions): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'unspentOutputs', - data: { filterOptions }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Get the accounts metadata. - * @returns The accounts metadata. - */ - getMetadata(): AccountMetadata { - return { - alias: this.meta.alias, - coinType: this.meta.coinType, - index: this.meta.index, - }; - } - - /** - * Calculate the minimum required storage deposit for an output. - * @param output output to calculate the deposit amount for. - * @returns The amount. - */ - async minimumRequiredStorageDeposit(output: OutputTypes): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'minimumRequiredStorageDeposit', - data: { - output, + ) + + return JSON.parse(response).payload + }, + + /** + * Get the data for an output. + * @param outputId The output to get. + * @returns The `OutputData`. + */ + async getOutput(outputId: string): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getOutput', + data: { + outputId, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Mint more native tokens. - * @param tokenId The native token id. - * @param mintAmount To be minted amount. - * @param increaseNativeTokenSupplyOptions Options for minting more tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction and the token ID. - */ - async increaseNativeTokenSupply( - tokenId: string, - mintAmount: HexEncodedAmount, - increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'increaseNativeTokenSupply', - data: { - tokenId, - mintAmount, - increaseNativeTokenSupplyOptions, - options: transactionOptions, + ) + return JSON.parse(response).payload + }, + + /** + * Get a `FoundryOutput` by native token ID. It will try to get the foundry from + * the account, if it isn't in the account it will try to get it from the node. + * @param tokenId The native token ID to get the foundry for. + * @returns The `FoundryOutput` that minted the token. + */ + async getFoundryOutput(tokenId: string): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getFoundryOutput', + data: { + tokenId, + }, }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Mint native tokens. - * @param nativeTokenOptions The options for minting tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction and the token ID. - */ - async mintNativeToken( - nativeTokenOptions: NativeTokenOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'mintNativeToken', - data: { - nativeTokenOptions: nativeTokenOptions, - options: transactionOptions, + ) + return JSON.parse(response).payload + }, + + /** + * Get outputs with additional unlock conditions. + * @param outputs The type of outputs to claim. + * @returns The output IDs of the unlockable outputs. + */ + async getOutputsWithAdditionalUnlockConditions( + outputs: OutputsToClaim, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getOutputsWithAdditionalUnlockConditions', + data: { + outputsToClaim: outputs, + }, }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Mint nfts. - * @param nftsOptions The options for minting nfts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction. - */ - async mintNfts( - nftsOptions: NftOptions[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'mintNfts', - data: { - nftsOptions, - options: transactionOptions, + ) + return JSON.parse(response).payload + }, + + /** + * Get a transaction stored in the account. + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getTransaction(transactionId: string): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getTransaction', + data: { + transactionId, + }, }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Prepare an output for sending, useful for offline signing. - * @param options The options for preparing an output. If the amount is - * below the minimum required storage deposit, by default the remaining - * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, - * when setting the `ReturnStrategy` to `gift`, the full minimum required - * storage deposit will be sent to the recipient. When the assets contain - * an nft id, the data from the existing `NftOutput` will be used, just with - * the address unlock conditions replaced. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared output. - */ - async prepareOutput( - options: OutputOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareOutput', - data: { - options, - transactionOptions, + ) + return JSON.parse(response).payload + }, + + /** + * Get the transaction with inputs of an incoming transaction stored in the account + * List might not be complete, if the node pruned the data already + * @param transactionId The ID of the transaction to get. + * @returns The transaction. + */ + async getIncomingTransactionData( + transactionId: string, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getIncomingTransactionData', + data: { + transactionId, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Prepare a send amount transaction, useful for offline signing. - * @param addressesWithAmount Address with amounts to send. - * @param options The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared transaction data. - */ - async prepareSendAmount( - addressesWithAmount: AddressWithAmount[], - options?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareSendAmount', - data: { - addressesWithAmount, - options, + ) + return JSON.parse(response).payload + }, + + /** + * List all the addresses of the account. + * @returns The addresses. + */ + async addresses(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'addresses', }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Prepare a transaction, useful for offline signing. - * @param outputs Outputs to use in the transaction. - * @param options The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared transaction data. - */ - async prepareTransaction( - outputs: OutputTypes[], - options?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareTransaction', - data: { - outputs, - options, + ) + + return JSON.parse(response).payload + }, + + /** + * List the addresses of the account with unspent outputs. + * @returns The addresses. + */ + async addressesWithUnspentOutputs(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'addressesWithUnspentOutputs', }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's - * included (referenced by a milestone). Returns the included block id. - */ - async retryTransactionUntilIncluded( - transactionId: string, - interval?: number, - maxAttempts?: number, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'retryTransactionUntilIncluded', - data: { - transactionId, - interval, - maxAttempts, + ) + + return JSON.parse(response).payload + }, + + /** + * List all outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async outputs(filterOptions?: FilterOptions): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'outputs', + data: { filterOptions }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Send a transaction with amounts from input addresses. - * @param addressesWithAmount Addresses with amounts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendAmount( - addressesWithAmount: AddressWithAmount[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendAmount', - data: { - addressesWithAmount, - options: transactionOptions, + ) + + return JSON.parse(response).payload + }, + + /** + * List all the pending transactions of the account. + * @returns The transactions. + */ + async pendingTransactions(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'pendingTransactions', }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send a micro transaction with amount below minimum storage deposit. - * @param addressesWithMicroAmount Addresses with micro amounts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendMicroTransaction( - addressesWithMicroAmount: AddressWithMicroAmount[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendMicroTransaction', - data: { - addressesWithMicroAmount, - options: transactionOptions, + ) + return JSON.parse(response).payload + }, + + /** + * List all incoming transactions of the account. + * @returns The incoming transactions with their inputs. + */ + async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'incomingTransactions', }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send native tokens. - * @param addressesNativeTokens Addresses amounts and native tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendNativeTokens( - addressesNativeTokens: AddressNativeTokens[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendNativeTokens', - data: { - addressesNativeTokens, - options: transactionOptions, + ) + + return JSON.parse(response).payload + }, + + /** + * List all the transactions of the account. + * @returns The transactions. + */ + async transactions(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'transactions', }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send nft. - * @param addressesAndNftIds Addresses and nft ids. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendNft( - addressesAndNftIds: AddressNftId[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendNft', - data: { - addressesAndNftIds, - options: transactionOptions, + ) + + return JSON.parse(response).payload + }, + + /** + * List all the unspent outputs of the account. + * @param filterOptions Options to filter the to be returned outputs. + * @returns The outputs with metadata. + */ + async unspentOutputs(filterOptions?: FilterOptions): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'unspentOutputs', + data: { filterOptions }, }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send outputs in a transaction. - * @param outputs The outputs to send. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendOutputs( - outputs: OutputTypes[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendOutputs', - data: { - outputs, - options: transactionOptions, + ) + + return JSON.parse(response).payload + }, + + /** + * Get the accounts metadata. + * @returns The accounts metadata. + */ + getMetadata(): AccountMetadata { + return { + alias: accountMeta.alias, + coinType: accountMeta.coinType, + index: accountMeta.index, + } + }, + + /** + * Calculate the minimum required storage deposit for an output. + * @param output output to calculate the deposit amount for. + * @returns The amount. + */ + async minimumRequiredStorageDeposit(output: OutputTypes): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'minimumRequiredStorageDeposit', + data: { + output, + }, }, - }, - ); - - return JSON.parse(response).payload; - } - - async setAlias(alias: string): Promise { - await this.messageHandler.callAccountMethod(this.meta.index, { - name: 'setAlias', - data: { - alias, - }, - }); - } - - /** - * Sign a prepared transaction, useful for offline signing. - * @param preparedTransactionData The prepared transaction data to sign. - * @returns The signed transaction essence. - */ - async signTransactionEssence( - preparedTransactionData: PreparedTransactionData, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'signTransactionEssence', - data: { - preparedTransactionData, + ) + return JSON.parse(response).payload + }, + + /** + * Mint more native tokens. + * @param tokenId The native token id. + * @param mintAmount To be minted amount. + * @param increaseNativeTokenSupplyOptions Options for minting more tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async increaseNativeTokenSupply( + tokenId: string, + mintAmount: HexEncodedAmount, + increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'increaseNativeTokenSupply', + data: { + tokenId, + mintAmount, + increaseNativeTokenSupplyOptions, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Validate the transaction, submit it to a node and store it in the account. - * @param signedTransactionData A signed transaction to submit and store. - * @returns The sent transaction. - */ - async submitAndStoreTransaction( - signedTransactionData: SignedTransactionEssence, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'submitAndStoreTransaction', - data: { - signedTransactionData, + ) + + return JSON.parse(response).payload + }, + + /** + * Mint native tokens. + * @param nativeTokenOptions The options for minting tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction and the token ID. + */ + async mintNativeToken( + nativeTokenOptions: NativeTokenOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'mintNativeToken', + data: { + nativeTokenOptions: nativeTokenOptions, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Sync the account by fetching new information from the nodes. - * Will also retry pending transactions if necessary. - * @param options Optional synchronization options. - * @returns The account balance. - */ - async sync(options?: AccountSyncOptions): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'syncAccount', - data: { - options, + ) + + return JSON.parse(response).payload + }, + + /** + * Mint nfts. + * @param nftsOptions The options for minting nfts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The minting transaction. + */ + async mintNfts( + nftsOptions: NftOptions[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'mintNfts', + data: { + nftsOptions, + options: transactionOptions, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - async vote(eventId: string, answers: number[]): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'vote', - data: { - eventId, - answers, + ) + + return JSON.parse(response).payload + }, + + /** + * Prepare an output for sending, useful for offline signing. + * @param options The options for preparing an output. If the amount is + * below the minimum required storage deposit, by default the remaining + * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, + * when setting the `ReturnStrategy` to `gift`, the full minimum required + * storage deposit will be sent to the recipient. When the assets contain + * an nft id, the data from the existing `NftOutput` will be used, just with + * the address unlock conditions replaced. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared output. + */ + async prepareOutput( + options: OutputOptions, + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'prepareOutput', + data: { + options, + transactionOptions, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - async stopParticipating(eventId: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'stopParticipating', - data: { - eventId, + ) + return JSON.parse(response).payload + }, + + /** + * Prepare a send amount transaction, useful for offline signing. + * @param addressesWithAmount Address with amounts to send. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareSendAmount( + addressesWithAmount: AddressWithAmount[], + options?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'prepareSendAmount', + data: { + addressesWithAmount, + options, + }, }, - }, - ); - return JSON.parse(resp).payload; - } - - async getVotingPower(): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getVotingPower', - }, - ); - return JSON.parse(resp).payload; - } + ) + return JSON.parse(response).payload + }, + + /** + * Prepare a transaction, useful for offline signing. + * @param outputs Outputs to use in the transaction. + * @param options The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The prepared transaction data. + */ + async prepareTransaction( + outputs: OutputTypes[], + options?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'prepareTransaction', + data: { + outputs, + options, + }, + }, + ) + return JSON.parse(response).payload + }, + + /** + * Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's + * included (referenced by a milestone). Returns the included block id. + */ + async retryTransactionUntilIncluded( + transactionId: string, + interval?: number, + maxAttempts?: number, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'retryTransactionUntilIncluded', + data: { + transactionId, + interval, + maxAttempts, + }, + }, + ) + return JSON.parse(response).payload + }, + + /** + * Send a transaction with amounts from input addresses. + * @param addressesWithAmount Addresses with amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendAmount( + addressesWithAmount: AddressWithAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'sendAmount', + data: { + addressesWithAmount, + options: transactionOptions, + }, + }, + ) + + return JSON.parse(response).payload + }, + + /** + * Send a micro transaction with amount below minimum storage deposit. + * @param addressesWithMicroAmount Addresses with micro amounts. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendMicroTransaction( + addressesWithMicroAmount: AddressWithMicroAmount[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'sendMicroTransaction', + data: { + addressesWithMicroAmount, + options: transactionOptions, + }, + }, + ) + + return JSON.parse(response).payload + }, + + /** + * Send native tokens. + * @param addressesNativeTokens Addresses amounts and native tokens. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNativeTokens( + addressesNativeTokens: AddressNativeTokens[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'sendNativeTokens', + data: { + addressesNativeTokens, + options: transactionOptions, + }, + }, + ) + + return JSON.parse(response).payload + }, + + /** + * Send nft. + * @param addressesAndNftIds Addresses and nft ids. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendNft( + addressesAndNftIds: AddressNftId[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'sendNft', + data: { + addressesAndNftIds, + options: transactionOptions, + }, + }, + ) + + return JSON.parse(response).payload + }, + + /** + * Send outputs in a transaction. + * @param outputs The outputs to send. + * @param transactionOptions The options to define a `RemainderValueStrategy` + * or custom inputs. + * @returns The sent transaction. + */ + async sendOutputs( + outputs: OutputTypes[], + transactionOptions?: TransactionOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'sendOutputs', + data: { + outputs, + options: transactionOptions, + }, + }, + ) - async getParticipationOverview(): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getParticipationOverview', - }, - ); - return JSON.parse(resp).payload; - } + return JSON.parse(response).payload + }, - async increaseVotingPower(amount: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'increaseVotingPower', + async setAlias(alias: string): Promise { + await messageHandler.callAccountMethod(accountMeta.index, { + name: 'setAlias', data: { - amount, + alias, }, - }, - ); - return JSON.parse(resp).payload; - } - - async decreaseVotingPower(amount: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'decreaseVotingPower', - data: { - amount, + }) + }, + + /** + * Sign a prepared transaction, useful for offline signing. + * @param preparedTransactionData The prepared transaction data to sign. + * @returns The signed transaction essence. + */ + async signTransactionEssence( + preparedTransactionData: PreparedTransactionData, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'signTransactionEssence', + data: { + preparedTransactionData, + }, + }, + ) + return JSON.parse(response).payload + }, + + /** + * Validate the transaction, submit it to a node and store it in the account. + * @param signedTransactionData A signed transaction to submit and store. + * @returns The sent transaction. + */ + async submitAndStoreTransaction( + signedTransactionData: SignedTransactionEssence, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'submitAndStoreTransaction', + data: { + signedTransactionData, + }, + }, + ) + return JSON.parse(response).payload + }, + + /** + * Sync the account by fetching new information from the nodes. + * Will also retry pending transactions if necessary. + * @param options Optional synchronization options. + * @returns The account balance. + */ + async sync(options?: AccountSyncOptions): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'syncAccount', + data: { + options, + }, + }, + ) + return JSON.parse(resp).payload + }, + + async vote(eventId: string, answers: number[]): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'vote', + data: { + eventId, + answers, + }, + }, + ) + return JSON.parse(resp).payload + }, + + async stopParticipating(eventId: string): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'stopParticipating', + data: { + eventId, + }, + }, + ) + return JSON.parse(resp).payload + }, + + async getVotingPower(): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getVotingPower', + }, + ) + return JSON.parse(resp).payload + }, + + async getParticipationOverview(): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getParticipationOverview', + }, + ) + return JSON.parse(resp).payload + }, + + async increaseVotingPower(amount: string): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'increaseVotingPower', + data: { + amount, + }, + }, + ) + return JSON.parse(resp).payload + }, + + async decreaseVotingPower(amount: string): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'decreaseVotingPower', + data: { + amount, + }, }, - }, - ); - return JSON.parse(resp).payload; + ) + return JSON.parse(resp).payload + } } } From 82962e518513cdb3571144f7e8cb9ab887c56694 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 22 Feb 2023 15:48:46 +0000 Subject: [PATCH 132/197] chore: remove `bindMethodsAcrossContextBridge` function Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 36 +++++------------------ 1 file changed, 8 insertions(+), 28 deletions(-) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 7edfcc33ef..8db14c0bd7 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,25 +1,18 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { AccountId, AccountSyncOptions, CreateAccountPayload } from '../types/account'; -import { AccountManagerOptions } from '../types'; -import { Account } from './Account'; -import { AccountManager } from './AccountManager'; +import { AccountId, CreateAccountPayload } from '../types/account' +import { AccountManagerOptions } from '../types' +import { AccountManager } from './AccountManager' type ProfileManager = Awaited> -type RecoverAccounts = Parameters -interface RecoverAccountsPayload { - accountStartIndex: number, - accountGapLimit: number, - addressGapLimit: number, - syncOptions?: AccountSyncOptions -} +type RecoverAccounts = NonNullable> interface ProfileManagers { [key: string]: ProfileManager } const profileManagers: ProfileManagers = {} - -const WalletApi = { +// @ts-ignore +const WalletApi: any = { async createAccountManager(id: AccountId, options: AccountManagerOptions) { const manager = await AccountManager(options) manager.id = id @@ -29,7 +22,6 @@ const WalletApi = { async createAccount(managerId: AccountId, payload: CreateAccountPayload) { const manager = profileManagers[managerId] const account = await manager.createAccount(payload) - bindMethodsAcrossContextBridge(Account.prototype, account) return account }, deleteAccountManager(managerId: AccountId) { @@ -40,30 +32,18 @@ const WalletApi = { async getAccount(managerId: AccountId, index: number) { const manager = profileManagers[managerId] const account = await manager.getAccount(index) - bindMethodsAcrossContextBridge(Account.prototype, account) return account }, async getAccounts(managerId: AccountId) { const manager = profileManagers[managerId] const accounts = await manager.getAccounts() - accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId: AccountId, payload: RecoverAccountsPayload) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { const manager = profileManagers[managerId] const accounts = await manager.recoverAccounts(...Object.values(payload) as RecoverAccounts) - accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, } -function bindMethodsAcrossContextBridge(prototype, object) { - const prototypeProperties = Object.getOwnPropertyNames(prototype) - prototypeProperties.forEach((key) => { - if (key !== 'constructor') { - object[key] = object[key].bind(object) - } - }) -} - -export { WalletApi }; +export { WalletApi } From 7b2dea2e9841715a37cae2385ba976cbcabb08f3 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 22 Feb 2023 16:07:33 +0000 Subject: [PATCH 133/197] chore: rename using `create` word Signed-off-by: Amadeo Marchioni --- bindings/capacitorjs/src/lib/WalletApi.ts | 6 +++--- .../src/lib/{Account.ts => createAccount.ts} | 2 +- .../{AccountManager.ts => createAccountManager.ts} | 14 ++++++++------ bindings/capacitorjs/src/lib/index.ts | 4 ++-- 4 files changed, 14 insertions(+), 12 deletions(-) rename bindings/capacitorjs/src/lib/{Account.ts => createAccount.ts} (99%) rename bindings/capacitorjs/src/lib/{AccountManager.ts => createAccountManager.ts} (96%) diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/bindings/capacitorjs/src/lib/WalletApi.ts index 8db14c0bd7..06abe65730 100644 --- a/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/bindings/capacitorjs/src/lib/WalletApi.ts @@ -3,9 +3,9 @@ import { AccountId, CreateAccountPayload } from '../types/account' import { AccountManagerOptions } from '../types' -import { AccountManager } from './AccountManager' +import { createAccountManager } from './createAccountManager' -type ProfileManager = Awaited> +type ProfileManager = Awaited> type RecoverAccounts = NonNullable> interface ProfileManagers { [key: string]: ProfileManager @@ -14,7 +14,7 @@ const profileManagers: ProfileManagers = {} // @ts-ignore const WalletApi: any = { async createAccountManager(id: AccountId, options: AccountManagerOptions) { - const manager = await AccountManager(options) + const manager = await createAccountManager(options) manager.id = id profileManagers[id] = manager return manager diff --git a/bindings/capacitorjs/src/lib/Account.ts b/bindings/capacitorjs/src/lib/createAccount.ts similarity index 99% rename from bindings/capacitorjs/src/lib/Account.ts rename to bindings/capacitorjs/src/lib/createAccount.ts index 5e30deb3ec..d79b07803d 100644 --- a/bindings/capacitorjs/src/lib/Account.ts +++ b/bindings/capacitorjs/src/lib/createAccount.ts @@ -47,7 +47,7 @@ import type { type MessageHandler = Awaited> /** The Account factory function. */ -export function Account(accountMeta: AccountMeta, messageHandler: MessageHandler) { +export function createAccount(accountMeta: AccountMeta, messageHandler: MessageHandler) { return { /** diff --git a/bindings/capacitorjs/src/lib/AccountManager.ts b/bindings/capacitorjs/src/lib/createAccountManager.ts similarity index 96% rename from bindings/capacitorjs/src/lib/AccountManager.ts rename to bindings/capacitorjs/src/lib/createAccountManager.ts index b92b749727..bfdbecc425 100644 --- a/bindings/capacitorjs/src/lib/AccountManager.ts +++ b/bindings/capacitorjs/src/lib/createAccountManager.ts @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 import { MessageHandler } from './MessageHandler'; -import { Account } from './Account'; +import { createAccount } from './createAccount'; import type { AccountId, @@ -22,8 +22,10 @@ import type { GenerateAddressOptions, } from '../types'; +type Account = ReturnType + /** The AccountManager class. */ -export async function AccountManager(options: AccountManagerOptions) { +export async function createAccountManager(options: AccountManagerOptions) { let id: AccountId @@ -106,7 +108,7 @@ export async function AccountManager(options: AccountManagerOptions) { cmd: 'createAccount', payload, }); - return new Account(JSON.parse(response).payload, messageHandler); + return createAccount(JSON.parse(response).payload, messageHandler); }, /** @@ -154,7 +156,7 @@ export async function AccountManager(options: AccountManagerOptions) { payload: accountId, }); - const account = new Account( + const account = createAccount( JSON.parse(response).payload, messageHandler, ); @@ -186,7 +188,7 @@ export async function AccountManager(options: AccountManagerOptions) { const accounts: Account[] = []; for (const account of payload) { - accounts.push(new Account(account, messageHandler)); + accounts.push(createAccount(account, messageHandler)); } return accounts; }, @@ -307,7 +309,7 @@ export async function AccountManager(options: AccountManagerOptions) { const accounts: Account[] = []; for (const account of JSON.parse(response).payload) { - accounts.push(new Account(account, messageHandler)); + accounts.push(createAccount(account, messageHandler)); } return accounts; }, diff --git a/bindings/capacitorjs/src/lib/index.ts b/bindings/capacitorjs/src/lib/index.ts index 2f896eec25..67852f5cd1 100644 --- a/bindings/capacitorjs/src/lib/index.ts +++ b/bindings/capacitorjs/src/lib/index.ts @@ -4,9 +4,9 @@ import { internalInitLogger } from './bindings' import type { LoggerConfig } from '../types' -export * from './AccountManager' +export * from './createAccountManager' export * from './MessageHandler' -export * from './Account' +export * from './createAccount' export * from './WalletApi' export * from '../types/index' From cd0bdf59fe6feb8481c6e27db1b20303d13959be Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 10:00:47 +0000 Subject: [PATCH 134/197] move capacitorjs folder to wallet/bindings folder Signed-off-by: Amadeo Marchioni --- bindings/swift/Cargo.toml | 19 ------------------ .../bindings}/capacitorjs/.gitignore | 0 .../capacitorjs/IotaWalletMobile.podspec | 0 .../bindings}/capacitorjs/README.md | 0 .../bindings}/capacitorjs/add_libs.sh | 0 .../bindings}/capacitorjs/android/.gitignore | 0 .../bindings}/capacitorjs/android/.npmignore | 0 .../capacitorjs/android/build.gradle | 0 .../capacitorjs/android/gradle.properties | 0 .../android/gradle/wrapper/gradle-wrapper.jar | Bin .../gradle/wrapper/gradle-wrapper.properties | 0 .../bindings}/capacitorjs/android/gradlew | 0 .../bindings}/capacitorjs/android/gradlew.bat | 0 .../capacitorjs/android/proguard-rules.pro | 0 .../capacitorjs/android/settings.gradle | 0 .../android/ExampleInstrumentedTest.java | 0 .../android/src/main/AndroidManifest.xml | 0 .../IotaWalletMobile/IotaWalletMobile.java | 0 .../com/getcapacitor/ExampleUnitTest.java | 0 .../bindings}/capacitorjs/ios/.gitignore | 0 .../ios/Plugin.xcodeproj/project.pbxproj | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../contents.xcworkspacedata | 0 .../xcshareddata/IDEWorkspaceChecks.plist | 0 .../capacitorjs/ios/Plugin/Info.plist | 0 .../ios/Plugin/Libraries/libwallet.h | 0 .../ios/Plugin/Libraries/module.modulemap | 0 .../bindings}/capacitorjs/ios/Plugin/Plugin.h | 0 .../bindings}/capacitorjs/ios/Plugin/Plugin.m | 0 .../capacitorjs/ios/Plugin/Plugin.swift | 0 .../capacitorjs/ios/PluginTests/Info.plist | 0 .../ios/PluginTests/PluginTests.swift | 0 .../bindings}/capacitorjs/ios/Podfile | 0 .../bindings}/capacitorjs/ios/Podfile.lock | 0 .../WalletFramework.xcframework/Info.plist | 0 .../Headers/WalletFramework.h | 0 .../WalletFramework.framework/Info.plist | 0 .../Modules/Modules.modulemap | 0 .../Headers/WalletFramework.h | 0 .../WalletFramework.framework/Info.plist | 0 .../Modules/Modules.modulemap | 0 .../bindings}/capacitorjs/package-lock.json | 0 .../bindings}/capacitorjs/package.json | 0 .../bindings}/capacitorjs/rollup.config.js | 0 .../bindings}/capacitorjs/src/definitions.ts | 0 .../bindings}/capacitorjs/src/index.ts | 0 .../capacitorjs/src/lib/MessageHandler.ts | 0 .../capacitorjs/src/lib/WalletApi.ts | 0 .../bindings}/capacitorjs/src/lib/bindings.ts | 0 .../capacitorjs/src/lib/createAccount.ts | 0 .../src/lib/createAccountManager.ts | 0 .../bindings}/capacitorjs/src/lib/index.ts | 0 .../capacitorjs/src/types/account.ts | 0 .../capacitorjs/src/types/accountManager.ts | 0 .../capacitorjs/src/types/address.ts | 0 .../capacitorjs/src/types/bridge/account.ts | 0 .../src/types/bridge/accountManager.ts | 0 .../capacitorjs/src/types/bridge/index.ts | 0 .../capacitorjs/src/types/buildOutputData.ts | 0 .../bindings}/capacitorjs/src/types/event.ts | 0 .../src/types/incomingTransactionData.ts | 0 .../bindings}/capacitorjs/src/types/index.ts | 0 .../capacitorjs/src/types/loggerConfig.ts | 0 .../capacitorjs/src/types/network.ts | 0 .../bindings}/capacitorjs/src/types/output.ts | 0 .../capacitorjs/src/types/outputOptions.ts | 0 .../capacitorjs/src/types/participation.ts | 0 .../src/types/preparedTransactionData.ts | 0 .../capacitorjs/src/types/secretManager.ts | 0 .../src/types/signedTransactionEssence.ts | 0 .../capacitorjs/src/types/transaction.ts | 0 .../src/types/transactionOptions.ts | 0 .../bindings}/capacitorjs/tsconfig.json | 0 74 files changed, 19 deletions(-) delete mode 100644 bindings/swift/Cargo.toml rename {bindings => wallet/bindings}/capacitorjs/.gitignore (100%) rename {bindings => wallet/bindings}/capacitorjs/IotaWalletMobile.podspec (100%) rename {bindings => wallet/bindings}/capacitorjs/README.md (100%) rename {bindings => wallet/bindings}/capacitorjs/add_libs.sh (100%) rename {bindings => wallet/bindings}/capacitorjs/android/.gitignore (100%) rename {bindings => wallet/bindings}/capacitorjs/android/.npmignore (100%) rename {bindings => wallet/bindings}/capacitorjs/android/build.gradle (100%) rename {bindings => wallet/bindings}/capacitorjs/android/gradle.properties (100%) rename {bindings => wallet/bindings}/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar (100%) rename {bindings => wallet/bindings}/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties (100%) rename {bindings => wallet/bindings}/capacitorjs/android/gradlew (100%) rename {bindings => wallet/bindings}/capacitorjs/android/gradlew.bat (100%) rename {bindings => wallet/bindings}/capacitorjs/android/proguard-rules.pro (100%) rename {bindings => wallet/bindings}/capacitorjs/android/settings.gradle (100%) rename {bindings => wallet/bindings}/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java (100%) rename {bindings => wallet/bindings}/capacitorjs/android/src/main/AndroidManifest.xml (100%) rename {bindings => wallet/bindings}/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java (100%) rename {bindings => wallet/bindings}/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/.gitignore (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Info.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Libraries/libwallet.h (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Libraries/module.modulemap (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Plugin.h (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Plugin.m (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Plugin/Plugin.swift (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/PluginTests/Info.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/PluginTests/PluginTests.swift (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Podfile (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/Podfile.lock (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/Info.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist (100%) rename {bindings => wallet/bindings}/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap (100%) rename {bindings => wallet/bindings}/capacitorjs/package-lock.json (100%) rename {bindings => wallet/bindings}/capacitorjs/package.json (100%) rename {bindings => wallet/bindings}/capacitorjs/rollup.config.js (100%) rename {bindings => wallet/bindings}/capacitorjs/src/definitions.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/index.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/MessageHandler.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/WalletApi.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/bindings.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/createAccount.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/createAccountManager.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/lib/index.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/account.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/accountManager.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/address.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/bridge/account.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/bridge/accountManager.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/bridge/index.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/buildOutputData.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/event.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/incomingTransactionData.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/index.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/loggerConfig.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/network.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/output.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/outputOptions.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/participation.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/preparedTransactionData.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/secretManager.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/signedTransactionEssence.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/transaction.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/src/types/transactionOptions.ts (100%) rename {bindings => wallet/bindings}/capacitorjs/tsconfig.json (100%) diff --git a/bindings/swift/Cargo.toml b/bindings/swift/Cargo.toml deleted file mode 100644 index 35e50dd03d..0000000000 --- a/bindings/swift/Cargo.toml +++ /dev/null @@ -1,19 +0,0 @@ -[package] -name = "iota-wallet" -version = "0.1.0" -edition = "2021" - -# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html - -[lib] -crate-type = [ "cdylib", "staticlib" ] # Creates dynamic lib - -[dependencies] -fern-logger = { version = "0.5.0", default-features = false } -futures = { version = "0.3.23", default-features = false } -iota-wallet = { path = "../../", features = [ "message_interface", "events" ] } -log = { version = "0.4.17", default-features = false } -once_cell = { version = "1.13.1", default-features = false } -serde = { version = "1.0.143", default-features = false, features = [ "derive" ] } -serde_json = { version = "1.0.83", default-features = false } -tokio = { version = "1.20.1", default-features = false} diff --git a/bindings/capacitorjs/.gitignore b/wallet/bindings/capacitorjs/.gitignore similarity index 100% rename from bindings/capacitorjs/.gitignore rename to wallet/bindings/capacitorjs/.gitignore diff --git a/bindings/capacitorjs/IotaWalletMobile.podspec b/wallet/bindings/capacitorjs/IotaWalletMobile.podspec similarity index 100% rename from bindings/capacitorjs/IotaWalletMobile.podspec rename to wallet/bindings/capacitorjs/IotaWalletMobile.podspec diff --git a/bindings/capacitorjs/README.md b/wallet/bindings/capacitorjs/README.md similarity index 100% rename from bindings/capacitorjs/README.md rename to wallet/bindings/capacitorjs/README.md diff --git a/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh similarity index 100% rename from bindings/capacitorjs/add_libs.sh rename to wallet/bindings/capacitorjs/add_libs.sh diff --git a/bindings/capacitorjs/android/.gitignore b/wallet/bindings/capacitorjs/android/.gitignore similarity index 100% rename from bindings/capacitorjs/android/.gitignore rename to wallet/bindings/capacitorjs/android/.gitignore diff --git a/bindings/capacitorjs/android/.npmignore b/wallet/bindings/capacitorjs/android/.npmignore similarity index 100% rename from bindings/capacitorjs/android/.npmignore rename to wallet/bindings/capacitorjs/android/.npmignore diff --git a/bindings/capacitorjs/android/build.gradle b/wallet/bindings/capacitorjs/android/build.gradle similarity index 100% rename from bindings/capacitorjs/android/build.gradle rename to wallet/bindings/capacitorjs/android/build.gradle diff --git a/bindings/capacitorjs/android/gradle.properties b/wallet/bindings/capacitorjs/android/gradle.properties similarity index 100% rename from bindings/capacitorjs/android/gradle.properties rename to wallet/bindings/capacitorjs/android/gradle.properties diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar b/wallet/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar similarity index 100% rename from bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar rename to wallet/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.jar diff --git a/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties b/wallet/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties similarity index 100% rename from bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties rename to wallet/bindings/capacitorjs/android/gradle/wrapper/gradle-wrapper.properties diff --git a/bindings/capacitorjs/android/gradlew b/wallet/bindings/capacitorjs/android/gradlew similarity index 100% rename from bindings/capacitorjs/android/gradlew rename to wallet/bindings/capacitorjs/android/gradlew diff --git a/bindings/capacitorjs/android/gradlew.bat b/wallet/bindings/capacitorjs/android/gradlew.bat similarity index 100% rename from bindings/capacitorjs/android/gradlew.bat rename to wallet/bindings/capacitorjs/android/gradlew.bat diff --git a/bindings/capacitorjs/android/proguard-rules.pro b/wallet/bindings/capacitorjs/android/proguard-rules.pro similarity index 100% rename from bindings/capacitorjs/android/proguard-rules.pro rename to wallet/bindings/capacitorjs/android/proguard-rules.pro diff --git a/bindings/capacitorjs/android/settings.gradle b/wallet/bindings/capacitorjs/android/settings.gradle similarity index 100% rename from bindings/capacitorjs/android/settings.gradle rename to wallet/bindings/capacitorjs/android/settings.gradle diff --git a/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java b/wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java similarity index 100% rename from bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java rename to wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java diff --git a/bindings/capacitorjs/android/src/main/AndroidManifest.xml b/wallet/bindings/capacitorjs/android/src/main/AndroidManifest.xml similarity index 100% rename from bindings/capacitorjs/android/src/main/AndroidManifest.xml rename to wallet/bindings/capacitorjs/android/src/main/AndroidManifest.xml diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java similarity index 100% rename from bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java rename to wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java diff --git a/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java b/wallet/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java similarity index 100% rename from bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java rename to wallet/bindings/capacitorjs/android/src/test/java/com/getcapacitor/ExampleUnitTest.java diff --git a/bindings/capacitorjs/ios/.gitignore b/wallet/bindings/capacitorjs/ios/.gitignore similarity index 100% rename from bindings/capacitorjs/ios/.gitignore rename to wallet/bindings/capacitorjs/ios/.gitignore diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj similarity index 100% rename from bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj rename to wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata b/wallet/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata similarity index 100% rename from bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata rename to wallet/bindings/capacitorjs/ios/Plugin.xcworkspace/contents.xcworkspacedata diff --git a/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/wallet/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist similarity index 100% rename from bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist rename to wallet/bindings/capacitorjs/ios/Plugin.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/bindings/capacitorjs/ios/Plugin/Info.plist b/wallet/bindings/capacitorjs/ios/Plugin/Info.plist similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Info.plist rename to wallet/bindings/capacitorjs/ios/Plugin/Info.plist diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h b/wallet/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h rename to wallet/bindings/capacitorjs/ios/Plugin/Libraries/libwallet.h diff --git a/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap b/wallet/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap rename to wallet/bindings/capacitorjs/ios/Plugin/Libraries/module.modulemap diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.h b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.h similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Plugin.h rename to wallet/bindings/capacitorjs/ios/Plugin/Plugin.h diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.m b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Plugin.m rename to wallet/bindings/capacitorjs/ios/Plugin/Plugin.m diff --git a/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift similarity index 100% rename from bindings/capacitorjs/ios/Plugin/Plugin.swift rename to wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift diff --git a/bindings/capacitorjs/ios/PluginTests/Info.plist b/wallet/bindings/capacitorjs/ios/PluginTests/Info.plist similarity index 100% rename from bindings/capacitorjs/ios/PluginTests/Info.plist rename to wallet/bindings/capacitorjs/ios/PluginTests/Info.plist diff --git a/bindings/capacitorjs/ios/PluginTests/PluginTests.swift b/wallet/bindings/capacitorjs/ios/PluginTests/PluginTests.swift similarity index 100% rename from bindings/capacitorjs/ios/PluginTests/PluginTests.swift rename to wallet/bindings/capacitorjs/ios/PluginTests/PluginTests.swift diff --git a/bindings/capacitorjs/ios/Podfile b/wallet/bindings/capacitorjs/ios/Podfile similarity index 100% rename from bindings/capacitorjs/ios/Podfile rename to wallet/bindings/capacitorjs/ios/Podfile diff --git a/bindings/capacitorjs/ios/Podfile.lock b/wallet/bindings/capacitorjs/ios/Podfile.lock similarity index 100% rename from bindings/capacitorjs/ios/Podfile.lock rename to wallet/bindings/capacitorjs/ios/Podfile.lock diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/Info.plist diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Info.plist diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Modules/Modules.modulemap diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Info.plist diff --git a/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap similarity index 100% rename from bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap rename to wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Modules/Modules.modulemap diff --git a/bindings/capacitorjs/package-lock.json b/wallet/bindings/capacitorjs/package-lock.json similarity index 100% rename from bindings/capacitorjs/package-lock.json rename to wallet/bindings/capacitorjs/package-lock.json diff --git a/bindings/capacitorjs/package.json b/wallet/bindings/capacitorjs/package.json similarity index 100% rename from bindings/capacitorjs/package.json rename to wallet/bindings/capacitorjs/package.json diff --git a/bindings/capacitorjs/rollup.config.js b/wallet/bindings/capacitorjs/rollup.config.js similarity index 100% rename from bindings/capacitorjs/rollup.config.js rename to wallet/bindings/capacitorjs/rollup.config.js diff --git a/bindings/capacitorjs/src/definitions.ts b/wallet/bindings/capacitorjs/src/definitions.ts similarity index 100% rename from bindings/capacitorjs/src/definitions.ts rename to wallet/bindings/capacitorjs/src/definitions.ts diff --git a/bindings/capacitorjs/src/index.ts b/wallet/bindings/capacitorjs/src/index.ts similarity index 100% rename from bindings/capacitorjs/src/index.ts rename to wallet/bindings/capacitorjs/src/index.ts diff --git a/bindings/capacitorjs/src/lib/MessageHandler.ts b/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts similarity index 100% rename from bindings/capacitorjs/src/lib/MessageHandler.ts rename to wallet/bindings/capacitorjs/src/lib/MessageHandler.ts diff --git a/bindings/capacitorjs/src/lib/WalletApi.ts b/wallet/bindings/capacitorjs/src/lib/WalletApi.ts similarity index 100% rename from bindings/capacitorjs/src/lib/WalletApi.ts rename to wallet/bindings/capacitorjs/src/lib/WalletApi.ts diff --git a/bindings/capacitorjs/src/lib/bindings.ts b/wallet/bindings/capacitorjs/src/lib/bindings.ts similarity index 100% rename from bindings/capacitorjs/src/lib/bindings.ts rename to wallet/bindings/capacitorjs/src/lib/bindings.ts diff --git a/bindings/capacitorjs/src/lib/createAccount.ts b/wallet/bindings/capacitorjs/src/lib/createAccount.ts similarity index 100% rename from bindings/capacitorjs/src/lib/createAccount.ts rename to wallet/bindings/capacitorjs/src/lib/createAccount.ts diff --git a/bindings/capacitorjs/src/lib/createAccountManager.ts b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts similarity index 100% rename from bindings/capacitorjs/src/lib/createAccountManager.ts rename to wallet/bindings/capacitorjs/src/lib/createAccountManager.ts diff --git a/bindings/capacitorjs/src/lib/index.ts b/wallet/bindings/capacitorjs/src/lib/index.ts similarity index 100% rename from bindings/capacitorjs/src/lib/index.ts rename to wallet/bindings/capacitorjs/src/lib/index.ts diff --git a/bindings/capacitorjs/src/types/account.ts b/wallet/bindings/capacitorjs/src/types/account.ts similarity index 100% rename from bindings/capacitorjs/src/types/account.ts rename to wallet/bindings/capacitorjs/src/types/account.ts diff --git a/bindings/capacitorjs/src/types/accountManager.ts b/wallet/bindings/capacitorjs/src/types/accountManager.ts similarity index 100% rename from bindings/capacitorjs/src/types/accountManager.ts rename to wallet/bindings/capacitorjs/src/types/accountManager.ts diff --git a/bindings/capacitorjs/src/types/address.ts b/wallet/bindings/capacitorjs/src/types/address.ts similarity index 100% rename from bindings/capacitorjs/src/types/address.ts rename to wallet/bindings/capacitorjs/src/types/address.ts diff --git a/bindings/capacitorjs/src/types/bridge/account.ts b/wallet/bindings/capacitorjs/src/types/bridge/account.ts similarity index 100% rename from bindings/capacitorjs/src/types/bridge/account.ts rename to wallet/bindings/capacitorjs/src/types/bridge/account.ts diff --git a/bindings/capacitorjs/src/types/bridge/accountManager.ts b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts similarity index 100% rename from bindings/capacitorjs/src/types/bridge/accountManager.ts rename to wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts diff --git a/bindings/capacitorjs/src/types/bridge/index.ts b/wallet/bindings/capacitorjs/src/types/bridge/index.ts similarity index 100% rename from bindings/capacitorjs/src/types/bridge/index.ts rename to wallet/bindings/capacitorjs/src/types/bridge/index.ts diff --git a/bindings/capacitorjs/src/types/buildOutputData.ts b/wallet/bindings/capacitorjs/src/types/buildOutputData.ts similarity index 100% rename from bindings/capacitorjs/src/types/buildOutputData.ts rename to wallet/bindings/capacitorjs/src/types/buildOutputData.ts diff --git a/bindings/capacitorjs/src/types/event.ts b/wallet/bindings/capacitorjs/src/types/event.ts similarity index 100% rename from bindings/capacitorjs/src/types/event.ts rename to wallet/bindings/capacitorjs/src/types/event.ts diff --git a/bindings/capacitorjs/src/types/incomingTransactionData.ts b/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts similarity index 100% rename from bindings/capacitorjs/src/types/incomingTransactionData.ts rename to wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts diff --git a/bindings/capacitorjs/src/types/index.ts b/wallet/bindings/capacitorjs/src/types/index.ts similarity index 100% rename from bindings/capacitorjs/src/types/index.ts rename to wallet/bindings/capacitorjs/src/types/index.ts diff --git a/bindings/capacitorjs/src/types/loggerConfig.ts b/wallet/bindings/capacitorjs/src/types/loggerConfig.ts similarity index 100% rename from bindings/capacitorjs/src/types/loggerConfig.ts rename to wallet/bindings/capacitorjs/src/types/loggerConfig.ts diff --git a/bindings/capacitorjs/src/types/network.ts b/wallet/bindings/capacitorjs/src/types/network.ts similarity index 100% rename from bindings/capacitorjs/src/types/network.ts rename to wallet/bindings/capacitorjs/src/types/network.ts diff --git a/bindings/capacitorjs/src/types/output.ts b/wallet/bindings/capacitorjs/src/types/output.ts similarity index 100% rename from bindings/capacitorjs/src/types/output.ts rename to wallet/bindings/capacitorjs/src/types/output.ts diff --git a/bindings/capacitorjs/src/types/outputOptions.ts b/wallet/bindings/capacitorjs/src/types/outputOptions.ts similarity index 100% rename from bindings/capacitorjs/src/types/outputOptions.ts rename to wallet/bindings/capacitorjs/src/types/outputOptions.ts diff --git a/bindings/capacitorjs/src/types/participation.ts b/wallet/bindings/capacitorjs/src/types/participation.ts similarity index 100% rename from bindings/capacitorjs/src/types/participation.ts rename to wallet/bindings/capacitorjs/src/types/participation.ts diff --git a/bindings/capacitorjs/src/types/preparedTransactionData.ts b/wallet/bindings/capacitorjs/src/types/preparedTransactionData.ts similarity index 100% rename from bindings/capacitorjs/src/types/preparedTransactionData.ts rename to wallet/bindings/capacitorjs/src/types/preparedTransactionData.ts diff --git a/bindings/capacitorjs/src/types/secretManager.ts b/wallet/bindings/capacitorjs/src/types/secretManager.ts similarity index 100% rename from bindings/capacitorjs/src/types/secretManager.ts rename to wallet/bindings/capacitorjs/src/types/secretManager.ts diff --git a/bindings/capacitorjs/src/types/signedTransactionEssence.ts b/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts similarity index 100% rename from bindings/capacitorjs/src/types/signedTransactionEssence.ts rename to wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts diff --git a/bindings/capacitorjs/src/types/transaction.ts b/wallet/bindings/capacitorjs/src/types/transaction.ts similarity index 100% rename from bindings/capacitorjs/src/types/transaction.ts rename to wallet/bindings/capacitorjs/src/types/transaction.ts diff --git a/bindings/capacitorjs/src/types/transactionOptions.ts b/wallet/bindings/capacitorjs/src/types/transactionOptions.ts similarity index 100% rename from bindings/capacitorjs/src/types/transactionOptions.ts rename to wallet/bindings/capacitorjs/src/types/transactionOptions.ts diff --git a/bindings/capacitorjs/tsconfig.json b/wallet/bindings/capacitorjs/tsconfig.json similarity index 100% rename from bindings/capacitorjs/tsconfig.json rename to wallet/bindings/capacitorjs/tsconfig.json From 6e6f605a268e76cc849f4f1ec8b8e721ab4b9d06 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 13:25:14 +0000 Subject: [PATCH 135/197] temporarily hidden `add_libs.sh` code to use latest version of wallet.rs Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index 45b1f4e9bc..b72bf1474f 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -1,17 +1,18 @@ #!/bin/bash -set -e -rm -rf tmp && mkdir tmp && cd tmp +# 🛑 temporarily hidden in favor of using the latest version of wallet.rs -curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip -unzip iota-wallet.zip +# set -e +# rm -rf tmp && mkdir tmp && cd tmp -rm -rf ../android/src/main/jniLibs -cp -r jniLibs ../android/src/main/jniLibs +# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip +# unzip iota-wallet.zip -curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar -rm -rf ../android/libs && mkdir -p ../android/libs -cp -r iota-wallet.jar ../android/libs +# rm -rf ../android/src/main/jniLibs +# cp -r jniLibs ../android/src/main/jniLibs -cd .. && rm -rf tmp -echo "success!" +# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar +# rm -rf ../android/libs && mkdir -p ../android/libs +# cp -r iota-wallet.jar ../android/libs + +# cd .. && rm -rf tmp From 97c4ed256f92996315007b253fca5f89842da5a0 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 13:25:50 +0000 Subject: [PATCH 136/197] update types to latest nodejs version Signed-off-by: Amadeo Marchioni --- .../bindings/capacitorjs/src/types/account.ts | 42 +++++++++-- .../bindings/capacitorjs/src/types/address.ts | 2 +- .../capacitorjs/src/types/bridge/account.ts | 62 ++++++++++++++-- .../src/types/bridge/accountManager.ts | 70 +++++++------------ .../capacitorjs/src/types/bridge/index.ts | 34 +++++---- .../src/types/incomingTransactionData.ts | 6 -- .../bindings/capacitorjs/src/types/index.ts | 3 +- .../bindings/capacitorjs/src/types/network.ts | 3 +- .../capacitorjs/src/types/participation.ts | 62 ++++++++++++---- .../src/types/signedTransactionEssence.ts | 2 +- .../capacitorjs/src/types/transaction.ts | 4 +- 11 files changed, 195 insertions(+), 95 deletions(-) delete mode 100644 wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts diff --git a/wallet/bindings/capacitorjs/src/types/account.ts b/wallet/bindings/capacitorjs/src/types/account.ts index c141d36b60..a981f018df 100644 --- a/wallet/bindings/capacitorjs/src/types/account.ts +++ b/wallet/bindings/capacitorjs/src/types/account.ts @@ -15,7 +15,7 @@ export type AccountId = number | string; /** The balance of an account */ export interface AccountBalance { - /** The balance of the base coin */ + /** The balance of the base coin */ baseCoin: BaseCoinBalance; /** The required storage deposit for the outputs */ requiredStorageDeposit: RequiredStorageDeposit; @@ -53,12 +53,13 @@ export interface RequiredStorageDeposit { /** The balance of a native token */ export interface NativeTokenBalance { tokenId: string; + metadata?: string; total: HexEncodedAmount; available: HexEncodedAmount; } /** Sync options for an account */ -export interface AccountSyncOptions { +export interface SyncOptions { /** * Specific Bech32 encoded addresses of the account to sync, if addresses are provided, * then `address_start_index` will be ignored @@ -83,13 +84,40 @@ export interface AccountSyncOptions { /// Try to sync transactions from incoming outputs with their inputs. Some data may not be obtained if it has been /// pruned. syncIncomingTransactions?: boolean; - /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ + /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ syncPendingTransactions?: boolean; - /** Specifies if only basic outputs should be synced or also alias and nft outputs. Default: true. */ - syncAliasesAndNfts?: boolean; - /** Specifies if only basic outputs with an AddressUnlockCondition alone should be synced, will overwrite - * `syncAliasesAndNfts`. Default: false. */ + /** Specifies what outputs should be synced for the ed25519 addresses from the account. */ + account?: AccountSyncOptions; + /** Specifies what outputs should be synced for the address of an alias output. */ + alias?: AliasSyncOptions; + /** Specifies what outputs should be synced for the address of an nft output. */ + nft?: NftSyncOptions; + /** Specifies if only basic outputs with an AddressUnlockCondition alone should be synced, will overwrite `account`, `alias` and `nft` options. Default: false. */ syncOnlyMostBasicOutputs?: boolean; + /** Sync native token foundries, so their metadata can be returned in the balance. Default: false. */ + syncNativeTokenFoundries?: boolean; +} + +/** Specifies what outputs should be synced for the ed25519 addresses from the account. */ +export interface AccountSyncOptions { + basicOutputs?: boolean; + aliasOutputs?: boolean; + nftOutputs?: boolean; +} + +/** Specifies what outputs should be synced for the address of an alias output. */ +export interface AliasSyncOptions { + basicOutputs?: boolean; + aliasOutputs?: boolean; + nftOutputs?: boolean; + foundryOutputs?: boolean; +} + +/** Specifies what outputs should be synced for the address of an nft output. */ +export interface NftSyncOptions { + basicOutputs?: boolean; + aliasOutputs?: boolean; + nftOutputs?: boolean; } /** The account object */ diff --git a/wallet/bindings/capacitorjs/src/types/address.ts b/wallet/bindings/capacitorjs/src/types/address.ts index d482b1e5cb..55076b7121 100644 --- a/wallet/bindings/capacitorjs/src/types/address.ts +++ b/wallet/bindings/capacitorjs/src/types/address.ts @@ -1,4 +1,4 @@ -// import type { Network } from './network'; +import type { Network } from './network'; import type { HexEncodedAmount } from '@iota/types'; /** Address Types */ diff --git a/wallet/bindings/capacitorjs/src/types/bridge/account.ts b/wallet/bindings/capacitorjs/src/types/bridge/account.ts index 6b8190b0dc..d1ce386982 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/account.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/account.ts @@ -1,5 +1,5 @@ import type { OutputTypes, HexEncodedAmount } from '@iota/types'; -import type { AccountSyncOptions, FilterOptions } from '../account'; +import type { SyncOptions, FilterOptions } from '../account'; import type { AddressWithAmount, AddressWithMicroAmount, @@ -13,6 +13,7 @@ import type { BuildFoundryOutputData, BuildNftOutputData, } from '../buildOutputData'; +import type { Node } from '../network'; import type { OutputOptions } from '../outputOptions'; import type { OutputsToClaim } from '../output'; import type { SignedTransactionEssence } from '../signedTransactionEssence'; @@ -24,6 +25,11 @@ import type { TransactionOptions, NftOptions, } from '../transactionOptions'; +import type { + ParticipationEventId, + ParticipationEventRegistrationOptions, + ParticipationEventType, +} from '../participation'; export type __BuildAliasOutputMethod__ = { name: 'buildAliasOutput'; @@ -94,6 +100,13 @@ export type __DecreaseNativeTokenSupplyMethod__ = { }; }; +export type __DeregisterParticipationEventMethod__ = { + name: 'deregisterParticipationEvent'; + data: { + eventId: ParticipationEventId; + }; +}; + export type __DestroyAliasMethod__ = { name: 'destroyAlias'; data: { @@ -248,6 +261,21 @@ export type __PrepareTransactionMethod__ = { }; }; +export type __RegisterParticipationEventsMethod__ = { + name: 'registerParticipationEvents'; + data: { + options: ParticipationEventRegistrationOptions; + }; +}; + +export type __RequestFundsFromFaucetMethod__ = { + name: 'requestFundsFromFaucet'; + data: { + url: string; + address: string; + }; +}; + export type __RetryTransactionUntilIncludedMethod__ = { name: 'retryTransactionUntilIncluded'; data: { @@ -321,14 +349,14 @@ export type __SubmitAndStoreTransactionMethod__ = { export type __SyncAccountMethod__ = { name: 'syncAccount'; data: { - options?: AccountSyncOptions; + options?: SyncOptions; }; }; export type __VoteMethod__ = { name: 'vote'; data: { - eventId?: string; + eventId?: ParticipationEventId; answers?: number[]; }; }; @@ -336,7 +364,7 @@ export type __VoteMethod__ = { export type __StopParticipatingMethod__ = { name: 'stopParticipating'; data: { - eventId: string; + eventId: ParticipationEventId; }; }; @@ -355,6 +383,32 @@ export type __IncreaseVotingPowerMethod__ = { }; }; +export type __GetParticipationEventMethod__ = { + name: 'getParticipationEvent'; + data: { + eventId: ParticipationEventId; + }; +}; + +export type __GetParticipationEventIdsMethod__ = { + name: 'getParticipationEventIds'; + data: { + node: Node, + eventType?: ParticipationEventType; + }; +}; + +export type __GetParticipationEventsMethod__ = { + name: 'getParticipationEvents'; +}; + +export type __GetParticipationEventStatusMethod__ = { + name: 'getParticipationEventStatus'; + data: { + eventId: ParticipationEventId; + }; +}; + export type __DecreaseVotingPowerMethod__ = { name: 'decreaseVotingPower'; data: { diff --git a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts index 664eb12023..fe47e5f37d 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -4,9 +4,12 @@ import type { CreateAccountPayload, } from '../account'; import type { GenerateAddressOptions } from '../address'; -import type { WalletEvent } from '../event'; -import type { Auth, ClientOptions, Node } from '../network'; -import type { EventId } from '../participation'; +import type { EventType, WalletEvent } from '../event'; +import type { Auth, ClientOptions } from '../network'; +import type { + ParticipationEventId, + ParticipationEventType, +} from '../participation'; export type __BackupMessage__ = { cmd: 'backup'; @@ -18,7 +21,9 @@ export type __BackupMessage__ = { export type __Bech32ToHex__ = { cmd: 'bech32ToHex'; - payload: string; + payload: { + bech32Address: string; + }; }; export type __ChangeStrongholdPasswordMessage__ = { @@ -33,21 +38,19 @@ export type __ClearStrongholdPasswordMessage__ = { cmd: 'clearStrongholdPassword'; }; +export type __ClearListenersMessage__ = { + cmd: 'clearListeners'; + payload: { eventTypes: EventType[] }; +}; + export type __CreateAccountMessage__ = { cmd: 'createAccount'; payload: CreateAccountPayload; }; -export type __DeregisterParticipationEvent__ = { - cmd: 'deregisterParticipationEvent'; - payload: { - eventId: EventId; - }; -}; - export type __EmitTestEventMessage__ = { cmd: 'emitTestEvent'; - payload: WalletEvent; + payload: { event: WalletEvent }; }; export type __GenerateMnemonicMessage__ = { @@ -64,7 +67,7 @@ export type __GetAccountsMessage__ = { export type __GetAccountMessage__ = { cmd: 'getAccount'; - payload: AccountId; + payload: { accountId: AccountId }; }; export type __GetLedgerNanoStatusMessage__ = { @@ -90,24 +93,6 @@ export type __GetNodeInfoMessage__ = { }; }; -export type __GetParticipationEventMessage__ = { - cmd: 'getParticipationEvent'; - payload: { - eventId: EventId; - }; -}; - -export type __GetParticipationEventsMessage__ = { - cmd: 'getParticipationEvents'; -}; - -export type __GetParticipationEventStatusMessage__ = { - cmd: 'getParticipationEventStatus'; - payload: { - eventId: EventId; - }; -}; - export type __HexToBech32__ = { cmd: 'hexToBech32'; payload: { @@ -130,14 +115,6 @@ export type __RecoverAccountsMessage__ = { }; }; -export type __RegisterParticipationEventMessage__ = { - cmd: 'registerParticipationEvent'; - payload: { - eventId: EventId; - nodes: Node[]; - }; -}; - export type __RemoveLatestAccountMessage__ = { cmd: 'removeLatestAccount'; }; @@ -152,17 +129,17 @@ export type __RestoreBackupMessage__ = { export type __SetClientOptionsMessage__ = { cmd: 'setClientOptions'; - payload: ClientOptions; + payload: { clientOptions: ClientOptions }; }; export type __SetStrongholdPasswordMessage__ = { cmd: 'setStrongholdPassword'; - payload: string; + payload: { password: string }; }; export type __SetStrongholdPasswordClearIntervalMessage__ = { cmd: 'setStrongholdPasswordClearInterval'; - payload?: number; + payload?: { intervalInMilliseconds?: number }; }; export type __StartBackgroundSyncMessage__ = { @@ -179,10 +156,15 @@ export type __StopBackgroundSyncMessage__ = { export type __StoreMnemonicMessage__ = { cmd: 'storeMnemonic'; - payload: string; + payload: { mnemonic: string }; }; export type __VerifyMnemonicMessage__ = { cmd: 'verifyMnemonic'; - payload: string; + payload: { mnemonic: string }; +}; + +export type __UpdateNodeAuthMessage__ = { + cmd: 'updateNodeAuth'; + payload: { url: string; auth?: Auth }; }; diff --git a/wallet/bindings/capacitorjs/src/types/bridge/index.ts b/wallet/bindings/capacitorjs/src/types/bridge/index.ts index ef1cc9d257..87108c1562 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/index.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/index.ts @@ -12,6 +12,7 @@ import type { __DecreaseNativeTokenSupplyMethod__, __DestroyAliasMethod__, __DestroyFoundryMethod__, + __DeregisterParticipationEventMethod__, __GenerateAddressesMethod__, __GetBalanceMethod__, __GetOutputMethod__, @@ -32,6 +33,8 @@ import type { __PrepareOutputMethod__, __PrepareSendAmountMethod__, __PrepareTransactionMethod__, + __RegisterParticipationEventsMethod__, + __RequestFundsFromFaucetMethod__, __RetryTransactionUntilIncludedMethod__, __SendAmountMethod__, __SendMicroTransactionMethod__, @@ -44,17 +47,22 @@ import type { __SyncAccountMethod__, __GetIncomingTransactionDataMethod__, __VoteMethod__, - __StopParticipatingMethod__, __GetVotingPowerMethod__, __GetParticipationOverviewMethod__, + __GetParticipationEventMethod__, + __GetParticipationEventsMethod__, + __GetParticipationEventStatusMethod__, + __GetParticipationEventIdsMethod__, __IncreaseVotingPowerMethod__, __DecreaseVotingPowerMethod__, + __StopParticipatingMethod__, } from './account'; import type { __BackupMessage__, __Bech32ToHex__, __ChangeStrongholdPasswordMessage__, __ClearStrongholdPasswordMessage__, + __ClearListenersMessage__, __CreateAccountMessage__, __EmitTestEventMessage__, __GenerateMnemonicMessage__, @@ -76,11 +84,7 @@ import type { __StopBackgroundSyncMessage__, __StoreMnemonicMessage__, __VerifyMnemonicMessage__, - __DeregisterParticipationEvent__, - __RegisterParticipationEventMessage__, - __GetParticipationEventMessage__, - __GetParticipationEventsMessage__, - __GetParticipationEventStatusMessage__, + __UpdateNodeAuthMessage__, } from './accountManager'; export type __AccountMethod__ = @@ -93,6 +97,7 @@ export type __AccountMethod__ = | __ClaimOutputsMethod__ | __ConsolidateOutputsMethod__ | __CreateAliasOutputMethod__ + | __DeregisterParticipationEventMethod__ | __DestroyAliasMethod__ | __DestroyFoundryMethod__ | __GenerateAddressesMethod__ @@ -101,6 +106,10 @@ export type __AccountMethod__ = | __GetIncomingTransactionDataMethod__ | __GetFoundryOutputMethod__ | __GetOutputsWithAdditionalUnlockConditionsMethod__ + | __GetParticipationEventMethod__ + | __GetParticipationEventIdsMethod__ + | __GetParticipationEventsMethod__ + | __GetParticipationEventStatusMethod__ | __GetTransactionMethod__ | __AddressesMethod__ | __AddressesWithUnspentOutputsMethod__ @@ -117,6 +126,8 @@ export type __AccountMethod__ = | __PrepareOutputMethod__ | __PrepareSendAmountMethod__ | __PrepareTransactionMethod__ + | __RegisterParticipationEventsMethod__ + | __RequestFundsFromFaucetMethod__ | __RetryTransactionUntilIncludedMethod__ | __SendAmountMethod__ | __SendMicroTransactionMethod__ @@ -147,9 +158,9 @@ export type __Message__ = | __Bech32ToHex__ | __CallAccountMethodMessage__ | __ChangeStrongholdPasswordMessage__ + | __ClearListenersMessage__ | __ClearStrongholdPasswordMessage__ | __CreateAccountMessage__ - | __DeregisterParticipationEvent__ | __EmitTestEventMessage__ | __GenerateMnemonicMessage__ | __GetAccountMessage__ @@ -158,13 +169,9 @@ export type __Message__ = | __GetLedgerNanoStatusMessage__ | __GenerateAddressMessage__ | __GetNodeInfoMessage__ - | __GetParticipationEventMessage__ - | __GetParticipationEventsMessage__ - | __GetParticipationEventStatusMessage__ | __HexToBech32__ | __IsStrongholdPasswordAvailableMessage__ | __RecoverAccountsMessage__ - | __RegisterParticipationEventMessage__ | __RemoveLatestAccountMessage__ | __RestoreBackupMessage__ | __SetClientOptionsMessage__ @@ -173,6 +180,5 @@ export type __Message__ = | __StartBackgroundSyncMessage__ | __StopBackgroundSyncMessage__ | __StoreMnemonicMessage__ - | __VerifyMnemonicMessage__; - - \ No newline at end of file + | __VerifyMnemonicMessage__ + | __UpdateNodeAuthMessage__; diff --git a/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts b/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts deleted file mode 100644 index 35c4ce0114..0000000000 --- a/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; - -export type IncomingTransactionData = [ - ITransactionPayload, - IOutputMetadataResponse[], -]; diff --git a/wallet/bindings/capacitorjs/src/types/index.ts b/wallet/bindings/capacitorjs/src/types/index.ts index 68a13c563f..732874e738 100644 --- a/wallet/bindings/capacitorjs/src/types/index.ts +++ b/wallet/bindings/capacitorjs/src/types/index.ts @@ -1,10 +1,9 @@ export * from './account'; export * from './accountManager'; export * from './address'; -export * from './bridge/index'; +export * from './bridge'; export * from './buildOutputData'; export * from './event'; -export * from './incomingTransactionData'; export * from './loggerConfig'; export * from './network'; export * from './output'; diff --git a/wallet/bindings/capacitorjs/src/types/network.ts b/wallet/bindings/capacitorjs/src/types/network.ts index a804af5e0d..9b2df538eb 100644 --- a/wallet/bindings/capacitorjs/src/types/network.ts +++ b/wallet/bindings/capacitorjs/src/types/network.ts @@ -9,8 +9,7 @@ export enum Network { /** Basic Auth or JWT */ export type Auth = { jwt?: string; - username?: string; - password?: string; + basicAuthNamePwd?: [string, string]; }; /** Information about the network and client */ diff --git a/wallet/bindings/capacitorjs/src/types/participation.ts b/wallet/bindings/capacitorjs/src/types/participation.ts index ae273550d2..6cb15791ed 100644 --- a/wallet/bindings/capacitorjs/src/types/participation.ts +++ b/wallet/bindings/capacitorjs/src/types/participation.ts @@ -1,40 +1,66 @@ -// import type { OutputId } from './output'; +import type { Node } from './network'; +import type { OutputId } from './output'; export interface ParticipationOverview { - participations: {[eventId: string]: { [outputId: string]: TrackedParticipationOverview }}; + participations: Participations; +} + +export interface Participations { + [eventId: ParticipationEventId]: { + [outputId: OutputId]: TrackedParticipationOverview; + }; } export interface TrackedParticipationOverview { - blockId: string; amount: string; - startMilestoneIndex: number; + answers: number[]; + blockId: string; endMilestoneIndex: number; + startMilestoneIndex: number; +} + +export interface ParticipationEvent { + id: ParticipationEventId; + data: ParticipationEventData; } -export interface Event { - id: EventId; - data: EventData; +export interface ParticipationEventRegistrationOptions { + node: Node; + eventsToRegister?: ParticipationEventId[]; + eventsToIgnore?: ParticipationEventId[]; } -export type EventId = string; +export interface ParticipationEventWithNodes { + id: ParticipationEventId; + data: ParticipationEventData; + nodes: Node[]; +} -export interface EventStatus { +export type ParticipationEventId = string; + +export type ParticipationEventMap = { + [id: ParticipationEventId]: ParticipationEventWithNodes +} + +export interface ParticipationEventStatus { milestoneIndex: number; status: string; - questions?: Answer[]; + questions?: QuestionStatus[]; checksum: string; } -export interface EventData { +export interface ParticipationEventData { name: string; milestoneIndexCommence: number; milestoneIndexStart: number; milestoneIndexEnd: number; - payload: EventPayload; + payload: ParticipationEventPayload; additionalInfo: string; } -export type EventPayload = VotingEventPayload | StakingEventPayload; +export type ParticipationEventPayload = + | VotingEventPayload + | StakingEventPayload; export interface VotingEventPayload { type: ParticipationEventType.Voting; @@ -63,6 +89,16 @@ export interface Answer { additionalInfo: string; } +export interface QuestionStatus { + answers: AnswerStatus[]; +} + +export interface AnswerStatus { + value: number; + current: number; + accumulated: number; +} + export enum ParticipationEventType { Voting = 0, Staking = 1, diff --git a/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts b/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts index b719509808..f640758c4a 100644 --- a/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts +++ b/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts @@ -1,7 +1,7 @@ import type { ITransactionPayload } from '@iota/types'; import type { InputSigningData } from './preparedTransactionData'; -/** The signed transaction with inputs data */ +/** The signed transaction with inputs data */ export interface SignedTransactionEssence { transactionPayload: ITransactionPayload; inputsData: InputSigningData; diff --git a/wallet/bindings/capacitorjs/src/types/transaction.ts b/wallet/bindings/capacitorjs/src/types/transaction.ts index b1e61e2186..0eeafa2338 100644 --- a/wallet/bindings/capacitorjs/src/types/transaction.ts +++ b/wallet/bindings/capacitorjs/src/types/transaction.ts @@ -1,4 +1,4 @@ -import type { ITransactionPayload } from '@iota/types'; +import type { IOutputResponse, ITransactionPayload } from '@iota/types'; /** Possible InclusionStates of transactions sent with the wallet */ export enum InclusionState { @@ -28,7 +28,9 @@ export interface Transaction { networkId: string; /** If the transaction was created by the wallet or someone else */ incoming: boolean; + /** Note that can be set when sending a transaction and is only stored locally */ note?: string; + inputs: IOutputResponse[]; } /** The result of a minting operation */ From ab327bdba43a12c22b071b5a609fe252a402e202 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 13:35:32 +0000 Subject: [PATCH 137/197] update `createAccount` with latest nodejs `Account`class Signed-off-by: Amadeo Marchioni --- .../capacitorjs/src/lib/createAccount.ts | 333 ++++++++++++------ 1 file changed, 225 insertions(+), 108 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/createAccount.ts b/wallet/bindings/capacitorjs/src/lib/createAccount.ts index d79b07803d..c82ea5f206 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccount.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccount.ts @@ -5,7 +5,7 @@ import type { MessageHandler } from './MessageHandler' import type { AccountBalance, AccountMetadata, - AccountSyncOptions, + SyncOptions, AccountMeta, Address, AddressWithAmount, @@ -20,14 +20,18 @@ import type { MintTokenTransaction, NativeTokenOptions, NftOptions, + Node, OutputData, OutputOptions, OutputsToClaim, PreparedTransactionData, Transaction, TransactionOptions, - IncomingTransactionData, ParticipationOverview, + ParticipationEventId, + ParticipationEventStatus, + ParticipationEventType, + ParticipationEventWithNodes, ParticipationEventRegistrationOptions, ParticipationEventMap, } from '../types' import type { SignedTransactionEssence } from '../types/signedTransactionEssence' import type { @@ -62,8 +66,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'buildAliasOutput', data, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -78,8 +82,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'buildBasicOutput', data, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -96,8 +100,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'buildFoundryOutput', data, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -112,8 +116,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'buildNftOutput', data, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -141,8 +145,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -167,8 +171,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -186,8 +190,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH outputIdsToClaim: outputIds, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -211,8 +215,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH outputConsolidationThreshold, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -235,8 +239,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -263,8 +267,23 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; + }, + + async deregisterParticipationEvent( + eventId: ParticipationEventId, + ): Promise { + const resp = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'deregisterParticipationEvent', + data: { + eventId, + }, + }, + ); + return JSON.parse(resp).payload; }, /** @@ -289,8 +308,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -314,8 +333,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, /** @@ -326,8 +345,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH async generateAddress( options?: AddressGenerationOptions, ): Promise
{ - const addresses = await this.generateAddresses(1, options) - return addresses[0] + const addresses = await this.generateAddresses(1, options); + return addresses[0]; }, /** @@ -349,8 +368,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -363,9 +382,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'getBalance', }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -382,8 +401,65 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH outputId, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; + }, + + async getParticipationEvent( + eventId: ParticipationEventId, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getParticipationEvent', + data: { + eventId, + }, + }, + ); + return JSON.parse(response).payload; + }, + + async getParticipationEventIds( + node: Node, + eventType?: ParticipationEventType, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getParticipationEventIds', + data: { + node, + eventType, + }, + }, + ); + return JSON.parse(response).payload; + }, + + async getParticipationEvents(): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getParticipationEvents', + }, + ); + return JSON.parse(response).payload; + }, + + async getParticipationEventStatus( + eventId: ParticipationEventId, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'getParticipationEventStatus', + data: { + eventId, + }, + }, + ); + return JSON.parse(response).payload; }, /** @@ -401,8 +477,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH tokenId, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -421,8 +497,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH outputsToClaim: outputs, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -439,8 +515,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH transactionId, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -451,7 +527,7 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH */ async getIncomingTransactionData( transactionId: string, - ): Promise { + ): Promise { const response = await messageHandler.callAccountMethod( accountMeta.index, { @@ -460,8 +536,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH transactionId, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -474,9 +550,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'addresses', }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -489,9 +565,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'addressesWithUnspentOutputs', }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -506,9 +582,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'outputs', data: { filterOptions }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -521,23 +597,23 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'pendingTransactions', }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** * List all incoming transactions of the account. * @returns The incoming transactions with their inputs. */ - async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { + async incomingTransactions(): Promise<[string, Transaction][]> { const response = await messageHandler.callAccountMethod( accountMeta.index, { name: 'incomingTransactions', }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -550,9 +626,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'transactions', }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -567,9 +643,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH name: 'unspentOutputs', data: { filterOptions }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -581,7 +657,7 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH alias: accountMeta.alias, coinType: accountMeta.coinType, index: accountMeta.index, - } + }; }, /** @@ -598,8 +674,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH output, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -628,9 +704,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -653,9 +729,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -678,9 +754,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -689,7 +765,7 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH * below the minimum required storage deposit, by default the remaining * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, * when setting the `ReturnStrategy` to `gift`, the full minimum required - * storage deposit will be sent to the recipient. When the assets contain + * storage deposit will be sent to the recipient. When the assets contain * an nft id, the data from the existing `NftOutput` will be used, just with * the address unlock conditions replaced. * @param transactionOptions The options to define a `RemainderValueStrategy` @@ -709,8 +785,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH transactionOptions, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -733,8 +809,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -757,8 +833,40 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; + }, + + async registerParticipationEvents( + options: ParticipationEventRegistrationOptions, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'registerParticipationEvents', + data: { + options, + }, + }, + ); + return JSON.parse(response).payload; + }, + + /** + * Request funds from a faucet. + */ + async requestFundsFromFaucet( + url: string, + address: string, + ): Promise { + const response = await messageHandler.callAccountMethod( + accountMeta.index, + { + name: 'requestFundsFromFaucet', + data: { url, address }, + }, + ); + return JSON.parse(response).payload; }, /** @@ -780,8 +888,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH maxAttempts, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -804,9 +912,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -829,9 +937,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -854,9 +962,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -879,9 +987,9 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, /** @@ -904,18 +1012,22 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options: transactionOptions, }, }, - ) + ); - return JSON.parse(response).payload + return JSON.parse(response).payload; }, + /** + * Set the alias for the account + * @param alias The account alias to set. + */ async setAlias(alias: string): Promise { await messageHandler.callAccountMethod(accountMeta.index, { name: 'setAlias', data: { alias, }, - }) + }); }, /** @@ -934,8 +1046,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH preparedTransactionData, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -954,8 +1066,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH signedTransactionData, }, }, - ) - return JSON.parse(response).payload + ); + return JSON.parse(response).payload; }, /** @@ -964,7 +1076,7 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH * @param options Optional synchronization options. * @returns The account balance. */ - async sync(options?: AccountSyncOptions): Promise { + async sync(options?: SyncOptions): Promise { const resp = await messageHandler.callAccountMethod( accountMeta.index, { @@ -973,11 +1085,14 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH options, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, - async vote(eventId: string, answers: number[]): Promise { + async vote( + eventId?: ParticipationEventId, + answers?: number[], + ): Promise { const resp = await messageHandler.callAccountMethod( accountMeta.index, { @@ -987,11 +1102,13 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH answers, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, - async stopParticipating(eventId: string): Promise { + async stopParticipating( + eventId: ParticipationEventId, + ): Promise { const resp = await messageHandler.callAccountMethod( accountMeta.index, { @@ -1000,8 +1117,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH eventId, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, async getVotingPower(): Promise { @@ -1010,8 +1127,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'getVotingPower', }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, async getParticipationOverview(): Promise { @@ -1020,8 +1137,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH { name: 'getParticipationOverview', }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, async increaseVotingPower(amount: string): Promise { @@ -1033,8 +1150,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH amount, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; }, async decreaseVotingPower(amount: string): Promise { @@ -1046,8 +1163,8 @@ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageH amount, }, }, - ) - return JSON.parse(resp).payload + ); + return JSON.parse(resp).payload; } } } From 53e3963db42c6c4767d711d512de99680c2ca5de Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 13:51:25 +0000 Subject: [PATCH 138/197] update `createAccountManager` with latest nodejs `AccountManager` class Signed-off-by: Amadeo Marchioni --- .../src/lib/createAccountManager.ts | 139 ++++++------------ 1 file changed, 49 insertions(+), 90 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts index bfdbecc425..f3ad7fd439 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts @@ -6,20 +6,16 @@ import { createAccount } from './createAccount'; import type { AccountId, - Auth, - EventType, AccountManagerOptions, + AccountSyncOptions, + Auth, + ClientOptions, CreateAccountPayload, + EventType, + GenerateAddressOptions, + LedgerNanoStatus, NodeInfoWrapper, - ClientOptions, - AccountSyncOptions, WalletEvent, - LedgerNanoStatus, - Event, - EventId, - Node, - EventStatus, - GenerateAddressOptions, } from '../types'; type Account = ReturnType @@ -34,23 +30,6 @@ export async function createAccountManager(options: AccountManagerOptions) { return { id, - /** - * Listen to wallet events with a callback. An empty array will listen to all possible events. - */ - async listen( - eventTypes: EventType[], - callback: (error: Error | undefined, result: string) => void, - ): Promise { - return messageHandler.listen(eventTypes, callback); - }, - - /** - * Clear the callbacks for provided events. An empty array will clear all listeners. - */ - clearListeners(eventTypes: EventType[]): Promise { - return messageHandler.clearListeners(eventTypes); - }, - /** * Backup the data to a Stronghold snapshot. */ @@ -70,7 +49,7 @@ export async function createAccountManager(options: AccountManagerOptions) { async bech32ToHex(bech32Address: string): Promise { const response = await messageHandler.sendMessage({ cmd: 'bech32ToHex', - payload: bech32Address, + payload: { bech32Address }, }); return JSON.parse(response).payload; }, @@ -114,17 +93,8 @@ export async function createAccountManager(options: AccountManagerOptions) { /** * Destroy the AccountManager and drop its database connection. */ - destroy(): void { - messageHandler.destroy(); - }, - - async deregisterParticipationEvent(eventId: EventId): Promise { - await messageHandler.sendMessage({ - cmd: 'deregisterParticipationEvent', - payload: { - eventId, - }, - }); + async destroy(): Promise { + await messageHandler.destroy(); }, /** @@ -133,7 +103,7 @@ export async function createAccountManager(options: AccountManagerOptions) { async emitTestEvent(event: WalletEvent): Promise { await messageHandler.sendMessage({ cmd: 'emitTestEvent', - payload: event, + payload: { event }, }); }, @@ -153,7 +123,7 @@ export async function createAccountManager(options: AccountManagerOptions) { async getAccount(accountId: AccountId): Promise { const response = await messageHandler.sendMessage({ cmd: 'getAccount', - payload: accountId, + payload: { accountId }, }); const account = createAccount( @@ -237,33 +207,6 @@ export async function createAccountManager(options: AccountManagerOptions) { return JSON.parse(response).payload; }, - async getParticipationEvent(eventId: EventId): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEvent', - payload: { - eventId, - }, - }); - return JSON.parse(response).payload; - }, - - async getParticipationEvents(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEvents', - }); - return JSON.parse(response).payload; - }, - - async getParticipationEventStatus(eventId: EventId): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEventStatus', - payload: { - eventId, - }, - }); - return JSON.parse(response).payload; - }, - /** * Transform hex encoded address to bech32 encoded address. If no bech32Hrp * is provided, the AccountManager will attempt to retrieve it from the @@ -287,6 +230,27 @@ export async function createAccountManager(options: AccountManagerOptions) { return JSON.parse(response).payload; }, + /** + * Listen to wallet events with a callback. An empty array will listen to all possible events. + */ + async listen( + eventTypes: EventType[], + callback: (error: Error, result: string) => void, + ): Promise { + return messageHandler.listen(eventTypes, callback); + }, + + /** + * Clear the callbacks for provided events. An empty array will clear all listeners. + */ + async clearListeners(eventTypes: EventType[]): Promise { + const response = await messageHandler.sendMessage({ + cmd: 'clearListeners', + payload: { eventTypes }, + }); + return JSON.parse(response).payload; + }, + /** * Find accounts with unspent outputs. */ @@ -323,21 +287,6 @@ export async function createAccountManager(options: AccountManagerOptions) { }); }, - async registerParticipationEvent( - eventId: EventId, - nodes: Node[], - ): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'registerParticipationEvent', - payload: { - eventId, - nodes, - }, - }); - - return JSON.parse(response).payload; - }, - /** * Restore a backup from a Stronghold file * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created @@ -357,10 +306,10 @@ export async function createAccountManager(options: AccountManagerOptions) { /** * Set ClientOptions. */ - async setClientOptions(options: ClientOptions): Promise { + async setClientOptions(clientOptions: ClientOptions): Promise { await messageHandler.sendMessage({ cmd: 'setClientOptions', - payload: options, + payload: { clientOptions }, }); }, @@ -370,7 +319,7 @@ export async function createAccountManager(options: AccountManagerOptions) { async setStrongholdPassword(password: string): Promise { await messageHandler.sendMessage({ cmd: 'setStrongholdPassword', - payload: password, + payload: { password }, }); }, @@ -382,7 +331,7 @@ export async function createAccountManager(options: AccountManagerOptions) { ): Promise { await messageHandler.sendMessage({ cmd: 'setStrongholdPasswordClearInterval', - payload: intervalInMilliseconds, + payload: { intervalInMilliseconds }, }); }, @@ -417,7 +366,7 @@ export async function createAccountManager(options: AccountManagerOptions) { async storeMnemonic(mnemonic: string): Promise { await messageHandler.sendMessage({ cmd: 'storeMnemonic', - payload: mnemonic, + payload: { mnemonic }, }); }, @@ -427,8 +376,18 @@ export async function createAccountManager(options: AccountManagerOptions) { async verifyMnemonic(mnemonic: string): Promise { await messageHandler.sendMessage({ cmd: 'verifyMnemonic', - payload: mnemonic, + payload: { mnemonic }, + }); + }, + + /** + * Update the authentication for the provided node. + */ + async updateNodeAuth(url: string, auth?: Auth): Promise { + await messageHandler.sendMessage({ + cmd: 'updateNodeAuth', + payload: { url, auth }, }); - } + }, } } From 7eb1c465f6ea5f0a20ded462a84ce0750eb230f8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 14:10:34 +0000 Subject: [PATCH 139/197] remove clearListeners from `MessageHandler` Signed-off-by: Amadeo Marchioni --- .../capacitorjs/src/lib/MessageHandler.ts | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts b/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts index eff984e225..b7acc9127c 100644 --- a/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -5,7 +5,6 @@ import { sendMessageAsync, messageHandlerNew, listen as _listen, - clearListeners as _clearListeners, destroy as _destroy, } from './bindings'; import type { @@ -60,7 +59,7 @@ export async function MessageHandler(options?: AccountManagerOptions) { const Error = error ? { name: error.toString(), message: error.cause?.toString() || '' - } : undefined + }: undefined callback( Error, result @@ -68,18 +67,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { }); } - async function clearListeners( - eventTypes: EventType[] - ): Promise { - await _clearListeners({ eventTypes, messageHandler }, ({ error, result }) => { - const Error = error ? { - name: error.toString(), - message: error?.cause?.toString() - } : undefined - return Error || result - }); - } - function destroy(): void { _destroy({ messageHandler }); } @@ -89,7 +76,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { sendMessage, callAccountMethod, listen, - clearListeners, destroy } } From 4e5cda78ab93dbc79488693edafb6f47d5844357 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 16:53:40 +0000 Subject: [PATCH 140/197] remove unused import declaration Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/types/address.ts | 1 - .../bindings/capacitorjs/src/types/bridge/accountManager.ts | 4 ---- 2 files changed, 5 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/types/address.ts b/wallet/bindings/capacitorjs/src/types/address.ts index 55076b7121..cc12a0b1e7 100644 --- a/wallet/bindings/capacitorjs/src/types/address.ts +++ b/wallet/bindings/capacitorjs/src/types/address.ts @@ -1,4 +1,3 @@ -import type { Network } from './network'; import type { HexEncodedAmount } from '@iota/types'; /** Address Types */ diff --git a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts index fe47e5f37d..36374d3f85 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -6,10 +6,6 @@ import type { import type { GenerateAddressOptions } from '../address'; import type { EventType, WalletEvent } from '../event'; import type { Auth, ClientOptions } from '../network'; -import type { - ParticipationEventId, - ParticipationEventType, -} from '../participation'; export type __BackupMessage__ = { cmd: 'backup'; From 1592aa8bd568fab6f43dcc80bb4062403c986b4a Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 17:49:40 +0000 Subject: [PATCH 141/197] remove clearListeners from iOS / Swift Signed-off-by: Amadeo Marchioni --- .../bindings/capacitorjs/ios/Plugin/Plugin.m | 1 - .../capacitorjs/ios/Plugin/Plugin.swift | 20 ------------------- 2 files changed, 21 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m index 1f7c7a7e26..d01f78aa48 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -9,6 +9,5 @@ CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); - CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index e5ae117795..8c6e938385 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -184,24 +184,4 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } - @objc func clearListeners(_ call: CAPPluginCall) { - print("Capacitor call clearListeners received", call.jsObjectRepresentation) - guard let handler = call.getInt("messageHandler") else { - return call.reject("handler is required") - } - let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) - - guard let eventTypes = call.getArray("eventTypes") else { - return call.reject("eventTypes is required") - } - let eventChar = eventTypes.description.cString(using: .utf8) - - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() - - iota_clear_listeners( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - } } From 7782ff5a2180ebd402f7705c1f6407f222a64471 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 17:51:14 +0000 Subject: [PATCH 142/197] rename package version to `2.0.0-rc.1` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/package.json b/wallet/bindings/capacitorjs/package.json index 36e89672ee..a12545b277 100644 --- a/wallet/bindings/capacitorjs/package.json +++ b/wallet/bindings/capacitorjs/package.json @@ -1,6 +1,6 @@ { "name": "@iota/wallet-mobile", - "version": "2.0.0-alpha.0", + "version": "2.0.0-rc.1", "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/api.js", From fdc02db930183dc56092e12a5ef3509b9c890414 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 17:57:25 +0000 Subject: [PATCH 143/197] remove clearListeners from Android / Java Signed-off-by: Amadeo Marchioni --- .../org/iota/IotaWalletMobile/IotaWalletMobile.java | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index ffc57b2b0f..a4485993de 100644 --- a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -177,14 +177,4 @@ public void destroy(final PluginCall call) { } } - @PluginMethod() - public void clearListeners(final PluginCall call) { - try { - wallet.clearListeners(); - call.release(bridge); - } catch (Exception ex) { - call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); - } - } - } From 1c7da26dac9645bf8698999bd0a67e767a3529e1 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 18:39:29 +0000 Subject: [PATCH 144/197] fix export at `src/types/index.ts` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/types/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/src/types/index.ts b/wallet/bindings/capacitorjs/src/types/index.ts index 732874e738..3bbcc66a03 100644 --- a/wallet/bindings/capacitorjs/src/types/index.ts +++ b/wallet/bindings/capacitorjs/src/types/index.ts @@ -1,7 +1,7 @@ export * from './account'; export * from './accountManager'; export * from './address'; -export * from './bridge'; +export * from './bridge/index'; export * from './buildOutputData'; export * from './event'; export * from './loggerConfig'; From ac9c77ee8223327a1484b574c2b58b0859104f5d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sun, 26 Feb 2023 18:41:52 +0000 Subject: [PATCH 145/197] remove hidden unneeded code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/rollup.config.js | 22 ++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/wallet/bindings/capacitorjs/rollup.config.js b/wallet/bindings/capacitorjs/rollup.config.js index 99d9f6e1c3..d45e21e30b 100644 --- a/wallet/bindings/capacitorjs/rollup.config.js +++ b/wallet/bindings/capacitorjs/rollup.config.js @@ -5,14 +5,14 @@ export default [{ input: ['dist/esm/index.js'], output: [ { - file: 'dist/plugin.js', - format: 'iife', - name: 'capacitorPlugin', - globals: { - '@capacitor/core': 'capacitorExports', - }, - sourcemap: true, - inlineDynamicImports: true, + file: 'dist/plugin.js', + format: 'iife', + name: 'capacitorPlugin', + globals: { + '@capacitor/core': 'capacitorExports', + }, + sourcemap: true, + inlineDynamicImports: true, }, ], external: ['@capacitor/core'], @@ -21,11 +21,7 @@ export default [{ input: ['dist/esm/lib/index.js'], output: [ { - file: 'dist/api.js', - // format: 'iife', - // globals: { - // '@capacitor/core': 'capacitorExports', - // }, + file: 'dist/api.js', }, ], external: ['@capacitor/core'], From 3ff4b66680397654ae363dc1633f29634c38ac63 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 08:12:20 +0000 Subject: [PATCH 146/197] update ios xcframework headers Signed-off-by: Amadeo Marchioni --- .../WalletFramework.framework/Headers/WalletFramework.h | 1 - .../ios-x86/WalletFramework.framework/Headers/WalletFramework.h | 1 - 2 files changed, 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h index bca40949e9..38dc9deb89 100644 --- a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h +++ b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -18,7 +18,6 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); #ifdef __cplusplus diff --git a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h index bca40949e9..38dc9deb89 100644 --- a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h +++ b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -18,7 +18,6 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); #ifdef __cplusplus From f896e6c513be62a4f77fe625ca30a3eeeac40cfb Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 09:14:22 +0000 Subject: [PATCH 147/197] update ios `project.pbxproj` with `libc++.tbd` as recommended Signed-off-by: Amadeo Marchioni --- .../capacitorjs/ios/Plugin.xcodeproj/project.pbxproj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj index 7084a43f99..e83b55243c 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj +++ b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -20,6 +20,7 @@ EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EE5A7DAE29ACAAB900F1D709 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -64,6 +65,7 @@ 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; }; 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; }; EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = WalletFramework.xcframework; sourceTree = ""; }; + EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; }; F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -74,6 +76,7 @@ buildActionMask = 2147483647; files = ( EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */, + EE5A7DAE29ACAAB900F1D709 /* libc++.tbd in Frameworks */, 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */, 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */, 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */, @@ -157,6 +160,7 @@ A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = { isa = PBXGroup; children = ( + EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */, EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */, 600FAB16252ED5A30039D358 /* libresolv.tbd */, 50ADFFA52020D75100D50D53 /* Capacitor.framework */, @@ -415,7 +419,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -469,7 +473,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -493,7 +497,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Plugin/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -526,7 +530,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Plugin/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From ffc1d24c26b6d8dc6b5e8cb0ba79067491387c47 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 16:57:56 +0000 Subject: [PATCH 148/197] add error vars to each fn at swift code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 8c6e938385..c56dbe3568 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -48,10 +48,6 @@ public class IotaWalletMobile: CAPPlugin { } } - // TODO: we really need pass this params from swift? - private let error_buffer: UnsafeMutablePointer? = nil - private let error_buffer_size = 0 - @objc func messageHandlerNew(_ call: CAPPluginCall) { do { print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) @@ -113,6 +109,9 @@ public class IotaWalletMobile: CAPPlugin { """ print(options) + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + // TODO: implement logger as a fn let filename = "\(path)/iota_wallet.log" let level_filter = "debug" @@ -155,11 +154,13 @@ public class IotaWalletMobile: CAPPlugin { // where it will be converted back to object type ready to use let context = Unmanaged.passRetained(contextResult).toOpaque() + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + iota_send_message(messageHandler, message, contextResult.callback, context) } @objc func listen(_ call: CAPPluginCall) { - print("Capacitor call listen received", call.jsObjectRepresentation) guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } From 3836271f8968c3c1a97e82fd6f2fd5e906f54549 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 16:59:02 +0000 Subject: [PATCH 149/197] add cString to options at swift code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index c56dbe3568..28d268f12f 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -107,7 +107,6 @@ public class IotaWalletMobile: CAPPlugin { }} } """ - print(options) let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 @@ -118,7 +117,7 @@ public class IotaWalletMobile: CAPPlugin { iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) // Keep the C++ handler / pointer of the messageHandler call result - let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + let handler: OpaquePointer? = iota_initialize(options.cString(using: .utf8), error_buffer, error_buffer_size) // Convert pointer to integer keeping bit pattern call.resolve(["messageHandler": Int(bitPattern: handler)]) From 6ece894bddeb3bdc8278d3f6a4dad61a0f4bf2a8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 17:01:54 +0000 Subject: [PATCH 150/197] add cString to message string Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 28d268f12f..2bad0bb9f2 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -156,7 +156,7 @@ public class IotaWalletMobile: CAPPlugin { let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 - iota_send_message(messageHandler, message, contextResult.callback, context) + iota_send_message(messageHandler, message.cString(using: .utf8), contextResult.callback, context) } @objc func listen(_ call: CAPPluginCall) { From 51738d84b6e37e9922c581193d01bc835eb26c58 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 27 Feb 2023 17:36:46 +0000 Subject: [PATCH 151/197] fix Swift Cargo.lock Signed-off-by: Amadeo Marchioni --- wallet/bindings/swift/Cargo.lock | 129 ++++++++++++++++--------------- 1 file changed, 68 insertions(+), 61 deletions(-) diff --git a/wallet/bindings/swift/Cargo.lock b/wallet/bindings/swift/Cargo.lock index ba734aedbe..b2c8257675 100644 --- a/wallet/bindings/swift/Cargo.lock +++ b/wallet/bindings/swift/Cargo.lock @@ -339,9 +339,9 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.4.0" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" +checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" dependencies = [ "glob", "libc", @@ -366,7 +366,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" [[package]] -<<<<<<< HEAD:wallet/bindings/swift/Cargo.lock name = "constant_time_eq" version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" @@ -381,19 +380,6 @@ dependencies = [ "libc", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.14" -======= -name = "cpufeatures" -version = "0.2.5" ->>>>>>> 394359b0 (fix: Cargo.lock):bindings/swift/Cargo.lock -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - [[package]] name = "crossbeam-utils" version = "0.8.14" @@ -783,9 +769,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.27.1" +version = "0.27.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" +checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" [[package]] name = "glob" @@ -915,9 +901,9 @@ dependencies = [ [[package]] name = "http" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" +checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" dependencies = [ "bytes", "fnv", @@ -1054,8 +1040,7 @@ dependencies = [ [[package]] name = "iota-client" version = "2.0.1-rc.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8206762d9c7062a3de9ec8a1653537c51b2d07e58a6589e74b6e70615c2581a" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "async-trait", "backtrace", @@ -1113,20 +1098,17 @@ dependencies = [ [[package]] name = "iota-pow" version = "1.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b3ffe5d6ada4c62fa5e5d0a7622893af02ad431d6a6144979686662eee5f1c" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "instant", "iota-crypto", "num_cpus", - "thiserror", ] [[package]] name = "iota-types" -version = "1.0.0-rc.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac00be923ed4f7ae33c03628d24d03c920f0d6c27806daae57ce735ac240f96" +version = "1.0.0-rc.6" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "bech32", "bitflags", @@ -1145,7 +1127,6 @@ dependencies = [ "serde-big-array", "serde_json", "serde_repr", - "thiserror", ] [[package]] @@ -1171,6 +1152,7 @@ dependencies = [ "getset", "gloo-storage", "gloo-timers", + "instant", "iota-client", "iota-crypto", "log", @@ -1182,6 +1164,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", + "wasm-bindgen-futures", "zeroize", ] @@ -1363,14 +1346,14 @@ dependencies = [ [[package]] name = "mio" -version = "0.8.5" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" +checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" dependencies = [ "libc", "log", "wasi", - "windows-sys", + "windows-sys 0.45.0", ] [[package]] @@ -1395,15 +1378,6 @@ dependencies = [ "minimal-lexical", ] -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - [[package]] name = "num-traits" version = "0.2.15" @@ -1443,9 +1417,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.17.0" +version = "1.17.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" +checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" [[package]] name = "opaque-debug" @@ -1603,9 +1577,9 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" dependencies = [ "once_cell", "toml_edit", @@ -1965,9 +1939,9 @@ checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" [[package]] name = "slab" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" +checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" dependencies = [ "autocfg", ] @@ -2066,9 +2040,9 @@ checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" [[package]] name = "syn" -version = "1.0.107" +version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ "proc-macro2", "quote", @@ -2115,9 +2089,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.17" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" +checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" dependencies = [ "itoa", "libc", @@ -2144,9 +2118,9 @@ dependencies = [ [[package]] name = "time-macros" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" +checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" dependencies = [ "time-core", ] @@ -2181,7 +2155,7 @@ dependencies = [ "pin-project-lite", "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.42.0", ] [[package]] @@ -2208,9 +2182,9 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.6" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6a3b08b64e6dfad376fa2432c7b1f01522e37a623c3050bc95db2d3ff21583" +checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" dependencies = [ "bytes", "futures-core", @@ -2222,19 +2196,19 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.5.1" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" +checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" [[package]] name = "toml_edit" -version = "0.18.1" +version = "0.19.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" +checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" dependencies = [ "indexmap", - "nom8", "toml_datetime", + "winnow", ] [[package]] @@ -2535,6 +2509,30 @@ dependencies = [ "windows_x86_64_msvc 0.42.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.42.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc 0.42.1", + "windows_i686_gnu 0.42.1", + "windows_i686_msvc 0.42.1", + "windows_x86_64_gnu 0.42.1", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc 0.42.1", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.42.1" @@ -2607,6 +2605,15 @@ version = "0.42.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" +[[package]] +name = "winnow" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" +dependencies = [ + "memchr", +] + [[package]] name = "winreg" version = "0.10.1" From cc86039edd8a58db8b90b7b3dad25f2194af90e2 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 28 Feb 2023 16:56:05 +0000 Subject: [PATCH 152/197] update `add_libs.sh` script using latest changes Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 34 +++++++++++++++++-------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index b72bf1474f..9cd2449734 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -1,18 +1,30 @@ #!/bin/bash -# 🛑 temporarily hidden in favor of using the latest version of wallet.rs +# 🛑 temporarily using host https://files.iota.org/firefly/bindings until CI will be done. -# set -e -# rm -rf tmp && mkdir tmp && cd tmp +set -e +rm -rf tmp && mkdir tmp && cd tmp -# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip -# unzip iota-wallet.zip +echo Installing Java libraries +# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet-java.zip +mkdir jniLibs && cd jniLibs +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/jniLibs-2.0.0-rc.1.zip > iota-wallet-java.zip +unzip iota-wallet-java.zip -# rm -rf ../android/src/main/jniLibs -# cp -r jniLibs ../android/src/main/jniLibs +rm -rf ../android/src/main/jniLibs +cd .. && cp -rv jniLibs ../android/src/main -# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar -# rm -rf ../android/libs && mkdir -p ../android/libs -# cp -r iota-wallet.jar ../android/libs +curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar +rm -rf ../android/libs && mkdir -p ../android/libs +cp -rv iota-wallet.jar ../android/libs -# cd .. && rm -rf tmp +echo Installing Swift libraries +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/WalletFramework-2.0.0-rc.1.zip > iota-wallet-swift.zip +unzip iota-wallet-swift.zip + +rm -f ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework +rm -f ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework +cp -v x86_64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework +cp -v aarch64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework + +cd .. && rm -rf tmp From 5d1939575223b8004d642a02018d3e65f2ec4dbf Mon Sep 17 00:00:00 2001 From: Tuditi Date: Thu, 2 Mar 2023 09:54:51 +0100 Subject: [PATCH 153/197] chore: update comment --- wallet/bindings/capacitorjs/src/lib/createAccount.ts | 3 ++- wallet/bindings/capacitorjs/src/lib/createAccountManager.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/createAccount.ts b/wallet/bindings/capacitorjs/src/lib/createAccount.ts index c82ea5f206..3fa975625a 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccount.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccount.ts @@ -50,7 +50,8 @@ import type { } from '@iota/types' type MessageHandler = Awaited> -/** The Account factory function. */ +/** createAccount is a factory function, because the methods become part of the object instead of the prototype chain. +This is beneficial, since the prototype chain is bound to a context and can be sanitized.**/ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageHandler) { return { diff --git a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts index f3ad7fd439..e1d79df988 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts @@ -20,7 +20,8 @@ import type { type Account = ReturnType -/** The AccountManager class. */ +/** createAccountManager is a factory function, because the methods become part of the object instead of the prototype chain. +This is beneficial, since the prototype chain is bound to a context and can be sanitized.**/ export async function createAccountManager(options: AccountManagerOptions) { let id: AccountId From 166a5790f5d4d150de9657c040651743a07b6f2c Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Thu, 2 Mar 2023 23:58:39 +0100 Subject: [PATCH 154/197] fixed listen --- Cargo.toml | 2 +- .../IotaWalletMobile/IotaWalletMobile.java | 42 ++++---- bindings/java/lib/native/src/lib.rs | 96 ++++++++++++------- 3 files changed, 88 insertions(+), 52 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 565c05aca4..eed6b86c43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ log = { version = "0.4.17", default-features = false } packable = { version = "0.7.0", default-features = false, features = [ "serde", "primitive-types" ] } prefix-hex = { version = "0.5.0", default-features = false, features = [ "std" ] } primitive-types = { version = "0.12.1", default-features = false } -rocksdb = { version = "0.19.0", default-features = false, features = [ "lz4" ], optional = true } +rocksdb = { version = "0.20.1", default-features = false, features = [ "lz4" ], optional = true } serde = { version = "1.0.152", default-features = false, features = [ "derive" ] } serde_json = { version = "1.0.91", default-features = false } thiserror = { version = "1.0.38", default-features = false } diff --git a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index ffc57b2b0f..653785a69a 100644 --- a/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -146,24 +146,30 @@ public void sendMessage(final PluginCall call) { @PluginMethod(returnType = PluginMethod.RETURN_CALLBACK) public void listen(final PluginCall call) throws WalletException, JSONException { - // if (!call.getData().has("eventTypes")) { - // call.reject("eventTypes and event are required"); - // } - // JSArray eventTypes = call.getArray("eventTypes"); - // try { - // wallet.listen(new EventListener() { - // @Override - // public void receive(Event event) { - // JSObject walletResponse = new JSObject(); - // walletResponse.put("result", event.getEvent().toString()); - // call.resolve(walletResponse); - // } - // }, WalletEventType.valueOf(eventTypes.getString(0))); - // } catch (WalletException e) { - // e.printStackTrace(); - // } - // call.setKeepAlive(true); - call.resolve(); + if (!call.getData().has("eventTypes")) { + call.reject("eventTypes are required"); + } + + JSArray eventTypes = call.getArray("eventTypes"); + WalletEventType[] types = new WalletEventType[eventTypes.length()]; + for (int i = 0; i < eventTypes.length(); i++) { + types[i] = WalletEventType.valueOf(eventTypes.getString(i)); + } + + try { + wallet.listen(new EventListener() { + @Override + public void receive(Event event) { + Log.d("listen", "Received event " + event.toString()); + JSObject walletResponse = new JSObject(); + walletResponse.put("result", event.getEvent().toString()); + call.resolve(walletResponse); + } + }, types); + } catch (WalletException ex) { + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); + } + call.setKeepAlive(true); } diff --git a/bindings/java/lib/native/src/lib.rs b/bindings/java/lib/native/src/lib.rs index 178bdb822f..da69a74e02 100644 --- a/bindings/java/lib/native/src/lib.rs +++ b/bindings/java/lib/native/src/lib.rs @@ -1,18 +1,30 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 +#[cfg(target_os = "android")] +#[macro_use] +extern crate log; +#[cfg(target_os = "android")] +extern crate android_logger; + use std::{convert::TryFrom, sync::Mutex}; +#[cfg(target_os = "android")] +use android_logger::Config; use iota_wallet::{ events::types::{Event, WalletEventType}, - message_interface::{create_message_handler, init_logger, send_message, ManagerOptions, Message, WalletMessageHandler}, + message_interface::{ + create_message_handler, init_logger, send_message, ManagerOptions, Message, WalletMessageHandler, + }, }; use jni::{ objects::{GlobalRef, JClass, JObject, JStaticMethodID, JString, JValue}, - signature::ReturnType, + signature::{Primitive, ReturnType}, sys::{jclass, jobject, jobjectArray, jstring}, JNIEnv, JavaVM, }; +#[cfg(target_os = "android")] +use log::LevelFilter; use once_cell::sync::OnceCell; use tokio::runtime::Runtime; @@ -21,6 +33,7 @@ lazy_static::lazy_static! { // Cache VM ref for callback static ref VM: Mutex> = Mutex::new(None); + // Cache Method for unchecked method call static ref METHOD_CACHE: Mutex> = Mutex::new(None); } @@ -28,12 +41,13 @@ lazy_static::lazy_static! { // A macro that checks if the result is an error and throws an exception if it is. macro_rules! jni_err_assert { ($env:ident, $result:expr, $ret:expr ) => {{ - if let Err(err) = $result { - throw_exception(&$env, err.to_string()); - return $ret; + match $result { + Err(err) => { + throw_exception(&$env, err.to_string()); + return $ret; + } + Ok(res) => res, } - // Can unwrap as we just checked and returned if its an error - $result.unwrap() }}; } @@ -46,7 +60,6 @@ macro_rules! string_from_jni { }}; } - /// A macro that takes in a JNIEnv, a JString, a type, and a return value. It then gets the string from /// the JNIEnv, and checks if it is an error. If it is an error, it throws an exception and returns /// the value of r. Otherwise returns the unwrapped result. @@ -72,8 +85,9 @@ macro_rules! env_assert { #[no_mangle] pub extern "system" fn Java_org_iota_api_NativeApi_initLogger(env: JNIEnv, _class: JClass, command: JString) { // This is a safety check to make sure that the JNIEnv is not in an exception state. - env_assert!(env,()); - jni_err_assert!(env, init_logger(string_from_jni!(env, command, ())), ()); + env_assert!(env, ()); + let ret = init_logger(string_from_jni!(env, command, ())); + jni_err_assert!(env, ret, ()); } // This keeps rust from "mangling" the name and making it unique for this crate. @@ -89,12 +103,22 @@ pub extern "system" fn Java_org_iota_api_NativeApi_createMessageHandler( ) { env_assert!(env, ()); + #[cfg(target_os = "android")] + android_logger::init_once( + Config::default() + .with_tag("lib_wallet") + .with_max_level(LevelFilter::Trace), + ); + if let Ok(mut message_handler_store) = MESSAGE_HANDLER.lock() { message_handler_store.replace(jni_err_assert!( env, - crate::block_on(create_message_handler(Some( - jni_from_json_make!(env, config, ManagerOptions, ()), - ))), + crate::block_on(create_message_handler(Some(jni_from_json_make!( + env, + config, + ManagerOptions, + () + ),))), () )); }; @@ -190,11 +214,14 @@ pub unsafe extern "system" fn Java_org_iota_api_NativeApi_listen( std::ptr::null_mut() ); + // Allocate callback class to not lose the class in native threads + let global_obj_class = jni_err_assert!(env, env.new_global_ref(JObject::from_raw(_class)), std::ptr::null_mut()); + match MESSAGE_HANDLER.lock() { Ok(message_handler_store) => match message_handler_store.as_ref() { - Some(message_handler) => { - crate::block_on(message_handler.listen(events_list, move |e| event_handle(global_obj.clone(), e))) - } + Some(message_handler) => crate::block_on(message_handler.listen(events_list, move |e| { + event_handle(global_obj_class.clone(), global_obj.clone(), e.clone()); + })), _ => throw_nullpointer(&env, "Wallet not initialised."), }, Err(err) => throw_exception(&env, err.to_string()), @@ -204,7 +231,7 @@ pub unsafe extern "system" fn Java_org_iota_api_NativeApi_listen( make_jni_string(&env, "{\"type\": \"success\", \"payload\": \"success\"}".to_string()) } -fn event_handle(callback_ref: GlobalRef, e: &Event) { +unsafe fn event_handle(clazz: GlobalRef, callback_ref: GlobalRef, event: Event) { // Grab env from VM. // If we cant get a lock, we cant handle the event let vm_guard = match VM.lock() { @@ -212,22 +239,19 @@ fn event_handle(callback_ref: GlobalRef, e: &Event) { Err(_) => return, }; + let vm = vm_guard + .as_ref() + .expect("Wallet not initialised, but an event was called"); + // Generate link back to the java env - let env = { - let vm = vm_guard - .as_ref() - .expect("Wallet not initialised, but an event was called"); - - let mut env = vm.get_env(); - if env.is_err() { - env = vm.attach_current_thread().map(|e| *e); - } - env.expect("Failed to get Java env for event callback") - }; + let env = vm + .attach_current_thread() + .expect("Failed to get Java env for event callback"); // Make sure env is ok env_assert!(env, ()); - let ev_ser = jni_err_assert!(env, serde_json::to_string(&e), ()); + + let ev_ser = jni_err_assert!(env, serde_json::to_string(&event), ()); // Make the Jni object to send back let event = jni::sys::jvalue { @@ -236,14 +260,20 @@ fn event_handle(callback_ref: GlobalRef, e: &Event) { // Get a ref back to the callback we call on the java side let cb = JValue::Object(callback_ref.as_obj()).to_jni(); + let clazz = JClass::from_raw(*clazz.as_obj()); // Call NativeApi, METHOD_CACHE assumed initialised if we received a VM - jni_err_assert!(env, env.call_static_method_unchecked( - "org/iota/api/NativeApi", + let res = env.call_static_method_unchecked( + clazz, METHOD_CACHE.lock().unwrap().unwrap(), - ReturnType::Object, + ReturnType::Primitive(Primitive::Void), &[event, cb], - ), ()); + ); + + if let Err(e) = res { + error!("Error calling method {}", e); + jni_err_assert!(env, env.exception_clear(), ()); + }; } pub(crate) fn block_on(cb: C) -> C::Output { From b615d25406c5562f4e089940087426b48519e277 Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 3 Mar 2023 00:00:58 +0100 Subject: [PATCH 155/197] android depdency --- bindings/java/lib/native/Cargo.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/bindings/java/lib/native/Cargo.toml b/bindings/java/lib/native/Cargo.toml index dd9d5d4a12..19250a25d6 100644 --- a/bindings/java/lib/native/Cargo.toml +++ b/bindings/java/lib/native/Cargo.toml @@ -24,5 +24,9 @@ serde_json = { version = "1.0.91", default-features = false } tokio = { version = "1.24.2", default-features = false, features = [ "macros" ] } lazy_static = { version = "1.4.0", default-features = false } +[target.'cfg(target_os = "android")'.dependencies] +log = { version = "0.4.0", default-features = false } +android_logger = { version = "0.13", default-features = false } + [features] ledger_nano = [ "iota-wallet/ledger_nano" ] \ No newline at end of file From 0004da7af11460ce553276ac3559242a41c6562e Mon Sep 17 00:00:00 2001 From: Brord van Wierst Date: Fri, 3 Mar 2023 01:28:45 +0100 Subject: [PATCH 156/197] error logging fix --- wallet/bindings/java/lib/native/src/lib.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wallet/bindings/java/lib/native/src/lib.rs b/wallet/bindings/java/lib/native/src/lib.rs index 6807ba9441..036b3c5e77 100644 --- a/wallet/bindings/java/lib/native/src/lib.rs +++ b/wallet/bindings/java/lib/native/src/lib.rs @@ -267,7 +267,10 @@ unsafe fn event_handle(clazz: GlobalRef, callback_ref: GlobalRef, event: Event) ); if let Err(e) = res { + #[cfg(target_os = "android")] error!("Error calling method {}", e); + #[cfg(not(target_os = "android"))] + println!("Error calling method {}", e); jni_err_assert!(env, env.exception_clear(), ()); }; } From 07dccde853d500fce6094155dd31ee7860017495 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Sat, 4 Mar 2023 16:17:48 +0000 Subject: [PATCH 157/197] fix merge conflicts Signed-off-by: Amadeo Marchioni --- .../bindings/capacitorjs/src/lib/Account.ts | 1059 ----------------- .../capacitorjs/src/lib/AccountManager.ts | 432 ------- .../capacitorjs/src/lib/MessageHandler.ts | 16 +- .../bindings/capacitorjs/src/lib/WalletApi.ts | 40 +- .../capacitorjs/src/lib/createAccount.ts | 3 +- .../src/lib/createAccountManager.ts | 3 +- wallet/bindings/capacitorjs/src/lib/index.ts | 4 +- .../bindings/capacitorjs/src/types/account.ts | 21 - .../bindings/capacitorjs/src/types/address.ts | 1 - .../capacitorjs/src/types/bridge/account.ts | 31 - .../src/types/bridge/accountManager.ts | 66 +- .../capacitorjs/src/types/bridge/index.ts | 56 - .../bindings/capacitorjs/src/types/index.ts | 1 - .../bindings/capacitorjs/src/types/network.ts | 5 - .../capacitorjs/src/types/participation.ts | 42 - .../src/types/signedTransactionEssence.ts | 4 - .../capacitorjs/src/types/transaction.ts | 8 - 17 files changed, 37 insertions(+), 1755 deletions(-) delete mode 100644 wallet/bindings/capacitorjs/src/lib/Account.ts delete mode 100644 wallet/bindings/capacitorjs/src/lib/AccountManager.ts diff --git a/wallet/bindings/capacitorjs/src/lib/Account.ts b/wallet/bindings/capacitorjs/src/lib/Account.ts deleted file mode 100644 index 032ce65e0b..0000000000 --- a/wallet/bindings/capacitorjs/src/lib/Account.ts +++ /dev/null @@ -1,1059 +0,0 @@ -// Copyright 2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -import type { MessageHandler } from './MessageHandler'; -import type { - AccountBalance, - AccountMetadata, - AccountSyncOptions, - AccountMeta, - Address, - AddressWithAmount, - AddressWithMicroAmount, - AddressNativeTokens, - AddressNftId, - AddressGenerationOptions, - AddressWithUnspentOutputs, - AliasOutputOptions, - FilterOptions, - IncreaseNativeTokenSupplyOptions, - MintTokenTransaction, - NativeTokenOptions, - NftOptions, - OutputData, - OutputOptions, - OutputsToClaim, - PreparedTransactionData, - Transaction, - TransactionOptions, - IncomingTransactionData, - ParticipationOverview, -} from '../types'; -import type { SignedTransactionEssence } from '../types/signedTransactionEssence'; -import type { - BuildAliasOutputData, - BuildBasicOutputData, - BuildFoundryOutputData, - BuildNftOutputData, -} from '../types/buildOutputData'; -import type { - HexEncodedAmount, - IAliasOutput, - IBasicOutput, - IFoundryOutput, - INftOutput, - OutputTypes, -} from '@iota/types'; -type MessageHandlerType = Awaited> - -/** The Account class. */ -export class Account { - // private because the data isn't updated - private meta: AccountMeta; - private messageHandler: MessageHandlerType; - - constructor(accountMeta: AccountMeta, messageHandler: MessageHandlerType) { - this.meta = accountMeta; - this.messageHandler = messageHandler; - } - - /** - * Build an `AliasOutput`. - * @param data Options for building an `AliasOutput`. - * @returns The built `AliasOutput`. - */ - async buildAliasOutput(data: BuildAliasOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildAliasOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build a `BasicOutput`. - * @param data Options for building a `BasicOutput`. - * @returns The built `BasicOutput`. - */ - async buildBasicOutput(data: BuildBasicOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildBasicOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build a `FoundryOutput`. - * @param data Options for building a `FoundryOutput`. - * @returns The built `FoundryOutput`. - */ - async buildFoundryOutput( - data: BuildFoundryOutputData, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildFoundryOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Build an `NftOutput`. - * @param data Options for building an `NftOutput`. - * @returns The built `NftOutput`. - */ - async buildNftOutput(data: BuildNftOutputData): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'buildNftOutput', - data, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Burn native tokens. This doesn't require the foundry output which minted them, but will not increase - * the foundries `melted_tokens` field, which makes it impossible to destroy the foundry output. Therefore it's - * recommended to use melting, if the foundry output is available. - * @param tokenId The native token id. - * @param burnAmount The to be burned amount. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async burnNativeToken( - tokenId: string, - burnAmount: HexEncodedAmount, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'burnNativeToken', - data: { - tokenId, - burnAmount, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Burn an nft output. Outputs controlled by it will be sweeped before if they don't have a storage - * deposit return, timelock or expiration unlock condition. This should be preferred over burning, because after - * burning, the foundry can never be destroyed anymore. - * @param nftId The NftId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async burnNft( - nftId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'burnNft', - data: { - nftId, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Claim basic or nft outputs that have additional unlock conditions - * to their `AddressUnlockCondition` from the account. - * @param outputIds The outputs to claim. - * @returns The resulting transaction. - */ - async claimOutputs(outputIds: string[]): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'claimOutputs', - data: { - outputIdsToClaim: outputIds, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Consolidate basic outputs with only an `AddressUnlockCondition` from an account - * by sending them to an own address again if the output amount is greater or - * equal to the output consolidation threshold. - * @param force Force consolidation on addresses where the threshold isn't met. - * @param outputConsolidationThreshold A default threshold is used if this is omitted. - * @returns The consolidation transaction. - */ - async consolidateOutputs( - force: boolean, - outputConsolidationThreshold?: number, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'consolidateOutputs', - data: { - force, - outputConsolidationThreshold, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * `createAliasOutput` creates an alias output - * @param aliasOutputOptions The alias output options. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns A transaction object. - */ - async createAliasOutput( - aliasOutputOptions?: AliasOutputOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'createAliasOutput', - data: { - aliasOutputOptions, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Melt native tokens. This happens with the foundry output which minted them, by increasing its - * `melted_tokens` field. - * @param tokenId The native token id. - * @param meltAmount To be melted amount. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async decreaseNativeTokenSupply( - tokenId: string, - meltAmount: HexEncodedAmount, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'decreaseNativeTokenSupply', - data: { - tokenId, - meltAmount, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Destroy an alias output. Outputs controlled by it will be sweeped before if they don't have a - * storage deposit return, timelock or expiration unlock condition. The amount and possible native tokens will be - * sent to the governor address. - * @param aliasId The AliasId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async destroyAlias( - aliasId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'destroyAlias', - data: { - aliasId, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Function to destroy a foundry output with a circulating supply of 0. - * Native tokens in the foundry (minted by other foundries) will be transactioned to the controlling alias. - * @param foundryId The FoundryId. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The transaction. - */ - async destroyFoundry( - foundryId: string, - transactionOptions?: TransactionOptions, - ): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'destroyFoundry', - data: { - foundryId, - options: transactionOptions, - }, - }, - ); - return JSON.parse(resp).payload; - } - - /** - * Generate a new unused address. - * @param options Options for address generation. - * @returns The address. - */ - async generateAddress( - options?: AddressGenerationOptions, - ): Promise
{ - const addresses = await this.generateAddresses(1, options); - return addresses[0]; - } - - /** - * Generate new unused addresses. - * @param amount The amount of addresses to generate. - * @param options Options for address generation. - * @returns The addresses. - */ - async generateAddresses( - amount: number, - options?: AddressGenerationOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'generateAddresses', - data: { - amount, - options, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get the account balance. - * @returns The account balance. - */ - async getBalance(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getBalance', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Get the data for an output. - * @param outputId The output to get. - * @returns The `OutputData`. - */ - async getOutput(outputId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getOutput', - data: { - outputId, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get a `FoundryOutput` by native token ID. It will try to get the foundry from - * the account, if it isn't in the account it will try to get it from the node. - * @param tokenId The native token ID to get the foundry for. - * @returns The `FoundryOutput` that minted the token. - */ - async getFoundryOutput(tokenId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getFoundryOutput', - data: { - tokenId, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get outputs with additional unlock conditions. - * @param outputs The type of outputs to claim. - * @returns The output IDs of the unlockable outputs. - */ - async getOutputsWithAdditionalUnlockConditions( - outputs: OutputsToClaim, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getOutputsWithAdditionalUnlockConditions', - data: { - outputsToClaim: outputs, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get a transaction stored in the account. - * @param transactionId The ID of the transaction to get. - * @returns The transaction. - */ - async getTransaction(transactionId: string): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getTransaction', - data: { - transactionId, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Get the transaction with inputs of an incoming transaction stored in the account - * List might not be complete, if the node pruned the data already - * @param transactionId The ID of the transaction to get. - * @returns The transaction. - */ - async getIncomingTransactionData( - transactionId: string, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getIncomingTransactionData', - data: { - transactionId, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * List all the addresses of the account. - * @returns The addresses. - */ - async addresses(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'addresses', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List the addresses of the account with unspent outputs. - * @returns The addresses. - */ - async addressesWithUnspentOutputs(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'addressesWithUnspentOutputs', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all outputs of the account. - * @param filterOptions Options to filter the to be returned outputs. - * @returns The outputs with metadata. - */ - async outputs(filterOptions?: FilterOptions): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'outputs', - data: { filterOptions }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the pending transactions of the account. - * @returns The transactions. - */ - async pendingTransactions(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'pendingTransactions', - }, - ); - return JSON.parse(response).payload; - } - - /** - * List all incoming transactions of the account. - * @returns The incoming transactions with their inputs. - */ - async incomingTransactions(): Promise<[string, IncomingTransactionData][]> { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'incomingTransactions', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the transactions of the account. - * @returns The transactions. - */ - async transactions(): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'transactions', - }, - ); - - return JSON.parse(response).payload; - } - - /** - * List all the unspent outputs of the account. - * @param filterOptions Options to filter the to be returned outputs. - * @returns The outputs with metadata. - */ - async unspentOutputs(filterOptions?: FilterOptions): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'unspentOutputs', - data: { filterOptions }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Get the accounts metadata. - * @returns The accounts metadata. - */ - getMetadata(): AccountMetadata { - return { - alias: this.meta.alias, - coinType: this.meta.coinType, - index: this.meta.index, - }; - } - - /** - * Calculate the minimum required storage deposit for an output. - * @param output output to calculate the deposit amount for. - * @returns The amount. - */ - async minimumRequiredStorageDeposit(output: OutputTypes): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'minimumRequiredStorageDeposit', - data: { - output, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Mint more native tokens. - * @param tokenId The native token id. - * @param mintAmount To be minted amount. - * @param increaseNativeTokenSupplyOptions Options for minting more tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction and the token ID. - */ - async increaseNativeTokenSupply( - tokenId: string, - mintAmount: HexEncodedAmount, - increaseNativeTokenSupplyOptions?: IncreaseNativeTokenSupplyOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'increaseNativeTokenSupply', - data: { - tokenId, - mintAmount, - increaseNativeTokenSupplyOptions, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Mint native tokens. - * @param nativeTokenOptions The options for minting tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction and the token ID. - */ - async mintNativeToken( - nativeTokenOptions: NativeTokenOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'mintNativeToken', - data: { - nativeTokenOptions: nativeTokenOptions, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Mint nfts. - * @param nftsOptions The options for minting nfts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The minting transaction. - */ - async mintNfts( - nftsOptions: NftOptions[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'mintNfts', - data: { - nftsOptions, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Prepare an output for sending, useful for offline signing. - * @param options The options for preparing an output. If the amount is - * below the minimum required storage deposit, by default the remaining - * amount will automatically be added with a `StorageDepositReturn` `UnlockCondition`, - * when setting the `ReturnStrategy` to `gift`, the full minimum required - * storage deposit will be sent to the recipient. When the assets contain - * an nft id, the data from the existing `NftOutput` will be used, just with - * the address unlock conditions replaced. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared output. - */ - async prepareOutput( - options: OutputOptions, - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareOutput', - data: { - options, - transactionOptions, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Prepare a send amount transaction, useful for offline signing. - * @param addressesWithAmount Address with amounts to send. - * @param options The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared transaction data. - */ - async prepareSendAmount( - addressesWithAmount: AddressWithAmount[], - options?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareSendAmount', - data: { - addressesWithAmount, - options, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Prepare a transaction, useful for offline signing. - * @param outputs Outputs to use in the transaction. - * @param options The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The prepared transaction data. - */ - async prepareTransaction( - outputs: OutputTypes[], - options?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'prepareTransaction', - data: { - outputs, - options, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Retries (promotes or reattaches) a transaction sent from the account for a provided transaction id until it's - * included (referenced by a milestone). Returns the included block id. - */ - async retryTransactionUntilIncluded( - transactionId: string, - interval?: number, - maxAttempts?: number, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'retryTransactionUntilIncluded', - data: { - transactionId, - interval, - maxAttempts, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Send a transaction with amounts from input addresses. - * @param addressesWithAmount Addresses with amounts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendAmount( - addressesWithAmount: AddressWithAmount[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendAmount', - data: { - addressesWithAmount, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send a micro transaction with amount below minimum storage deposit. - * @param addressesWithMicroAmount Addresses with micro amounts. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendMicroTransaction( - addressesWithMicroAmount: AddressWithMicroAmount[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendMicroTransaction', - data: { - addressesWithMicroAmount, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send native tokens. - * @param addressesNativeTokens Addresses amounts and native tokens. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendNativeTokens( - addressesNativeTokens: AddressNativeTokens[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendNativeTokens', - data: { - addressesNativeTokens, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send nft. - * @param addressesAndNftIds Addresses and nft ids. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendNft( - addressesAndNftIds: AddressNftId[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendNft', - data: { - addressesAndNftIds, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - /** - * Send outputs in a transaction. - * @param outputs The outputs to send. - * @param transactionOptions The options to define a `RemainderValueStrategy` - * or custom inputs. - * @returns The sent transaction. - */ - async sendOutputs( - outputs: OutputTypes[], - transactionOptions?: TransactionOptions, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'sendOutputs', - data: { - outputs, - options: transactionOptions, - }, - }, - ); - - return JSON.parse(response).payload; - } - - async setAlias(alias: string): Promise { - await this.messageHandler.callAccountMethod(this.meta.index, { - name: 'setAlias', - data: { - alias, - }, - }); - } - - /** - * Sign a prepared transaction, useful for offline signing. - * @param preparedTransactionData The prepared transaction data to sign. - * @returns The signed transaction essence. - */ - async signTransactionEssence( - preparedTransactionData: PreparedTransactionData, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'signTransactionEssence', - data: { - preparedTransactionData, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Validate the transaction, submit it to a node and store it in the account. - * @param signedTransactionData A signed transaction to submit and store. - * @returns The sent transaction. - */ - async submitAndStoreTransaction( - signedTransactionData: SignedTransactionEssence, - ): Promise { - const response = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'submitAndStoreTransaction', - data: { - signedTransactionData, - }, - }, - ); - return JSON.parse(response).payload; - } - - /** - * Sync the account by fetching new information from the nodes. - * Will also retry pending transactions if necessary. - * @param options Optional synchronization options. - * @returns The account balance. - */ - async sync(options?: AccountSyncOptions): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'syncAccount', - data: { - options, - }, - }, - ); - return JSON.parse(resp).payload; - } - - async vote(eventId: string, answers: number[]): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'vote', - data: { - eventId, - answers, - }, - }, - ); - return JSON.parse(resp).payload; - } - - async stopParticipating(eventId: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'stopParticipating', - data: { - eventId, - }, - }, - ); - return JSON.parse(resp).payload; - } - - async getVotingPower(): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getVotingPower', - }, - ); - return JSON.parse(resp).payload; - } - - async getParticipationOverview(): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'getParticipationOverview', - }, - ); - return JSON.parse(resp).payload; - } - - async increaseVotingPower(amount: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'increaseVotingPower', - data: { - amount, - }, - }, - ); - return JSON.parse(resp).payload; - } - - async decreaseVotingPower(amount: string): Promise { - const resp = await this.messageHandler.callAccountMethod( - this.meta.index, - { - name: 'decreaseVotingPower', - data: { - amount, - }, - }, - ); - return JSON.parse(resp).payload; - } -} diff --git a/wallet/bindings/capacitorjs/src/lib/AccountManager.ts b/wallet/bindings/capacitorjs/src/lib/AccountManager.ts deleted file mode 100644 index b92b749727..0000000000 --- a/wallet/bindings/capacitorjs/src/lib/AccountManager.ts +++ /dev/null @@ -1,432 +0,0 @@ -// Copyright 2021 IOTA Stiftung -// SPDX-License-Identifier: Apache-2.0 - -import { MessageHandler } from './MessageHandler'; -import { Account } from './Account'; - -import type { - AccountId, - Auth, - EventType, - AccountManagerOptions, - CreateAccountPayload, - NodeInfoWrapper, - ClientOptions, - AccountSyncOptions, - WalletEvent, - LedgerNanoStatus, - Event, - EventId, - Node, - EventStatus, - GenerateAddressOptions, -} from '../types'; - -/** The AccountManager class. */ -export async function AccountManager(options: AccountManagerOptions) { - - let id: AccountId - - let messageHandler = await MessageHandler(options); - - return { - id, - - /** - * Listen to wallet events with a callback. An empty array will listen to all possible events. - */ - async listen( - eventTypes: EventType[], - callback: (error: Error | undefined, result: string) => void, - ): Promise { - return messageHandler.listen(eventTypes, callback); - }, - - /** - * Clear the callbacks for provided events. An empty array will clear all listeners. - */ - clearListeners(eventTypes: EventType[]): Promise { - return messageHandler.clearListeners(eventTypes); - }, - - /** - * Backup the data to a Stronghold snapshot. - */ - async backup(destination: string, password: string): Promise { - await messageHandler.sendMessage({ - cmd: 'backup', - payload: { - destination, - password, - }, - }); - }, - - /** - * Transform a bech32 encoded address to a hex encoded address - */ - async bech32ToHex(bech32Address: string): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'bech32ToHex', - payload: bech32Address, - }); - return JSON.parse(response).payload; - }, - - /** - * Change the Stronghold password. - */ - async changeStrongholdPassword( - currentPassword: string, - newPassword: string, - ): Promise { - await messageHandler.sendMessage({ - cmd: 'changeStrongholdPassword', - payload: { - currentPassword, - newPassword, - }, - }); - }, - - /** - * Clear the Stronghold password from memory. - */ - async clearStrongholdPassword(): Promise { - await messageHandler.sendMessage({ - cmd: 'clearStrongholdPassword', - }); - }, - - /** - * Create a new account. - */ - async createAccount(payload: CreateAccountPayload): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'createAccount', - payload, - }); - return new Account(JSON.parse(response).payload, messageHandler); - }, - - /** - * Destroy the AccountManager and drop its database connection. - */ - destroy(): void { - messageHandler.destroy(); - }, - - async deregisterParticipationEvent(eventId: EventId): Promise { - await messageHandler.sendMessage({ - cmd: 'deregisterParticipationEvent', - payload: { - eventId, - }, - }); - }, - - /** - * Emit a provided event for testing of the event system. - */ - async emitTestEvent(event: WalletEvent): Promise { - await messageHandler.sendMessage({ - cmd: 'emitTestEvent', - payload: event, - }); - }, - - /** - * Generate a random BIP39 mnemonic. - */ - async generateMnemonic(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'generateMnemonic', - }); - return JSON.parse(response).payload; - }, - - /** - * Get an account by its alias or index. - */ - async getAccount(accountId: AccountId): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getAccount', - payload: accountId, - }); - - const account = new Account( - JSON.parse(response).payload, - messageHandler, - ); - - return account; - }, - - /** - * Get all account indexes. - */ - async getAccountIndexes(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getAccountIndexes', - }); - - return JSON.parse(response).payload; - }, - - /** - * Get all accounts. - */ - async getAccounts(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getAccounts', - }); - - const { payload } = JSON.parse(response); - - const accounts: Account[] = []; - - for (const account of payload) { - accounts.push(new Account(account, messageHandler)); - } - return accounts; - }, - - /** - * Generate an address without storing it. - */ - async generateAddress( - accountIndex: number, - internal: boolean, - addressIndex: number, - options?: GenerateAddressOptions, - bech32Hrp?: string, - ): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'generateAddress', - payload: { - accountIndex, - internal, - addressIndex, - options, - bech32Hrp, - }, - }); - return JSON.parse(response).payload; - }, - - /** - * Get the node info. - */ - async getNodeInfo(url?: string, auth?: Auth): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getNodeInfo', - payload: { url, auth }, - }); - return JSON.parse(response).payload; - }, - - /** - * Get the status for a Ledger Nano. - */ - async getLedgerNanoStatus(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getLedgerNanoStatus', - }); - return JSON.parse(response).payload; - }, - - async getParticipationEvent(eventId: EventId): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEvent', - payload: { - eventId, - }, - }); - return JSON.parse(response).payload; - }, - - async getParticipationEvents(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEvents', - }); - return JSON.parse(response).payload; - }, - - async getParticipationEventStatus(eventId: EventId): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'getParticipationEventStatus', - payload: { - eventId, - }, - }); - return JSON.parse(response).payload; - }, - - /** - * Transform hex encoded address to bech32 encoded address. If no bech32Hrp - * is provided, the AccountManager will attempt to retrieve it from the - * NodeInfo. If this does not succeed, it will default to the Shimmer testnet bech32Hrp. - */ - async hexToBech32(hex: string, bech32Hrp?: string): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'hexToBech32', - payload: { hex, bech32Hrp }, - }); - return JSON.parse(response).payload; - }, - - /** - * Check if the Stronghold password has been set. - */ - async isStrongholdPasswordAvailable(): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'isStrongholdPasswordAvailable', - }); - return JSON.parse(response).payload; - }, - - /** - * Find accounts with unspent outputs. - */ - async recoverAccounts( - accountStartIndex: number, - accountGapLimit: number, - addressGapLimit: number, - syncOptions: AccountSyncOptions, - ): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'recoverAccounts', - payload: { - accountStartIndex, - accountGapLimit, - addressGapLimit, - syncOptions, - }, - }); - - const accounts: Account[] = []; - - for (const account of JSON.parse(response).payload) { - accounts.push(new Account(account, messageHandler)); - } - return accounts; - }, - - /** - * Delete the latest account. - */ - async removeLatestAccount(): Promise { - await messageHandler.sendMessage({ - cmd: 'removeLatestAccount', - }); - }, - - async registerParticipationEvent( - eventId: EventId, - nodes: Node[], - ): Promise { - const response = await messageHandler.sendMessage({ - cmd: 'registerParticipationEvent', - payload: { - eventId, - nodes, - }, - }); - - return JSON.parse(response).payload; - }, - - /** - * Restore a backup from a Stronghold file - * Replaces client_options, coin_type, secret_manager and accounts. Returns an error if accounts were already created - * If Stronghold is used as secret_manager, the existing Stronghold file will be overwritten. If a mnemonic was - * stored, it will be gone. - */ - async restoreBackup(source: string, password: string): Promise { - await messageHandler.sendMessage({ - cmd: 'restoreBackup', - payload: { - source, - password, - }, - }); - }, - - /** - * Set ClientOptions. - */ - async setClientOptions(options: ClientOptions): Promise { - await messageHandler.sendMessage({ - cmd: 'setClientOptions', - payload: options, - }); - }, - - /** - * Set the Stronghold password. - */ - async setStrongholdPassword(password: string): Promise { - await messageHandler.sendMessage({ - cmd: 'setStrongholdPassword', - payload: password, - }); - }, - - /** - * Set the interval after which the Stronghold password gets cleared from memory. - */ - async setStrongholdPasswordClearInterval( - intervalInMilliseconds?: number, - ): Promise { - await messageHandler.sendMessage({ - cmd: 'setStrongholdPasswordClearInterval', - payload: intervalInMilliseconds, - }); - }, - - /** - * Start the background syncing process for all accounts. - */ - async startBackgroundSync( - options?: AccountSyncOptions, - intervalInMilliseconds?: number, - ): Promise { - await messageHandler.sendMessage({ - cmd: 'startBackgroundSync', - payload: { - options, - intervalInMilliseconds, - }, - }); - }, - - /** - * Stop the background syncing process for all accounts. - */ - async stopBackgroundSync(): Promise { - await messageHandler.sendMessage({ - cmd: 'stopBackgroundSync', - }); - }, - - /** - * Store a mnemonic in the Stronghold snapshot. - */ - async storeMnemonic(mnemonic: string): Promise { - await messageHandler.sendMessage({ - cmd: 'storeMnemonic', - payload: mnemonic, - }); - }, - - /** - * Verify if a mnemonic is a valid BIP39 mnemonic. - */ - async verifyMnemonic(mnemonic: string): Promise { - await messageHandler.sendMessage({ - cmd: 'verifyMnemonic', - payload: mnemonic, - }); - } - } -} diff --git a/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts b/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts index eff984e225..b7acc9127c 100644 --- a/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts +++ b/wallet/bindings/capacitorjs/src/lib/MessageHandler.ts @@ -5,7 +5,6 @@ import { sendMessageAsync, messageHandlerNew, listen as _listen, - clearListeners as _clearListeners, destroy as _destroy, } from './bindings'; import type { @@ -60,7 +59,7 @@ export async function MessageHandler(options?: AccountManagerOptions) { const Error = error ? { name: error.toString(), message: error.cause?.toString() || '' - } : undefined + }: undefined callback( Error, result @@ -68,18 +67,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { }); } - async function clearListeners( - eventTypes: EventType[] - ): Promise { - await _clearListeners({ eventTypes, messageHandler }, ({ error, result }) => { - const Error = error ? { - name: error.toString(), - message: error?.cause?.toString() - } : undefined - return Error || result - }); - } - function destroy(): void { _destroy({ messageHandler }); } @@ -89,7 +76,6 @@ export async function MessageHandler(options?: AccountManagerOptions) { sendMessage, callAccountMethod, listen, - clearListeners, destroy } } diff --git a/wallet/bindings/capacitorjs/src/lib/WalletApi.ts b/wallet/bindings/capacitorjs/src/lib/WalletApi.ts index 7edfcc33ef..06abe65730 100644 --- a/wallet/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/wallet/bindings/capacitorjs/src/lib/WalletApi.ts @@ -1,27 +1,20 @@ // Copyright 2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -import { AccountId, AccountSyncOptions, CreateAccountPayload } from '../types/account'; -import { AccountManagerOptions } from '../types'; -import { Account } from './Account'; -import { AccountManager } from './AccountManager'; +import { AccountId, CreateAccountPayload } from '../types/account' +import { AccountManagerOptions } from '../types' +import { createAccountManager } from './createAccountManager' -type ProfileManager = Awaited> -type RecoverAccounts = Parameters -interface RecoverAccountsPayload { - accountStartIndex: number, - accountGapLimit: number, - addressGapLimit: number, - syncOptions?: AccountSyncOptions -} +type ProfileManager = Awaited> +type RecoverAccounts = NonNullable> interface ProfileManagers { [key: string]: ProfileManager } const profileManagers: ProfileManagers = {} - -const WalletApi = { +// @ts-ignore +const WalletApi: any = { async createAccountManager(id: AccountId, options: AccountManagerOptions) { - const manager = await AccountManager(options) + const manager = await createAccountManager(options) manager.id = id profileManagers[id] = manager return manager @@ -29,7 +22,6 @@ const WalletApi = { async createAccount(managerId: AccountId, payload: CreateAccountPayload) { const manager = profileManagers[managerId] const account = await manager.createAccount(payload) - bindMethodsAcrossContextBridge(Account.prototype, account) return account }, deleteAccountManager(managerId: AccountId) { @@ -40,30 +32,18 @@ const WalletApi = { async getAccount(managerId: AccountId, index: number) { const manager = profileManagers[managerId] const account = await manager.getAccount(index) - bindMethodsAcrossContextBridge(Account.prototype, account) return account }, async getAccounts(managerId: AccountId) { const manager = profileManagers[managerId] const accounts = await manager.getAccounts() - accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, - async recoverAccounts(managerId: AccountId, payload: RecoverAccountsPayload) { + async recoverAccounts(managerId: AccountId, payload: RecoverAccounts) { const manager = profileManagers[managerId] const accounts = await manager.recoverAccounts(...Object.values(payload) as RecoverAccounts) - accounts.forEach((account) => bindMethodsAcrossContextBridge(Account.prototype, account)) return accounts }, } -function bindMethodsAcrossContextBridge(prototype, object) { - const prototypeProperties = Object.getOwnPropertyNames(prototype) - prototypeProperties.forEach((key) => { - if (key !== 'constructor') { - object[key] = object[key].bind(object) - } - }) -} - -export { WalletApi }; +export { WalletApi } diff --git a/wallet/bindings/capacitorjs/src/lib/createAccount.ts b/wallet/bindings/capacitorjs/src/lib/createAccount.ts index 3fa975625a..c82ea5f206 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccount.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccount.ts @@ -50,8 +50,7 @@ import type { } from '@iota/types' type MessageHandler = Awaited> -/** createAccount is a factory function, because the methods become part of the object instead of the prototype chain. -This is beneficial, since the prototype chain is bound to a context and can be sanitized.**/ +/** The Account factory function. */ export function createAccount(accountMeta: AccountMeta, messageHandler: MessageHandler) { return { diff --git a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts index e1d79df988..f3ad7fd439 100644 --- a/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts +++ b/wallet/bindings/capacitorjs/src/lib/createAccountManager.ts @@ -20,8 +20,7 @@ import type { type Account = ReturnType -/** createAccountManager is a factory function, because the methods become part of the object instead of the prototype chain. -This is beneficial, since the prototype chain is bound to a context and can be sanitized.**/ +/** The AccountManager class. */ export async function createAccountManager(options: AccountManagerOptions) { let id: AccountId diff --git a/wallet/bindings/capacitorjs/src/lib/index.ts b/wallet/bindings/capacitorjs/src/lib/index.ts index 2f896eec25..67852f5cd1 100644 --- a/wallet/bindings/capacitorjs/src/lib/index.ts +++ b/wallet/bindings/capacitorjs/src/lib/index.ts @@ -4,9 +4,9 @@ import { internalInitLogger } from './bindings' import type { LoggerConfig } from '../types' -export * from './AccountManager' +export * from './createAccountManager' export * from './MessageHandler' -export * from './Account' +export * from './createAccount' export * from './WalletApi' export * from '../types/index' diff --git a/wallet/bindings/capacitorjs/src/types/account.ts b/wallet/bindings/capacitorjs/src/types/account.ts index efb71ddea1..a981f018df 100644 --- a/wallet/bindings/capacitorjs/src/types/account.ts +++ b/wallet/bindings/capacitorjs/src/types/account.ts @@ -15,11 +15,7 @@ export type AccountId = number | string; /** The balance of an account */ export interface AccountBalance { -<<<<<<< HEAD - /** The balance of the base coin */ -======= /** The balance of the base coin */ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf baseCoin: BaseCoinBalance; /** The required storage deposit for the outputs */ requiredStorageDeposit: RequiredStorageDeposit; @@ -57,20 +53,13 @@ export interface RequiredStorageDeposit { /** The balance of a native token */ export interface NativeTokenBalance { tokenId: string; -<<<<<<< HEAD -======= metadata?: string; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf total: HexEncodedAmount; available: HexEncodedAmount; } /** Sync options for an account */ -<<<<<<< HEAD -export interface AccountSyncOptions { -======= export interface SyncOptions { ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf /** * Specific Bech32 encoded addresses of the account to sync, if addresses are provided, * then `address_start_index` will be ignored @@ -95,15 +84,6 @@ export interface SyncOptions { /// Try to sync transactions from incoming outputs with their inputs. Some data may not be obtained if it has been /// pruned. syncIncomingTransactions?: boolean; -<<<<<<< HEAD - /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ - syncPendingTransactions?: boolean; - /** Specifies if only basic outputs should be synced or also alias and nft outputs. Default: true. */ - syncAliasesAndNfts?: boolean; - /** Specifies if only basic outputs with an AddressUnlockCondition alone should be synced, will overwrite - * `syncAliasesAndNfts`. Default: false. */ - syncOnlyMostBasicOutputs?: boolean; -======= /** Checks pending transactions and promotes/reattaches them if necessary. Default: true. */ syncPendingTransactions?: boolean; /** Specifies what outputs should be synced for the ed25519 addresses from the account. */ @@ -138,7 +118,6 @@ export interface NftSyncOptions { basicOutputs?: boolean; aliasOutputs?: boolean; nftOutputs?: boolean; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf } /** The account object */ diff --git a/wallet/bindings/capacitorjs/src/types/address.ts b/wallet/bindings/capacitorjs/src/types/address.ts index d482b1e5cb..cc12a0b1e7 100644 --- a/wallet/bindings/capacitorjs/src/types/address.ts +++ b/wallet/bindings/capacitorjs/src/types/address.ts @@ -1,4 +1,3 @@ -// import type { Network } from './network'; import type { HexEncodedAmount } from '@iota/types'; /** Address Types */ diff --git a/wallet/bindings/capacitorjs/src/types/bridge/account.ts b/wallet/bindings/capacitorjs/src/types/bridge/account.ts index 00e420fa68..d1ce386982 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/account.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/account.ts @@ -1,9 +1,5 @@ import type { OutputTypes, HexEncodedAmount } from '@iota/types'; -<<<<<<< HEAD -import type { AccountSyncOptions, FilterOptions } from '../account'; -======= import type { SyncOptions, FilterOptions } from '../account'; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf import type { AddressWithAmount, AddressWithMicroAmount, @@ -17,10 +13,7 @@ import type { BuildFoundryOutputData, BuildNftOutputData, } from '../buildOutputData'; -<<<<<<< HEAD -======= import type { Node } from '../network'; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf import type { OutputOptions } from '../outputOptions'; import type { OutputsToClaim } from '../output'; import type { SignedTransactionEssence } from '../signedTransactionEssence'; @@ -32,14 +25,11 @@ import type { TransactionOptions, NftOptions, } from '../transactionOptions'; -<<<<<<< HEAD -======= import type { ParticipationEventId, ParticipationEventRegistrationOptions, ParticipationEventType, } from '../participation'; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export type __BuildAliasOutputMethod__ = { name: 'buildAliasOutput'; @@ -110,8 +100,6 @@ export type __DecreaseNativeTokenSupplyMethod__ = { }; }; -<<<<<<< HEAD -======= export type __DeregisterParticipationEventMethod__ = { name: 'deregisterParticipationEvent'; data: { @@ -119,7 +107,6 @@ export type __DeregisterParticipationEventMethod__ = { }; }; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export type __DestroyAliasMethod__ = { name: 'destroyAlias'; data: { @@ -274,8 +261,6 @@ export type __PrepareTransactionMethod__ = { }; }; -<<<<<<< HEAD -======= export type __RegisterParticipationEventsMethod__ = { name: 'registerParticipationEvents'; data: { @@ -291,7 +276,6 @@ export type __RequestFundsFromFaucetMethod__ = { }; }; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export type __RetryTransactionUntilIncludedMethod__ = { name: 'retryTransactionUntilIncluded'; data: { @@ -365,22 +349,14 @@ export type __SubmitAndStoreTransactionMethod__ = { export type __SyncAccountMethod__ = { name: 'syncAccount'; data: { -<<<<<<< HEAD - options?: AccountSyncOptions; -======= options?: SyncOptions; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf }; }; export type __VoteMethod__ = { name: 'vote'; data: { -<<<<<<< HEAD - eventId?: string; -======= eventId?: ParticipationEventId; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf answers?: number[]; }; }; @@ -388,11 +364,7 @@ export type __VoteMethod__ = { export type __StopParticipatingMethod__ = { name: 'stopParticipating'; data: { -<<<<<<< HEAD - eventId: string; -======= eventId: ParticipationEventId; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf }; }; @@ -411,8 +383,6 @@ export type __IncreaseVotingPowerMethod__ = { }; }; -<<<<<<< HEAD -======= export type __GetParticipationEventMethod__ = { name: 'getParticipationEvent'; data: { @@ -439,7 +409,6 @@ export type __GetParticipationEventStatusMethod__ = { }; }; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export type __DecreaseVotingPowerMethod__ = { name: 'decreaseVotingPower'; data: { diff --git a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts index 664eb12023..36374d3f85 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/accountManager.ts @@ -4,9 +4,8 @@ import type { CreateAccountPayload, } from '../account'; import type { GenerateAddressOptions } from '../address'; -import type { WalletEvent } from '../event'; -import type { Auth, ClientOptions, Node } from '../network'; -import type { EventId } from '../participation'; +import type { EventType, WalletEvent } from '../event'; +import type { Auth, ClientOptions } from '../network'; export type __BackupMessage__ = { cmd: 'backup'; @@ -18,7 +17,9 @@ export type __BackupMessage__ = { export type __Bech32ToHex__ = { cmd: 'bech32ToHex'; - payload: string; + payload: { + bech32Address: string; + }; }; export type __ChangeStrongholdPasswordMessage__ = { @@ -33,21 +34,19 @@ export type __ClearStrongholdPasswordMessage__ = { cmd: 'clearStrongholdPassword'; }; +export type __ClearListenersMessage__ = { + cmd: 'clearListeners'; + payload: { eventTypes: EventType[] }; +}; + export type __CreateAccountMessage__ = { cmd: 'createAccount'; payload: CreateAccountPayload; }; -export type __DeregisterParticipationEvent__ = { - cmd: 'deregisterParticipationEvent'; - payload: { - eventId: EventId; - }; -}; - export type __EmitTestEventMessage__ = { cmd: 'emitTestEvent'; - payload: WalletEvent; + payload: { event: WalletEvent }; }; export type __GenerateMnemonicMessage__ = { @@ -64,7 +63,7 @@ export type __GetAccountsMessage__ = { export type __GetAccountMessage__ = { cmd: 'getAccount'; - payload: AccountId; + payload: { accountId: AccountId }; }; export type __GetLedgerNanoStatusMessage__ = { @@ -90,24 +89,6 @@ export type __GetNodeInfoMessage__ = { }; }; -export type __GetParticipationEventMessage__ = { - cmd: 'getParticipationEvent'; - payload: { - eventId: EventId; - }; -}; - -export type __GetParticipationEventsMessage__ = { - cmd: 'getParticipationEvents'; -}; - -export type __GetParticipationEventStatusMessage__ = { - cmd: 'getParticipationEventStatus'; - payload: { - eventId: EventId; - }; -}; - export type __HexToBech32__ = { cmd: 'hexToBech32'; payload: { @@ -130,14 +111,6 @@ export type __RecoverAccountsMessage__ = { }; }; -export type __RegisterParticipationEventMessage__ = { - cmd: 'registerParticipationEvent'; - payload: { - eventId: EventId; - nodes: Node[]; - }; -}; - export type __RemoveLatestAccountMessage__ = { cmd: 'removeLatestAccount'; }; @@ -152,17 +125,17 @@ export type __RestoreBackupMessage__ = { export type __SetClientOptionsMessage__ = { cmd: 'setClientOptions'; - payload: ClientOptions; + payload: { clientOptions: ClientOptions }; }; export type __SetStrongholdPasswordMessage__ = { cmd: 'setStrongholdPassword'; - payload: string; + payload: { password: string }; }; export type __SetStrongholdPasswordClearIntervalMessage__ = { cmd: 'setStrongholdPasswordClearInterval'; - payload?: number; + payload?: { intervalInMilliseconds?: number }; }; export type __StartBackgroundSyncMessage__ = { @@ -179,10 +152,15 @@ export type __StopBackgroundSyncMessage__ = { export type __StoreMnemonicMessage__ = { cmd: 'storeMnemonic'; - payload: string; + payload: { mnemonic: string }; }; export type __VerifyMnemonicMessage__ = { cmd: 'verifyMnemonic'; - payload: string; + payload: { mnemonic: string }; +}; + +export type __UpdateNodeAuthMessage__ = { + cmd: 'updateNodeAuth'; + payload: { url: string; auth?: Auth }; }; diff --git a/wallet/bindings/capacitorjs/src/types/bridge/index.ts b/wallet/bindings/capacitorjs/src/types/bridge/index.ts index 1c28c87f36..87108c1562 100644 --- a/wallet/bindings/capacitorjs/src/types/bridge/index.ts +++ b/wallet/bindings/capacitorjs/src/types/bridge/index.ts @@ -12,10 +12,7 @@ import type { __DecreaseNativeTokenSupplyMethod__, __DestroyAliasMethod__, __DestroyFoundryMethod__, -<<<<<<< HEAD -======= __DeregisterParticipationEventMethod__, ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf __GenerateAddressesMethod__, __GetBalanceMethod__, __GetOutputMethod__, @@ -36,11 +33,8 @@ import type { __PrepareOutputMethod__, __PrepareSendAmountMethod__, __PrepareTransactionMethod__, -<<<<<<< HEAD -======= __RegisterParticipationEventsMethod__, __RequestFundsFromFaucetMethod__, ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf __RetryTransactionUntilIncludedMethod__, __SendAmountMethod__, __SendMicroTransactionMethod__, @@ -53,13 +47,6 @@ import type { __SyncAccountMethod__, __GetIncomingTransactionDataMethod__, __VoteMethod__, -<<<<<<< HEAD - __StopParticipatingMethod__, - __GetVotingPowerMethod__, - __GetParticipationOverviewMethod__, - __IncreaseVotingPowerMethod__, - __DecreaseVotingPowerMethod__, -======= __GetVotingPowerMethod__, __GetParticipationOverviewMethod__, __GetParticipationEventMethod__, @@ -69,17 +56,13 @@ import type { __IncreaseVotingPowerMethod__, __DecreaseVotingPowerMethod__, __StopParticipatingMethod__, ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf } from './account'; import type { __BackupMessage__, __Bech32ToHex__, __ChangeStrongholdPasswordMessage__, __ClearStrongholdPasswordMessage__, -<<<<<<< HEAD -======= __ClearListenersMessage__, ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf __CreateAccountMessage__, __EmitTestEventMessage__, __GenerateMnemonicMessage__, @@ -101,15 +84,7 @@ import type { __StopBackgroundSyncMessage__, __StoreMnemonicMessage__, __VerifyMnemonicMessage__, -<<<<<<< HEAD - __DeregisterParticipationEvent__, - __RegisterParticipationEventMessage__, - __GetParticipationEventMessage__, - __GetParticipationEventsMessage__, - __GetParticipationEventStatusMessage__, -======= __UpdateNodeAuthMessage__, ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf } from './accountManager'; export type __AccountMethod__ = @@ -122,10 +97,7 @@ export type __AccountMethod__ = | __ClaimOutputsMethod__ | __ConsolidateOutputsMethod__ | __CreateAliasOutputMethod__ -<<<<<<< HEAD -======= | __DeregisterParticipationEventMethod__ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf | __DestroyAliasMethod__ | __DestroyFoundryMethod__ | __GenerateAddressesMethod__ @@ -134,13 +106,10 @@ export type __AccountMethod__ = | __GetIncomingTransactionDataMethod__ | __GetFoundryOutputMethod__ | __GetOutputsWithAdditionalUnlockConditionsMethod__ -<<<<<<< HEAD -======= | __GetParticipationEventMethod__ | __GetParticipationEventIdsMethod__ | __GetParticipationEventsMethod__ | __GetParticipationEventStatusMethod__ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf | __GetTransactionMethod__ | __AddressesMethod__ | __AddressesWithUnspentOutputsMethod__ @@ -157,11 +126,8 @@ export type __AccountMethod__ = | __PrepareOutputMethod__ | __PrepareSendAmountMethod__ | __PrepareTransactionMethod__ -<<<<<<< HEAD -======= | __RegisterParticipationEventsMethod__ | __RequestFundsFromFaucetMethod__ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf | __RetryTransactionUntilIncludedMethod__ | __SendAmountMethod__ | __SendMicroTransactionMethod__ @@ -192,15 +158,9 @@ export type __Message__ = | __Bech32ToHex__ | __CallAccountMethodMessage__ | __ChangeStrongholdPasswordMessage__ -<<<<<<< HEAD - | __ClearStrongholdPasswordMessage__ - | __CreateAccountMessage__ - | __DeregisterParticipationEvent__ -======= | __ClearListenersMessage__ | __ClearStrongholdPasswordMessage__ | __CreateAccountMessage__ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf | __EmitTestEventMessage__ | __GenerateMnemonicMessage__ | __GetAccountMessage__ @@ -209,19 +169,9 @@ export type __Message__ = | __GetLedgerNanoStatusMessage__ | __GenerateAddressMessage__ | __GetNodeInfoMessage__ -<<<<<<< HEAD - | __GetParticipationEventMessage__ - | __GetParticipationEventsMessage__ - | __GetParticipationEventStatusMessage__ | __HexToBech32__ | __IsStrongholdPasswordAvailableMessage__ | __RecoverAccountsMessage__ - | __RegisterParticipationEventMessage__ -======= - | __HexToBech32__ - | __IsStrongholdPasswordAvailableMessage__ - | __RecoverAccountsMessage__ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf | __RemoveLatestAccountMessage__ | __RestoreBackupMessage__ | __SetClientOptionsMessage__ @@ -230,11 +180,5 @@ export type __Message__ = | __StartBackgroundSyncMessage__ | __StopBackgroundSyncMessage__ | __StoreMnemonicMessage__ -<<<<<<< HEAD - | __VerifyMnemonicMessage__; - - -======= | __VerifyMnemonicMessage__ | __UpdateNodeAuthMessage__; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf diff --git a/wallet/bindings/capacitorjs/src/types/index.ts b/wallet/bindings/capacitorjs/src/types/index.ts index 68a13c563f..3bbcc66a03 100644 --- a/wallet/bindings/capacitorjs/src/types/index.ts +++ b/wallet/bindings/capacitorjs/src/types/index.ts @@ -4,7 +4,6 @@ export * from './address'; export * from './bridge/index'; export * from './buildOutputData'; export * from './event'; -export * from './incomingTransactionData'; export * from './loggerConfig'; export * from './network'; export * from './output'; diff --git a/wallet/bindings/capacitorjs/src/types/network.ts b/wallet/bindings/capacitorjs/src/types/network.ts index ff59cdfccd..9b2df538eb 100644 --- a/wallet/bindings/capacitorjs/src/types/network.ts +++ b/wallet/bindings/capacitorjs/src/types/network.ts @@ -9,12 +9,7 @@ export enum Network { /** Basic Auth or JWT */ export type Auth = { jwt?: string; -<<<<<<< HEAD - username?: string; - password?: string; -======= basicAuthNamePwd?: [string, string]; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf }; /** Information about the network and client */ diff --git a/wallet/bindings/capacitorjs/src/types/participation.ts b/wallet/bindings/capacitorjs/src/types/participation.ts index 691d825181..6cb15791ed 100644 --- a/wallet/bindings/capacitorjs/src/types/participation.ts +++ b/wallet/bindings/capacitorjs/src/types/participation.ts @@ -1,33 +1,3 @@ -<<<<<<< HEAD -// import type { OutputId } from './output'; - -export interface ParticipationOverview { - participations: {[eventId: string]: { [outputId: string]: TrackedParticipationOverview }}; -} - -export interface TrackedParticipationOverview { - blockId: string; - amount: string; - startMilestoneIndex: number; - endMilestoneIndex: number; -} - -export interface Event { - id: EventId; - data: EventData; -} - -export type EventId = string; - -export interface EventStatus { - milestoneIndex: number; - status: string; - questions?: Answer[]; - checksum: string; -} - -export interface EventData { -======= import type { Node } from './network'; import type { OutputId } from './output'; @@ -80,18 +50,10 @@ export interface ParticipationEventStatus { } export interface ParticipationEventData { ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf name: string; milestoneIndexCommence: number; milestoneIndexStart: number; milestoneIndexEnd: number; -<<<<<<< HEAD - payload: EventPayload; - additionalInfo: string; -} - -export type EventPayload = VotingEventPayload | StakingEventPayload; -======= payload: ParticipationEventPayload; additionalInfo: string; } @@ -99,7 +61,6 @@ export type EventPayload = VotingEventPayload | StakingEventPayload; export type ParticipationEventPayload = | VotingEventPayload | StakingEventPayload; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export interface VotingEventPayload { type: ParticipationEventType.Voting; @@ -128,8 +89,6 @@ export interface Answer { additionalInfo: string; } -<<<<<<< HEAD -======= export interface QuestionStatus { answers: AnswerStatus[]; } @@ -140,7 +99,6 @@ export interface AnswerStatus { accumulated: number; } ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export enum ParticipationEventType { Voting = 0, Staking = 1, diff --git a/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts b/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts index 4791d10910..f640758c4a 100644 --- a/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts +++ b/wallet/bindings/capacitorjs/src/types/signedTransactionEssence.ts @@ -1,11 +1,7 @@ import type { ITransactionPayload } from '@iota/types'; import type { InputSigningData } from './preparedTransactionData'; -<<<<<<< HEAD -/** The signed transaction with inputs data */ -======= /** The signed transaction with inputs data */ ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf export interface SignedTransactionEssence { transactionPayload: ITransactionPayload; inputsData: InputSigningData; diff --git a/wallet/bindings/capacitorjs/src/types/transaction.ts b/wallet/bindings/capacitorjs/src/types/transaction.ts index 832ab51b75..0eeafa2338 100644 --- a/wallet/bindings/capacitorjs/src/types/transaction.ts +++ b/wallet/bindings/capacitorjs/src/types/transaction.ts @@ -1,8 +1,4 @@ -<<<<<<< HEAD -import type { ITransactionPayload } from '@iota/types'; -======= import type { IOutputResponse, ITransactionPayload } from '@iota/types'; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf /** Possible InclusionStates of transactions sent with the wallet */ export enum InclusionState { @@ -32,13 +28,9 @@ export interface Transaction { networkId: string; /** If the transaction was created by the wallet or someone else */ incoming: boolean; -<<<<<<< HEAD - note?: string; -======= /** Note that can be set when sending a transaction and is only stored locally */ note?: string; inputs: IOutputResponse[]; ->>>>>>> 5d1939575223b8004d642a02018d3e65f2ec4dbf } /** The result of a minting operation */ From a6ae01da116723d99e34c2f2db43e50ff7538775 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 6 Mar 2023 12:10:35 +0000 Subject: [PATCH 158/197] fix listen function on java plugin Signed-off-by: Amadeo Marchioni --- .../main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 653785a69a..28c03761d8 100644 --- a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -135,7 +135,7 @@ public void sendMessage(final PluginCall call) { clientResponse.add("payload", jsonResponse); ret.put("result", clientResponse.toString()); } else { - ret.put("result", "Ok"); + ret.put("result", "ok"); } call.resolve(ret); } catch (Exception ex) { @@ -162,7 +162,7 @@ public void listen(final PluginCall call) throws WalletException, JSONException public void receive(Event event) { Log.d("listen", "Received event " + event.toString()); JSObject walletResponse = new JSObject(); - walletResponse.put("result", event.getEvent().toString()); + walletResponse.put("result", event.toString()); call.resolve(walletResponse); } }, types); From f603fb101069ccf28fc7951f4f52a976ca8a801d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 7 Mar 2023 11:10:58 +0000 Subject: [PATCH 159/197] fix version number on package.json Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/package.json b/wallet/bindings/capacitorjs/package.json index 36e89672ee..f2ad1eb3f2 100644 --- a/wallet/bindings/capacitorjs/package.json +++ b/wallet/bindings/capacitorjs/package.json @@ -1,6 +1,6 @@ { "name": "@iota/wallet-mobile", - "version": "2.0.0-alpha.0", + "version": "1.0.0-alpha.0", "description": "Capacitor plugin binding to the wallet library", "homepage": "https://github.com/iotaledger/wallet.rs#readme", "main": "dist/api.js", From b306c19a90f069472e5323ea19d39a5dde952cc3 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 7 Mar 2023 11:41:50 +0000 Subject: [PATCH 160/197] remove deprecated `extern crate` Signed-off-by: Amadeo Marchioni --- wallet/bindings/java/lib/native/src/lib.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/wallet/bindings/java/lib/native/src/lib.rs b/wallet/bindings/java/lib/native/src/lib.rs index 036b3c5e77..28af2376cb 100644 --- a/wallet/bindings/java/lib/native/src/lib.rs +++ b/wallet/bindings/java/lib/native/src/lib.rs @@ -1,12 +1,6 @@ // Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 -#[cfg(target_os = "android")] -#[macro_use] -extern crate log; -#[cfg(target_os = "android")] -extern crate android_logger; - use std::{convert::TryFrom, sync::Mutex}; #[cfg(target_os = "android")] @@ -22,7 +16,7 @@ use jni::{ JNIEnv, JavaVM, }; #[cfg(target_os = "android")] -use log::LevelFilter; +use log::{LevelFilter, error}; use once_cell::sync::OnceCell; use tokio::runtime::Runtime; From c02500f42086e2ce721f8ff34443add135a3fb0d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 7 Mar 2023 11:49:08 +0000 Subject: [PATCH 161/197] disable Android `lib_wallet` logs Signed-off-by: Amadeo Marchioni --- wallet/bindings/java/lib/native/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/java/lib/native/src/lib.rs b/wallet/bindings/java/lib/native/src/lib.rs index 28af2376cb..646605ced2 100644 --- a/wallet/bindings/java/lib/native/src/lib.rs +++ b/wallet/bindings/java/lib/native/src/lib.rs @@ -99,7 +99,7 @@ pub extern "system" fn Java_org_iota_api_NativeApi_createMessageHandler( android_logger::init_once( Config::default() .with_tag("lib_wallet") - .with_max_level(LevelFilter::Trace), + .with_max_level(LevelFilter::Off), ); if let Ok(mut message_handler_store) = MESSAGE_HANDLER.lock() { From cb00a7d754ff83cd967e27b41769eba22fa5ee66 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 7 Mar 2023 14:01:44 +0000 Subject: [PATCH 162/197] remove old `Cargo.lock` file on `swift` folder Signed-off-by: Amadeo Marchioni --- wallet/bindings/swift/Cargo.lock | 2665 ------------------------------ 1 file changed, 2665 deletions(-) delete mode 100644 wallet/bindings/swift/Cargo.lock diff --git a/wallet/bindings/swift/Cargo.lock b/wallet/bindings/swift/Cargo.lock deleted file mode 100644 index b2c8257675..0000000000 --- a/wallet/bindings/swift/Cargo.lock +++ /dev/null @@ -1,2665 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", -] - -[[package]] -name = "anyhow" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "async-trait" -version = "0.1.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bindgen" -version = "0.64.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "blake2b_simd" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq 0.2.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "bytemuck" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - -[[package]] -name = "clang-sys" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ed9a53e5d4d9c573ae844bfac6872b159cb1d1585a83b29e7a64b7eef7332a" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "colored" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "constant_time_eq" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" - -[[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "derive_builder" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_macro" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" -dependencies = [ - "derive_builder_core", - "syn", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" -dependencies = [ - "block-buffer 0.10.3", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek", - "hashbrown 0.12.3", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "fern" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" -dependencies = [ - "colored", - "log", -] - -[[package]] -name = "fern-logger" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d72fcbd7f804f2dcb89b295dfdfeff1a81338b1960387a45261f857ddc553a9f" -dependencies = [ - "fern", - "log", - "serde", - "thiserror", - "time-helper", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" - -[[package]] -name = "futures-executor" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" - -[[package]] -name = "futures-sink" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" - -[[package]] -name = "futures-task" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" - -[[package]] -name = "futures-util" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "getset" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gloo-storage" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" -dependencies = [ - "gloo-utils", - "js-sys", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-utils" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "h2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", - "serde", -] - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hkdf" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "http" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6effc99afb63425aff9b05836f029929e345a6148a14b7ecd5ab67af944482" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" -dependencies = [ - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "iota-client" -version = "2.0.1-rc.6" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "async-trait", - "backtrace", - "derive_builder", - "derive_more", - "futures", - "gloo-timers", - "hashbrown 0.13.2", - "instant", - "iota-crypto", - "iota-pow", - "iota-types", - "iota_stronghold", - "log", - "num_cpus", - "packable", - "prefix-hex", - "primitive-types", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "url", - "zeroize", -] - -[[package]] -name = "iota-crypto" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e04d492224bff6e97142f033d0a4383bcbc05918be1ff7b3abd2c1cc85205a2" -dependencies = [ - "aead", - "aes", - "aes-gcm", - "autocfg", - "blake2", - "chacha20poly1305", - "curve25519-dalek", - "digest 0.10.6", - "ed25519-zebra", - "generic-array", - "getrandom", - "hmac", - "num-traits", - "pbkdf2", - "serde", - "sha2 0.10.6", - "unicode-normalization", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "iota-pow" -version = "1.0.0-rc.3" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "instant", - "iota-crypto", - "num_cpus", -] - -[[package]] -name = "iota-types" -version = "1.0.0-rc.6" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "bech32", - "bitflags", - "bytemuck", - "derive_more", - "getset", - "hashbrown 0.13.2", - "hex", - "iota-crypto", - "iota-pow", - "iterator-sorted", - "packable", - "prefix-hex", - "primitive-types", - "serde", - "serde-big-array", - "serde_json", - "serde_repr", -] - -[[package]] -name = "iota-wallet" -version = "0.1.0" -dependencies = [ - "futures", - "iota-wallet 1.0.0-rc.5", - "once_cell", - "serde", - "serde_json", - "tokio", -] - -[[package]] -name = "iota-wallet" -version = "1.0.0-rc.5" -dependencies = [ - "async-trait", - "backtrace", - "fern-logger", - "futures", - "getset", - "gloo-storage", - "gloo-timers", - "instant", - "iota-client", - "iota-crypto", - "log", - "packable", - "prefix-hex", - "primitive-types", - "rocksdb", - "serde", - "serde_json", - "thiserror", - "tokio", - "wasm-bindgen-futures", - "zeroize", -] - -[[package]] -name = "iota_stronghold" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5baaa2460627283f54b968db7a38c9c754dc6059157cae64550ed1b79c91aa" -dependencies = [ - "bincode", - "hkdf", - "iota-crypto", - "rust-argon2", - "serde", - "stronghold-derive", - "stronghold-utils", - "stronghold_engine", - "thiserror", - "zeroize", -] - -[[package]] -name = "ipnet" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" - -[[package]] -name = "iterator-sorted" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d101775d2bc8f99f4ac18bf29b9ed70c0dd138b9a1e88d7b80179470cbbe8bd2" - -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - -[[package]] -name = "jobserver" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "librocksdb-sys" -version = "0.10.0+7.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "lz4-sys", -] - -[[package]] -name = "libsodium-sys" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd" -dependencies = [ - "cc", - "libc", - "pkg-config", - "walkdir", -] - -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", - "serde", -] - -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.45.0", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "object" -version = "0.30.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "packable" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8013e43f83d46fba11c27e96b3c9d152614e085756fad393c1501cc3ecc0cd5" -dependencies = [ - "autocfg", - "packable-derive", - "primitive-types", - "serde", -] - -[[package]] -name = "packable-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567693dd2f9a4339cb0a54adfcc0cb431c0ac88b2e46c6ddfb5f5d11a1cc4f" -dependencies = [ - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "parity-scale-codec" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "paste" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prefix-hex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75e3396888185b76a6e4c8fc883b3f039e56d3c0bca279744d2df70b3662e784" -dependencies = [ - "hex", - "primitive-types", - "uint", -] - -[[package]] -name = "primitive-types" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "reqwest" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" -dependencies = [ - "base64 0.21.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rocksdb" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rust-argon2" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b50162d19404029c1ceca6f6980fe40d45c8b369f6f44446fa14bb39573b5bb9" -dependencies = [ - "base64 0.13.1", - "blake2b_simd", - "constant_time_eq 0.1.5", - "crossbeam-utils", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" -dependencies = [ - "base64 0.21.0", -] - -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-big-array" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3323f09a748af288c3dc2474ea6803ee81f118321775bffa3ac8f7e65c5e90e7" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_repr" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - -[[package]] -name = "slab" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6528351c9bc8ab22353f9d776db39a20288e8d6c37ef8cfe3317cf875eecfc2d" -dependencies = [ - "autocfg", -] - -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stronghold-derive" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2835db23c4724c05a2f85b81c4681f4aa8ea158edc8a7f4ad791c916fb766c2e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "stronghold-runtime" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93abb10fbd11335d31c33a70b2523c0caab348215caa2ce6da04a268c30afcb" -dependencies = [ - "dirs", - "iota-crypto", - "libc", - "libsodium-sys", - "log", - "nix", - "rand", - "serde", - "thiserror", - "windows", - "zeroize", -] - -[[package]] -name = "stronghold-utils" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8300214898af5e153e7f66e49dbd1c6a21585f2d592d9f24f58b969792475ed6" -dependencies = [ - "rand", - "stronghold-derive", -] - -[[package]] -name = "stronghold_engine" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d68a609d0a4f05dbde8b704619faa7f861069bbc649e3abecb4d389f10236f" -dependencies = [ - "anyhow", - "dirs-next", - "hex", - "iota-crypto", - "once_cell", - "paste", - "serde", - "stronghold-runtime", - "thiserror", - "zeroize", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "thiserror" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" -dependencies = [ - "itoa", - "libc", - "num_threads", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - -[[package]] -name = "time-helper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c30f0091717eeeff0b556d830302d5563de8b72fd49127aa5899a06a369808" -dependencies = [ - "time", -] - -[[package]] -name = "time-macros" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys 0.42.0", -] - -[[package]] -name = "tokio-macros" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-util" -version = "0.7.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml_datetime" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" - -[[package]] -name = "toml_edit" -version = "0.19.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a1eb0622d28f4b9c90adc4ea4b2b46b47663fde9ac5fafcb14a1369d5508825" -dependencies = [ - "indexmap", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" - -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53b97a83176b369b0eb2fd8158d4ae215357d02df9d40c1e1bf1879c5482c80" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e2522491fbfcd58cc84d47aeb2958948c4b8982e9a2d8a2a35bbaed431390e7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" - -[[package]] -name = "winnow" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "faf09497b8f8b5ac5d3bb4d05c0a99be20f26fd3d5f2db7b0716e946d5103658" -dependencies = [ - "memchr", -] - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "x25519-dalek" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" -dependencies = [ - "curve25519-dalek", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "zeroize" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] From 92e973dd45934ce49657bb7cac8b1c5cc3c79486 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 7 Mar 2023 14:47:46 +0000 Subject: [PATCH 163/197] fix format on java lib.rs Signed-off-by: Amadeo Marchioni --- wallet/bindings/java/lib/native/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/java/lib/native/src/lib.rs b/wallet/bindings/java/lib/native/src/lib.rs index 646605ced2..2d1ee4e3ec 100644 --- a/wallet/bindings/java/lib/native/src/lib.rs +++ b/wallet/bindings/java/lib/native/src/lib.rs @@ -16,7 +16,7 @@ use jni::{ JNIEnv, JavaVM, }; #[cfg(target_os = "android")] -use log::{LevelFilter, error}; +use log::{error, LevelFilter}; use once_cell::sync::OnceCell; use tokio::runtime::Runtime; From c51b0b9a03e3aabc8ee14d768df39877021ecab0 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 08:18:04 +0000 Subject: [PATCH 164/197] fix url Pod description Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/IotaWalletMobile.podspec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/IotaWalletMobile.podspec b/wallet/bindings/capacitorjs/IotaWalletMobile.podspec index 2df52e2290..a37426f08c 100644 --- a/wallet/bindings/capacitorjs/IotaWalletMobile.podspec +++ b/wallet/bindings/capacitorjs/IotaWalletMobile.podspec @@ -4,7 +4,7 @@ s.version = '0.0.1' s.summary = 'Capacitor plugin binding to the wallet library' s.license = { :type => 'Apache-2.0' } - s.homepage = 'https://github.com/iotaledger/wallet.rs/bindings/capacitorjs/#readme' + s.homepage = 'https://github.com/iotaledger/wallet.rs/wallet/bindings/capacitorjs/#readme' s.author = 'IOTA Stiftung' s.source = { :git => 'https://github.com/iotaledger/wallet.rs.git', :tag => s.version.to_s } s.source_files = ['ios/Plugin/**/*.{swift,h,m,c,cc,mm,cpp}', 'ios/*.{h,m,swift}'] From 071be00fb7b94a9654ae68e3076e883b7194e3f5 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 11:03:51 +0000 Subject: [PATCH 165/197] fix: expose clearListeners for Firefly mobile Signed-off-by: Amadeo Marchioni --- .../java/lib/src/main/java/org/iota/api/NativeApi.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/wallet/bindings/java/lib/src/main/java/org/iota/api/NativeApi.java b/wallet/bindings/java/lib/src/main/java/org/iota/api/NativeApi.java index be6eb65a4e..385df9a88d 100644 --- a/wallet/bindings/java/lib/src/main/java/org/iota/api/NativeApi.java +++ b/wallet/bindings/java/lib/src/main/java/org/iota/api/NativeApi.java @@ -76,7 +76,9 @@ protected NativeApi(WalletConfig walletConfig) throws InitializeWalletException private static native void createMessageHandler(String config) throws Exception; // Destroys account handle - protected static native void destroyHandle(); + // For Firefly mobile, we sent clearListeners event by sendMessage + // so we need to call destroyHandle mannualy from Capacitor binding plugin. + public static native void destroyHandle(); private static native String sendMessage(String command); From f0ade9e7733a14fe53bce129f088914130769f44 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 11:05:02 +0000 Subject: [PATCH 166/197] fix Android capacitor binding `destroy` function Signed-off-by: Amadeo Marchioni --- .../iota/IotaWalletMobile/IotaWalletMobile.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 28c03761d8..d0a5056af3 100644 --- a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -13,7 +13,6 @@ import com.getcapacitor.annotation.CapacitorPlugin; import java.util.Arrays; -import java.util.List; import org.iota.Wallet; import org.iota.api.WalletCommand; @@ -22,7 +21,6 @@ import org.iota.types.WalletConfig; import org.iota.types.events.Event; import org.iota.types.events.EventListener; -import org.iota.types.events.transaction.TransactionProgressEvent; import org.iota.types.events.wallet.WalletEventType; import org.iota.types.exceptions.WalletException; import org.iota.types.secret.StrongholdSecretManager; @@ -30,13 +28,12 @@ import org.json.JSONException; import org.json.JSONObject; -import com.google.gson.JsonArray; import com.google.gson.JsonElement; import com.google.gson.JsonObject; import com.google.gson.JsonParser; import static org.iota.api.NativeApi.callBaseApi; -import static org.iota.api.NativeApi.callListen; +import static org.iota.api.NativeApi.destroyHandle; @CapacitorPlugin(name = "IotaWalletMobile") @@ -116,11 +113,11 @@ public void sendMessage(final PluginCall call) { JsonElement element = JsonParser.parseString(message); JsonObject jsonObject = element.getAsJsonObject(); WalletCommand walletCommand; - if (jsonObject.has("payload")) { - walletCommand = new WalletCommand( - jsonObject.get("cmd").getAsString(), - jsonObject.get("payload") - ); + if (jsonObject.has("payload") && jsonObject.has("cmd")) { + walletCommand = new WalletCommand( + jsonObject.get("cmd").getAsString(), + jsonObject.get("payload") + ); } else { walletCommand = new WalletCommand(jsonObject.get("cmd").getAsString()); @@ -176,7 +173,7 @@ public void receive(Event event) { @PluginMethod() public void destroy(final PluginCall call) { try { - wallet.destroy(); + destroyHandle(); call.release(bridge); } catch (Exception ex) { call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); From 51bebab70a7082ff4d9d440c987d7a7a27402ca3 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 12:32:49 +0000 Subject: [PATCH 167/197] temporarily using host https://files.iota.org/firefly/bindings until CI will be done Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 29 +++++++++++++++---------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index 45b1f4e9bc..3119db7e1b 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -1,17 +1,22 @@ #!/bin/bash - +# 🛑 temporarily using host https://files.iota.org/firefly/bindings until CI will be done. set -e rm -rf tmp && mkdir tmp && cd tmp - -curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet.zip -unzip iota-wallet.zip - +echo Installing Java libraries +# curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet-java.zip +mkdir jniLibs && cd jniLibs +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/jniLibs-1.0.0-alpha.0.zip > iota-wallet-java.zip +unzip iota-wallet-java.zip rm -rf ../android/src/main/jniLibs -cp -r jniLibs ../android/src/main/jniLibs - -curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1.jar > iota-wallet.jar +cd .. && cp -rv jniLibs ../android/src/main +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/iota-wallet-1.0.0-alpha.0.jar > iota-wallet.jar rm -rf ../android/libs && mkdir -p ../android/libs -cp -r iota-wallet.jar ../android/libs - -cd .. && rm -rf tmp -echo "success!" +cp -rv iota-wallet.jar ../android/libs +echo Installing Swift libraries +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/WalletFramework-2.0.0-alpha.0.zip > iota-wallet-swift.zip +unzip iota-wallet-swift.zip +rm -f ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework +rm -f ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework +cp -v x86_64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework +cp -v aarch64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework +cd .. && rm -rf tmp \ No newline at end of file From 5e44815e9acc4b857c38617c28fbaba46b147d94 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 12:35:35 +0000 Subject: [PATCH 168/197] fix typo Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index 3119db7e1b..4372896f2f 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -13,7 +13,7 @@ curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/iota-wall rm -rf ../android/libs && mkdir -p ../android/libs cp -rv iota-wallet.jar ../android/libs echo Installing Swift libraries -curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/WalletFramework-2.0.0-alpha.0.zip > iota-wallet-swift.zip +curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/WalletFramework-1.0.0-alpha.0.zip > iota-wallet-swift.zip unzip iota-wallet-swift.zip rm -f ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework rm -f ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework From 5a48c07ffb4c7450bb940f13e4f1fea84b6acac3 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 13 Mar 2023 18:18:08 +0000 Subject: [PATCH 169/197] fix `add_libs.sh` folders code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index 4372896f2f..ad47c1c00e 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -17,6 +17,6 @@ curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/WalletFra unzip iota-wallet-swift.zip rm -f ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework rm -f ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework -cp -v x86_64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework -cp -v aarch64/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework +cp -v x86_64-apple-ios/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/WalletFramework +cp -v aarch64-apple-ios/libiota_wallet.a ../ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/WalletFramework cd .. && rm -rf tmp \ No newline at end of file From 2a20cd7508576a02f65bd1b1128645d342c17177 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 14 Mar 2023 17:05:04 +0000 Subject: [PATCH 170/197] fix urls at `README.md` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/wallet/bindings/capacitorjs/README.md b/wallet/bindings/capacitorjs/README.md index 9e89a606c8..a9166c7e0f 100644 --- a/wallet/bindings/capacitorjs/README.md +++ b/wallet/bindings/capacitorjs/README.md @@ -2,10 +2,9 @@ ## Requirements (only for building the binary yourself) -[Android: Follow this guide](https://github.com/iotaledger/wallet.rs/tree/develop/bindings/java#instead-build-everything-from-scratch-yourself) - -[iOS: Follow this guide](https://github.com/iotaledger/wallet.rs/blob/develop/bindings/swift) +[Android: Follow this guide](https://github.com/iotaledger/wallet.rs/tree/develop/wallet/bindings/java#instead-build-everything-from-scratch-yourself) +[iOS: Follow this guide](https://github.com/iotaledger/wallet.rs/blob/develop/wallet/bindings/swift) ## Installation From 42cdeed675a69da0d451c2d25b21a4ec2c0abe69 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Tue, 14 Mar 2023 17:10:47 +0000 Subject: [PATCH 171/197] remove debug prints on `Plugin.swift` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index e5ae117795..c5c88750a5 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -54,7 +54,6 @@ public class IotaWalletMobile: CAPPlugin { @objc func messageHandlerNew(_ call: CAPPluginCall) { do { - print("Capacitor call messageHandlerNew received", call.jsObjectRepresentation) guard let storagePath = call.getString("storagePath"), let clientOptions = call.getObject("clientOptions"), let coinType = call.getInt("coinType"), @@ -71,7 +70,7 @@ public class IotaWalletMobile: CAPPlugin { let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) let stringfiedSecretManager = String(data: SecretManager!, encoding: .utf8)! - print(stringfiedSecretManager) + // prepare the internal app directory path let fm = FileManager.default guard let documents = fm.urls( @@ -111,7 +110,6 @@ public class IotaWalletMobile: CAPPlugin { }} } """ - print(options) // TODO: implement logger as a fn let filename = "\(path)/iota_wallet.log" @@ -129,7 +127,6 @@ public class IotaWalletMobile: CAPPlugin { } @objc func destroy(_ call: CAPPluginCall) { - print("Capacitor call destroy received", call.jsObjectRepresentation) guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } @@ -159,7 +156,6 @@ public class IotaWalletMobile: CAPPlugin { } @objc func listen(_ call: CAPPluginCall) { - print("Capacitor call listen received", call.jsObjectRepresentation) guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } @@ -185,7 +181,6 @@ public class IotaWalletMobile: CAPPlugin { } @objc func clearListeners(_ call: CAPPluginCall) { - print("Capacitor call clearListeners received", call.jsObjectRepresentation) guard let handler = call.getInt("messageHandler") else { return call.reject("handler is required") } From c7290b43ca0281ed6bf59528da7e4ed359dbbda9 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 15 Mar 2023 21:28:58 +0000 Subject: [PATCH 172/197] revert ffc1d24, define error vars on each function Signed-off-by: Amadeo Marchioni --- .../capacitorjs/ios/Plugin/Plugin.swift | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index c5c88750a5..34b3519658 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -48,10 +48,6 @@ public class IotaWalletMobile: CAPPlugin { } } - // TODO: we really need pass this params from swift? - private let error_buffer: UnsafeMutablePointer? = nil - private let error_buffer_size = 0 - @objc func messageHandlerNew(_ call: CAPPluginCall) { do { guard let storagePath = call.getString("storagePath"), @@ -70,7 +66,7 @@ public class IotaWalletMobile: CAPPlugin { let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) let stringfiedSecretManager = String(data: SecretManager!, encoding: .utf8)! - + print(stringfiedSecretManager) // prepare the internal app directory path let fm = FileManager.default guard let documents = fm.urls( @@ -111,6 +107,9 @@ public class IotaWalletMobile: CAPPlugin { } """ + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + // TODO: implement logger as a fn let filename = "\(path)/iota_wallet.log" let level_filter = "debug" @@ -152,6 +151,9 @@ public class IotaWalletMobile: CAPPlugin { // where it will be converted back to object type ready to use let context = Unmanaged.passRetained(contextResult).toOpaque() + let error_buffer: UnsafeMutablePointer? = nil + let error_buffer_size = 0 + iota_send_message(messageHandler, message, contextResult.callback, context) } @@ -180,23 +182,4 @@ public class IotaWalletMobile: CAPPlugin { call.resolve() } - @objc func clearListeners(_ call: CAPPluginCall) { - guard let handler = call.getInt("messageHandler") else { - return call.reject("handler is required") - } - let messageHandler: OpaquePointer? = OpaquePointer(bitPattern: handler) - - guard let eventTypes = call.getArray("eventTypes") else { - return call.reject("eventTypes is required") - } - let eventChar = eventTypes.description.cString(using: .utf8) - - let contextResult = ContextResult(_call: call) - let context = Unmanaged.passRetained(contextResult).toOpaque() - - iota_clear_listeners( - messageHandler, eventChar, contextResult.callback, context, - error_buffer, error_buffer_size - ) - } } From f3c161c4a2c0ef8da59649128b0d19eaba8664de Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 15 Mar 2023 21:35:15 +0000 Subject: [PATCH 173/197] revert `project.pbxproj` Signed-off-by: Amadeo Marchioni --- .../capacitorjs/ios/Plugin.xcodeproj/project.pbxproj | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj index 7084a43f99..e83b55243c 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj +++ b/wallet/bindings/capacitorjs/ios/Plugin.xcodeproj/project.pbxproj @@ -20,6 +20,7 @@ EE52B7DE29378BFC003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; }; EE52B7E029378C47003728DB /* WalletFramework.xcframework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; + EE5A7DAE29ACAAB900F1D709 /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -64,6 +65,7 @@ 91781294A431A2A7CC6EB714 /* Pods-Plugin.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-Plugin.release.xcconfig"; path = "Pods/Target Support Files/Pods-Plugin/Pods-Plugin.release.xcconfig"; sourceTree = ""; }; 96ED1B6440D6672E406C8D19 /* Pods-PluginTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.debug.xcconfig"; sourceTree = ""; }; EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = WalletFramework.xcframework; sourceTree = ""; }; + EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = "libc++.tbd"; path = "usr/lib/libc++.tbd"; sourceTree = SDKROOT; }; F65BB2953ECE002E1EF3E424 /* Pods-PluginTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-PluginTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-PluginTests/Pods-PluginTests.release.xcconfig"; sourceTree = ""; }; F6753A823D3815DB436415E3 /* Pods_PluginTests.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_PluginTests.framework; sourceTree = BUILT_PRODUCTS_DIR; }; /* End PBXFileReference section */ @@ -74,6 +76,7 @@ buildActionMask = 2147483647; files = ( EE52B7DF29378C47003728DB /* WalletFramework.xcframework in Frameworks */, + EE5A7DAE29ACAAB900F1D709 /* libc++.tbd in Frameworks */, 50ADFFA42020D75100D50D53 /* Capacitor.framework in Frameworks */, 03FC29A292ACC40490383A1F /* Pods_Plugin.framework in Frameworks */, 600FAB17252ED5AC0039D358 /* libresolv.tbd in Frameworks */, @@ -157,6 +160,7 @@ A797B9EFA3DCEFEA1FBB66A9 /* Frameworks */ = { isa = PBXGroup; children = ( + EE5A7DAD29ACAAAE00F1D709 /* libc++.tbd */, EE52B7DC29378BFC003728DB /* WalletFramework.xcframework */, 600FAB16252ED5A30039D358 /* libresolv.tbd */, 50ADFFA52020D75100D50D53 /* Capacitor.framework */, @@ -415,7 +419,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; @@ -469,7 +473,7 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; @@ -493,7 +497,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Plugin/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -526,7 +530,7 @@ DYLIB_INSTALL_NAME_BASE = "@rpath"; INFOPLIST_FILE = Plugin/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", From 237137c5faa3a554ef15f98e42aac20ff5b164fa Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 15 Mar 2023 21:37:48 +0000 Subject: [PATCH 174/197] remove unused variables on `Plugin.swift` Signed-off-by: Amadeo Marchioni --- .../capacitorjs/ios/Plugin/Plugin.swift | 3 -- wallet/bindings/java/lib/native/Cargo.lock | 44 +++++++++++++++---- 2 files changed, 35 insertions(+), 12 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 34b3519658..ada831024b 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -64,9 +64,6 @@ public class IotaWalletMobile: CAPPlugin { // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") - let SecretManager = try? JSONSerialization.data(withJSONObject: secretManager) - let stringfiedSecretManager = String(data: SecretManager!, encoding: .utf8)! - print(stringfiedSecretManager) // prepare the internal app directory path let fm = FileManager.default guard let documents = fm.urls( diff --git a/wallet/bindings/java/lib/native/Cargo.lock b/wallet/bindings/java/lib/native/Cargo.lock index 35a3ac46ec..c0cdf8114f 100644 --- a/wallet/bindings/java/lib/native/Cargo.lock +++ b/wallet/bindings/java/lib/native/Cargo.lock @@ -74,6 +74,24 @@ dependencies = [ "version_check", ] +[[package]] +name = "android_log-sys" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f0fc03f560e1aebde41c2398b691cb98b5ea5996a6184a7a67bbbb77448969" + +[[package]] +name = "android_logger" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fa490e751f3878eb9accb9f18988eca52c2337ce000a8bf31ef50d4c723ca9e" +dependencies = [ + "android_log-sys", + "env_logger", + "log", + "once_cell", +] + [[package]] name = "anyhow" version = "1.0.69" @@ -636,6 +654,15 @@ dependencies = [ "syn", ] +[[package]] +name = "env_logger" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" +dependencies = [ + "log", +] + [[package]] name = "fern" version = "0.6.1" @@ -1118,8 +1145,7 @@ dependencies = [ [[package]] name = "iota-client" version = "2.0.1-rc.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8206762d9c7062a3de9ec8a1653537c51b2d07e58a6589e74b6e70615c2581a" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "async-trait", "backtrace", @@ -1199,20 +1225,17 @@ dependencies = [ [[package]] name = "iota-pow" version = "1.0.0-rc.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73b3ffe5d6ada4c62fa5e5d0a7622893af02ad431d6a6144979686662eee5f1c" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "instant", "iota-crypto", "num_cpus", - "thiserror", ] [[package]] name = "iota-types" -version = "1.0.0-rc.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ac00be923ed4f7ae33c03628d24d03c920f0d6c27806daae57ce735ac240f96" +version = "1.0.0-rc.6" +source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" dependencies = [ "bech32 0.9.1", "bitflags", @@ -1231,7 +1254,6 @@ dependencies = [ "serde-big-array", "serde_json", "serde_repr", - "thiserror", ] [[package]] @@ -1245,6 +1267,7 @@ dependencies = [ "getset", "gloo-storage", "gloo-timers", + "instant", "iota-client", "iota-crypto", "log", @@ -1256,6 +1279,7 @@ dependencies = [ "serde_json", "thiserror", "tokio", + "wasm-bindgen-futures", "zeroize", ] @@ -1263,10 +1287,12 @@ dependencies = [ name = "iota-wallet-java" version = "0.1.0" dependencies = [ + "android_logger", "futures", "iota-wallet", "jni", "lazy_static", + "log", "once_cell", "serde_json", "tokio", From 58a6b3fb6aab942ba8bf95af2b427e7b7fbd94bb Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 15 Mar 2023 21:42:09 +0000 Subject: [PATCH 175/197] fix `Wallet.m` variable Signed-off-by: Amadeo Marchioni --- wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index 4759d35d81..4bf3cafb98 100644 --- a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -+ (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) { +(BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) level_filter { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } From da78000139b863c809bbfbbf1326474654e91581 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Wed, 15 Mar 2023 21:48:51 +0000 Subject: [PATCH 176/197] remove accidentally pushed file`Cargo.lock` Signed-off-by: Amadeo Marchioni --- wallet/bindings/java/lib/native/Cargo.lock | 2867 -------------------- 1 file changed, 2867 deletions(-) delete mode 100644 wallet/bindings/java/lib/native/Cargo.lock diff --git a/wallet/bindings/java/lib/native/Cargo.lock b/wallet/bindings/java/lib/native/Cargo.lock deleted file mode 100644 index c0cdf8114f..0000000000 --- a/wallet/bindings/java/lib/native/Cargo.lock +++ /dev/null @@ -1,2867 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "aead" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b613b8e1e3cf911a086f53f03bf286f52fd7a7258e4fa606f0ef220d39d8877" -dependencies = [ - "generic-array", -] - -[[package]] -name = "aes" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e8b47f52ea9bae42228d07ec09eb676433d7c4ed1ebdf0f1d1c29ed446f1ab8" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "opaque-debug", -] - -[[package]] -name = "aes-gcm" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df5f85a83a7d8b0442b6aa7b504b8212c1733da07b98aae43d4bc21b2cb3cdf6" -dependencies = [ - "aead", - "aes", - "cipher", - "ctr", - "ghash", - "subtle", -] - -[[package]] -name = "ahash" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcb51a0695d8f838b1ee009b3fbf66bda078cd64590202a864a8f3e8c4315c47" -dependencies = [ - "getrandom", - "once_cell", - "version_check", -] - -[[package]] -name = "ahash" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c99f64d1e06488f620f932677e24bc6e2897582980441ae90a671415bd7ec2f" -dependencies = [ - "cfg-if", - "once_cell", - "version_check", -] - -[[package]] -name = "android_log-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27f0fc03f560e1aebde41c2398b691cb98b5ea5996a6184a7a67bbbb77448969" - -[[package]] -name = "android_logger" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fa490e751f3878eb9accb9f18988eca52c2337ce000a8bf31ef50d4c723ca9e" -dependencies = [ - "android_log-sys", - "env_logger", - "log", - "once_cell", -] - -[[package]] -name = "anyhow" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "224afbd727c3d6e4b90103ece64b8d1b67fbb1973b1046c2281eed3f3803f800" - -[[package]] -name = "arrayref" -version = "0.3.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4c527152e37cf757a3f78aae5a06fbeefdb07ccc535c980a3208ee3060dd544" - -[[package]] -name = "arrayvec" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" - -[[package]] -name = "async-trait" -version = "0.1.64" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd7fce9ba8c3c042128ce72d8b2ddbf3a05747efb67ea0313c635e10bda47a2" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - -[[package]] -name = "bech32" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dabbe35f96fb9507f7330793dc490461b2962659ac5d427181e451a623751d1" - -[[package]] -name = "bech32" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d86b93f97252c47b41663388e6d155714a9d0c398b99f1005cbc5f978b29f445" - -[[package]] -name = "bincode" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" -dependencies = [ - "serde", -] - -[[package]] -name = "bindgen" -version = "0.64.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4243e6031260db77ede97ad86c27e501d646a27ab57b59a574f725d98ab1fb4" -dependencies = [ - "bitflags", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitvec" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" -dependencies = [ - "funty", - "radium", - "tap", - "wyz", -] - -[[package]] -name = "blake2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "blake2b_simd" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2f0dc9a68c6317d884f97cc36cf5a3d20ba14ce404227df55e1af708ab04bc" -dependencies = [ - "arrayref", - "arrayvec", - "constant_time_eq 0.2.4", -] - -[[package]] -name = "block-buffer" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" -dependencies = [ - "generic-array", -] - -[[package]] -name = "block-buffer" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69cce20737498f97b993470a6e536b8523f0af7892a4f928cceb1ac5e52ebe7e" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" - -[[package]] -name = "byte-slice-cast" -version = "1.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" - -[[package]] -name = "bytemuck" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" - -[[package]] -name = "byteorder" -version = "1.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c189c53d098945499cdfa7ecc63567cf3886b3332b312a5b4585d8d3a6a610" - -[[package]] -name = "bytes" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b2fd2a0dcf38d7971e2194b6b6eebab45ae01067456a7fd93d5547a61b70be" - -[[package]] -name = "bzip2-sys" -version = "0.1.11+1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" -dependencies = [ - "cc", - "libc", - "pkg-config", -] - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" -dependencies = [ - "jobserver", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chacha20" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c80e5460aa66fe3b91d40bcbdab953a597b60053e34d684ac6903f863b680a6" -dependencies = [ - "cfg-if", - "cipher", - "cpufeatures", - "zeroize", -] - -[[package]] -name = "chacha20poly1305" -version = "0.9.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18446b09be63d457bbec447509e85f662f32952b035ce892290396bc0b0cff5" -dependencies = [ - "aead", - "chacha20", - "cipher", - "poly1305", - "zeroize", -] - -[[package]] -name = "cipher" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ee52072ec15386f770805afd189a01c8841be8696bed250fa2f13c4c0d6dfb7" -dependencies = [ - "generic-array", -] - -[[package]] -name = "clang-sys" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa2e27ae6ab525c3d369ded447057bca5438d86dc3a68f6faafb8269ba82ebf3" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "colored" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4ffc801dacf156c5854b9df4f425a626539c3a6ef7893cc0c5084a23f0b6c59" -dependencies = [ - "atty", - "lazy_static", - "winapi", -] - -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "constant_time_eq" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245097e9a4535ee1e3e3931fcfcd55a796a44c643e8596ff6566d68f09b87bbc" - -[[package]] -name = "constant_time_eq" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3ad85c1f65dc7b37604eb0e89748faf0b9653065f2a8ef69f96a687ec1e9279" - -[[package]] -name = "cpufeatures" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28d997bd5e24a5928dd43e46dc529867e207907fe0b239c3477d924f7f2ca320" -dependencies = [ - "libc", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb766fa798726286dbbb842f174001dab8abc7b627a1dd86e0b7222a95d929f" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctr" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "049bb91fb4aaf0e3c7efa6cd5ef877dbbbd15b39dad06d9948de4ec8a75761ea" -dependencies = [ - "cipher", -] - -[[package]] -name = "curve25519-dalek" -version = "3.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b9fdf9972b2bd6af2d913799d9ebc165ea4d2e65878e329d9c6b372c4491b61" -dependencies = [ - "byteorder", - "digest 0.9.0", - "rand_core 0.5.1", - "subtle", - "zeroize", -] - -[[package]] -name = "darling" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0808e1bd8671fb44a113a14e13497557533369847788fa2ae912b6ebfce9fa8" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "001d80444f28e193f30c2f293455da62dcf9a6b29918a4253152ae2b1de592cb" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn", -] - -[[package]] -name = "darling_macro" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b36230598a2d5de7ec1c6f51f72d8a99a9208daff41de2084d06e3fd3ea56685" -dependencies = [ - "darling_core", - "quote", - "syn", -] - -[[package]] -name = "derive_builder" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d67778784b508018359cbc8696edb3db78160bab2c2a28ba7f56ef6932997f8" -dependencies = [ - "derive_builder_macro", -] - -[[package]] -name = "derive_builder_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c11bdc11a0c47bc7d37d582b5285da6849c96681023680b906673c5707af7b0f" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "derive_builder_macro" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebcda35c7a396850a55ffeac740804b40ffec779b98fffbb1738f4033f0ee79e" -dependencies = [ - "derive_builder_core", - "syn", -] - -[[package]] -name = "derive_more" -version = "0.99.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "digest" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" -dependencies = [ - "generic-array", -] - -[[package]] -name = "digest" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" -dependencies = [ - "block-buffer 0.10.3", - "crypto-common", - "subtle", -] - -[[package]] -name = "dirs" -version = "4.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-next" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b98cf8ebf19c3d1b223e151f99a4f9f0690dca41414773390fc824184ac833e1" -dependencies = [ - "cfg-if", - "dirs-sys-next", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "dirs-sys-next" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - -[[package]] -name = "doc-comment" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10" - -[[package]] -name = "ed25519-zebra" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c24f403d068ad0b359e577a77f92392118be3f3c927538f2bb544a5ecd828c6" -dependencies = [ - "curve25519-dalek", - "hashbrown 0.12.3", - "hex", - "rand_core 0.6.4", - "sha2 0.9.9", - "zeroize", -] - -[[package]] -name = "encoding_rs" -version = "0.8.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071a31f4ee85403370b58aca746f01041ede6f0da2730960ad001edc2b71b394" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "enum-iterator" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c79a6321a1197d7730510c7e3f6cb80432dfefecb32426de8cea0aa19b4bb8d7" -dependencies = [ - "enum-iterator-derive", -] - -[[package]] -name = "enum-iterator-derive" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e94aa31f7c0dc764f57896dc615ddd76fc13b0d5dca7eb6cc5e018a5a09ec06" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "env_logger" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" -dependencies = [ - "log", -] - -[[package]] -name = "fern" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bdd7b0849075e79ee9a1836df22c717d1eba30451796fdc631b04565dd11e2a" -dependencies = [ - "colored", - "log", -] - -[[package]] -name = "fern-logger" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d72fcbd7f804f2dcb89b295dfdfeff1a81338b1960387a45261f857ddc553a9f" -dependencies = [ - "fern", - "log", - "serde", - "thiserror", - "time-helper", -] - -[[package]] -name = "fixed-hash" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" -dependencies = [ - "byteorder", - "rand", - "rustc-hex", - "static_assertions", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "form_urlencoded" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "funty" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" - -[[package]] -name = "futures" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13e2792b0ff0340399d58445b88fd9770e3489eff258a4cbc1523418f12abf84" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e5317663a9089767a1ec00a487df42e0ca174b61b4483213ac24448e4664df5" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec90ff4d0fe1f57d600049061dc6bb68ed03c7d2fbd697274c41805dcb3f8608" - -[[package]] -name = "futures-executor" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8de0a35a6ab97ec8869e32a2473f4b1324459e14c29275d14b10cb1fd19b50e" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", - "num_cpus", -] - -[[package]] -name = "futures-io" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfb8371b6fb2aeb2d280374607aeabfc99d95c72edfe51692e42d3d7f0d08531" - -[[package]] -name = "futures-macro" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a73af87da33b5acf53acfebdc339fe592ecf5357ac7c0a7734ab9d8c876a70" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "futures-sink" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f310820bb3e8cfd46c80db4d7fb8353e15dfff853a127158425f31e0be6c8364" - -[[package]] -name = "futures-task" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf79a1bf610b10f42aea489289c5a2c478a786509693b80cd39c44ccd936366" - -[[package]] -name = "futures-util" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c1d6de3acfef38d2be4b1f543f553131788603495be83da675e180c8d6b7bd1" -dependencies = [ - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite", - "pin-utils", - "slab", -] - -[[package]] -name = "generic-array" -version = "0.14.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bff49e947297f3312447abdca79f45f4738097cc82b06e72054d2223f601f1b9" -dependencies = [ - "typenum", - "version_check", -] - -[[package]] -name = "getrandom" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "getset" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e45727250e75cc04ff2846a66397da8ef2b3db8e40e0cef4df67950a07621eb9" -dependencies = [ - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "ghash" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1583cc1656d7839fd3732b80cf4f38850336cdb9b8ded1cd399ca62958de3c99" -dependencies = [ - "opaque-debug", - "polyval", -] - -[[package]] -name = "gimli" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "221996f774192f0f718773def8201c4ae31f02616a54ccfc2d358bb0e5cefdec" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gloo-storage" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d6ab60bf5dbfd6f0ed1f7843da31b41010515c745735c970e821945ca91e480" -dependencies = [ - "gloo-utils", - "js-sys", - "serde", - "serde_json", - "thiserror", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gloo-timers" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b995a66bb87bebce9a0f4a95aed01daca4872c050bfcb21653361c03bc35e5c" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "gloo-utils" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8e8fc851e9c7b9852508bc6e3f690f452f474417e8545ec9857b7f7377036b5" -dependencies = [ - "js-sys", - "serde", - "serde_json", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "h2" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f9f29bc9dda355256b2916cf526ab02ce0aeaaaf2bad60d65ef3f12f11dd0f4" -dependencies = [ - "bytes", - "fnv", - "futures-core", - "futures-sink", - "futures-util", - "http", - "indexmap", - "slab", - "tokio", - "tokio-util", - "tracing", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" -dependencies = [ - "ahash 0.7.6", -] - -[[package]] -name = "hashbrown" -version = "0.13.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" -dependencies = [ - "ahash 0.8.3", - "serde", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" - -[[package]] -name = "hidapi" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "798154e4b6570af74899d71155fb0072d5b17e6aa12f39c8ef22c60fb8ec99e7" -dependencies = [ - "cc", - "libc", - "pkg-config", - "winapi", -] - -[[package]] -name = "hkdf" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" -dependencies = [ - "hmac", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "http" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399" -dependencies = [ - "bytes", - "fnv", - "itoa", -] - -[[package]] -name = "http-body" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" -dependencies = [ - "bytes", - "http", - "pin-project-lite", -] - -[[package]] -name = "httparse" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" - -[[package]] -name = "httpdate" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" - -[[package]] -name = "hyper" -version = "0.14.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e011372fa0b68db8350aa7a248930ecc7839bf46d8485577d69f117a75f164c" -dependencies = [ - "bytes", - "futures-channel", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "httparse", - "httpdate", - "itoa", - "pin-project-lite", - "socket2", - "tokio", - "tower-service", - "tracing", - "want", -] - -[[package]] -name = "hyper-rustls" -version = "0.23.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" -dependencies = [ - "http", - "hyper", - "rustls", - "tokio", - "tokio-rustls", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "impl-codec" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" -dependencies = [ - "parity-scale-codec", -] - -[[package]] -name = "impl-serde" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" -dependencies = [ - "serde", -] - -[[package]] -name = "impl-trait-for-tuples" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "indexmap" -version = "1.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1885e79c1fc4b10f0e172c475f458b7f7b93061064d98c3293e98c5ba0c8b399" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "iota-client" -version = "2.0.1-rc.6" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "async-trait", - "backtrace", - "derive_builder", - "derive_more", - "futures", - "gloo-timers", - "hashbrown 0.13.2", - "instant", - "iota-crypto", - "iota-ledger-nano", - "iota-pow", - "iota-types", - "iota_stronghold", - "log", - "num_cpus", - "packable", - "prefix-hex", - "primitive-types", - "reqwest", - "serde", - "serde_json", - "thiserror", - "tokio", - "url", - "zeroize", -] - -[[package]] -name = "iota-crypto" -version = "0.15.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e04d492224bff6e97142f033d0a4383bcbc05918be1ff7b3abd2c1cc85205a2" -dependencies = [ - "aead", - "aes", - "aes-gcm", - "autocfg", - "blake2", - "chacha20poly1305", - "curve25519-dalek", - "digest 0.10.6", - "ed25519-zebra", - "generic-array", - "getrandom", - "hmac", - "num-traits", - "pbkdf2", - "serde", - "sha2 0.10.6", - "unicode-normalization", - "x25519-dalek", - "zeroize", -] - -[[package]] -name = "iota-ledger-nano" -version = "1.0.0-alpha.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a3ecb2b7f3881d5ced64dde43ba36864191e90a249853e0dda56a9521a2a3d" -dependencies = [ - "bech32 0.7.3", - "enum-iterator", - "futures", - "hidapi", - "lazy_static", - "ledger-apdu", - "ledger-transport", - "ledger-transport-hid", - "log", - "once_cell", - "serde", - "thiserror", - "trait-async", -] - -[[package]] -name = "iota-pow" -version = "1.0.0-rc.3" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "instant", - "iota-crypto", - "num_cpus", -] - -[[package]] -name = "iota-types" -version = "1.0.0-rc.6" -source = "git+https://github.com/iotaledger/iota.rs?rev=e8422a87c89d3bcc811d41668ddd4d9078d36438#e8422a87c89d3bcc811d41668ddd4d9078d36438" -dependencies = [ - "bech32 0.9.1", - "bitflags", - "bytemuck", - "derive_more", - "getset", - "hashbrown 0.13.2", - "hex", - "iota-crypto", - "iota-pow", - "iterator-sorted", - "packable", - "prefix-hex", - "primitive-types", - "serde", - "serde-big-array", - "serde_json", - "serde_repr", -] - -[[package]] -name = "iota-wallet" -version = "1.0.0-rc.5" -dependencies = [ - "async-trait", - "backtrace", - "fern-logger", - "futures", - "getset", - "gloo-storage", - "gloo-timers", - "instant", - "iota-client", - "iota-crypto", - "log", - "packable", - "prefix-hex", - "primitive-types", - "rocksdb", - "serde", - "serde_json", - "thiserror", - "tokio", - "wasm-bindgen-futures", - "zeroize", -] - -[[package]] -name = "iota-wallet-java" -version = "0.1.0" -dependencies = [ - "android_logger", - "futures", - "iota-wallet", - "jni", - "lazy_static", - "log", - "once_cell", - "serde_json", - "tokio", -] - -[[package]] -name = "iota_stronghold" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c5baaa2460627283f54b968db7a38c9c754dc6059157cae64550ed1b79c91aa" -dependencies = [ - "bincode", - "hkdf", - "iota-crypto", - "rust-argon2", - "serde", - "stronghold-derive", - "stronghold-utils", - "stronghold_engine", - "thiserror", - "zeroize", -] - -[[package]] -name = "ipnet" -version = "2.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30e22bd8629359895450b59ea7a776c850561b96a3b1d31321c1949d9e6c9146" - -[[package]] -name = "iterator-sorted" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d101775d2bc8f99f4ac18bf29b9ed70c0dd138b9a1e88d7b80179470cbbe8bd2" - -[[package]] -name = "itoa" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440" - -[[package]] -name = "jni" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jobserver" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "ledger-apdu" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe435806c197dfeaa5efcded5e623c4b8230fd28fdf1e91e7a86e40ef2acbf90" -dependencies = [ - "arrayref", - "no-std-compat", - "snafu", -] - -[[package]] -name = "ledger-transport" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1117f2143d92c157197785bf57711d7b02f2cfa101e162f8ca7900fb7f976321" -dependencies = [ - "async-trait", - "ledger-apdu", -] - -[[package]] -name = "ledger-transport-hid" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45ba81a1f5f24396b37211478aff7fbcd605dd4544df8dbed07b9da3c2057aee" -dependencies = [ - "byteorder", - "cfg-if", - "hex", - "hidapi", - "ledger-transport", - "libc", - "log", - "thiserror", -] - -[[package]] -name = "libc" -version = "0.2.139" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "librocksdb-sys" -version = "0.10.0+7.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fe4d5874f5ff2bc616e55e8c6086d478fcda13faf9495768a4aa1c22042d30b" -dependencies = [ - "bindgen", - "bzip2-sys", - "cc", - "glob", - "libc", - "libz-sys", - "lz4-sys", -] - -[[package]] -name = "libsodium-sys" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b779387cd56adfbc02ea4a668e704f729be8d6a6abd2c27ca5ee537849a92fd" -dependencies = [ - "cc", - "libc", - "pkg-config", - "walkdir", -] - -[[package]] -name = "libz-sys" -version = "1.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" -dependencies = [ - "cc", - "pkg-config", - "vcpkg", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", - "serde", -] - -[[package]] -name = "lz4-sys" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57d27b317e207b10f69f5e75494119e391a96f48861ae870d1da6edac98ca900" -dependencies = [ - "cc", - "libc", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a60c7ce501c71e03a9c9c0d35b861413ae925bd979cc7a4e30d060069aaac8d" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "mio" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d732bc30207a6423068df043e3d02e0735b155ad7ce1a6f76fe2baa5b158de" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags", - "cfg-if", - "libc", - "memoffset", -] - -[[package]] -name = "no-std-compat" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b93853da6d84c2e3c7d730d6473e8817692dd89be387eb01b94d7f108ecb5b8c" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nom8" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae01545c9c7fc4486ab7debaf2aad7003ac19431791868fb2e8066df97fad2f8" -dependencies = [ - "memchr", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" -dependencies = [ - "hermit-abi 0.2.6", - "libc", -] - -[[package]] -name = "num_threads" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" -dependencies = [ - "libc", -] - -[[package]] -name = "object" -version = "0.30.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66" - -[[package]] -name = "opaque-debug" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" - -[[package]] -name = "packable" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8013e43f83d46fba11c27e96b3c9d152614e085756fad393c1501cc3ecc0cd5" -dependencies = [ - "autocfg", - "packable-derive", - "primitive-types", - "serde", -] - -[[package]] -name = "packable-derive" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9567693dd2f9a4339cb0a54adfcc0cb431c0ac88b2e46c6ddfb5f5d11a1cc4f" -dependencies = [ - "proc-macro-crate", - "proc-macro-error", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "parity-scale-codec" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" -dependencies = [ - "arrayvec", - "bitvec", - "byte-slice-cast", - "impl-trait-for-tuples", - "parity-scale-codec-derive", - "serde", -] - -[[package]] -name = "parity-scale-codec-derive" -version = "3.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "paste" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba" - -[[package]] -name = "pbkdf2" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83a0692ec44e4cf1ef28ca317f14f8f07da2d95ec3fa01f86e4467b725e60917" -dependencies = [ - "digest 0.10.6", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" - -[[package]] -name = "pin-project-lite" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "pkg-config" -version = "0.3.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ac9a59f73473f1b8d852421e59e64809f025994837ef743615c6d0c5b305160" - -[[package]] -name = "poly1305" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "048aeb476be11a4b6ca432ca569e375810de9294ae78f4774e78ea98a9246ede" -dependencies = [ - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "polyval" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8419d2b623c7c0896ff2d5d96e2cb4ede590fed28fcc34934f4c33c036e620a1" -dependencies = [ - "cfg-if", - "cpufeatures", - "opaque-debug", - "universal-hash", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prefix-hex" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75e3396888185b76a6e4c8fc883b3f039e56d3c0bca279744d2df70b3662e784" -dependencies = [ - "hex", - "primitive-types", - "uint", -] - -[[package]] -name = "primitive-types" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f3486ccba82358b11a77516035647c34ba167dfa53312630de83b12bd4f3d66" -dependencies = [ - "fixed-hash", - "impl-codec", - "impl-serde", - "uint", -] - -[[package]] -name = "proc-macro-crate" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "66618389e4ec1c7afe67d51a9bf34ff9236480f8d51e7489b7d5ab0303c13f34" -dependencies = [ - "once_cell", - "toml_edit", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.51" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d727cae5b39d21da60fa540906919ad737832fe0b1c165da3a34d6548c849d6" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radium" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.4", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "redox_syscall" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb5a58c1855b4b6819d59012155603f0b22ad30cad752600aadfcb695265519a" -dependencies = [ - "bitflags", -] - -[[package]] -name = "redox_users" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b033d837a7cf162d7993aded9304e30a83213c648b6e389db233191f891e5c2b" -dependencies = [ - "getrandom", - "redox_syscall", - "thiserror", -] - -[[package]] -name = "regex" -version = "1.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48aaa5748ba571fb95cd2c85c09f629215d3a6ece942baa100950af03a34f733" -dependencies = [ - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.6.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "456c603be3e8d448b072f410900c09faf164fbce2d480456f50eea6e25f9c848" - -[[package]] -name = "reqwest" -version = "0.11.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21eed90ec8570952d53b772ecf8f206aa1ec9a3d76b2521c56c42973f2d91ee9" -dependencies = [ - "base64 0.21.0", - "bytes", - "encoding_rs", - "futures-core", - "futures-util", - "h2", - "http", - "http-body", - "hyper", - "hyper-rustls", - "ipnet", - "js-sys", - "log", - "mime", - "once_cell", - "percent-encoding", - "pin-project-lite", - "rustls", - "rustls-pemfile", - "serde", - "serde_json", - "serde_urlencoded", - "tokio", - "tokio-rustls", - "tower-service", - "url", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "webpki-roots", - "winreg", -] - -[[package]] -name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin", - "untrusted", - "web-sys", - "winapi", -] - -[[package]] -name = "rocksdb" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "015439787fce1e75d55f279078d33ff14b4af5d93d995e8838ee4631301c8a99" -dependencies = [ - "libc", - "librocksdb-sys", -] - -[[package]] -name = "rust-argon2" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b50162d19404029c1ceca6f6980fe40d45c8b369f6f44446fa14bb39573b5bb9" -dependencies = [ - "base64 0.13.1", - "blake2b_simd", - "constant_time_eq 0.1.5", - "crossbeam-utils", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef03e0a2b150c7a90d01faf6254c9c48a41e95fb2a8c2ac1c6f0d2b9aefc342" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc-hex" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" - -[[package]] -name = "rustls" -version = "0.20.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" -dependencies = [ - "log", - "ring", - "sct", - "webpki", -] - -[[package]] -name = "rustls-pemfile" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" -dependencies = [ - "base64 0.21.0", -] - -[[package]] -name = "ryu" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde" - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "sct" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d53dcdb7c9f8158937a7981b48accfd39a43af418591a5d008c7b22b5e1b7ca4" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "serde" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde-big-array" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3323f09a748af288c3dc2474ea6803ee81f118321775bffa3ac8f7e65c5e90e7" -dependencies = [ - "serde", -] - -[[package]] -name = "serde_derive" -version = "1.0.152" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_json" -version = "1.0.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cad406b69c91885b5107daf2c29572f6c8cdb3c66826821e286c533490c0bc76" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_repr" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "serde_urlencoded" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" -dependencies = [ - "form_urlencoded", - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sha2" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" -dependencies = [ - "block-buffer 0.9.0", - "cfg-if", - "cpufeatures", - "digest 0.9.0", - "opaque-debug", -] - -[[package]] -name = "sha2" -version = "0.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest 0.10.6", -] - -[[package]] -name = "shlex" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43b2853a4d09f215c24cc5489c992ce46052d359b5109343cbafbf26bc62f8a3" - -[[package]] -name = "slab" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4614a76b2a8be0058caa9dbbaf66d988527d86d003c11a94fbd335d7661edcef" -dependencies = [ - "autocfg", -] - -[[package]] -name = "snafu" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0656e7e3ffb70f6c39b3c2a86332bb74aa3c679da781642590f3c1118c5045" -dependencies = [ - "doc-comment", - "snafu-derive", -] - -[[package]] -name = "snafu-derive" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "475b3bbe5245c26f2d8a6f62d67c1f30eb9fffeccee721c45d162c3ebbdf81b2" -dependencies = [ - "heck", - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "socket2" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2d2db9033d13a1567121ddd7a095ee144db4e1ca1b1bda3419bc0da294ebd" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stronghold-derive" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2835db23c4724c05a2f85b81c4681f4aa8ea158edc8a7f4ad791c916fb766c2e" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "stronghold-runtime" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d93abb10fbd11335d31c33a70b2523c0caab348215caa2ce6da04a268c30afcb" -dependencies = [ - "dirs", - "iota-crypto", - "libc", - "libsodium-sys", - "log", - "nix", - "rand", - "serde", - "thiserror", - "windows", - "zeroize", -] - -[[package]] -name = "stronghold-utils" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8300214898af5e153e7f66e49dbd1c6a21585f2d592d9f24f58b969792475ed6" -dependencies = [ - "rand", - "stronghold-derive", -] - -[[package]] -name = "stronghold_engine" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d68a609d0a4f05dbde8b704619faa7f861069bbc649e3abecb4d389f10236f" -dependencies = [ - "anyhow", - "dirs-next", - "hex", - "iota-crypto", - "once_cell", - "paste", - "serde", - "stronghold-runtime", - "thiserror", - "zeroize", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" - -[[package]] -name = "syn" -version = "1.0.107" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "synstructure" -version = "0.12.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f36bdaa60a83aca3921b5259d5400cbf5e90fc51931376a9bd4a0eb79aa7210f" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "unicode-xid", -] - -[[package]] -name = "tap" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" - -[[package]] -name = "thiserror" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "time" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" -dependencies = [ - "itoa", - "libc", - "num_threads", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - -[[package]] -name = "time-helper" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17c30f0091717eeeff0b556d830302d5563de8b72fd49127aa5899a06a369808" -dependencies = [ - "time", -] - -[[package]] -name = "time-macros" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2" -dependencies = [ - "time-core", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.25.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e00990ebabbe4c14c08aca901caed183ecd5c09562a12c824bb53d3c3fd3af" -dependencies = [ - "autocfg", - "bytes", - "libc", - "memchr", - "mio", - "num_cpus", - "pin-project-lite", - "socket2", - "tokio-macros", - "windows-sys", -] - -[[package]] -name = "tokio-macros" -version = "1.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d266c00fde287f55d3f1c3e96c500c362a2b8c695076ec180f27918820bc6df8" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "tokio-rustls" -version = "0.23.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" -dependencies = [ - "rustls", - "tokio", - "webpki", -] - -[[package]] -name = "tokio-util" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6a3b08b64e6dfad376fa2432c7b1f01522e37a623c3050bc95db2d3ff21583" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "pin-project-lite", - "tokio", - "tracing", -] - -[[package]] -name = "toml_datetime" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4553f467ac8e3d374bc9a177a26801e5d0f9b211aa1673fb137a403afd1c9cf5" - -[[package]] -name = "toml_edit" -version = "0.18.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56c59d8dd7d0dcbc6428bf7aa2f0e823e26e43b3c9aca15bbc9475d23e5fa12b" -dependencies = [ - "indexmap", - "nom8", - "toml_datetime", -] - -[[package]] -name = "tower-service" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" - -[[package]] -name = "tracing" -version = "0.1.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce8c33a8d48bd45d624a6e523445fd21ec13d3653cd51f681abf67418f54eb8" -dependencies = [ - "cfg-if", - "pin-project-lite", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" -dependencies = [ - "once_cell", -] - -[[package]] -name = "trait-async" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfe8c654712ee594c93b7222d98b4e61c7e003aec49e73877edac607a213699d" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - -[[package]] -name = "try-lock" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "uint" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" -dependencies = [ - "byteorder", - "crunchy", - "hex", - "static_assertions", -] - -[[package]] -name = "unicode-bidi" -version = "0.3.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d54675592c1dbefd78cbd98db9bacd89886e1ca50692a0692baefffdeb92dd58" - -[[package]] -name = "unicode-ident" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "universal-hash" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f214e8f697e925001e66ec2c6e37a4ef93f0f78c2eed7814394e10c62025b05" -dependencies = [ - "generic-array", - "subtle", -] - -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - -[[package]] -name = "url" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", - "serde", -] - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "walkdir" -version = "2.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "808cf2735cd4b6866113f648b791c6adc5714537bc222d9347bb203386ffda56" -dependencies = [ - "same-file", - "winapi", - "winapi-util", -] - -[[package]] -name = "want" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" -dependencies = [ - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.34" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "web-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f095d78192e208183081cc07bc5515ef55216397af48b873e5edcd72637fa1bd" -dependencies = [ - "ring", - "untrusted", -] - -[[package]] -name = "webpki-roots" -version = "0.22.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6c71e40d7d2c34a5106301fb632274ca37242cd0c9d3e64dbece371a40a2d87" -dependencies = [ - "webpki", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e53b97a83176b369b0eb2fd8158d4ae215357d02df9d40c1e1bf1879c5482c80" -dependencies = [ - "windows_aarch64_msvc 0.36.1", - "windows_i686_gnu 0.36.1", - "windows_i686_msvc 0.36.1", - "windows_x86_64_gnu 0.36.1", - "windows_x86_64_msvc 0.36.1", -] - -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc 0.42.1", - "windows_i686_gnu 0.42.1", - "windows_i686_msvc 0.42.1", - "windows_x86_64_gnu 0.42.1", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc 0.42.1", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c9864e83243fdec7fc9c5444389dcbbfd258f745e7853198f365e3c4968a608" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9bb8c3fd39ade2d67e9874ac4f3db21f0d710bee00fe7cab16949ec184eeaa47" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8b1b673ffc16c47a9ff48570a9d85e25d265735c503681332589af6253c6c7" - -[[package]] -name = "windows_i686_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "180e6ccf01daf4c426b846dfc66db1fc518f074baa793aa7d9b9aaeffad6a3b6" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3887528ad530ba7bdbb1faa8275ec7a1155a45ffa57c37993960277145d640" - -[[package]] -name = "windows_i686_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2e7917148b2812d1eeafaeb22a97e4813dfa60a3f8f78ebe204bcc88f12f024" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf4d1122317eddd6ff351aa852118a2418ad4214e6613a50e0191f7004372605" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dcd171b8776c41b97521e5da127a2d86ad280114807d0b2ab1e462bc764d9e1" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1040f221285e17ebccbc2591ffdc2d44ee1f9186324dd3e84e99ac68d699c45" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "628bfdf232daa22b0d64fdb62b09fcc36bb01f05a3939e20ab73aaf9470d0463" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.36.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c811ca4a8c853ef420abd8592ba53ddbbac90410fab6903b3e79972a631f7680" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd" - -[[package]] -name = "winreg" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80d0f4e272c85def139476380b12f9ac60926689dd2e01d4923222f40580869d" -dependencies = [ - "winapi", -] - -[[package]] -name = "wyz" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" -dependencies = [ - "tap", -] - -[[package]] -name = "x25519-dalek" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a0c105152107e3b96f6a00a65e86ce82d9b125230e1c4302940eca58ff71f4f" -dependencies = [ - "curve25519-dalek", - "rand_core 0.5.1", - "zeroize", -] - -[[package]] -name = "zeroize" -version = "1.5.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c394b5bd0c6f669e7275d9c20aa90ae064cb22e75a1cad54e1b34088034b149f" -dependencies = [ - "zeroize_derive", -] - -[[package]] -name = "zeroize_derive" -version = "1.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bf07cb3e50ea2003396695d58bf46bc9887a1f362260446fad6bc4e79bd36c" -dependencies = [ - "proc-macro2", - "quote", - "syn", - "synstructure", -] From 434edd4b7c0ca26b3ed2eeaf59122f327b618d6a Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Thu, 16 Mar 2023 19:03:01 +0000 Subject: [PATCH 177/197] fix script copy libraries Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/add_libs.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/add_libs.sh b/wallet/bindings/capacitorjs/add_libs.sh index ad47c1c00e..b12833dfc1 100755 --- a/wallet/bindings/capacitorjs/add_libs.sh +++ b/wallet/bindings/capacitorjs/add_libs.sh @@ -4,11 +4,10 @@ set -e rm -rf tmp && mkdir tmp && cd tmp echo Installing Java libraries # curl -SL --progress-bar --fail https://github.com/iotaledger/wallet.rs/releases/download/iota-wallet-java-1.0.0-rc.1-new/iota-wallet-1.0.0-rc.1-android.zip > iota-wallet-java.zip -mkdir jniLibs && cd jniLibs curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/jniLibs-1.0.0-alpha.0.zip > iota-wallet-java.zip unzip iota-wallet-java.zip rm -rf ../android/src/main/jniLibs -cd .. && cp -rv jniLibs ../android/src/main +cp -rv jniLibs ../android/src/main curl -SL --progress-bar --fail https://files.iota.org/firefly/bindings/iota-wallet-1.0.0-alpha.0.jar > iota-wallet.jar rm -rf ../android/libs && mkdir -p ../android/libs cp -rv iota-wallet.jar ../android/libs From 2a3f83899c3fed3e24e763081d706616496a7731 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 12:12:40 +0000 Subject: [PATCH 178/197] remove java boilerplate for testing Signed-off-by: Amadeo Marchioni --- .../android/ExampleInstrumentedTest.java | 27 ------------------- 1 file changed, 27 deletions(-) delete mode 100644 wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java diff --git a/wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java b/wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java deleted file mode 100644 index 64f83739d7..0000000000 --- a/wallet/bindings/capacitorjs/android/src/androidTest/java/com/getcapacitor/android/ExampleInstrumentedTest.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.getcapacitor.android; - -import android.content.Context; - -import androidx.test.platform.app.InstrumentationRegistry; -import androidx.test.ext.junit.runners.AndroidJUnit4; - -import org.junit.Test; -import org.junit.runner.RunWith; - -import static org.junit.Assert.*; - -/** - * Instrumented test, which will execute on an Android device. - * - * @see Testing documentation - */ -@RunWith(AndroidJUnit4.class) -public class ExampleInstrumentedTest { - @Test - public void useAppContext() throws Exception { - // Context of the app under test. - Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext(); - - assertEquals("com.getcapacitor.android", appContext.getPackageName()); - } -} From df693b47130fb3d28b3e4ba8865115a03ad3ab29 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 12:15:20 +0000 Subject: [PATCH 179/197] remove `clearListeners` from `Plugin.m` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.m | 1 - 1 file changed, 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m index 1f7c7a7e26..d01f78aa48 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.m @@ -9,6 +9,5 @@ CAP_PLUGIN_METHOD(messageHandlerNew, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(sendMessage, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(listen, CAPPluginReturnCallback); - CAP_PLUGIN_METHOD(clearListeners, CAPPluginReturnPromise); CAP_PLUGIN_METHOD(destroy, CAPPluginReturnPromise); ) From 65da59ccdd0a2fa7df61c082c451ae2b995ae912 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 12:53:24 +0000 Subject: [PATCH 180/197] Remove `clearListeners` from `WalletFramework.h` Signed-off-by: Amadeo Marchioni --- .../WalletFramework.framework/Headers/WalletFramework.h | 1 - .../ios-x86/WalletFramework.framework/Headers/WalletFramework.h | 1 - 2 files changed, 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h index bca40949e9..38dc9deb89 100644 --- a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h +++ b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-arm64/WalletFramework.framework/Headers/WalletFramework.h @@ -18,7 +18,6 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); #ifdef __cplusplus diff --git a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h index bca40949e9..38dc9deb89 100644 --- a/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h +++ b/wallet/bindings/capacitorjs/ios/WalletFramework.xcframework/ios-x86/WalletFramework.framework/Headers/WalletFramework.h @@ -18,7 +18,6 @@ extern iota_wallet_handle_t* iota_initialize(const char* manager_options, char* extern void iota_destroy(iota_wallet_handle_t*); extern void iota_send_message(iota_wallet_handle_t* wallet_handle, const char* message, Callback callback, void* context); extern int8_t iota_listen(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); -extern int8_t iota_clear_listeners(iota_wallet_handle_t* wallet_handle, const char* event_types, Callback callback, void* context, char* error_buffer, size_t error_buffer_size); #ifdef __cplusplus From b4071e6a934dc48ea80d810081f3f57488860da8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 15:13:58 +0000 Subject: [PATCH 181/197] remove old comments, use ios 13 Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Podfile | 29 +------------------------ 1 file changed, 1 insertion(+), 28 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Podfile b/wallet/bindings/capacitorjs/ios/Podfile index 8fdf8429d1..edfaade4e4 100644 --- a/wallet/bindings/capacitorjs/ios/Podfile +++ b/wallet/bindings/capacitorjs/ios/Podfile @@ -1,42 +1,15 @@ -platform :ios, '12.0' +platform :ios, '13.0' def capacitor_pods - # Comment the next line if you're not using Swift and don't want to use dynamic frameworks use_frameworks! pod 'Capacitor', :path => '../node_modules/@capacitor/ios' pod 'CapacitorCordova', :path => '../node_modules/@capacitor/ios' - # pod 'IotaWalletInternal', :podspec => './packages/mobile/capacitor/plugins/iota-wallet/IotaWalletInternal.podspec' - end target 'Plugin' do capacitor_pods - # use_frameworks! - # pod 'IotaWalletInternal', :path => 'WalletFramework.xcframework/' end target 'PluginTests' do capacitor_pods end - -# post_install do |installer| -# installer.pods_project.build_configurations.each do |config| -# config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64" -# end - -# # Add WalletFramework.xcframework as a dependency of IotaWalletMobile -# # Based on https://github.com/CocoaPods/Xcodeproj/issues/408#issuecomment-249347379 -# # and https://www.rubydoc.info/github/CocoaPods/Xcodeproj/Xcodeproj/Project - -# # Get the PBXFileReference to the framework -# pods = installer.pods_project.groups.find { |group| group.name == 'Pods' } -# pod = pods.children.find { |child| child.name == 'ios/WalletFramework.xcframework' } -# frameworks = pod.children.find { |child| child.name == 'Frameworks' } -# framework_file_ref = frameworks.children.first - -# target = installer.pods_project.targets.find { |target| target.name == 'IotaWalletMobile' } - -# # Add the framework to "Link Binary with Libraries" -# frameworks_build_phase = target.build_phases.find { |build_phase| build_phase.to_s == 'FrameworksBuildPhase' } -# frameworks_build_phase.add_file_reference(framework_file_ref) -# end From 5247d9557c07d496ebd191b847a2c54cbf1f78c7 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 15:15:55 +0000 Subject: [PATCH 182/197] Restore to cString Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index ada831024b..492cc69ec2 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -113,7 +113,7 @@ public class IotaWalletMobile: CAPPlugin { iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) // Keep the C++ handler / pointer of the messageHandler call result - let handler: OpaquePointer? = iota_initialize(options, error_buffer, error_buffer_size) + let handler: OpaquePointer? = iota_initialize(options.cString(using: .utf8), error_buffer, error_buffer_size) // Convert pointer to integer keeping bit pattern call.resolve(["messageHandler": Int(bitPattern: handler)]) @@ -151,7 +151,7 @@ public class IotaWalletMobile: CAPPlugin { let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 - iota_send_message(messageHandler, message, contextResult.callback, context) + iota_send_message(messageHandler, message.cString(using: .utf8), contextResult.callback, context) } @objc func listen(_ call: CAPPluginCall) { From d44bc0825401fcafa33210ecdebc13adafa0881d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 15:20:11 +0000 Subject: [PATCH 183/197] remove TODOs at `Plugin.swift` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 7 ------- 1 file changed, 7 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 492cc69ec2..66f8f8302f 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -37,7 +37,6 @@ public class IotaWalletMobile: CAPPlugin { guard let context = context, let response = response else { return } // retain of the object awaiting for the next message. - // TODO: verify it's released later let contextResult = Unmanaged.fromOpaque(context).retain().takeRetainedValue() if let error = error { @@ -61,7 +60,6 @@ public class IotaWalletMobile: CAPPlugin { return call.reject("clientOptions or secretManager is an invalid JSON object") } let ClientOptions = try? JSONSerialization.data(withJSONObject: clientOptions) - // TODO: replacing for urls slashes temporaly, make better using Codable structs with URL type? let stringfiedClientOptions = String(data: ClientOptions!, encoding: .utf8)!.replacingOccurrences(of: "\\", with: "") // prepare the internal app directory path @@ -107,11 +105,6 @@ public class IotaWalletMobile: CAPPlugin { let error_buffer: UnsafeMutablePointer? = nil let error_buffer_size = 0 - // TODO: implement logger as a fn - let filename = "\(path)/iota_wallet.log" - let level_filter = "debug" - iota_init_logger(filename.cString(using: .utf8), level_filter.cString(using: .utf8)) - // Keep the C++ handler / pointer of the messageHandler call result let handler: OpaquePointer? = iota_initialize(options.cString(using: .utf8), error_buffer, error_buffer_size) // Convert pointer to integer keeping bit pattern From 3ad4397d16dfdc30b64a3579e2c91edbc795887c Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 16:18:06 +0000 Subject: [PATCH 184/197] remove unneeded error vars at `sendMessage` swift code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 66f8f8302f..2a9b0a689f 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -141,9 +141,6 @@ public class IotaWalletMobile: CAPPlugin { // where it will be converted back to object type ready to use let context = Unmanaged.passRetained(contextResult).toOpaque() - let error_buffer: UnsafeMutablePointer? = nil - let error_buffer_size = 0 - iota_send_message(messageHandler, message.cString(using: .utf8), contextResult.callback, context) } From d6cdf397bd69e64aa800d7321d05bb9d2aca4e97 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 16:33:21 +0000 Subject: [PATCH 185/197] remove TODOs comments, import the right way `libwallet.h` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.h b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.h index e20890f9b2..e9db01f984 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.h +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.h @@ -2,9 +2,6 @@ // SPDX-License-Identifier: Apache-2.0 #import -// TODO remove then of full test -// to use the walllet-ios-internal 0.2.2 unhide next line -// #import "libwallet.h" //! Project version number for Plugin. FOUNDATION_EXPORT double PluginVersionNumber; @@ -13,4 +10,5 @@ FOUNDATION_EXPORT double PluginVersionNumber; FOUNDATION_EXPORT const unsigned char PluginVersionString[]; // In this header, you should import all the public headers of your framework using statements like #import +#import From 39909c54469ffab756459fe9c5190de0217abbf2 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 16:35:58 +0000 Subject: [PATCH 186/197] remove unneeded call resolve on `Plugin.swift` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift | 1 - 1 file changed, 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift index 2a9b0a689f..9d5054deeb 100644 --- a/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift +++ b/wallet/bindings/capacitorjs/ios/Plugin/Plugin.swift @@ -166,7 +166,6 @@ public class IotaWalletMobile: CAPPlugin { ) call.keepAlive = true - call.resolve() } } From 513c4c7a612791b38519a33b1d58dfd0ed179280 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 16:37:33 +0000 Subject: [PATCH 187/197] remove lacking verify script from 'package.json` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/package.json b/wallet/bindings/capacitorjs/package.json index f2ad1eb3f2..98a3b2d4ab 100644 --- a/wallet/bindings/capacitorjs/package.json +++ b/wallet/bindings/capacitorjs/package.json @@ -14,7 +14,7 @@ "IotaWalletMobile.podspec" ], "scripts": { - "verify": "npm run verify:ios && npm run verify:android && npm run verify:web", + "verify": "npm run verify:ios && npm run verify:android", "verify:ios": "cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin && cd ..", "verify:android": "cd android && ./gradlew clean build test && cd ..", "build": "npm run clean && tsc && rollup -c rollup.config.js", @@ -35,6 +35,7 @@ "dependencies": { "@capacitor/core": "^3.4.1", "@iota/types": "^1.0.0-beta.15", + "rimraf": "^3.0.2", "rollup": "^2.29.0" }, "devDependencies": { @@ -42,7 +43,6 @@ "@capacitor/core": "^3.4.1", "@capacitor/docgen": "^0.0.10", "@capacitor/ios": "^3.4.1", - "rimraf": "^3.0.2", "typescript": "^4.9.4" }, "peerDependencies": { From 0309988cdf61010c98c17856fb25b5103c86cd5f Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:01:56 +0000 Subject: [PATCH 188/197] remove dead code Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/rollup.config.js | 22 ++++++++------------ 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/wallet/bindings/capacitorjs/rollup.config.js b/wallet/bindings/capacitorjs/rollup.config.js index 99d9f6e1c3..d45e21e30b 100644 --- a/wallet/bindings/capacitorjs/rollup.config.js +++ b/wallet/bindings/capacitorjs/rollup.config.js @@ -5,14 +5,14 @@ export default [{ input: ['dist/esm/index.js'], output: [ { - file: 'dist/plugin.js', - format: 'iife', - name: 'capacitorPlugin', - globals: { - '@capacitor/core': 'capacitorExports', - }, - sourcemap: true, - inlineDynamicImports: true, + file: 'dist/plugin.js', + format: 'iife', + name: 'capacitorPlugin', + globals: { + '@capacitor/core': 'capacitorExports', + }, + sourcemap: true, + inlineDynamicImports: true, }, ], external: ['@capacitor/core'], @@ -21,11 +21,7 @@ export default [{ input: ['dist/esm/lib/index.js'], output: [ { - file: 'dist/api.js', - // format: 'iife', - // globals: { - // '@capacitor/core': 'capacitorExports', - // }, + file: 'dist/api.js', }, ], external: ['@capacitor/core'], From faf533d73919fed503223e65df4d67638a57209b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:02:24 +0000 Subject: [PATCH 189/197] remove comments and `clearListeners` function Signed-off-by: Amadeo Marchioni --- .../org/iota/IotaWalletMobile/IotaWalletMobile.java | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index d0a5056af3..657f81bb93 100644 --- a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -126,7 +126,6 @@ public void sendMessage(final PluginCall call) { JsonElement jsonResponse = callBaseApi(walletCommand); JSObject ret = new JSObject(); if (jsonResponse != null) { - Log.d("jsonResponse", jsonResponse.toString()); JsonObject clientResponse = new JsonObject(); clientResponse.addProperty("type", jsonObject.get("cmd").getAsString()); clientResponse.add("payload", jsonResponse); @@ -157,7 +156,6 @@ public void listen(final PluginCall call) throws WalletException, JSONException wallet.listen(new EventListener() { @Override public void receive(Event event) { - Log.d("listen", "Received event " + event.toString()); JSObject walletResponse = new JSObject(); walletResponse.put("result", event.toString()); call.resolve(walletResponse); @@ -180,14 +178,4 @@ public void destroy(final PluginCall call) { } } - @PluginMethod() - public void clearListeners(final PluginCall call) { - try { - wallet.clearListeners(); - call.release(bridge); - } catch (Exception ex) { - call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())); - } - } - } From 994515b436255aaf65137570cd0c89c1f2a30c28 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:06:20 +0000 Subject: [PATCH 190/197] remove `clearListeners` from `definitions.ts` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/definitions.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/definitions.ts b/wallet/bindings/capacitorjs/src/definitions.ts index 3b3bd674ae..b3c7e3eed8 100644 --- a/wallet/bindings/capacitorjs/src/definitions.ts +++ b/wallet/bindings/capacitorjs/src/definitions.ts @@ -22,15 +22,6 @@ export interface IotaWalletMobileTypes { }; result: string; }) => void): Promise; - clearListeners(options: { - eventTypes: EventType[]; - messageHandler: number; - }, callback: (message: { - error: { - cause: unknown; - }; - result: string; - }) => void): Promise; destroy(options: { messageHandler: number; }): Promise; From e5b8d1efdd2699499ed538af32cee3f36802bf3d Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:07:36 +0000 Subject: [PATCH 191/197] remove old ts file from `types` folder Signed-off-by: Amadeo Marchioni --- .../capacitorjs/src/types/incomingTransactionData.ts | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts diff --git a/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts b/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts deleted file mode 100644 index 35c4ce0114..0000000000 --- a/wallet/bindings/capacitorjs/src/types/incomingTransactionData.ts +++ /dev/null @@ -1,6 +0,0 @@ -import type { IOutputMetadataResponse, ITransactionPayload } from '@iota/types'; - -export type IncomingTransactionData = [ - ITransactionPayload, - IOutputMetadataResponse[], -]; From 822e2c478f98d47b0cf9ba2bfef8412927584d0b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:53:21 +0000 Subject: [PATCH 192/197] remove `clearListeners` from `bindings.ts` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/lib/bindings.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/bindings.ts b/wallet/bindings/capacitorjs/src/lib/bindings.ts index 6a5bd11386..37d20af3d1 100644 --- a/wallet/bindings/capacitorjs/src/lib/bindings.ts +++ b/wallet/bindings/capacitorjs/src/lib/bindings.ts @@ -8,7 +8,6 @@ const { sendMessage, messageHandlerNew, listen, - clearListeners, destroy, } = IotaWalletMobile @@ -23,6 +22,5 @@ export { sendMessageAsync, messageHandlerNew, listen, - clearListeners, destroy, } From 3f0f410954f335bf61819de9070746d8ab046f17 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 17:54:24 +0000 Subject: [PATCH 193/197] fix `WalletApi` type definitions Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/lib/WalletApi.ts | 4 ++-- wallet/bindings/capacitorjs/tsconfig.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/lib/WalletApi.ts b/wallet/bindings/capacitorjs/src/lib/WalletApi.ts index 06abe65730..63818923f8 100644 --- a/wallet/bindings/capacitorjs/src/lib/WalletApi.ts +++ b/wallet/bindings/capacitorjs/src/lib/WalletApi.ts @@ -11,8 +11,8 @@ interface ProfileManagers { [key: string]: ProfileManager } const profileManagers: ProfileManagers = {} -// @ts-ignore -const WalletApi: any = { + +const WalletApi = { async createAccountManager(id: AccountId, options: AccountManagerOptions) { const manager = await createAccountManager(options) manager.id = id diff --git a/wallet/bindings/capacitorjs/tsconfig.json b/wallet/bindings/capacitorjs/tsconfig.json index 6c8b987e15..3842a133fb 100644 --- a/wallet/bindings/capacitorjs/tsconfig.json +++ b/wallet/bindings/capacitorjs/tsconfig.json @@ -6,7 +6,7 @@ "allowUnreachableCode": true, "declaration": true, "esModuleInterop": true, - "lib": ["dom", "es2017"], + "lib": ["dom", "esnext"], "module": "esnext", "moduleResolution": "node", "noFallthroughCasesInSwitch": true, From 6e473accba11e11806a5138e935146b3f2072eec Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Fri, 17 Mar 2023 18:29:55 +0000 Subject: [PATCH 194/197] update `Error` type at `definitions.ts` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/definitions.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wallet/bindings/capacitorjs/src/definitions.ts b/wallet/bindings/capacitorjs/src/definitions.ts index b3c7e3eed8..10a690248e 100644 --- a/wallet/bindings/capacitorjs/src/definitions.ts +++ b/wallet/bindings/capacitorjs/src/definitions.ts @@ -17,9 +17,7 @@ export interface IotaWalletMobileTypes { eventTypes: EventType[]; messageHandler: number; }, callback: (message: { - error: { - cause: unknown; - }; + error: Error; result: string; }) => void): Promise; destroy(options: { From 05d2f5e2e73ebdfe13919905f8dc9ae28836d16b Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 20 Mar 2023 15:10:45 +0000 Subject: [PATCH 195/197] fix typo Signed-off-by: Amadeo Marchioni --- wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m index 4bf3cafb98..4aa04b59f4 100644 --- a/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m +++ b/wallet/bindings/swift/xcode/IotaWallet/IotaWallet/Wallet.m @@ -15,7 +15,7 @@ @interface Wallet () { @implementation Wallet -(BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) level_filter { +- (BOOL) init_logger:(NSString*) file_name level_filter: (nullable NSString*) level_filter { return iota_init_logger(file_name.UTF8String, level_filter.UTF8String) == 0 ? YES : NO; } From 31be07d41b9d28b23544b46673e437eb7ed137e8 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 20 Mar 2023 17:15:29 +0000 Subject: [PATCH 196/197] fix call reject with error messages Signed-off-by: Amadeo Marchioni --- .../main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java index 657f81bb93..118a395482 100644 --- a/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java +++ b/wallet/bindings/capacitorjs/android/src/main/java/org/iota/IotaWalletMobile/IotaWalletMobile.java @@ -95,7 +95,7 @@ public void messageHandlerNew(final PluginCall call) throws JSONException { ret.put("messageHandler", messageHandlerPointer); call.resolve(ret); } catch (Exception e) { - e.printStackTrace(); + call.reject(ex.getMessage() + Arrays.toString(ex.getStackTrace())) } } From 2fb135612133ad03bf1ea46c956843d7c04187a7 Mon Sep 17 00:00:00 2001 From: Amadeo Marchioni Date: Mon, 20 Mar 2023 17:19:08 +0000 Subject: [PATCH 197/197] remove non-implemented `initLogger` from `definitions.ts` Signed-off-by: Amadeo Marchioni --- wallet/bindings/capacitorjs/src/definitions.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/wallet/bindings/capacitorjs/src/definitions.ts b/wallet/bindings/capacitorjs/src/definitions.ts index 10a690248e..187394bd83 100644 --- a/wallet/bindings/capacitorjs/src/definitions.ts +++ b/wallet/bindings/capacitorjs/src/definitions.ts @@ -3,7 +3,6 @@ import type { EventType, AccountManagerOptions } from './types'; export interface IotaWalletMobileTypes { - initLogger(path: string): Promise; messageHandlerNew(messageOptions: AccountManagerOptions): Promise<{ messageHandler: number; }>;