diff --git a/.gitignore b/.gitignore index 970241189..5eaf3c18e 100644 --- a/.gitignore +++ b/.gitignore @@ -126,7 +126,7 @@ cw_shared_external/ios/External/ cw_haven/ios/External/ cw_haven/android/.externalNativeBuild/ cw_haven/android/.cxx/ - +cw_zano/ios/External/ lib/bitcoin/bitcoin.dart lib/monero/monero.dart lib/haven/haven.dart @@ -137,6 +137,7 @@ lib/polygon/polygon.dart lib/solana/solana.dart lib/tron/tron.dart lib/wownero/wownero.dart +lib/zano/zano.dart ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_180.png ios/Runner/Assets.xcassets/AppIcon.appiconset/app_icon_120.png diff --git a/assets/images/zano_icon.png b/assets/images/zano_icon.png new file mode 100644 index 000000000..ff3cb023c Binary files /dev/null and b/assets/images/zano_icon.png differ diff --git a/assets/zano_node_list.yml b/assets/zano_node_list.yml new file mode 100644 index 000000000..3ab03b6c9 --- /dev/null +++ b/assets/zano_node_list.yml @@ -0,0 +1,4 @@ +- + uri: zano.org + is_default: true + useSSL: true \ No newline at end of file diff --git a/cw_bitcoin/pubspec.lock b/cw_bitcoin/pubspec.lock index c65f056bb..e27a5f7df 100644 --- a/cw_bitcoin/pubspec.lock +++ b/cw_bitcoin/pubspec.lock @@ -17,30 +17,22 @@ packages: url: "https://pub.dev" source: hosted version: "4.7.0" - archive: - dependency: transitive - description: - name: archive - sha256: cb6a278ef2dbb298455e1a713bda08524a175630ec643a242c399c932a0a1f7d - url: "https://pub.dev" - source: hosted - version: "3.6.1" args: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.5.0" asn1lib: dependency: transitive description: name: asn1lib - sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" + sha256: "58082b3f0dca697204dbab0ef9ff208bfaea7767ea771076af9a343488428dda" url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.5.3" async: dependency: transitive description: @@ -50,10 +42,10 @@ packages: source: hosted version: "2.11.0" bech32: - dependency: "direct main" + dependency: transitive description: path: "." - ref: HEAD + ref: "cake-0.2.2" resolved-ref: "05755063b593aa6cca0a4820a318e0ce17de6192" url: "https://github.com/cake-tech/bech32.git" source: git @@ -84,31 +76,32 @@ packages: source: git version: "1.0.1" bitcoin_base: - dependency: "direct overridden" + dependency: "direct main" description: path: "." - ref: cake-update-v9 - resolved-ref: "86969a14e337383e14965f5fb45a72a63e5009bc" + ref: cake-update-v3 + resolved-ref: cc99eedb1d28ee9376dda0465ef72aa627ac6149 url: "https://github.com/cake-tech/bitcoin_base" source: git - version: "4.7.0" + version: "4.2.1" + bitcoin_flutter: + dependency: "direct main" + description: + path: "." + ref: cake-update-v4 + resolved-ref: e19ffb7e7977278a75b27e0479b3c6f4034223b3 + url: "https://github.com/cake-tech/bitcoin_flutter.git" + source: git + version: "2.1.0" blockchain_utils: dependency: "direct main" description: path: "." - ref: cake-update-v2 - resolved-ref: "59fdf29d72068e0522a96a8953ed7272833a9f57" + ref: cake-update-v1 + resolved-ref: cabd7e0e16c4da9920338c76eff3aeb8af0211f3 url: "https://github.com/cake-tech/blockchain_utils" source: git - version: "3.3.0" - bluez: - dependency: transitive - description: - name: bluez - sha256: "203a1924e818a9dd74af2b2c7a8f375ab8e5edf0e486bba8f90a0d8a17ed9fce" - url: "https://pub.dev" - source: hosted - version: "0.8.2" + version: "2.1.2" boolean_selector: dependency: transitive description: @@ -145,10 +138,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.1" build_resolvers: dependency: "direct dev" description: @@ -161,10 +154,10 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.9" build_runner_core: dependency: transitive description: @@ -189,15 +182,6 @@ packages: url: "https://pub.dev" source: hosted version: "8.9.2" - cake_backup: - dependency: transitive - description: - path: "." - ref: main - resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38" - url: "https://github.com/cake-tech/cake_backup.git" - source: git - version: "1.0.0+1" characters: dependency: transitive description: @@ -250,18 +234,18 @@ packages: dependency: transitive description: name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.6" + version: "3.0.3" cryptography: dependency: "direct main" description: @@ -270,14 +254,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.7.0" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" cw_core: dependency: "direct main" description: @@ -285,13 +261,6 @@ packages: relative: true source: path version: "0.0.1" - cw_mweb: - dependency: "direct main" - description: - path: "../cw_mweb" - relative: true - source: path - version: "0.0.1" dart_style: dependency: transitive description: @@ -308,14 +277,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.3" - dbus: + decimal: dependency: transitive description: - name: dbus - sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" url: "https://pub.dev" source: hosted - version: "0.7.10" + version: "2.3.3" encrypt: dependency: transitive description: @@ -333,37 +302,37 @@ packages: source: hosted version: "1.3.1" ffi: - dependency: "direct overridden" + dependency: transitive description: name: ffi - sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" + sha256: "493f37e7df1804778ff3a53bd691d8692ddf69702cf4c1c1096a2e41b4779e21" url: "https://pub.dev" source: hosted - version: "2.1.0" + version: "2.1.2" ffigen: dependency: transitive description: name: ffigen - sha256: "3e12e80ccb6539bb3917217bb6f32709220efb737de0d0fa8736da0b7cb507da" + sha256: d3e76c2ad48a4e7f93a29a162006f00eba46ce7c08194a77bb5c5e97d1b5ff0a url: "https://pub.dev" source: hosted - version: "12.0.0" + version: "8.0.2" file: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -377,21 +346,16 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.1+1" - flutter_test: - dependency: "direct dev" - description: flutter - source: sdk - version: "0.0.0" - flutter_web_bluetooth: + flutter_reactive_ble: dependency: transitive description: - name: flutter_web_bluetooth - sha256: fcd03e2e5f82edcedcbc940f1b6a0635a50757374183254f447640886c53208e + name: flutter_reactive_ble + sha256: "247e2efa76de203d1ba11335c13754b5b9d0504b5423e5b0c93a600f016b24e0" url: "https://pub.dev" source: hosted - version: "0.2.4" - flutter_web_plugins: - dependency: transitive + version: "5.3.1" + flutter_test: + dependency: "direct dev" description: flutter source: sdk version: "0.0.0" @@ -403,6 +367,14 @@ packages: url: "https://pub.dev" source: hosted version: "4.0.0" + functional_data: + dependency: transitive + description: + name: functional_data + sha256: "76d17dc707c40e552014f5a49c0afcc3f1e3f05e800cd6b7872940bfe41a5039" + url: "https://pub.dev" + source: hosted + version: "1.2.0" glob: dependency: transitive description: @@ -411,38 +383,14 @@ packages: url: "https://pub.dev" source: hosted version: "2.1.2" - google_identity_services_web: - dependency: transitive - description: - name: google_identity_services_web - sha256: "5be191523702ba8d7a01ca97c17fca096822ccf246b0a9f11923a6ded06199b6" - url: "https://pub.dev" - source: hosted - version: "0.3.1+4" - googleapis_auth: - dependency: transitive - description: - name: googleapis_auth - sha256: befd71383a955535060acde8792e7efc11d2fccd03dd1d3ec434e85b68775938 - url: "https://pub.dev" - source: hosted - version: "1.6.0" graphs: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted - version: "2.3.2" - grpc: - dependency: "direct main" - description: - name: grpc - sha256: e93ee3bce45c134bf44e9728119102358c7cd69de7832d9a874e2e74eb8cab40 - url: "https://pub.dev" - source: hosted - version: "3.2.4" + version: "2.3.1" hex: dependency: transitive description: @@ -471,18 +419,10 @@ packages: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "761a297c042deedc1ffbb156d6e2af13886bb305c2a343a4d972504cd67dd938" url: "https://pub.dev" source: hosted - version: "1.2.2" - http2: - dependency: transitive - description: - name: http2 - sha256: "9ced024a160b77aba8fb8674e38f70875e321d319e6f303ec18e87bd5a4b0c1d" - url: "https://pub.dev" - source: hosted - version: "2.3.0" + version: "1.2.1" http_multi_server: dependency: transitive description: @@ -503,10 +443,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -535,68 +475,59 @@ packages: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" ledger_bitcoin: dependency: "direct main" description: - path: "packages/ledger-bitcoin" + path: "." ref: HEAD - resolved-ref: "07cd61ef76a2a017b6d5ef233396740163265457" - url: "https://github.com/cake-tech/ledger-flutter-plus-plugins" - source: git - version: "0.0.3" - ledger_flutter_plus: - dependency: "direct main" - description: - name: ledger_flutter_plus - sha256: c7b04008553193dbca7e17b430768eecc372a72b0ff3625b5e7fc5e5c8d3231b - url: "https://pub.dev" - source: hosted - version: "1.4.1" - ledger_litecoin: - dependency: "direct main" - description: - path: "packages/ledger-litecoin" - ref: HEAD - resolved-ref: "3dee36713e6ebec9dceb59b9ccae7f243a53ea9e" - url: "https://github.com/cake-tech/ledger-flutter-plus-plugins" + resolved-ref: f819d37e235e239c315e93856abbf5e5d3b71dab + url: "https://github.com/cake-tech/ledger-bitcoin" source: git version: "0.0.2" - ledger_usb_plus: - dependency: transitive + ledger_flutter: + dependency: "direct main" description: - name: ledger_usb_plus - sha256: "21cc5d976cf7edb3518bd2a0c4164139cbb0817d2e4f2054707fc4edfdf9ce87" + name: ledger_flutter + sha256: f1680060ed6ff78f275837e0024ccaf667715a59ba7aa29fa7354bc7752e71c8 url: "https://pub.dev" source: hosted - version: "1.0.4" + version: "1.0.1" + ledger_usb: + dependency: transitive + description: + name: ledger_usb + sha256: "52c92d03a4cffe06c82921c8e2f79f3cdad6e1cf78e1e9ca35444196ff8f14c2" + url: "https://pub.dev" + source: hosted + version: "1.0.0" logging: dependency: transitive description: name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.0" matcher: dependency: transitive description: @@ -609,26 +540,26 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.5" mobx: dependency: "direct main" description: @@ -673,18 +604,18 @@ packages: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: c9e7d3a4cd1410877472158bee69963a4579f78b68c65a2b7d40d1a7a88bb161 url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.3" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: a248d8146ee5983446bf03ed5ea8f6533129a12b11f12057ad1b4a67a2b3b41d url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.4" path_provider_foundation: dependency: transitive description: @@ -713,26 +644,18 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.dev" - source: hosted - version: "6.0.2" + version: "2.2.1" platform: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -742,13 +665,13 @@ packages: source: hosted version: "2.1.8" pointycastle: - dependency: "direct overridden" + dependency: transitive description: name: pointycastle - sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" + sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" url: "https://pub.dev" source: hosted - version: "3.7.4" + version: "3.9.1" pool: dependency: transitive description: @@ -758,13 +681,13 @@ packages: source: hosted version: "1.5.1" protobuf: - dependency: "direct overridden" + dependency: transitive description: name: protobuf - sha256: "68645b24e0716782e58948f8467fd42a880f255096a821f9e7d0ec625b00c84d" + sha256: "01dd9bd0fa02548bf2ceee13545d4a0ec6046459d847b6b061d8a27237108a08" url: "https://pub.dev" source: hosted - version: "3.1.0" + version: "2.1.0" provider: dependency: transitive description: @@ -785,82 +708,50 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.3" quiver: dependency: transitive description: name: quiver - sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 + sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 url: "https://pub.dev" source: hosted - version: "3.2.2" + version: "3.2.1" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" + reactive_ble_mobile: + dependency: transitive + description: + name: reactive_ble_mobile + sha256: "9ec2b4c9c725e439950838d551579750060258fbccd5536d0543b4d07d225798" + url: "https://pub.dev" + source: hosted + version: "5.3.1" + reactive_ble_platform_interface: + dependency: transitive + description: + name: reactive_ble_platform_interface + sha256: "632c92401a2d69c9b94bd48f8fd47488a7013f3d1f9b291884350291a4a81813" + url: "https://pub.dev" + source: hosted + version: "5.3.1" rxdart: dependency: "direct main" description: name: rxdart - sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + sha256: "0c7c0cedd93788d996e33041ffecda924cc54389199cde4e6a34b440f50044cb" url: "https://pub.dev" source: hosted - version: "0.28.0" - shared_preferences: - dependency: "direct main" - description: - name: shared_preferences - sha256: "746e5369a43170c25816cc472ee016d3a66bc13fcf430c0bc41ad7b4b2922051" - url: "https://pub.dev" - source: hosted - version: "2.3.2" - shared_preferences_android: - dependency: transitive - description: - name: shared_preferences_android - sha256: "3b9febd815c9ca29c9e3520d50ec32f49157711e143b7a4ca039eb87e8ade5ab" - url: "https://pub.dev" - source: hosted - version: "2.3.3" - shared_preferences_foundation: - dependency: transitive - description: - name: shared_preferences_foundation - sha256: "07e050c7cd39bad516f8d64c455f04508d09df104be326d8c02551590a0d513d" - url: "https://pub.dev" - source: hosted - version: "2.5.3" - shared_preferences_linux: - dependency: transitive - description: - name: shared_preferences_linux - sha256: "580abfd40f415611503cae30adf626e6656dfb2f0cee8f465ece7b6defb40f2f" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_platform_interface: - dependency: transitive - description: - name: shared_preferences_platform_interface - sha256: "57cbf196c486bc2cf1f02b85784932c6094376284b3ad5779d1b1c6c6a816b80" - url: "https://pub.dev" - source: hosted - version: "2.4.1" - shared_preferences_web: - dependency: transitive - description: - name: shared_preferences_web - sha256: d2ca4132d3946fec2184261726b355836a82c33d7d5b67af32692aff18a4684e - url: "https://pub.dev" - source: hosted - version: "2.4.2" - shared_preferences_windows: - dependency: transitive - description: - name: shared_preferences_windows - sha256: "94ef0f72b2d71bc3e700e025db3710911bd51a71cefb65cc609dd0d9a982e3c1" - url: "https://pub.dev" - source: hosted - version: "2.4.1" + version: "0.27.7" shelf: dependency: transitive description: @@ -873,10 +764,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -886,10 +777,10 @@ packages: dependency: transitive description: name: socks5_proxy - sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053" + sha256: "045cbba84f6e2b01c1c77634a63e926352bf110ef5f07fc462c6d43bbd4b6a83" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.5+dev.2" source_gen: dependency: transitive description: @@ -918,8 +809,8 @@ packages: dependency: "direct main" description: path: "." - ref: "sp_v4.0.0" - resolved-ref: ca1add293bd1e06920aa049b655832da50d0dab2 + ref: "sp_v2.0.0" + resolved-ref: "62c152b9086cd968019128845371072f7e1168de" url: "https://github.com/cake-tech/sp_scanner" source: git version: "0.0.1" @@ -967,10 +858,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.1" timing: dependency: transitive description: @@ -979,38 +870,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.4.0" - universal_ble: - dependency: transitive - description: - name: universal_ble - sha256: "0dfbd6b64bff3ad61ed7a895c232530d9614e9b01ab261a74433a43267edb7f3" - url: "https://pub.dev" - source: hosted - version: "0.12.0" - universal_platform: - dependency: transitive - description: - name: universal_platform - sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" - url: "https://pub.dev" - source: hosted - version: "1.1.0" + version: "1.3.2" unorm_dart: dependency: transitive description: @@ -1031,10 +898,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "13.0.0" watcher: dependency: "direct overridden" description: @@ -1047,42 +914,34 @@ packages: dependency: transitive description: name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb + sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27" url: "https://pub.dev" source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" + version: "0.5.1" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42" url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.4.5" + win32: + dependency: transitive + description: + name: win32 + sha256: "0eaf06e3446824099858367950a813472af675116bf63f008a4c2a75ae13e9cb" + url: "https://pub.dev" + source: hosted + version: "5.5.0" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" - source: hosted - version: "6.5.0" + version: "1.0.4" yaml: dependency: transitive description: @@ -1100,5 +959,5 @@ packages: source: hosted version: "2.2.1" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.3.0 <4.0.0" + flutter: ">=3.16.6" diff --git a/cw_core/lib/amount_converter.dart b/cw_core/lib/amount_converter.dart index 1c5456b07..71d0cef42 100644 --- a/cw_core/lib/amount_converter.dart +++ b/cw_core/lib/amount_converter.dart @@ -1,3 +1,5 @@ +import 'package:decimal/decimal.dart'; +import 'package:decimal/intl.dart'; import 'package:intl/intl.dart'; import 'package:cw_core/crypto_currency.dart'; @@ -43,6 +45,8 @@ class AmountConverter { case CryptoCurrency.xnzd: case CryptoCurrency.xusd: return _moneroAmountToString(amount); + case CryptoCurrency.zano: + return _moneroAmountToStringUsingDecimals(amount); default: return ''; } @@ -59,4 +63,10 @@ class AmountConverter { static String _wowneroAmountToString(int amount) => _wowneroAmountFormat .format(cryptoAmountToDouble(amount: amount, divider: _wowneroAmountDivider)); + + static Decimal cryptoAmountToDecimal({required int amount, required int divider}) => + (Decimal.fromInt(amount) / Decimal.fromInt(divider)).toDecimal(); + + static String _moneroAmountToStringUsingDecimals(int amount) => _moneroAmountFormat.format( + DecimalIntl(cryptoAmountToDecimal(amount: amount, divider: _moneroAmountDivider))); } diff --git a/cw_core/lib/crypto_currency.dart b/cw_core/lib/crypto_currency.dart index 0280bb45a..3387a25d0 100644 --- a/cw_core/lib/crypto_currency.dart +++ b/cw_core/lib/crypto_currency.dart @@ -107,6 +107,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen CryptoCurrency.tbtc, CryptoCurrency.wow, CryptoCurrency.ton, + CryptoCurrency.zano, ]; static const havenCurrencies = [ @@ -225,6 +226,7 @@ class CryptoCurrency extends EnumerableItem with Serializable implemen static const tbtc = CryptoCurrency(title: 'tBTC', fullName: 'Testnet Bitcoin', raw: 93, name: 'tbtc', iconPath: 'assets/images/tbtc.png', decimals: 8); static const wow = CryptoCurrency(title: 'WOW', fullName: 'Wownero', raw: 94, name: 'wow', iconPath: 'assets/images/wownero_icon.png', decimals: 11); static const ton = CryptoCurrency(title: 'TON', fullName: 'Toncoin', raw: 95, name: 'ton', iconPath: 'assets/images/ton_icon.png', decimals: 8); + static const zano = CryptoCurrency(title: 'ZANO', tag: 'ZANO', fullName: 'Zano', raw: 96, name: 'zano', iconPath: 'assets/images/zano_icon.png', decimals: 12); static final Map _rawCurrencyMap = diff --git a/cw_core/lib/currency_for_wallet_type.dart b/cw_core/lib/currency_for_wallet_type.dart index af6037a3b..bd1c224a3 100644 --- a/cw_core/lib/currency_for_wallet_type.dart +++ b/cw_core/lib/currency_for_wallet_type.dart @@ -30,8 +30,11 @@ CryptoCurrency currencyForWalletType(WalletType type, {bool? isTestnet}) { return CryptoCurrency.trx; case WalletType.wownero: return CryptoCurrency.wow; + case WalletType.zano: + return CryptoCurrency.zano; case WalletType.none: throw Exception( + 'Unexpected wallet type: ${type.toString()} for CryptoCurrency currencyForWalletType'); } } diff --git a/cw_core/lib/hive_type_ids.dart b/cw_core/lib/hive_type_ids.dart index 0899ac665..0a48c6b1a 100644 --- a/cw_core/lib/hive_type_ids.dart +++ b/cw_core/lib/hive_type_ids.dart @@ -19,4 +19,6 @@ const DERIVATION_INFO_TYPE_ID = 17; const TRON_TOKEN_TYPE_ID = 18; const HARDWARE_WALLET_TYPE_TYPE_ID = 19; const MWEB_UTXO_TYPE_ID = 20; -const HAVEN_SEED_STORE_TYPE_ID = 21; \ No newline at end of file +const HAVEN_SEED_STORE_TYPE_ID = 21; +const ZANO_ASSET_TYPE_ID = 22; + diff --git a/cw_core/lib/node.dart b/cw_core/lib/node.dart index 18d2ffc44..ec44cb257 100644 --- a/cw_core/lib/node.dart +++ b/cw_core/lib/node.dart @@ -108,6 +108,8 @@ class Node extends HiveObject with Keyable { case WalletType.solana: case WalletType.tron: return Uri.https(uriRaw, path ?? ''); + case WalletType.zano: + return Uri.https(uriRaw, ''); case WalletType.none: throw Exception('Unexpected type ${type.toString()} for Node uri'); } @@ -167,6 +169,8 @@ class Node extends HiveObject with Keyable { case WalletType.solana: case WalletType.tron: return requestElectrumServer(); + case WalletType.zano: + return requestZanoNode(); case WalletType.none: return false; } @@ -175,6 +179,11 @@ class Node extends HiveObject with Keyable { } } + Future requestZanoNode() async { + // TODO: fix it + return true; + } + Future requestMoneroNode() async { if (uri.toString().contains(".onion") || useSocksProxy) { return await requestNodeWithProxy(); diff --git a/cw_core/lib/wallet_type.dart b/cw_core/lib/wallet_type.dart index e3957b4e7..79d2b002d 100644 --- a/cw_core/lib/wallet_type.dart +++ b/cw_core/lib/wallet_type.dart @@ -16,6 +16,7 @@ const walletTypes = [ WalletType.polygon, WalletType.solana, WalletType.tron, + WalletType.zano, ]; @HiveType(typeId: WALLET_TYPE_TYPE_ID) @@ -58,6 +59,10 @@ enum WalletType { @HiveField(12) wownero, + + @HiveField(13) + zano, + } int serializeToInt(WalletType type) { @@ -86,6 +91,8 @@ int serializeToInt(WalletType type) { return 10; case WalletType.wownero: return 11; + case WalletType.zano: + return 12; case WalletType.none: return -1; } @@ -117,8 +124,11 @@ WalletType deserializeFromInt(int raw) { return WalletType.tron; case 11: return WalletType.wownero; + case 12: + return WalletType.zano; default: - throw Exception('Unexpected token: $raw for WalletType deserializeFromInt'); + throw Exception( + 'Unexpected token: $raw for WalletType deserializeFromInt'); } } @@ -148,6 +158,8 @@ String walletTypeToString(WalletType type) { return 'Tron'; case WalletType.wownero: return 'Wownero'; + case WalletType.zano: + return 'Zano'; case WalletType.none: return ''; } @@ -179,6 +191,8 @@ String walletTypeToDisplayName(WalletType type) { return 'Tron (TRX)'; case WalletType.wownero: return 'Wownero (WOW)'; + case WalletType.zano: + return 'Zano (ZANO)'; case WalletType.none: return ''; } @@ -213,6 +227,8 @@ CryptoCurrency walletTypeToCryptoCurrency(WalletType type, {bool isTestnet = fal return CryptoCurrency.trx; case WalletType.wownero: return CryptoCurrency.wow; + case WalletType.zano: + return CryptoCurrency.zano; case WalletType.none: throw Exception( 'Unexpected wallet type: ${type.toString()} for CryptoCurrency walletTypeToCryptoCurrency'); diff --git a/cw_core/pubspec.lock b/cw_core/pubspec.lock index c12839a19..343c7c4e3 100644 --- a/cw_core/pubspec.lock +++ b/cw_core/pubspec.lock @@ -5,39 +5,34 @@ packages: dependency: transitive description: name: _fe_analyzer_shared - sha256: f256b0c0ba6c7577c15e2e4e114755640a875e885099367bf6e012b19314c834 + sha256: eb376e9acf6938204f90eb3b1f00b578640d3188b4c8a8ec054f9f479af8d051 url: "https://pub.dev" source: hosted - version: "72.0.0" - _macros: - dependency: transitive - description: dart - source: sdk - version: "0.3.2" + version: "64.0.0" analyzer: dependency: transitive description: name: analyzer - sha256: b652861553cd3990d8ed361f7979dc6d7053a9ac8843fa73820ab68ce5410139 + sha256: "69f54f967773f6c26c7dcb13e93d7ccee8b17a641689da39e878d5cf13b06893" url: "https://pub.dev" source: hosted - version: "6.7.0" + version: "6.2.0" args: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596 url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.4.2" asn1lib: dependency: transitive description: name: asn1lib - sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" + sha256: "21afe4333076c02877d14f4a89df111e658a6d466cbfc802eb705eb91bd5adfd" url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.5.0" async: dependency: transitive description: @@ -74,10 +69,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "0343061a33da9c5810b2d6cee51945127d8f4c060b7fbdd9d54917f0a3feaaa1" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.1" build_resolvers: dependency: "direct dev" description: @@ -90,18 +85,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "581bacf68f89ec8792f5e5a0b2c4decd1c948e97ce659dc783688c8a88fbec21" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.8" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: f8126682b87a7282a339b871298cc12009cb67109cfa1614d6436fb0289193e0 + sha256: c9e32d21dd6626b5c163d48b037ce906bbe428bc23ab77bcd77bb21e593b6185 url: "https://pub.dev" source: hosted - version: "7.3.2" + version: "7.2.11" built_collection: dependency: transitive description: @@ -114,19 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: c9aabae0718ec394e5bc3c7272e6bb0dc0b32201a08fe185ec1d8401d3e39309 url: "https://pub.dev" source: hosted - version: "8.9.2" - cake_backup: - dependency: "direct main" - description: - path: "." - ref: main - resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38" - url: "https://github.com/cake-tech/cake_backup.git" - source: git - version: "1.0.0+1" + version: "8.8.1" characters: dependency: transitive description: @@ -171,42 +157,34 @@ packages: dependency: transitive description: name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab url: "https://pub.dev" source: hosted - version: "3.0.6" - cryptography: - dependency: transitive - description: - name: cryptography - sha256: d146b76d33d94548cf035233fbc2f4338c1242fa119013bead807d033fc4ae05 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" + version: "3.0.3" dart_style: dependency: transitive description: name: dart_style - sha256: "7856d364b589d1f08986e140938578ed36ed948581fbc3bc9aef1805039ac5ab" + sha256: "40ae61a5d43feea6d24bd22c0537a6629db858963b99b4bc1c3db80676f32368" url: "https://pub.dev" source: hosted - version: "2.3.7" + version: "2.3.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" + url: "https://pub.dev" + source: hosted + version: "2.3.3" encrypt: dependency: "direct main" description: @@ -227,26 +205,26 @@ packages: dependency: transitive description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.0" file: dependency: "direct main" description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -256,10 +234,10 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" + sha256: "4a5d062ff85ed3759f4aac6410ff0ffae32e324b2e71ca722ae1b37b32e865f4" url: "https://pub.dev" source: hosted - version: "2.2.1+1" + version: "2.2.0+2" flutter_test: dependency: "direct dev" description: flutter @@ -269,10 +247,10 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "3.2.0" glob: dependency: transitive description: @@ -285,10 +263,10 @@ packages: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + sha256: aedc5a15e78fc65a6e23bcd927f24c64dd995062bcd1ca6eda65a3cff92a4d19 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.3.1" hive: dependency: transitive description: @@ -309,10 +287,10 @@ packages: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -333,10 +311,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -357,50 +335,42 @@ packages: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: b10a7b2ff83d83c777edba3c6a0f97045ddadd56c944e1a23a3fdf43a1bf4467 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.8.1" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" logging: dependency: transitive description: name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340" url: "https://pub.dev" source: hosted - version: "1.3.0" - macros: - dependency: transitive - description: - name: macros - sha256: "0acaed5d6b7eab89f63350bccd82119e6c602df0f391260d0e32b5e23db79536" - url: "https://pub.dev" - source: hosted - version: "0.1.2-main.4" + version: "1.2.0" matcher: dependency: transitive description: @@ -413,42 +383,42 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" mobx: dependency: "direct main" description: name: mobx - sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" + sha256: "74ee54012dc7c1b3276eaa960a600a7418ef5f9997565deb8fca1fd88fb36b78" url: "https://pub.dev" source: hosted - version: "2.3.3+2" + version: "2.3.0+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: "8e0d8653a0c720ad933cd8358f6f89f740ce89203657c13f25bea772ef1fff7c" + sha256: b26c7f9c20b38f0ea572c1ed3f29d8e027cb265538bbd1aed3ec198642cfca42 url: "https://pub.dev" source: hosted - version: "2.6.1" + version: "2.6.0+1" nested: dependency: transitive description: @@ -477,26 +447,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: b27217933eeeba8ff24845c34003b003b2b22151de3c908d0e679e8fe1aa078b url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.2" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: "477184d672607c0a3bf68fbbf601805f92ef79c82b64b4d6eb318cbca4c48668" url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.2" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "5a7999be66e000916500be4f15a3633ebceb8302719b47b9cc49ce924125350f" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.2" path_provider_linux: dependency: transitive description: @@ -517,18 +487,18 @@ packages: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.2.1" platform: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.4" plugin_platform_interface: dependency: transitive description: @@ -541,10 +511,10 @@ packages: dependency: transitive description: name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + sha256: "43ac87de6e10afabc85c445745a7b799e04de84cebaa4fd7bf55a5e1e9604d29" url: "https://pub.dev" source: hosted - version: "3.9.1" + version: "3.7.4" pool: dependency: transitive description: @@ -557,10 +527,10 @@ packages: dependency: transitive description: name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + sha256: "9a96a0a19b594dbc5bf0f1f27d2bc67d5f95957359b461cd9feb44ed6ae75096" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "6.1.1" pub_semver: dependency: transitive description: @@ -573,10 +543,18 @@ packages: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: c63b2876e58e194e4b0828fcb080ad0e06d051cb607a6be51a9e084f47cb9367 url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.3" + rational: + dependency: transitive + description: + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf + url: "https://pub.dev" + source: hosted + version: "2.2.2" shelf: dependency: transitive description: @@ -589,10 +567,10 @@ packages: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1" url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" sky_engine: dependency: transitive description: flutter @@ -602,10 +580,10 @@ packages: dependency: "direct main" description: name: socks5_proxy - sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053" + sha256: "1d21b5606169654bbf4cfb904e8e6ed897e9f763358709f87310c757096d909a" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.4" source_gen: dependency: transitive description: @@ -674,10 +652,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.1" timing: dependency: transitive description: @@ -686,22 +664,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.2" unorm_dart: dependency: "direct main" description: @@ -722,10 +692,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "13.0.0" watcher: dependency: "direct overridden" description: @@ -734,38 +704,30 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + sha256: d88238e5eac9a42bb43ca4e721edba3c08c6354d4a53063afaa568516217621b url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.4.0" + win32: + dependency: transitive + description: + name: win32 + sha256: "350a11abd2d1d97e0cc7a28a81b781c08002aa2864d9e3f192ca0ffa18b06ed3" + url: "https://pub.dev" + source: hosted + version: "5.0.9" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: faea9dee56b520b55a566385b84f2e8de55e7496104adada9962e0bd11bcff1d url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "1.0.4" yaml: dependency: transitive description: @@ -775,5 +737,5 @@ packages: source: hosted version: "3.1.2" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=3.10.0" diff --git a/cw_core/pubspec.yaml b/cw_core/pubspec.yaml index 19eda51e0..80722bbb7 100644 --- a/cw_core/pubspec.yaml +++ b/cw_core/pubspec.yaml @@ -24,6 +24,7 @@ dependencies: url: https://github.com/cake-tech/cake_backup.git ref: main version: 1.0.0 + decimal: ^2.3.3 socks5_proxy: ^1.0.4 unorm_dart: ^0.3.0 # tor: diff --git a/cw_haven/pubspec.lock b/cw_haven/pubspec.lock index b6cae9f39..3fa2d7f0c 100644 --- a/cw_haven/pubspec.lock +++ b/cw_haven/pubspec.lock @@ -21,18 +21,18 @@ packages: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.3.2" asn1lib: dependency: transitive description: name: asn1lib - sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" + sha256: ab96a1cb3beeccf8145c52e449233fe68364c9641623acd3adad66f8184f1039 url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.4.0" async: dependency: transitive description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.1" build_config: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.0" build_resolvers: dependency: "direct dev" description: @@ -85,18 +85,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.9" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "7.2.7" built_collection: dependency: transitive description: @@ -109,19 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" url: "https://pub.dev" source: hosted - version: "8.9.2" - cake_backup: - dependency: transitive - description: - path: "." - ref: main - resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38" - url: "https://github.com/cake-tech/cake_backup.git" - source: git - version: "1.0.0+1" + version: "8.4.3" characters: dependency: transitive description: @@ -134,10 +125,10 @@ packages: dependency: transitive description: name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "2.0.2" clock: dependency: transitive description: @@ -150,10 +141,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.4.0" collection: dependency: transitive description: @@ -166,34 +157,18 @@ packages: dependency: transitive description: name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 url: "https://pub.dev" source: hosted - version: "3.0.6" - cryptography: - dependency: transitive - description: - name: cryptography - sha256: d146b76d33d94548cf035233fbc2f4338c1242fa119013bead807d033fc4ae05 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" + version: "3.0.2" cw_core: dependency: "direct main" description: @@ -209,14 +184,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: transitive + description: + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" + url: "https://pub.dev" + source: hosted + version: "2.3.3" encrypt: dependency: transitive description: name: encrypt - sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + sha256: "4fd4e4fdc21b9d7d4141823e1e6515cd94e7b8d84749504c232999fba25d9bbb" url: "https://pub.dev" source: hosted - version: "5.0.3" + version: "5.0.1" fake_async: dependency: transitive description: @@ -229,26 +212,26 @@ packages: dependency: "direct main" description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.0.1" file: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -258,10 +241,10 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" + sha256: "0da4add0016387a7bf309a0d0c41d36c6b3ae25ed7a176409267f166509e723e" url: "https://pub.dev" source: hosted - version: "2.2.1+1" + version: "2.0.6+5" flutter_test: dependency: "direct dev" description: flutter @@ -271,26 +254,26 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "3.2.0" glob: dependency: transitive description: name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" graphs: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.2.0" hive: dependency: transitive description: @@ -311,10 +294,10 @@ packages: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -335,10 +318,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -359,42 +342,42 @@ packages: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.8.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" logging: dependency: transitive description: name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.1.1" matcher: dependency: transitive description: @@ -407,50 +390,42 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" mobx: dependency: "direct main" description: name: mobx - sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" + sha256: f1862bd92c6a903fab67338f27e2f731117c3cb9ea37cee1a487f9e4e0de314a url: "https://pub.dev" source: hosted - version: "2.3.3+2" + version: "2.1.3+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: d4beb9cea4b7b014321235f8fdc7c2193ee0fe1d1198e9da7403f8bc85c4407c + sha256: "86122e410d8ea24dda0c69adb5c2a6ccadd5ce02ad46e144764e0d0184a06181" url: "https://pub.dev" source: hosted - version: "2.3.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" + version: "2.1.1" package_config: dependency: transitive description: @@ -471,26 +446,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.1" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.1" path_provider_linux: dependency: transitive description: @@ -503,42 +478,42 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.2.1" platform: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.1.3" pointycastle: dependency: transitive description: name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 url: "https://pub.dev" source: hosted - version: "3.9.1" + version: "3.6.2" pool: dependency: transitive description: @@ -547,46 +522,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - provider: + process: dependency: transitive description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "4.2.4" pub_semver: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.3" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" + rational: + dependency: transitive + description: + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf + url: "https://pub.dev" + source: hosted + version: "2.2.2" shelf: dependency: transitive description: name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -596,10 +579,10 @@ packages: dependency: transitive description: name: socks5_proxy - sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053" + sha256: "1d21b5606169654bbf4cfb904e8e6ed897e9f763358709f87310c757096d909a" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.4" source_gen: dependency: transitive description: @@ -668,10 +651,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.1" timing: dependency: transitive description: @@ -680,22 +663,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.1" unorm_dart: dependency: transitive description: @@ -716,10 +691,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "13.0.0" watcher: dependency: "direct overridden" description: @@ -728,46 +703,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" + source: hosted + version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "0.2.0+3" yaml: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=3.7.0" diff --git a/cw_monero/pubspec.lock b/cw_monero/pubspec.lock index 24be1c0dd..ab98fa721 100644 --- a/cw_monero/pubspec.lock +++ b/cw_monero/pubspec.lock @@ -21,18 +21,18 @@ packages: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.3.2" asn1lib: dependency: transitive description: name: asn1lib - sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" + sha256: ab96a1cb3beeccf8145c52e449233fe68364c9641623acd3adad66f8184f1039 url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.4.0" async: dependency: transitive description: @@ -41,14 +41,6 @@ packages: url: "https://pub.dev" source: hosted version: "2.11.0" - bluez: - dependency: transitive - description: - name: bluez - sha256: "203a1924e818a9dd74af2b2c7a8f375ab8e5edf0e486bba8f90a0d8a17ed9fce" - url: "https://pub.dev" - source: hosted - version: "0.8.2" boolean_selector: dependency: transitive description: @@ -61,10 +53,10 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.1" build_config: dependency: transitive description: @@ -77,10 +69,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.0" build_resolvers: dependency: "direct dev" description: @@ -93,18 +85,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.9" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "7.2.7" built_collection: dependency: transitive description: @@ -117,19 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" url: "https://pub.dev" source: hosted - version: "8.9.2" - cake_backup: - dependency: transitive - description: - path: "." - ref: main - resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38" - url: "https://github.com/cake-tech/cake_backup.git" - source: git - version: "1.0.0+1" + version: "8.4.3" characters: dependency: transitive description: @@ -142,10 +125,10 @@ packages: dependency: transitive description: name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "2.0.2" clock: dependency: transitive description: @@ -158,10 +141,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.4.0" collection: dependency: transitive description: @@ -174,34 +157,18 @@ packages: dependency: transitive description: name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 url: "https://pub.dev" source: hosted - version: "3.0.6" - cryptography: - dependency: transitive - description: - name: cryptography - sha256: d146b76d33d94548cf035233fbc2f4338c1242fa119013bead807d033fc4ae05 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" + version: "3.0.2" cw_core: dependency: "direct main" description: @@ -217,22 +184,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" - dbus: + decimal: dependency: transitive description: - name: dbus - sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac" + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" url: "https://pub.dev" source: hosted - version: "0.7.10" + version: "2.3.3" encrypt: dependency: "direct main" description: name: encrypt - sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + sha256: "4fd4e4fdc21b9d7d4141823e1e6515cd94e7b8d84749504c232999fba25d9bbb" url: "https://pub.dev" source: hosted - version: "5.0.3" + version: "5.0.1" fake_async: dependency: transitive description: @@ -245,26 +212,26 @@ packages: dependency: "direct main" description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.0" file: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -274,63 +241,55 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" + sha256: "0da4add0016387a7bf309a0d0c41d36c6b3ae25ed7a176409267f166509e723e" url: "https://pub.dev" source: hosted - version: "2.2.1+1" + version: "2.0.6+5" flutter_test: dependency: "direct dev" description: flutter source: sdk version: "0.0.0" - flutter_web_bluetooth: - dependency: transitive - description: - name: flutter_web_bluetooth - sha256: "52ce64f65d7321c4bf6abfe9dac02fb888731339a5e0ad6de59fb916c20c9f02" - url: "https://pub.dev" - source: hosted - version: "0.2.3" frontend_server_client: dependency: transitive description: name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "3.2.0" glob: dependency: transitive description: name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" graphs: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.2.0" hashlib: dependency: transitive description: name: hashlib - sha256: f572f2abce09fc7aee53f15927052b9732ea1053e540af8cae211111ee0b99b1 + sha256: "71bf102329ddb8e50c8a995ee4645ae7f1728bb65e575c17196b4d8262121a96" url: "https://pub.dev" source: hosted - version: "1.21.0" + version: "1.12.0" hashlib_codecs: dependency: transitive description: name: hashlib_codecs - sha256: "8cea9ccafcfeaa7324d2ae52c61c69f7ff71f4237507a018caab31b9e416e3b1" + sha256: "49e2a471f74b15f1854263e58c2ac11f2b631b5b12c836f9708a35397d36d626" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.2.0" hive: dependency: transitive description: @@ -351,10 +310,10 @@ packages: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -375,10 +334,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -399,58 +358,42 @@ packages: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.8.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" - ledger_flutter_plus: - dependency: "direct main" - description: - name: ledger_flutter_plus - sha256: c7b04008553193dbca7e17b430768eecc372a72b0ff3625b5e7fc5e5c8d3231b - url: "https://pub.dev" - source: hosted - version: "1.4.1" - ledger_usb_plus: - dependency: transitive - description: - name: ledger_usb_plus - sha256: "21cc5d976cf7edb3518bd2a0c4164139cbb0817d2e4f2054707fc4edfdf9ce87" - url: "https://pub.dev" - source: hosted - version: "1.0.4" + version: "2.0.1" logging: dependency: transitive description: name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.1.1" matcher: dependency: transitive description: @@ -463,49 +406,49 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" mobx: dependency: "direct main" description: name: mobx - sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" + sha256: f1862bd92c6a903fab67338f27e2f731117c3cb9ea37cee1a487f9e4e0de314a url: "https://pub.dev" source: hosted - version: "2.3.3+2" + version: "2.1.3+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: d4beb9cea4b7b014321235f8fdc7c2193ee0fe1d1198e9da7403f8bc85c4407c + sha256: "86122e410d8ea24dda0c69adb5c2a6ccadd5ce02ad46e144764e0d0184a06181" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.1.1" monero: dependency: "direct main" description: - path: "impls/monero.dart" - ref: af5277f96073917185864d3596e82b67bee54e78 - resolved-ref: af5277f96073917185864d3596e82b67bee54e78 - url: "https://github.com/mrcyjanek/monero_c" + path: "." + ref: d46753eca865e9e56c2f0ef6fe485c42e11982c5 + resolved-ref: d46753eca865e9e56c2f0ef6fe485c42e11982c5 + url: "https://github.com/mrcyjanek/monero.dart" source: git version: "0.0.0" mutex: @@ -516,14 +459,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" package_config: dependency: transitive description: @@ -544,26 +479,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.1" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.1" path_provider_linux: dependency: transitive description: @@ -576,58 +511,50 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" - petitparser: - dependency: transitive - description: - name: petitparser - sha256: c15605cd28af66339f8eb6fbe0e541bfe2d1b72d5825efc6598f3e0a31b9ad27 - url: "https://pub.dev" - source: hosted - version: "6.0.2" + version: "2.2.1" platform: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.1.3" pointycastle: dependency: transitive description: name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" url: "https://pub.dev" source: hosted - version: "3.9.1" + version: "3.7.3" polyseed: dependency: "direct main" description: name: polyseed - sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770" + sha256: edf28042e7b0b28f97a0469aa98e6e4015937cef6b9340cd6ad2822139c95217 url: "https://pub.dev" source: hosted - version: "0.0.6" + version: "0.0.5" pool: dependency: transitive description: @@ -636,54 +563,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - provider: + process: dependency: transitive description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "4.2.4" pub_semver: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.3" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" url: "https://pub.dev" source: hosted - version: "1.3.0" - rxdart: + version: "1.2.1" + rational: dependency: transitive description: - name: rxdart - sha256: "5c3004a4a8dbb94bd4bf5412a4def4acdaa12e12f269737a5751369e12d1a962" + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf url: "https://pub.dev" source: hosted - version: "0.28.0" + version: "2.2.2" shelf: dependency: transitive description: name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -693,10 +620,10 @@ packages: dependency: transitive description: name: socks5_proxy - sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053" + sha256: "1d21b5606169654bbf4cfb904e8e6ed897e9f763358709f87310c757096d909a" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.4" source_gen: dependency: transitive description: @@ -765,10 +692,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.1" timing: dependency: transitive description: @@ -777,38 +704,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" url: "https://pub.dev" source: hosted - version: "1.4.0" - universal_ble: - dependency: transitive - description: - name: universal_ble - sha256: "0dfbd6b64bff3ad61ed7a895c232530d9614e9b01ab261a74433a43267edb7f3" - url: "https://pub.dev" - source: hosted - version: "0.12.0" - universal_platform: - dependency: transitive - description: - name: universal_platform - sha256: "64e16458a0ea9b99260ceb5467a214c1f298d647c659af1bff6d3bf82536b1ec" - url: "https://pub.dev" - source: hosted - version: "1.1.0" + version: "1.3.1" unorm_dart: dependency: transitive description: @@ -829,10 +732,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "13.0.0" watcher: dependency: "direct overridden" description: @@ -841,54 +744,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" + source: hosted + version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 url: "https://pub.dev" source: hosted - version: "1.1.0" - xml: - dependency: transitive - description: - name: xml - sha256: b015a8ad1c488f66851d762d3090a21c600e479dc75e68328c52774040cf9226 - url: "https://pub.dev" - source: hosted - version: "6.5.0" + version: "0.2.0+3" yaml: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=3.7.0" diff --git a/cw_wownero/pubspec.lock b/cw_wownero/pubspec.lock index 1e16fa089..910786ded 100644 --- a/cw_wownero/pubspec.lock +++ b/cw_wownero/pubspec.lock @@ -21,18 +21,18 @@ packages: dependency: transitive description: name: args - sha256: bf9f5caeea8d8fe6721a9c358dd8a5c1947b27f1cfaa18b39c301273594919e6 + sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.3.2" asn1lib: dependency: transitive description: name: asn1lib - sha256: "6b151826fcc95ff246cd219a0bf4c753ea14f4081ad71c61939becf3aba27f70" + sha256: ab96a1cb3beeccf8145c52e449233fe68364c9641623acd3adad66f8184f1039 url: "https://pub.dev" source: hosted - version: "1.5.5" + version: "1.4.0" async: dependency: transitive description: @@ -53,10 +53,10 @@ packages: dependency: transitive description: name: build - sha256: "80184af8b6cb3e5c1c4ec6d8544d27711700bc3e6d2efad04238c7b5290889f0" + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" url: "https://pub.dev" source: hosted - version: "2.4.1" + version: "2.3.1" build_config: dependency: transitive description: @@ -69,10 +69,10 @@ packages: dependency: transitive description: name: build_daemon - sha256: "79b2aef6ac2ed00046867ed354c88778c9c0f029df8a20fe10b5436826721ef9" + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" url: "https://pub.dev" source: hosted - version: "4.0.2" + version: "4.0.0" build_resolvers: dependency: "direct dev" description: @@ -85,18 +85,18 @@ packages: dependency: "direct dev" description: name: build_runner - sha256: "028819cfb90051c6b5440c7e574d1896f8037e3c96cf17aaeb054c9311cfbf4d" + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" url: "https://pub.dev" source: hosted - version: "2.4.13" + version: "2.4.9" build_runner_core: dependency: transitive description: name: build_runner_core - sha256: "6d6ee4276b1c5f34f21fdf39425202712d2be82019983d52f351c94aafbc2c41" + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" url: "https://pub.dev" source: hosted - version: "7.2.10" + version: "7.2.7" built_collection: dependency: transitive description: @@ -109,19 +109,10 @@ packages: dependency: transitive description: name: built_value - sha256: c7913a9737ee4007efedaffc968c049fd0f3d0e49109e778edc10de9426005cb + sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" url: "https://pub.dev" source: hosted - version: "8.9.2" - cake_backup: - dependency: transitive - description: - path: "." - ref: main - resolved-ref: "3aba867dcab6737f6707782f5db15d71f303db38" - url: "https://github.com/cake-tech/cake_backup.git" - source: git - version: "1.0.0+1" + version: "8.4.3" characters: dependency: transitive description: @@ -134,10 +125,10 @@ packages: dependency: transitive description: name: checked_yaml - sha256: feb6bed21949061731a7a75fc5d2aa727cf160b91af9a3e464c5e3a32e28b5ff + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" url: "https://pub.dev" source: hosted - version: "2.0.3" + version: "2.0.2" clock: dependency: transitive description: @@ -150,10 +141,10 @@ packages: dependency: transitive description: name: code_builder - sha256: f692079e25e7869c14132d39f223f8eec9830eb76131925143b2129c4bb01b37 + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" url: "https://pub.dev" source: hosted - version: "4.10.0" + version: "4.4.0" collection: dependency: transitive description: @@ -166,34 +157,18 @@ packages: dependency: transitive description: name: convert - sha256: b30acd5944035672bc15c6b7a8b47d773e41e2f17de064350988c5d02adb1c68 + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" crypto: dependency: transitive description: name: crypto - sha256: "1e445881f28f22d6140f181e07737b22f1e099a5e1ff94b0af2f9e4a463f4855" + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 url: "https://pub.dev" source: hosted - version: "3.0.6" - cryptography: - dependency: transitive - description: - name: cryptography - sha256: d146b76d33d94548cf035233fbc2f4338c1242fa119013bead807d033fc4ae05 - url: "https://pub.dev" - source: hosted - version: "2.7.0" - cupertino_icons: - dependency: transitive - description: - name: cupertino_icons - sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 - url: "https://pub.dev" - source: hosted - version: "1.0.8" + version: "3.0.2" cw_core: dependency: "direct main" description: @@ -209,14 +184,22 @@ packages: url: "https://pub.dev" source: hosted version: "2.2.4" + decimal: + dependency: transitive + description: + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" + url: "https://pub.dev" + source: hosted + version: "2.3.3" encrypt: dependency: "direct main" description: name: encrypt - sha256: "62d9aa4670cc2a8798bab89b39fc71b6dfbacf615de6cf5001fb39f7e4a996a2" + sha256: "4fd4e4fdc21b9d7d4141823e1e6515cd94e7b8d84749504c232999fba25d9bbb" url: "https://pub.dev" source: hosted - version: "5.0.3" + version: "5.0.1" fake_async: dependency: transitive description: @@ -229,26 +212,26 @@ packages: dependency: "direct main" description: name: ffi - sha256: "16ed7b077ef01ad6170a3d0c57caa4a112a38d7a2ed5602e0aca9ca6f3d98da6" + sha256: "7bf0adc28a23d395f19f3f1eb21dd7cfd1dd9f8e1c50051c069122e6853bc878" url: "https://pub.dev" source: hosted - version: "2.1.3" + version: "2.1.0" file: dependency: transitive description: name: file - sha256: a3b4f84adafef897088c160faf7dfffb7696046cb13ae90b508c2cbc95d3b8d4 + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" url: "https://pub.dev" source: hosted - version: "7.0.1" + version: "6.1.4" fixnum: dependency: transitive description: name: fixnum - sha256: b6dc7065e46c974bc7c5f143080a6764ec7a4be6da1285ececdc37be96de53be + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" url: "https://pub.dev" source: hosted - version: "1.1.1" + version: "1.1.0" flutter: dependency: "direct main" description: flutter @@ -258,10 +241,10 @@ packages: dependency: "direct main" description: name: flutter_mobx - sha256: "859fbf452fa9c2519d2700b125dd7fb14c508bbdd7fb65e26ca8ff6c92280e2e" + sha256: "0da4add0016387a7bf309a0d0c41d36c6b3ae25ed7a176409267f166509e723e" url: "https://pub.dev" source: hosted - version: "2.2.1+1" + version: "2.0.6+5" flutter_test: dependency: "direct dev" description: flutter @@ -271,42 +254,42 @@ packages: dependency: transitive description: name: frontend_server_client - sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694 + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" url: "https://pub.dev" source: hosted - version: "4.0.0" + version: "3.2.0" glob: dependency: transitive description: name: glob - sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63" + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" graphs: dependency: transitive description: name: graphs - sha256: "741bbf84165310a68ff28fe9e727332eef1407342fca52759cb21ad8177bb8d0" + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 url: "https://pub.dev" source: hosted - version: "2.3.2" + version: "2.2.0" hashlib: dependency: transitive description: name: hashlib - sha256: f572f2abce09fc7aee53f15927052b9732ea1053e540af8cae211111ee0b99b1 + sha256: "71bf102329ddb8e50c8a995ee4645ae7f1728bb65e575c17196b4d8262121a96" url: "https://pub.dev" source: hosted - version: "1.21.0" + version: "1.12.0" hashlib_codecs: dependency: transitive description: name: hashlib_codecs - sha256: "8cea9ccafcfeaa7324d2ae52c61c69f7ff71f4237507a018caab31b9e416e3b1" + sha256: "49e2a471f74b15f1854263e58c2ac11f2b631b5b12c836f9708a35397d36d626" url: "https://pub.dev" source: hosted - version: "2.6.0" + version: "2.2.0" hive: dependency: transitive description: @@ -327,10 +310,10 @@ packages: dependency: "direct main" description: name: http - sha256: b9c29a161230ee03d3ccf545097fccd9b87a5264228c5d348202e0f0c28f9010 + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" url: "https://pub.dev" source: hosted - version: "1.2.2" + version: "1.1.0" http_multi_server: dependency: transitive description: @@ -351,10 +334,10 @@ packages: dependency: "direct main" description: name: intl - sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" url: "https://pub.dev" source: hosted - version: "0.19.0" + version: "0.18.1" io: dependency: transitive description: @@ -375,42 +358,42 @@ packages: dependency: transitive description: name: json_annotation - sha256: "1ce844379ca14835a50d2f019a3099f419082cfdd231cd86a142af94dd5c6bb1" + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 url: "https://pub.dev" source: hosted - version: "4.9.0" + version: "4.8.0" leak_tracker: dependency: transitive description: name: leak_tracker - sha256: "3f87a60e8c63aecc975dda1ceedbc8f24de75f09e4856ea27daf8958f2f0ce05" + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" url: "https://pub.dev" source: hosted - version: "10.0.5" + version: "10.0.0" leak_tracker_flutter_testing: dependency: transitive description: name: leak_tracker_flutter_testing - sha256: "932549fb305594d82d7183ecd9fa93463e9914e1b67cacc34bc40906594a1806" + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 url: "https://pub.dev" source: hosted - version: "3.0.5" + version: "2.0.1" leak_tracker_testing: dependency: transitive description: name: leak_tracker_testing - sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.0.1" logging: dependency: transitive description: name: logging - sha256: c8245ada5f1717ed44271ed1c26b8ce85ca3228fd2ffdb75468ab01979309d61 + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.1.1" matcher: dependency: transitive description: @@ -423,49 +406,49 @@ packages: dependency: transitive description: name: material_color_utilities - sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" url: "https://pub.dev" source: hosted - version: "0.11.1" + version: "0.8.0" meta: dependency: transitive description: name: meta - sha256: bdb68674043280c3428e9ec998512fb681678676b3c54e773629ffe74419f8c7 + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 url: "https://pub.dev" source: hosted - version: "1.15.0" + version: "1.11.0" mime: dependency: transitive description: name: mime - sha256: "41a20518f0cb1256669420fdba0cd90d21561e560ac240f26ef8322e45bb7ed6" + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.4" mobx: dependency: "direct main" description: name: mobx - sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" + sha256: f1862bd92c6a903fab67338f27e2f731117c3cb9ea37cee1a487f9e4e0de314a url: "https://pub.dev" source: hosted - version: "2.3.3+2" + version: "2.1.3+1" mobx_codegen: dependency: "direct dev" description: name: mobx_codegen - sha256: d4beb9cea4b7b014321235f8fdc7c2193ee0fe1d1198e9da7403f8bc85c4407c + sha256: "86122e410d8ea24dda0c69adb5c2a6ccadd5ce02ad46e144764e0d0184a06181" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.1.1" monero: dependency: "direct main" description: - path: "impls/monero.dart" - ref: af5277f96073917185864d3596e82b67bee54e78 - resolved-ref: af5277f96073917185864d3596e82b67bee54e78 - url: "https://github.com/mrcyjanek/monero_c" + path: "." + ref: d46753eca865e9e56c2f0ef6fe485c42e11982c5 + resolved-ref: d46753eca865e9e56c2f0ef6fe485c42e11982c5 + url: "https://github.com/mrcyjanek/monero.dart" source: git version: "0.0.0" mutex: @@ -476,14 +459,6 @@ packages: url: "https://pub.dev" source: hosted version: "3.1.0" - nested: - dependency: transitive - description: - name: nested - sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20" - url: "https://pub.dev" - source: hosted - version: "1.0.0" package_config: dependency: transitive description: @@ -504,26 +479,26 @@ packages: dependency: "direct main" description: name: path_provider - sha256: fec0d61223fba3154d87759e3cc27fe2c8dc498f6386c6d6fc80d1afdd1bf378 + sha256: a1aa8aaa2542a6bc57e381f132af822420216c80d4781f7aa085ca3229208aaa url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.1" path_provider_android: dependency: transitive description: name: path_provider_android - sha256: c464428172cb986b758c6d1724c603097febb8fb855aa265aeecc9280c294d4a + sha256: e595b98692943b4881b219f0a9e3945118d3c16bd7e2813f98ec6e532d905f72 url: "https://pub.dev" source: hosted - version: "2.2.12" + version: "2.2.1" path_provider_foundation: dependency: transitive description: name: path_provider_foundation - sha256: f234384a3fdd67f989b4d54a5d73ca2a6c422fa55ae694381ae0f4375cd1ea16 + sha256: "19314d595120f82aca0ba62787d58dde2cc6b5df7d2f0daf72489e38d1b57f2d" url: "https://pub.dev" source: hosted - version: "2.4.0" + version: "2.3.1" path_provider_linux: dependency: transitive description: @@ -536,50 +511,50 @@ packages: dependency: transitive description: name: path_provider_platform_interface - sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + sha256: "94b1e0dd80970c1ce43d5d4e050a9918fce4f4a775e6142424c30a29a363265c" url: "https://pub.dev" source: hosted - version: "2.1.2" + version: "2.1.1" path_provider_windows: dependency: transitive description: name: path_provider_windows - sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + sha256: "8bc9f22eee8690981c22aa7fc602f5c85b497a6fb2ceb35ee5a5e5ed85ad8170" url: "https://pub.dev" source: hosted - version: "2.3.0" + version: "2.2.1" platform: dependency: transitive description: name: platform - sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" url: "https://pub.dev" source: hosted - version: "3.1.6" + version: "3.1.0" plugin_platform_interface: dependency: transitive description: name: plugin_platform_interface - sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a url: "https://pub.dev" source: hosted - version: "2.1.8" + version: "2.1.3" pointycastle: dependency: transitive description: name: pointycastle - sha256: "4be0097fcf3fd3e8449e53730c631200ebc7b88016acecab2b0da2f0149222fe" + sha256: "7c1e5f0d23c9016c5bbd8b1473d0d3fb3fc851b876046039509e18e0c7485f2c" url: "https://pub.dev" source: hosted - version: "3.9.1" + version: "3.7.3" polyseed: dependency: "direct main" description: name: polyseed - sha256: "11d4dbee409db053c5e9cd77382b2f5115f43fc2529158a826a96f3ba505d770" + sha256: edf28042e7b0b28f97a0469aa98e6e4015937cef6b9340cd6ad2822139c95217 url: "https://pub.dev" source: hosted - version: "0.0.6" + version: "0.0.5" pool: dependency: transitive description: @@ -588,46 +563,54 @@ packages: url: "https://pub.dev" source: hosted version: "1.5.1" - provider: + process: dependency: transitive description: - name: provider - sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" url: "https://pub.dev" source: hosted - version: "6.1.2" + version: "4.2.4" pub_semver: dependency: transitive description: name: pub_semver - sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c" + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" url: "https://pub.dev" source: hosted - version: "2.1.4" + version: "2.1.3" pubspec_parse: dependency: transitive description: name: pubspec_parse - sha256: c799b721d79eb6ee6fa56f00c04b472dcd44a30d258fac2174a6ec57302678f8 + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" url: "https://pub.dev" source: hosted - version: "1.3.0" + version: "1.2.1" + rational: + dependency: transitive + description: + name: rational + sha256: cb808fb6f1a839e6fc5f7d8cb3b0a10e1db48b3be102de73938c627f0b636336 + url: "https://pub.dev" + source: hosted + version: "2.2.3" shelf: dependency: transitive description: name: shelf - sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4 + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c url: "https://pub.dev" source: hosted - version: "1.4.1" + version: "1.4.0" shelf_web_socket: dependency: transitive description: name: shelf_web_socket - sha256: "073c147238594ecd0d193f3456a5fe91c4b0abbcc68bf5cd95b36c4e194ac611" + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 url: "https://pub.dev" source: hosted - version: "2.0.0" + version: "1.0.3" sky_engine: dependency: transitive description: flutter @@ -637,10 +620,10 @@ packages: dependency: transitive description: name: socks5_proxy - sha256: "616818a0ea1064a4823b53c9f7eaf8da64ed82dcd51ed71371c7e54751ed5053" + sha256: "1d21b5606169654bbf4cfb904e8e6ed897e9f763358709f87310c757096d909a" url: "https://pub.dev" source: hosted - version: "1.0.6" + version: "1.0.4" source_gen: dependency: transitive description: @@ -709,10 +692,10 @@ packages: dependency: transitive description: name: test_api - sha256: "5b8a98dafc4d5c4c9c72d8b31ab2b23fc13422348d2997120294d3bac86b4ddb" + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" url: "https://pub.dev" source: hosted - version: "0.7.2" + version: "0.6.1" timing: dependency: transitive description: @@ -721,22 +704,14 @@ packages: url: "https://pub.dev" source: hosted version: "1.0.1" - tuple: - dependency: transitive - description: - name: tuple - sha256: a97ce2013f240b2f3807bcbaf218765b6f301c3eff91092bcfa23a039e7dd151 - url: "https://pub.dev" - source: hosted - version: "2.0.2" typed_data: dependency: transitive description: name: typed_data - sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" url: "https://pub.dev" source: hosted - version: "1.4.0" + version: "1.3.1" unorm_dart: dependency: transitive description: @@ -757,10 +732,10 @@ packages: dependency: transitive description: name: vm_service - sha256: f652077d0bdf60abe4c1f6377448e8655008eef28f128bc023f7b5e8dfeb48fc + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 url: "https://pub.dev" source: hosted - version: "14.2.4" + version: "13.0.0" watcher: dependency: "direct overridden" description: @@ -769,46 +744,38 @@ packages: url: "https://pub.dev" source: hosted version: "1.1.0" - web: - dependency: transitive - description: - name: web - sha256: cd3543bd5798f6ad290ea73d210f423502e71900302dde696f8bff84bf89a1cb - url: "https://pub.dev" - source: hosted - version: "1.1.0" - web_socket: - dependency: transitive - description: - name: web_socket - sha256: "3c12d96c0c9a4eec095246debcea7b86c0324f22df69893d538fcc6f1b8cce83" - url: "https://pub.dev" - source: hosted - version: "0.1.6" web_socket_channel: dependency: transitive description: name: web_socket_channel - sha256: "9f187088ed104edd8662ca07af4b124465893caf063ba29758f97af57e61da8f" + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b url: "https://pub.dev" source: hosted - version: "3.0.1" + version: "2.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" + source: hosted + version: "3.1.3" xdg_directories: dependency: transitive description: name: xdg_directories - sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 url: "https://pub.dev" source: hosted - version: "1.1.0" + version: "0.2.0+3" yaml: dependency: transitive description: name: yaml - sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5" + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" url: "https://pub.dev" source: hosted - version: "3.1.2" + version: "3.1.1" sdks: - dart: ">=3.5.0 <4.0.0" - flutter: ">=3.24.0" + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=3.7.0" diff --git a/cw_zano/.gitignore b/cw_zano/.gitignore new file mode 100644 index 000000000..e9dc58d3d --- /dev/null +++ b/cw_zano/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.dart_tool/ + +.packages +.pub/ + +build/ diff --git a/cw_zano/.metadata b/cw_zano/.metadata new file mode 100644 index 000000000..cb1a29e7c --- /dev/null +++ b/cw_zano/.metadata @@ -0,0 +1,10 @@ +# This file tracks properties of this Flutter project. +# Used by Flutter tool to assess capabilities and perform upgrades etc. +# +# This file should be version controlled and should not be manually edited. + +version: + revision: 4d7946a68d26794349189cf21b3f68cc6fe61dcb + channel: stable + +project_type: plugin diff --git a/cw_zano/CHANGELOG.md b/cw_zano/CHANGELOG.md new file mode 100644 index 000000000..41cc7d819 --- /dev/null +++ b/cw_zano/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.0.1 + +* TODO: Describe initial release. diff --git a/cw_zano/LICENSE b/cw_zano/LICENSE new file mode 100644 index 000000000..ba75c69f7 --- /dev/null +++ b/cw_zano/LICENSE @@ -0,0 +1 @@ +TODO: Add your license here. diff --git a/cw_zano/README.md b/cw_zano/README.md new file mode 100644 index 000000000..4a297e8e3 --- /dev/null +++ b/cw_zano/README.md @@ -0,0 +1,15 @@ +# cw_zano + +A new flutter plugin project. + +## Getting Started + +This project is a starting point for a Flutter +[plug-in package](https://flutter.dev/developing-packages/), +a specialized package that includes platform-specific implementation code for +Android and/or iOS. + +For help getting started with Flutter, view our +[online documentation](https://flutter.dev/docs), which offers tutorials, +samples, guidance on mobile development, and a full API reference. + diff --git a/cw_zano/android/.gitignore b/cw_zano/android/.gitignore new file mode 100644 index 000000000..4abf6a863 --- /dev/null +++ b/cw_zano/android/.gitignore @@ -0,0 +1,9 @@ +*.iml +.gradle +/local.properties +/.idea/workspace.xml +/.idea/libraries +.DS_Store +/build +/captures +.cxx/ \ No newline at end of file diff --git a/cw_zano/android/CMakeLists.txt b/cw_zano/android/CMakeLists.txt new file mode 100644 index 000000000..425cfc181 --- /dev/null +++ b/cw_zano/android/CMakeLists.txt @@ -0,0 +1,119 @@ +cmake_minimum_required(VERSION 3.4.1) + +add_library( cw_zano + SHARED + ../ios/Classes/zano_api.cpp) + + find_library( log-lib log ) + +set(EXTERNAL_LIBS_DIR ${CMAKE_SOURCE_DIR}/../../cw_shared_external/ios/External/android) +set(EXTERNAL_ZANO_ROOT ${CMAKE_SOURCE_DIR}/../../../zano) + + + +############ +# OpenSSL +############ + +add_library(crypto STATIC IMPORTED) +set_target_properties(crypto PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libcrypto.a) + +add_library(ssl STATIC IMPORTED) +set_target_properties(ssl PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libssl.a) + +############ +# Boost +############ + +add_library(boost_chrono STATIC IMPORTED) +set_target_properties(boost_chrono PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_chrono.a) + +add_library(boost_date_time STATIC IMPORTED) +set_target_properties(boost_date_time PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_date_time.a) + +add_library(boost_filesystem STATIC IMPORTED) +set_target_properties(boost_filesystem PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_filesystem.a) + +add_library(boost_program_options STATIC IMPORTED) +set_target_properties(boost_program_options PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_program_options.a) + +add_library(boost_regex STATIC IMPORTED) +set_target_properties(boost_regex PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_regex.a) + +add_library(boost_serialization STATIC IMPORTED) +set_target_properties(boost_serialization PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_serialization.a) + +add_library(boost_system STATIC IMPORTED) +set_target_properties(boost_system PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_system.a) + +add_library(boost_thread STATIC IMPORTED) +set_target_properties(boost_thread PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_thread.a) + +add_library(boost_wserialization STATIC IMPORTED) +set_target_properties(boost_wserialization PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_wserialization.a) + +add_library(boost_log STATIC IMPORTED) + set_target_properties(boost_log PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/libboost_log.a) + +############# +# Zano +############# +add_library(zano_common STATIC IMPORTED) +set_target_properties(zano_common PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/zano/libcommon.a) + + +add_library(zano_crypto STATIC IMPORTED) +set_target_properties(zano_crypto PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/zano/libcrypto.a) + +add_library(zano_currency_core STATIC IMPORTED) +set_target_properties(zano_currency_core PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/zano/libcurrency_core.a) + +add_library(zano_z STATIC IMPORTED) +set_target_properties(zano_z PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/zano/libz.a) + +add_library(zano_wallet STATIC IMPORTED) +set_target_properties(zano_wallet PROPERTIES IMPORTED_LOCATION + ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/lib/zano/libwallet.a) + +include_directories( ${EXTERNAL_LIBS_DIR}/${ANDROID_ABI}/include ) +include_directories( ${EXTERNAL_ZANO_ROOT}/src/wallet ) + + +target_link_libraries( cw_zano + zano_common + zano_crypto + zano_currency_core + zano_z + zano_wallet + + boost_chrono + boost_date_time + boost_filesystem + boost_program_options + boost_regex + boost_serialization + boost_system + boost_thread + boost_wserialization + boost_log + + ssl + crypto + ${log-lib} + ) \ No newline at end of file diff --git a/cw_zano/android/build.gradle b/cw_zano/android/build.gradle new file mode 100644 index 000000000..68fc762f7 --- /dev/null +++ b/cw_zano/android/build.gradle @@ -0,0 +1,45 @@ +group 'com.cakewallet.cw_zano' +version '1.0-SNAPSHOT' + +buildscript { + ext.kotlin_version = '1.7.10' + repositories { + google() + jcenter() + } + + dependencies { + classpath 'com.android.tools.build:gradle:4.1.0' + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + } +} + +rootProject.allprojects { + repositories { + google() + jcenter() + } +} + +apply plugin: 'com.android.library' +apply plugin: 'kotlin-android' + +android { + compileSdkVersion 28 + + sourceSets { + main.java.srcDirs += 'src/main/kotlin' + } + defaultConfig { + minSdkVersion 21 + } + externalNativeBuild { + cmake { + path "CMakeLists.txt" + } + } +} + +dependencies { + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" +} diff --git a/cw_zano/android/gradle.properties b/cw_zano/android/gradle.properties new file mode 100644 index 000000000..94adc3a3f --- /dev/null +++ b/cw_zano/android/gradle.properties @@ -0,0 +1,3 @@ +org.gradle.jvmargs=-Xmx1536M +android.useAndroidX=true +android.enableJetifier=true diff --git a/cw_zano/android/gradle/wrapper/gradle-wrapper.properties b/cw_zano/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000..3c9d0852b --- /dev/null +++ b/cw_zano/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.7-all.zip diff --git a/cw_zano/android/settings.gradle b/cw_zano/android/settings.gradle new file mode 100644 index 000000000..7c4d5263b --- /dev/null +++ b/cw_zano/android/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'cw_zano' diff --git a/cw_zano/android/src/main/AndroidManifest.xml b/cw_zano/android/src/main/AndroidManifest.xml new file mode 100644 index 000000000..26903e6c0 --- /dev/null +++ b/cw_zano/android/src/main/AndroidManifest.xml @@ -0,0 +1,3 @@ + + diff --git a/cw_zano/android/src/main/kotlin/com/cakewallet/cw_zano/CwZanoPlugin.kt b/cw_zano/android/src/main/kotlin/com/cakewallet/cw_zano/CwZanoPlugin.kt new file mode 100644 index 000000000..95df8ae7b --- /dev/null +++ b/cw_zano/android/src/main/kotlin/com/cakewallet/cw_zano/CwZanoPlugin.kt @@ -0,0 +1,36 @@ +package com.cakewallet.cw_zano + +import androidx.annotation.NonNull + +import io.flutter.embedding.engine.plugins.FlutterPlugin +import io.flutter.plugin.common.MethodCall +import io.flutter.plugin.common.MethodChannel +import io.flutter.plugin.common.MethodChannel.MethodCallHandler +import io.flutter.plugin.common.MethodChannel.Result +import io.flutter.plugin.common.PluginRegistry.Registrar + +/** CwZanoPlugin */ +class CwZanoPlugin: FlutterPlugin, MethodCallHandler { + /// The MethodChannel that will the communication between Flutter and native Android + /// + /// This local reference serves to register the plugin with the Flutter Engine and unregister it + /// when the Flutter Engine is detached from the Activity + private lateinit var channel : MethodChannel + + override fun onAttachedToEngine(@NonNull flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) { + channel = MethodChannel(flutterPluginBinding.binaryMessenger, "cw_zano") + channel.setMethodCallHandler(this) + } + + override fun onMethodCall(@NonNull call: MethodCall, @NonNull result: Result) { + if (call.method == "getPlatformVersion") { + result.success("Android ${android.os.Build.VERSION.RELEASE}") + } else { + result.notImplemented() + } + } + + override fun onDetachedFromEngine(@NonNull binding: FlutterPlugin.FlutterPluginBinding) { + channel.setMethodCallHandler(null) + } +} diff --git a/cw_zano/ios/.gitignore b/cw_zano/ios/.gitignore new file mode 100644 index 000000000..aa479fd3c --- /dev/null +++ b/cw_zano/ios/.gitignore @@ -0,0 +1,37 @@ +.idea/ +.vagrant/ +.sconsign.dblite +.svn/ + +.DS_Store +*.swp +profile + +DerivedData/ +build/ +GeneratedPluginRegistrant.h +GeneratedPluginRegistrant.m + +.generated/ + +*.pbxuser +*.mode1v3 +*.mode2v3 +*.perspectivev3 + +!default.pbxuser +!default.mode1v3 +!default.mode2v3 +!default.perspectivev3 + +xcuserdata + +*.moved-aside + +*.pyc +*sync/ +Icon? +.tags* + +/Flutter/Generated.xcconfig +/Flutter/flutter_export_environment.sh \ No newline at end of file diff --git a/cw_zano/ios/Assets/.gitkeep b/cw_zano/ios/Assets/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/cw_zano/ios/Classes/CwZanoPlugin.h b/cw_zano/ios/Classes/CwZanoPlugin.h new file mode 100644 index 000000000..ee043b49c --- /dev/null +++ b/cw_zano/ios/Classes/CwZanoPlugin.h @@ -0,0 +1,4 @@ +#import + +@interface CwZanoPlugin : NSObject +@end diff --git a/cw_zano/ios/Classes/CwZanoPlugin.m b/cw_zano/ios/Classes/CwZanoPlugin.m new file mode 100644 index 000000000..987663b56 --- /dev/null +++ b/cw_zano/ios/Classes/CwZanoPlugin.m @@ -0,0 +1,15 @@ +#import "CwZanoPlugin.h" +#if __has_include() +#import +#else +// Support project import fallback if the generated compatibility header +// is not copied when this plugin is created as a library. +// https://forums.swift.org/t/swift-static-libraries-dont-copy-generated-objective-c-header/19816 +#import "cw_zano-Swift.h" +#endif + +@implementation CwZanoPlugin ++ (void)registerWithRegistrar:(NSObject*)registrar { + [SwiftCwZanoPlugin registerWithRegistrar:registrar]; +} +@end diff --git a/cw_zano/ios/Classes/SwiftCwZanoPlugin.swift b/cw_zano/ios/Classes/SwiftCwZanoPlugin.swift new file mode 100644 index 000000000..9c789d8a6 --- /dev/null +++ b/cw_zano/ios/Classes/SwiftCwZanoPlugin.swift @@ -0,0 +1,14 @@ +import Flutter +import UIKit + +public class SwiftCwZanoPlugin: NSObject, FlutterPlugin { + public static func register(with registrar: FlutterPluginRegistrar) { + let channel = FlutterMethodChannel(name: "cw_zano", binaryMessenger: registrar.messenger()) + let instance = SwiftCwZanoPlugin() + registrar.addMethodCallDelegate(instance, channel: channel) + } + + public func handle(_ call: FlutterMethodCall, result: @escaping FlutterResult) { + result("iOS " + UIDevice.current.systemVersion) + } +} diff --git a/cw_zano/ios/Classes/zano_api.cpp b/cw_zano/ios/Classes/zano_api.cpp new file mode 100644 index 000000000..a62a114f8 --- /dev/null +++ b/cw_zano/ios/Classes/zano_api.cpp @@ -0,0 +1,870 @@ +#include +#include "cstdlib" +#include +#include +#include +#include +#include +#include "thread" + + +#if __APPLE__ +// Fix for randomx on ios +void __clear_cache(void* start, void* end) { } +//#include "../External/ios/include/wallet2_api.h" +#endif + +#include "../External/include/wallet2_api.h" + +#include "../../../cw_shared_external/ios/External/ios/sources/zano/src/wallet/plain_wallet_api.h" +//#include "plain_wallet_api_ex.h" + + + +//using namespace std::chrono_literals; + +#ifdef __cplusplus +extern "C" +{ +#endif + //const uint64_t MONERO_BLOCK_SIZE = 1000; + + struct Utf8Box + { + char *value; + + Utf8Box(char *_value) + { + value = _value; + } + }; + + + struct SubaddressRow + { + uint64_t id; + char *address; + char *label; + + SubaddressRow(std::size_t _id, char *_address, char *_label) + { + id = static_cast(_id); + address = _address; + label = _label; + } + }; + + struct AccountRow + { + uint64_t id; + char *label; + + AccountRow(std::size_t _id, char *_label) + { + id = static_cast(_id); + label = _label; + } + }; + + struct ZanoBalance + { + uint64_t amount; + char *assetType; + + ZanoBalance(char *_assetType, uint64_t _amount) + { + amount = _amount; + assetType = _assetType; + } + }; + + struct ZanoRate + { + uint64_t rate; + char *assetType; + + ZanoRate(char *_assetType, uint64_t _rate) + { + rate = _rate; + assetType = _assetType; + } + }; + + /*struct MoneroWalletListener : Monero::WalletListener + { + uint64_t m_height; + bool m_need_to_refresh; + bool m_new_transaction; + + MoneroWalletListener() + { + m_height = 0; + m_need_to_refresh = false; + m_new_transaction = false; + } + + void moneySpent(const std::string &txId, uint64_t amount, std::string assetType) + { + m_new_transaction = true; + } + + void moneyReceived(const std::string &txId, uint64_t amount, std::string assetType) + { + m_new_transaction = true; + } + + void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) + { + m_new_transaction = true; + } + + void newBlock(uint64_t height) + { + m_height = height; + } + + void updated() + { + m_new_transaction = true; + } + + void refreshed() + { + m_need_to_refresh = true; + } + + void resetNeedToRefresh() + { + m_need_to_refresh = false; + } + + bool isNeedToRefresh() + { + return m_need_to_refresh; + } + + bool isNewTransactionExist() + { + return m_new_transaction; + } + + void resetIsNewTransactionExist() + { + m_new_transaction = false; + } + + uint64_t height() + { + return m_height; + } + }; + */ + + struct TransactionInfoRow + { + uint64_t amount; + uint64_t fee; + uint64_t blockHeight; + uint64_t confirmations; + uint32_t subaddrAccount; + int8_t direction; + int8_t isPending; + uint32_t subaddrIndex; + + char *hash; + char *paymentId; + char *assetType; + + int64_t datetime; + + TransactionInfoRow(/*wallet_public::wallet_transfer_info& wti*/) + { + /* + amount = wti.subtransfers. + fee = transaction->fee(); + blockHeight = transaction->blockHeight(); + subaddrAccount = transaction->subaddrAccount(); + std::set::iterator it = transaction->subaddrIndex().begin(); + subaddrIndex = *it; + confirmations = transaction->confirmations(); + datetime = static_cast(transaction->timestamp()); + direction = transaction->direction(); + isPending = static_cast(transaction->isPending()); + std::string *hash_str = new std::string(transaction->hash()); + hash = strdup(hash_str->c_str()); + paymentId = strdup(transaction->paymentId().c_str()); + assetType = strdup(transaction->assetType().c_str()); + */ + } + }; + + /* + Monero::Wallet *m_wallet; + Monero::TransactionHistory *m_transaction_history; + MoneroWalletListener *m_listener; + Monero::Subaddress *m_subaddress; + Monero::SubaddressAccount *m_account; + uint64_t m_last_known_wallet_height; + uint64_t m_cached_syncing_blockchain_height = 0; + std::mutex store_lock; + bool is_storing = false; + */ + //void change_current_wallet(Monero::Wallet *wallet) + //{ + /* + m_wallet = wallet; + m_listener = nullptr; + + + if (wallet != nullptr) + { + m_transaction_history = wallet->history(); + } + else + { + m_transaction_history = nullptr; + } + + if (wallet != nullptr) + { + m_account = wallet->subaddressAccount(); + } + else + { + m_account = nullptr; + } + + if (wallet != nullptr) + { + m_subaddress = wallet->subaddress(); + } + else + { + m_subaddress = nullptr; + } + */ + //} + + //Monero::Wallet *get_current_wallet() + //{ + + // return nullptr;//return m_wallet; + //} + + char * create_wallet(char *path, char *password, char *language, int32_t networkType, char *error) + { + return strdup(plain_wallet::generate(path, password).c_str()); + } + + char * restore_wallet_from_seed(char *path, char *password, char *seed, int32_t networkType, uint64_t restoreHeight, char *error) + { + return strdup(plain_wallet::restore(seed, path, password, "").c_str()); + } + + bool restore_wallet_from_keys(char *path, char *password, char *language, char *address, char *viewKey, char *spendKey, int32_t networkType, uint64_t restoreHeight, char *error) + { + /* + Monero::NetworkType _networkType = static_cast(networkType); + Monero::Wallet *wallet = Monero::WalletManagerFactory::getWalletManager()->createWalletFromKeys( + std::string(path), + std::string(password), + std::string(language), + _networkType, + (uint64_t)restoreHeight, + std::string(address), + std::string(viewKey), + std::string(spendKey)); + + int status; + std::string errorString; + + wallet->statusWithErrorString(status, errorString); + + if (status != Monero::Wallet::Status_Ok || !errorString.empty()) + { + error = strdup(errorString.c_str()); + return false; + } + + change_current_wallet(wallet); + */ + return false; + } + + char * load_wallet(char *path, char *password, int32_t nettype) + { + return strdup(plain_wallet::open(path, password).c_str()); + } + + char *error_string() { + return strdup("");//strdup(get_current_wallet()->errorString().c_str()); + } + + + bool is_wallet_exist(char *path) + { + return plain_wallet::is_wallet_exist(path); + } + + char *close_wallet(uint64_t hwallet) + { + return strdup(plain_wallet::close_wallet(hwallet).c_str()); + } + + + char *get_wallet_info(uint64_t hwallet) { + return strdup(plain_wallet::get_wallet_info(hwallet).c_str()); + } + + /* + get_filename(): -> get_wallet_info(h).wi.path + secret_view_key(): -> get_wallet_info(h).wi_extended.view_private_key + public_view_key(): -> get_wallet_info(h).wi_extended.view_public_key + secret_spend_key(): -> get_wallet_info(h).wi_extended.spend_private_key + public_spend_key(): -> get_wallet_info(h).wi_extended.spend_public_key + get_address(): -> get_wallet_info(h).wi.address + seed(): -> get_wallet_info(h).wi_extended.seed + get_current_height(): -> get_wallet_status(h).current_wallet_height + get_node_height(): -> get_wallet_status(h).current_daemon_height + + get_syncing_height() ??? how it's different from get_current_height??= + start_refresh() ??? + set_refresh_from_block_height ??? + set_recovering_from_seed ??? + get_node_height_or_update ??? + is_needed_to_refresh ??? + is_new_transaction_exist ??? + set_listener ??? + transactions_refresh() ??? + on_startup() ??? + rescan_blockchain() ??? + set_trusted_daemon()/trusted_daemon() ??? + + + asset_types_size()/asset_types() dedicated from balance + + update_rate()/get_rate()/size_of_rate() - need to fetch Zano price from coinmarketcap API, other assets ??? + + subaddrress_size()/subaddrress_get_all() - no subaddresses, only one address, available via get_wallet_info(h).wi.address + + connect_to_node()/is_connected(): -> get_connectivity_status(): { + "is_online": true, + "last_daemon_is_disconnected": false, + "is_server_busy": false, + "last_proxy_communicate_timestamp": 12121212 + } + + } + + get_full_balance/get_unlocked_balance(): -> async_call("invoke", hwallet, "{method: 'get_recent_txs_and_info', params: {offset: 0,count: 30,update_provision_info: true}}") + return list of last transactions + balances + + store(): -> async_call("invoke", hwallet, "{method: 'store', params: {}}") + + set_password() return "OK" if succeded + + transaction_create/transaction_commit () replaced with method 'transfer' that receive following argument in JSON: + async_call("invoke", hwallet, " + { + "method": "transfer", + "params": { + "destinations": [ + { + "amount": "0.222", + "address": "iZ2GHyPD7g28hgBfboZeCENaYrHSYZ1bLFi5cgWvn4WJLaxfgs4kqG6cJi9ai2zrXWSCpsvRXit14gKjeijx6YPCLJEv6Fx4rVm1hdAGQFiv", + "asset_id" "bec034f4f158f97cfc4933c3e387b098f69870e955a49061f9ce956212729534" + } + ], + "fee": 10000000000, + "mixin": 10, + "payment_id": "", + "comment": "haha", + "push_payer": false, + "hide_receiver": true + } + } + ") + + after transaction_create() event happened you need to call API get_current_tx_fee(priority_raw), get fee from it and use it to + show to dialog in UI, and then if confirmed when transaction_commit() need to actually call async_call(...) that do actual transfer + + subaddress doesn't exist in Zano so following api is not present: + subaddress_add_row/subaddress_set_label/subaddress_refresh/account_size/account_get_all/account_add_row/account_set_label_row/account_refresh + + transactions_get_all() -> + async_call("invoke", hwallet, " + { + "method": "get_recent_txs_and_info", + "params": { + "offset": 0, + "count": 30, + "update_provision_info": true + } + } + ") + + transactions_count() -> invoke: get_recent_txs_and_info + + + + + */ + + uint64_t get_current_tx_fee(uint64_t priority) + { + return plain_wallet::get_current_tx_fee(priority); + } + + + char* get_wallet_status(uint64_t hwallet) + { + return strdup(plain_wallet::get_wallet_status(hwallet).c_str()); + } + + char* get_address_info(char* address) + { + return strdup(plain_wallet::get_address_info(address).c_str()); + } + + + char* async_call(char* method_name, uint64_t instance_id, char* params) + { + return strdup(plain_wallet::async_call(method_name, instance_id, params).c_str()); + } + char* try_pull_result(uint64_t job_id) + { + return strdup(plain_wallet::try_pull_result(job_id).c_str()); + } + + char* sync_call(const std::string& method_name, uint64_t instance_id, const std::string& params) + { + return strdup(plain_wallet::sync_call(method_name, instance_id, params).c_str()); + } + + char* get_connectivity_status() + { + return strdup(plain_wallet::get_connectivity_status().c_str()); + } + + bool setup_node(char *address, char *login, char *password, bool use_ssl, bool is_light_wallet, char *error) + { + nice(19); + if(use_ssl) + { + //LOG_ERROR("SSL is not supported yet for Zano"); + return false; + } + + std::string res = plain_wallet::init(address, "", 0); + if(API_RETURN_CODE_OK != res) + { + //LOG_ERROR("Failed init wallet"); + return false; + } + + return true; + } + + //void start_refresh() + //{ + //get_current_wallet()->refreshAsync(); + //get_current_wallet()->startRefresh(); + //} + + //void set_refresh_from_block_height(uint64_t height) + //{ + //get_current_wallet()->setRefreshFromBlockHeight(height); + //} + + //void set_recovering_from_seed(bool is_recovery) + //{ + //get_current_wallet()->setRecoveringFromSeed(is_recovery); + //} + + char* set_password(uint64_t hwallet, char *password, Utf8Box &error) + { + return strdup(plain_wallet::reset_wallet_password(hwallet, password).c_str()); + } + + + /* + bool transaction_create(char *address, char *asset_type, char *payment_id, char *amount, + uint8_t priority_raw, uint32_t subaddr_account, Utf8Box &error, PendingTransactionRaw &pendingTransaction) + { + pendingTransaction.fee = plain_wallet::get_current_tx_fee(priority_raw); + pendingTransaction.amount = strdup(amount); + pendingTransaction.address = strdup(address); + pendingTransaction.asset_type = strdup(asset_type); + pendingTransaction.payment_id = strdup(payment_id); + pendingTransaction.priority_raw = priority_raw; + pendingTransaction.subaddr_account = 0; + return true; + }*/ + + //bool transaction_create_mult_dest(char **addresses, char *asset_type, char *payment_id, char **amounts, uint32_t size, + // uint8_t priority_raw, uint32_t subaddr_account, Utf8Box &error, PendingTransactionRaw &pendingTransaction) + //{ + /* + nice(19); + + std::vector _addresses; + std::vector _amounts; + + for (int i = 0; i < size; i++) { + _addresses.push_back(std::string(*addresses)); + _amounts.push_back(Monero::Wallet::amountFromString(std::string(*amounts))); + addresses++; + amounts++; + } + + auto priority = static_cast(priority_raw); + std::string _payment_id; + Monero::PendingTransaction *transaction; + + if (payment_id != nullptr) + { + _payment_id = std::string(payment_id); + } + + transaction = m_wallet->createTransactionMultDest(_addresses, _payment_id, _amounts, + std::string(asset_type), std::string(asset_type), m_wallet->defaultMixin(), priority, subaddr_account,{}); + + int status = transaction->status(); + + if (status == Monero::PendingTransaction::Status::Status_Error || status == Monero::PendingTransaction::Status::Status_Critical) + { + error = Utf8Box(strdup(transaction->errorString().c_str())); + return false; + } + + if (m_listener != nullptr) { + m_listener->m_new_transaction = true; + } + + pendingTransaction = PendingTransactionRaw(transaction); + return true; + */ + // return false; + //} + + //bool transaction_commit(PendingTransactionRaw *transaction, Utf8Box &error) + //{ + /* + bool committed = transaction->transaction->commit(); + + if (!committed) + { + error = Utf8Box(strdup(transaction->transaction->errorString().c_str())); + } else if (m_listener != nullptr) { + m_listener->m_new_transaction = true; + } + + return committed; + */ + // return false; + //} + + //uint64_t get_node_height_or_update(uint64_t base_eight) + //{ + /* + if (m_cached_syncing_blockchain_height < base_eight) { + m_cached_syncing_blockchain_height = base_eight; + } + + return m_cached_syncing_blockchain_height; + */ + // return 0; + //} + + //uint64_t get_syncing_height(uint64_t hwallet) + //{ + /* + if (m_listener == nullptr) { + return 0; + } + + uint64_t height = m_listener->height(); + + if (height <= 1) { + return 0; + } + + if (height != m_last_known_wallet_height) + { + m_last_known_wallet_height = height; + } + + return height; + */ + // return 0; + //} + + //uint64_t is_needed_to_refresh() + //{ + // return 0; + /* + if (m_listener == nullptr) { + return false; + } + + bool should_refresh = m_listener->isNeedToRefresh(); + + if (should_refresh) { + m_listener->resetNeedToRefresh(); + } + + return should_refresh; + */ + //} + + //uint8_t is_new_transaction_exist() + //{ + /* + if (m_listener == nullptr) { + return false; + } + + bool is_new_transaction_exist = m_listener->isNewTransactionExist(); + + if (is_new_transaction_exist) + { + m_listener->resetIsNewTransactionExist(); + } + + return is_new_transaction_exist; + */ + // return 0; + //} + + //void set_listener() + //{ + /* + m_last_known_wallet_height = 0; + + if (m_listener != nullptr) + { + free(m_listener); + } + + m_listener = new MoneroWalletListener(); + get_current_wallet()->setListener(m_listener); + */ + //} + + //int64_t *subaddrress_get_all() + //{ + /* + std::vector _subaddresses = m_subaddress->getAll(); + size_t size = _subaddresses.size(); + int64_t *subaddresses = (int64_t *)malloc(size * sizeof(int64_t)); + + for (int i = 0; i < size; i++) + { + Monero::SubaddressRow *row = _subaddresses[i]; + SubaddressRow *_row = new SubaddressRow(row->getRowId(), strdup(row->getAddress().c_str()), strdup(row->getLabel().c_str())); + subaddresses[i] = reinterpret_cast(_row); + } + + return subaddresses; + */ + // return nullptr; + //} + + //int32_t subaddrress_size() + //{ + //std::vector _subaddresses = m_subaddress->getAll(); + //return _subaddresses.size(); + // return 0; + //} + + //void subaddress_add_row(uint32_t accountIndex, char *label) + //{ + //m_subaddress->addRow(accountIndex, std::string(label)); + //} + + //void subaddress_set_label(uint32_t accountIndex, uint32_t addressIndex, char *label) + //{ + //m_subaddress->setLabel(accountIndex, addressIndex, std::string(label)); + //} + + //void subaddress_refresh(uint32_t accountIndex) + //{ + //m_subaddress->refresh(accountIndex); + //} + //int32_t account_size() + //{ + //std::vector _accocunts = m_account->getAll(); + //return _accocunts.size(); + // return 0; + //} + + //int64_t *account_get_all() + //{ + /* + std::vector _accocunts = m_account->getAll(); + size_t size = _accocunts.size(); + int64_t *accocunts = (int64_t *)malloc(size * sizeof(int64_t)); + + for (int i = 0; i < size; i++) + { + Monero::SubaddressAccountRow *row = _accocunts[i]; + AccountRow *_row = new AccountRow(row->getRowId(), strdup(row->getLabel().c_str())); + accocunts[i] = reinterpret_cast(_row); + } + + return accocunts; + */ + // return nullptr; + //} + + //void account_add_row(char *label) + //{ + //m_account->addRow(std::string(label)); + //} + //void account_set_label_row(uint32_t account_index, char *label) + //{ + //m_account->setLabel(account_index, label); + //} + + //void account_refresh() + //{ + //m_account->refresh(); + //} + + //int64_t *transactions_get_all() + //{ + /* + std::vector transactions = m_transaction_history->getAll(); + size_t size = transactions.size(); + int64_t *transactionAddresses = (int64_t *)malloc(size * sizeof(int64_t)); + + for (int i = 0; i < size; i++) + { + Monero::TransactionInfo *row = transactions[i]; + TransactionInfoRow *tx = new TransactionInfoRow(row); + transactionAddresses[i] = reinterpret_cast(tx); + } + + return transactionAddresses; + */ + // return nullptr; + //} + + //void transactions_refresh() + //{ + //m_transaction_history->refresh(); + //} + + //int64_t transactions_count() + //{ + //return m_transaction_history->count(); + // return 0; + //} + + //int LedgerExchange( + // unsigned char *command, + // unsigned int cmd_len, + // unsigned char *response, + // unsigned int max_resp_len) + //{ + // return -1; + //} + + //int LedgerFind(char *buffer, size_t len) + //{ + // return -1; + //} + + //void on_startup() + //{ + //Monero::Utils::onStartup(); + //Monero::WalletManagerFactory::setLogLevel(4); + //} + + //void rescan_blockchain() + //{ + //m_wallet->rescanBlockchainAsync(); + //} + + char * get_tx_key(char * txId) + { + return strdup(""); //return strdup(m_wallet->getTxKey(std::string(txId)).c_str()); + } + + //int32_t asset_types_size() + //{ + // return 0; //return Monero::Assets::list().size(); + //} + + //char **asset_types() + //{ + /* + size_t size = Monero::Assets::list().size(); + std::vector assetList = Monero::Assets::list(); + char **assetTypesPts; + assetTypesPts = (char **) malloc( size * sizeof(char*)); + + for (int i = 0; i < size; i++) + { + + std::string asset = assetList[i]; + //assetTypes[i] = (char *)malloc( 5 * sizeof(char)); + assetTypesPts[i] = strdup(asset.c_str()); + } + + return assetTypesPts; + */ + // return nullptr; + //} + + //std::map rates; + + //void update_rate() + //{ + //rates = get_current_wallet()->oracleRates(); + //} + + //int64_t *get_rate() + //{ + /* + size_t size = rates.size(); + int64_t *havenRates = (int64_t *)malloc(size * sizeof(int64_t)); + int i = 0; + + for (auto const& rate : rates) + { + char *assetType = strdup(rate.first.c_str()); + HavenRate *havenRate = new HavenRate(assetType, rate.second); + havenRates[i] = reinterpret_cast(havenRate); + i++; + } + + return havenRates; + */ + // return nullptr; + //} + + //int32_t size_of_rate() + //{ + // return 0; //return static_cast(rates.size()); + //} + + void set_trusted_daemon(bool arg) + { + //m_wallet->setTrustedDaemon(arg); + } + + bool trusted_daemon() + { + return false; + //return m_wallet->trustedDaemon(); + } + + char* get_version() + { + return strdup(plain_wallet::get_version().c_str()); + } + +#ifdef __cplusplus +} +#endif diff --git a/cw_zano/ios/External/CMakeLists.txt b/cw_zano/ios/External/CMakeLists.txt new file mode 100644 index 000000000..420372308 --- /dev/null +++ b/cw_zano/ios/External/CMakeLists.txt @@ -0,0 +1,168 @@ +# Portions Copyright (c) 2017-2022, The Monero Project +# This file is based off of the https://code.google.com/archive/p/ios-cmake/ +# It has been altered for Monero iOS development +# +# +# Options: +# +# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64 +# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders +# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch. +# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch. +# +# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder +# By default this location is automatcially chosen based on the IOS_PLATFORM value above. +# If set manually, it will override the default location and force the user of a particular Developer Platform +# +# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder +# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value. +# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path. +# If set manually, this will force the use of a specific SDK version + +message (STATUS "Running Zano IOS setup cmake file") + +# Standard settings +set (CMAKE_SYSTEM_NAME iOS) +set (CMAKE_SYSTEM_VERSION 15) +#set (UNIX True) +set (APPLE True) +set (IOS True) + +# Required as of cmake 2.8.10 +set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE) + +# Determine the cmake host system version so we know where to find the iOS SDKs +#find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin) +#if (CMAKE_UNAME) +# exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION) +# string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}") +#endif (CMAKE_UNAME) +# Force the compilers to gcc for iOS +# include (CMakeForceCompiler) +# set (MAKE_C_COMPILER "/usr/bin/gcc Apple") +# set (CMAKE_CXX_COMPILER "/usr/bin/g++ Apple") +#set(CMAKE_AR ar CACHE FILEPATH "" FORCE) + +# Skip the platform compiler checks for cross compiling +# set (CMAKE_CXX_COMPILER_WORKS TRUE) +# set (CMAKE_C_COMPILER_WORKS TRUE) + +# All iOS/Darwin specific settings - some may be redundant +set (CMAKE_SHARED_LIBRARY_PREFIX "lib") +set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib") +set (CMAKE_SHARED_MODULE_PREFIX "lib") +set (CMAKE_SHARED_MODULE_SUFFIX ".so") +# set (CMAKE_MODULE_EXISTS 1) +#set (CMAKE_DL_LIBS "") + +#set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ") +#set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ") +#set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}") +#set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}") + +# Hidden visibilty is required for cxx on iOS +# set (CMAKE_C_FLAGS_INIT "") +# set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden") + +#set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}") +#set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}") + +#set (CMAKE_PLATFORM_HAS_INSTALLNAME 1) +#set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names") +#set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names") +#set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,") +#set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,") +#set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a") + +# Setup iOS platform unless specified manually with IOS_PLATFORM +if (NOT DEFINED IOS_PLATFORM) + set (IOS_PLATFORM "OS") +endif (NOT DEFINED IOS_PLATFORM) +set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform") + +# Setup building for arm64 or not +if (NOT DEFINED BUILD_ARM64) + set (BUILD_ARM64 true) +endif (NOT DEFINED BUILD_ARM64) +set (BUILD_ARM64 ${BUILD_ARM64} CACHE STRING "Build arm64 arch or not") + +# Check the platform selection and setup for developer root +if (${IOS_PLATFORM} STREQUAL "OS") + set (IOS_PLATFORM_LOCATION "iPhoneOS.platform") + + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos") +elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR") + set (SIMULATOR true) + set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform") + + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") +elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64") + set (SIMULATOR true) + set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform") + + # This causes the installers to properly locate the output libraries + set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator") +else (${IOS_PLATFORM} STREQUAL "OS") + message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR") +endif (${IOS_PLATFORM} STREQUAL "OS") + +# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT +# Note Xcode 4.3 changed the installation location, choose the most recent one available +# exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR) +# set (XCODE_POST_43_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer") +# set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer") +#if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) +# if (EXISTS ${XCODE_POST_43_ROOT}) +# set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT}) +# elseif(EXISTS ${XCODE_PRE_43_ROOT}) +# set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT}) +# endif (EXISTS ${XCODE_POST_43_ROOT}) +#endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT) +#set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform") + +# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT +#if (NOT DEFINED CMAKE_IOS_SDK_ROOT) +# file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*") +# if (_CMAKE_IOS_SDKS) +# list (SORT _CMAKE_IOS_SDKS) +# list (REVERSE _CMAKE_IOS_SDKS) +# list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT) +# else (_CMAKE_IOS_SDKS) +# message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.") +# endif (_CMAKE_IOS_SDKS) +# message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}") +#endif (NOT DEFINED CMAKE_IOS_SDK_ROOT) +#set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK") + +# Set the sysroot default to the most recent SDK +#set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support") +# set (CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}) +#set(CMAKE_OSX_SYSROOT "$(xcrun --sdk ${IOS_PLATFORM_LOCATION} --show-sdk-path)") + + +# set the architecture for iOS +#if (NOT DEFINED ARCH) +# set (ARCH armv7) +#endif() +set (IOS_ARCH ${ARCH}) + +#set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE STRING "Build architecture for iOS") +set(CMAKE_OSX_ARCHITECTURES arm64) +message(STATUS "ios arch: ${IOS_ARCH}") + +# Set the find root to the iOS developer roots and to user defined paths +#set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE STRING "iOS find search path root") + +# default to searching for frameworks first +# set (CMAKE_FIND_FRAMEWORK FIRST) + +# set up the default search directories for frameworks +# set (CMAKE_SYSTEM_FRAMEWORK_PATH +# ${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks +# ${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks +# ${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks +#) + +message(STATUS "IOS CMAKE conf finished") \ No newline at end of file diff --git a/cw_zano/ios/External/include/wallet2_api.h b/cw_zano/ios/External/include/wallet2_api.h new file mode 100644 index 000000000..1065f8f84 --- /dev/null +++ b/cw_zano/ios/External/include/wallet2_api.h @@ -0,0 +1,1333 @@ +// Copyright (c) 2014-2019, The Monero Project +// +// All rights reserved. +// +// Redistribution and use in source and binary forms, with or without modification, are +// permitted provided that the following conditions are met: +// +// 1. Redistributions of source code must retain the above copyright notice, this list of +// conditions and the following disclaimer. +// +// 2. Redistributions in binary form must reproduce the above copyright notice, this list +// of conditions and the following disclaimer in the documentation and/or other +// materials provided with the distribution. +// +// 3. Neither the name of the copyright holder nor the names of its contributors may be +// used to endorse or promote products derived from this software without specific +// prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY +// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL +// THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS +// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, +// STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF +// THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Parts of this file are originally copyright (c) 2012-2013 The Cryptonote developers + +#pragma once + + +#include +#include +#include +#include +#include +#include +#include +#include + +// Public interface for libwallet library +namespace Monero { + +enum NetworkType : uint8_t { + MAINNET = 0, + TESTNET, + STAGENET +}; + + + namespace Assets { + + std::vector list(); + } + + namespace Utils { + bool isAddressLocal(const std::string &hostaddr); + void onStartup(); + } + + template + class optional { + public: + optional(): set(false) {} + optional(const T &t): t(t), set(true) {} + const T &operator*() const { return t; } + T &operator*() { return t; } + operator bool() const { return set; } + private: + T t; + bool set; + }; + +/** + * @brief Transaction-like interface for sending money + */ +struct PendingTransaction +{ + enum Status { + Status_Ok, + Status_Error, + Status_Critical + }; + + enum Priority { + Priority_Default = 0, + Priority_Low = 1, + Priority_Medium = 2, + Priority_High = 3, + Priority_Last + }; + + virtual ~PendingTransaction() = 0; + virtual int status() const = 0; + virtual std::string errorString() const = 0; + // commit transaction or save to file if filename is provided. + virtual bool commit(const std::string &filename = "", bool overwrite = false) = 0; + virtual uint64_t amount() const = 0; + virtual std::string assetType() const = 0; + virtual uint64_t dust() const = 0; + virtual uint64_t fee() const = 0; + virtual std::vector txid() const = 0; + /*! + * \brief txCount - number of transactions current transaction will be splitted to + * \return + */ + virtual uint64_t txCount() const = 0; + virtual std::vector subaddrAccount() const = 0; + virtual std::vector> subaddrIndices() const = 0; + + /** + * @brief multisigSignData + * @return encoded multisig transaction with signers' keys. + * Transfer this data to another wallet participant to sign it. + * Assumed use case is: + * 1. Initiator: + * auto data = pendingTransaction->multisigSignData(); + * 2. Signer1: + * pendingTransaction = wallet->restoreMultisigTransaction(data); + * pendingTransaction->signMultisigTx(); + * auto signed = pendingTransaction->multisigSignData(); + * 3. Signer2: + * pendingTransaction = wallet->restoreMultisigTransaction(signed); + * pendingTransaction->signMultisigTx(); + * pendingTransaction->commit(); + */ + virtual std::string multisigSignData() = 0; + virtual void signMultisigTx() = 0; + /** + * @brief signersKeys + * @return vector of base58-encoded signers' public keys + */ + virtual std::vector signersKeys() const = 0; +}; + +/** + * @brief Transaction-like interface for sending money + */ +struct UnsignedTransaction +{ + enum Status { + Status_Ok, + Status_Error, + Status_Critical + }; + + virtual ~UnsignedTransaction() = 0; + virtual int status() const = 0; + virtual std::string errorString() const = 0; + virtual std::vector amount() const = 0; + virtual std::vector fee() const = 0; + virtual std::vector mixin() const = 0; + // returns a string with information about all transactions. + virtual std::string confirmationMessage() const = 0; + virtual std::vector paymentId() const = 0; + virtual std::vector recipientAddress() const = 0; + virtual uint64_t minMixinCount() const = 0; + /*! + * \brief txCount - number of transactions current transaction will be splitted to + * \return + */ + virtual uint64_t txCount() const = 0; + /*! + * @brief sign - Sign txs and saves to file + * @param signedFileName + * return - true on success + */ + virtual bool sign(const std::string &signedFileName) = 0; +}; + +/** + * @brief The TransactionInfo - interface for displaying transaction information + */ +struct TransactionInfo +{ + enum Direction { + Direction_In, + Direction_Out + }; + + struct Transfer { + Transfer(uint64_t _amount, const std::string &address); + const uint64_t amount; + const std::string address; + }; + + virtual ~TransactionInfo() = 0; + virtual int direction() const = 0; + virtual bool isPending() const = 0; + virtual bool isFailed() const = 0; + virtual uint64_t amount() const = 0; + virtual uint64_t fee() const = 0; + virtual uint64_t blockHeight() const = 0; + virtual std::set subaddrIndex() const = 0; + virtual uint32_t subaddrAccount() const = 0; + virtual std::string label() const = 0; + virtual uint64_t confirmations() const = 0; + virtual uint64_t unlockTime() const = 0; + //! transaction_id + virtual std::string hash() const = 0; + virtual std::time_t timestamp() const = 0; + virtual std::string paymentId() const = 0; + virtual std::string assetType() const = 0; + //! only applicable for output transactions + virtual const std::vector & transfers() const = 0; +}; +/** + * @brief The TransactionHistory - interface for displaying transaction history + */ +struct TransactionHistory +{ + virtual ~TransactionHistory() = 0; + virtual int count() const = 0; + virtual TransactionInfo * transaction(int index) const = 0; + virtual TransactionInfo * transaction(const std::string &id) const = 0; + virtual std::vector getAll() const = 0; + virtual void refresh() = 0; +}; + +/** + * @brief AddressBookRow - provides functions to manage address book + */ +struct AddressBookRow { +public: + AddressBookRow(std::size_t _rowId, const std::string &_address, const std::string &_paymentId, const std::string &_description): + m_rowId(_rowId), + m_address(_address), + m_paymentId(_paymentId), + m_description(_description) {} + +private: + std::size_t m_rowId; + std::string m_address; + std::string m_paymentId; + std::string m_description; +public: + std::string extra; + std::string getAddress() const {return m_address;} + std::string getDescription() const {return m_description;} + std::string getPaymentId() const {return m_paymentId;} + std::size_t getRowId() const {return m_rowId;} +}; + +/** + * @brief The AddressBook - interface for +Book + */ +struct AddressBook +{ + enum ErrorCode { + Status_Ok, + General_Error, + Invalid_Address, + Invalid_Payment_Id + }; + virtual ~AddressBook() = 0; + virtual std::vector getAll() const = 0; + virtual bool addRow(const std::string &dst_addr , const std::string &payment_id, const std::string &description) = 0; + virtual bool deleteRow(std::size_t rowId) = 0; + virtual void refresh() = 0; + virtual std::string errorString() const = 0; + virtual int errorCode() const = 0; + virtual int lookupPaymentID(const std::string &payment_id) const = 0; +}; + +struct SubaddressRow { +public: + SubaddressRow(std::size_t _rowId, const std::string &_address, const std::string &_label): + m_rowId(_rowId), + m_address(_address), + m_label(_label) {} + +private: + std::size_t m_rowId; + std::string m_address; + std::string m_label; +public: + std::string extra; + std::string getAddress() const {return m_address;} + std::string getLabel() const {return m_label;} + std::size_t getRowId() const {return m_rowId;} +}; + +struct Subaddress +{ + virtual ~Subaddress() = 0; + virtual std::vector getAll() const = 0; + virtual void addRow(uint32_t accountIndex, const std::string &label) = 0; + virtual void setLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0; + virtual void refresh(uint32_t accountIndex) = 0; +}; + +struct SubaddressAccountRow { +public: + SubaddressAccountRow(std::size_t _rowId, const std::string &_address, const std::string &_label, const std::map> &_balance, const std::map> &_unlockedBalance): + m_rowId(_rowId), + m_address(_address), + m_label(_label), + m_balance(_balance), + m_unlockedBalance(_unlockedBalance) {} + +private: + std::size_t m_rowId; + std::string m_address; + std::string m_label; + std::map> m_balance; + std::map> m_unlockedBalance; +public: + std::string extra; + std::string getAddress() const {return m_address;} + std::string getLabel() const {return m_label;} + std::map> getBalance() const {return m_balance;} + std::map> getUnlockedBalance() const {return m_unlockedBalance;} + std::size_t getRowId() const {return m_rowId;} +}; + +struct SubaddressAccount +{ + virtual ~SubaddressAccount() = 0; + virtual std::vector getAll() const = 0; + virtual void addRow(const std::string &label) = 0; + virtual void setLabel(uint32_t accountIndex, const std::string &label) = 0; + virtual void refresh() = 0; +}; + +struct MultisigState { + MultisigState() : isMultisig(false), isReady(false), threshold(0), total(0) {} + + bool isMultisig; + bool isReady; + uint32_t threshold; + uint32_t total; +}; + + +struct DeviceProgress { + DeviceProgress(): m_progress(0), m_indeterminate(false) {} + DeviceProgress(double progress, bool indeterminate=false): m_progress(progress), m_indeterminate(indeterminate) {} + + virtual double progress() const { return m_progress; } + virtual bool indeterminate() const { return m_indeterminate; } + +protected: + double m_progress; + bool m_indeterminate; +}; + +struct Wallet; +struct WalletListener +{ + virtual ~WalletListener() = 0; + /** + * @brief moneySpent - called when money spent + * @param txId - transaction id + * @param amount - amount + */ + virtual void moneySpent(const std::string &txId, uint64_t amount, std::string asset_type) = 0; + + /** + * @brief moneyReceived - called when money received + * @param txId - transaction id + * @param amount - amount + */ + virtual void moneyReceived(const std::string &txId, uint64_t amount, std::string asset_type) = 0; + + /** + * @brief unconfirmedMoneyReceived - called when payment arrived in tx pool + * @param txId - transaction id + * @param amount - amount + */ + virtual void unconfirmedMoneyReceived(const std::string &txId, uint64_t amount) = 0; + + /** + * @brief newBlock - called when new block received + * @param height - block height + */ + virtual void newBlock(uint64_t height) = 0; + + /** + * @brief updated - generic callback, called when any event (sent/received/block reveived/etc) happened with the wallet; + */ + virtual void updated() = 0; + + + /** + * @brief refreshed - called when wallet refreshed by background thread or explicitly refreshed by calling "refresh" synchronously + */ + virtual void refreshed() = 0; + + /** + * @brief called by device if the action is required + */ + virtual void onDeviceButtonRequest(uint64_t code) { (void)code; } + + /** + * @brief called by device if the button was pressed + */ + virtual void onDeviceButtonPressed() { } + + /** + * @brief called by device when PIN is needed + */ + virtual optional onDevicePinRequest() { + throw std::runtime_error("Not supported"); + } + + /** + * @brief called by device when passphrase entry is needed + */ + virtual optional onDevicePassphraseRequest(bool & on_device) { + on_device = true; + return optional(); + } + + /** + * @brief Signalizes device operation progress + */ + virtual void onDeviceProgress(const DeviceProgress & event) { (void)event; }; + + /** + * @brief If the listener is created before the wallet this enables to set created wallet object + */ + virtual void onSetWallet(Wallet * wallet) { (void)wallet; }; +}; + + +/** + * @brief Interface for wallet operations. + * TODO: check if /include/IWallet.h is still actual + */ +struct Wallet +{ + enum Device { + Device_Software = 0, + Device_Ledger = 1, + Device_Trezor = 2 + }; + + enum Status { + Status_Ok, + Status_Error, + Status_Critical + }; + + enum ConnectionStatus { + ConnectionStatus_Disconnected, + ConnectionStatus_Connected, + ConnectionStatus_WrongVersion + }; + + virtual ~Wallet() = 0; + virtual std::string seed() const = 0; + virtual std::string getSeedLanguage() const = 0; + virtual void setSeedLanguage(const std::string &arg) = 0; + //! returns wallet status (Status_Ok | Status_Error) + virtual int status() const = 0; //deprecated: use safe alternative statusWithErrorString + //! in case error status, returns error string + virtual std::string errorString() const = 0; //deprecated: use safe alternative statusWithErrorString + //! returns both error and error string atomically. suggested to use in instead of status() and errorString() + virtual void statusWithErrorString(int& status, std::string& errorString) const = 0; + virtual bool setPassword(const std::string &password) = 0; + virtual bool setDevicePin(const std::string &pin) { (void)pin; return false; }; + virtual bool setDevicePassphrase(const std::string &passphrase) { (void)passphrase; return false; }; + virtual std::string address(uint32_t accountIndex = 0, uint32_t addressIndex = 0) const = 0; + std::string mainAddress() const { return address(0, 0); } + virtual std::string path() const = 0; + virtual NetworkType nettype() const = 0; + bool mainnet() const { return nettype() == MAINNET; } + bool testnet() const { return nettype() == TESTNET; } + bool stagenet() const { return nettype() == STAGENET; } + //! returns current hard fork info + virtual void hardForkInfo(uint8_t &version, uint64_t &earliest_height) const = 0; + //! check if hard fork rules should be used + virtual bool useForkRules(uint8_t version, int64_t early_blocks) const = 0; + /*! + * \brief integratedAddress - returns integrated address for current wallet address and given payment_id. + * if passed "payment_id" param is an empty string or not-valid payment id string + * (16 characters hexadecimal string) - random payment_id will be generated + * + * \param payment_id - 16 characters hexadecimal string or empty string if new random payment id needs to be + * generated + * \return - 106 characters string representing integrated address + */ + virtual std::string integratedAddress(const std::string &payment_id) const = 0; + + /*! + * \brief secretViewKey - returns secret view key + * \return - secret view key + */ + virtual std::string secretViewKey() const = 0; + + /*! + * \brief publicViewKey - returns public view key + * \return - public view key + */ + virtual std::string publicViewKey() const = 0; + + /*! + * \brief secretSpendKey - returns secret spend key + * \return - secret spend key + */ + virtual std::string secretSpendKey() const = 0; + + /*! + * \brief publicSpendKey - returns public spend key + * \return - public spend key + */ + virtual std::string publicSpendKey() const = 0; + + /*! + * \brief publicMultisigSignerKey - returns public signer key + * \return - public multisignature signer key or empty string if wallet is not multisig + */ + virtual std::string publicMultisigSignerKey() const = 0; + + /*! + * \brief store - stores wallet to file. + * \param path - main filename to store wallet to. additionally stores address file and keys file. + * to store to the same file - just pass empty string; + * \return + */ + virtual bool store(const std::string &path) = 0; + /*! + * \brief filename - returns wallet filename + * \return + */ + virtual std::string filename() const = 0; + /*! + * \brief keysFilename - returns keys filename. usually this formed as "wallet_filename".keys + * \return + */ + virtual std::string keysFilename() const = 0; + /*! + * \brief init - initializes wallet with daemon connection params. + * if daemon_address is local address, "trusted daemon" will be set to true forcibly + * startRefresh() should be called when wallet is initialized. + * + * \param daemon_address - daemon address in "hostname:port" format + * \param upper_transaction_size_limit + * \param daemon_username + * \param daemon_password + * \param lightWallet - start wallet in light mode, connect to a openmonero compatible server. + * \return - true on success + */ + virtual bool init(const std::string &daemon_address, uint64_t upper_transaction_size_limit = 0, const std::string &daemon_username = "", const std::string &daemon_password = "", bool use_ssl = false, bool lightWallet = false) = 0; + + /*! + * \brief createWatchOnly - Creates a watch only wallet + * \param path - where to store the wallet + * \param password + * \param language + * \return - true if created successfully + */ + virtual bool createWatchOnly(const std::string &path, const std::string &password, const std::string &language) const = 0; + + /*! + * \brief setRefreshFromBlockHeight - start refresh from block height on recover + * + * \param refresh_from_block_height - blockchain start height + */ + virtual void setRefreshFromBlockHeight(uint64_t refresh_from_block_height) = 0; + + /*! + * \brief getRestoreHeight - get wallet creation height + * + */ + virtual uint64_t getRefreshFromBlockHeight() const = 0; + + /*! + * \brief setRecoveringFromSeed - set state recover form seed + * + * \param recoveringFromSeed - true/false + */ + virtual void setRecoveringFromSeed(bool recoveringFromSeed) = 0; + + /*! + * \brief setRecoveringFromDevice - set state to recovering from device + * + * \param recoveringFromDevice - true/false + */ + virtual void setRecoveringFromDevice(bool recoveringFromDevice) = 0; + + /*! + * \brief setSubaddressLookahead - set size of subaddress lookahead + * + * \param major - size fot the major index + * \param minor - size fot the minor index + */ + virtual void setSubaddressLookahead(uint32_t major, uint32_t minor) = 0; + + /** + * @brief connectToDaemon - connects to the daemon. TODO: check if it can be removed + * @return + */ + virtual bool connectToDaemon() = 0; + + /** + * @brief connected - checks if the wallet connected to the daemon + * @return - true if connected + */ + virtual ConnectionStatus connected() const = 0; + virtual void setTrustedDaemon(bool arg) = 0; + virtual bool trustedDaemon() const = 0; + virtual std::map> balance(uint32_t accountIndex = 0) const = 0; + virtual uint64_t balance(std::string asset_type, uint32_t accountIndex) const = 0; + virtual std::map balanceAll() const = 0; + virtual std::map> unlockedBalance(uint32_t accountIndex = 0) const = 0; + virtual uint64_t unlockedBalance(std::string asset_type, uint32_t accountIndex) const = 0; + virtual std::map unlockedBalanceAll() const = 0; + virtual std::map oracleRates() const = 0; + + /** + * @brief watchOnly - checks if wallet is watch only + * @return - true if watch only + */ + virtual bool watchOnly() const = 0; + + /** + * @brief blockChainHeight - returns current blockchain height + * @return + */ + virtual uint64_t blockChainHeight() const = 0; + + /** + * @brief approximateBlockChainHeight - returns approximate blockchain height calculated from date/time + * @return + */ + virtual uint64_t approximateBlockChainHeight() const = 0; + + /** + * @brief estimateBlockChainHeight - returns estimate blockchain height. More accurate than approximateBlockChainHeight, + * uses daemon height and falls back to calculation from date/time + * @return + **/ + virtual uint64_t estimateBlockChainHeight() const = 0; + /** + * @brief daemonBlockChainHeight - returns daemon blockchain height + * @return 0 - in case error communicating with the daemon. + * status() will return Status_Error and errorString() will return verbose error description + */ + virtual uint64_t daemonBlockChainHeight() const = 0; + + /** + * @brief daemonBlockChainTargetHeight - returns daemon blockchain target height + * @return 0 - in case error communicating with the daemon. + * status() will return Status_Error and errorString() will return verbose error description + */ + virtual uint64_t daemonBlockChainTargetHeight() const = 0; + + /** + * @brief synchronized - checks if wallet was ever synchronized + * @return + */ + virtual bool synchronized() const = 0; + + static std::string displayAmount(uint64_t amount); + static uint64_t amountFromString(const std::string &amount); + static uint64_t amountFromDouble(double amount); + static std::string genPaymentId(); + static bool paymentIdValid(const std::string &paiment_id); + static bool addressValid(const std::string &str, NetworkType nettype); + static bool addressValid(const std::string &str, bool testnet) // deprecated + { + return addressValid(str, testnet ? TESTNET : MAINNET); + } + static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, NetworkType nettype, std::string &error); + static bool keyValid(const std::string &secret_key_string, const std::string &address_string, bool isViewKey, bool testnet, std::string &error) // deprecated + { + return keyValid(secret_key_string, address_string, isViewKey, testnet ? TESTNET : MAINNET, error); + } + static std::string paymentIdFromAddress(const std::string &str, NetworkType nettype); + static std::string paymentIdFromAddress(const std::string &str, bool testnet) // deprecated + { + return paymentIdFromAddress(str, testnet ? TESTNET : MAINNET); + } + static uint64_t maximumAllowedAmount(); + // Easylogger wrapper + static void init(const char *argv0, const char *default_log_base_name) { init(argv0, default_log_base_name, "", true); } + static void init(const char *argv0, const char *default_log_base_name, const std::string &log_path, bool console); + static void debug(const std::string &category, const std::string &str); + static void info(const std::string &category, const std::string &str); + static void warning(const std::string &category, const std::string &str); + static void error(const std::string &category, const std::string &str); + + /** + * @brief StartRefresh - Start/resume refresh thread (refresh every 10 seconds) + */ + virtual void startRefresh() = 0; + /** + * @brief pauseRefresh - pause refresh thread + */ + virtual void pauseRefresh() = 0; + + /** + * @brief refresh - refreshes the wallet, updating transactions from daemon + * @return - true if refreshed successfully; + */ + virtual bool refresh() = 0; + + /** + * @brief refreshAsync - refreshes wallet asynchronously. + */ + virtual void refreshAsync() = 0; + + /** + * @brief rescanBlockchain - rescans the wallet, updating transactions from daemon + * @return - true if refreshed successfully; + */ + virtual bool rescanBlockchain() = 0; + + /** + * @brief rescanBlockchainAsync - rescans wallet asynchronously, starting from genesys + */ + virtual void rescanBlockchainAsync() = 0; + + /** + * @brief setAutoRefreshInterval - setup interval for automatic refresh. + * @param seconds - interval in millis. if zero or less than zero - automatic refresh disabled; + */ + virtual void setAutoRefreshInterval(int millis) = 0; + + /** + * @brief autoRefreshInterval - returns automatic refresh interval in millis + * @return + */ + virtual int autoRefreshInterval() const = 0; + + /** + * @brief addSubaddressAccount - appends a new subaddress account at the end of the last major index of existing subaddress accounts + * @param label - the label for the new account (which is the as the label of the primary address (accountIndex,0)) + */ + virtual void addSubaddressAccount(const std::string& label) = 0; + /** + * @brief numSubaddressAccounts - returns the number of existing subaddress accounts + */ + virtual size_t numSubaddressAccounts() const = 0; + /** + * @brief numSubaddresses - returns the number of existing subaddresses associated with the specified subaddress account + * @param accountIndex - the major index specifying the subaddress account + */ + virtual size_t numSubaddresses(uint32_t accountIndex) const = 0; + /** + * @brief addSubaddress - appends a new subaddress at the end of the last minor index of the specified subaddress account + * @param accountIndex - the major index specifying the subaddress account + * @param label - the label for the new subaddress + */ + virtual void addSubaddress(uint32_t accountIndex, const std::string& label) = 0; + /** + * @brief getSubaddressLabel - gets the label of the specified subaddress + * @param accountIndex - the major index specifying the subaddress account + * @param addressIndex - the minor index specifying the subaddress + */ + virtual std::string getSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex) const = 0; + /** + * @brief setSubaddressLabel - sets the label of the specified subaddress + * @param accountIndex - the major index specifying the subaddress account + * @param addressIndex - the minor index specifying the subaddress + * @param label - the new label for the specified subaddress + */ + virtual void setSubaddressLabel(uint32_t accountIndex, uint32_t addressIndex, const std::string &label) = 0; + + /** + * @brief multisig - returns current state of multisig wallet creation process + * @return MultisigState struct + */ + virtual MultisigState multisig() const = 0; + /** + * @brief getMultisigInfo + * @return serialized and signed multisig info string + */ + virtual std::string getMultisigInfo() const = 0; + /** + * @brief makeMultisig - switches wallet in multisig state. The one and only creation phase for N / N wallets + * @param info - vector of multisig infos from other participants obtained with getMulitisInfo call + * @param threshold - number of required signers to make valid transaction. Must be equal to number of participants (N) or N - 1 + * @return in case of N / N wallets returns empty string since no more key exchanges needed. For N - 1 / N wallets returns base58 encoded extra multisig info + */ + virtual std::string makeMultisig(const std::vector& info, uint32_t threshold) = 0; + /** + * @brief exchange_multisig_keys - provides additional key exchange round for arbitrary multisig schemes (like N-1/N, M/N) + * @param info - base58 encoded key derivations returned by makeMultisig or exchangeMultisigKeys function call + * @return new info string if more rounds required or an empty string if wallet creation is done + */ + virtual std::string exchangeMultisigKeys(const std::vector &info) = 0; + /** + * @brief finalizeMultisig - finalizes N - 1 / N multisig wallets creation + * @param extraMultisigInfo - wallet participants' extra multisig info obtained with makeMultisig call + * @return true if success + */ + virtual bool finalizeMultisig(const std::vector& extraMultisigInfo) = 0; + /** + * @brief exportMultisigImages - exports transfers' key images + * @param images - output paramter for hex encoded array of images + * @return true if success + */ + virtual bool exportMultisigImages(std::string& images) = 0; + /** + * @brief importMultisigImages - imports other participants' multisig images + * @param images - array of hex encoded arrays of images obtained with exportMultisigImages + * @return number of imported images + */ + virtual size_t importMultisigImages(const std::vector& images) = 0; + /** + * @brief hasMultisigPartialKeyImages - checks if wallet needs to import multisig key images from other participants + * @return true if there are partial key images + */ + virtual bool hasMultisigPartialKeyImages() const = 0; + + /** + * @brief restoreMultisigTransaction creates PendingTransaction from signData + * @param signData encrypted unsigned transaction. Obtained with PendingTransaction::multisigSignData + * @return PendingTransaction + */ + virtual PendingTransaction* restoreMultisigTransaction(const std::string& signData) = 0; + + /*! + * \brief createTransactionMultDest creates transaction with multiple destinations. if dst_addr is an integrated address, payment_id is ignored + * \param dst_addr vector of destination address as string + * \param payment_id optional payment_id, can be empty string + * \param amount vector of amounts + * \param mixin_count mixin count. if 0 passed, wallet will use default value + * \param subaddr_account subaddress account from which the input funds are taken + * \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices + * \param priority + * \return PendingTransaction object. caller is responsible to check PendingTransaction::status() + * after object returned + */ + + virtual PendingTransaction * createTransactionMultDest(const std::vector &dst_addr, const std::string &payment_id, + optional> amount, + const std::string &str_source, const std::string &str_dest, + uint32_t mixin_count, + PendingTransaction::Priority = PendingTransaction::Priority_Low, + uint32_t subaddr_account = 0, + std::set subaddr_indices = {}) = 0; + + /*! + * \brief createTransaction creates transaction. if dst_addr is an integrated address, payment_id is ignored + * \param dst_addr destination address as string + * \param payment_id optional payment_id, can be empty string + * \param amount amount + * \param mixin_count mixin count. if 0 passed, wallet will use default value + * \param subaddr_account subaddress account from which the input funds are taken + * \param subaddr_indices set of subaddress indices to use for transfer or sweeping. if set empty, all are chosen when sweeping, and one or more are automatically chosen when transferring. after execution, returns the set of actually used indices + * \param priority + * \return PendingTransaction object. caller is responsible to check PendingTransaction::status() + * after object returned + */ + + virtual PendingTransaction * createTransaction(const std::string &dst_addr, const std::string &payment_id, + optional amount, + const std::string &str_source, const std::string &str_dest, + uint32_t mixin_count, + PendingTransaction::Priority = PendingTransaction::Priority_Low, + uint32_t subaddr_account = 0, + std::set subaddr_indices = {}) = 0; + + /*! + * \brief createSweepUnmixableTransaction creates transaction with unmixable outputs. + * \return PendingTransaction object. caller is responsible to check PendingTransaction::status() + * after object returned + */ + + virtual PendingTransaction * createSweepUnmixableTransaction() = 0; + + /*! + * \brief loadUnsignedTx - creates transaction from unsigned tx file + * \return - UnsignedTransaction object. caller is responsible to check UnsignedTransaction::status() + * after object returned + */ + virtual UnsignedTransaction * loadUnsignedTx(const std::string &unsigned_filename) = 0; + + /*! + * \brief submitTransaction - submits transaction in signed tx file + * \return - true on success + */ + virtual bool submitTransaction(const std::string &fileName) = 0; + + + /*! + * \brief disposeTransaction - destroys transaction object + * \param t - pointer to the "PendingTransaction" object. Pointer is not valid after function returned; + */ + virtual void disposeTransaction(PendingTransaction * t) = 0; + + /*! + * \brief Estimates transaction fee. + * \param destinations Vector consisting of pairs. + * \return Estimated fee. + */ + virtual uint64_t estimateTransactionFee(const std::vector> &destinations, + PendingTransaction::Priority priority) const = 0; + + /*! + * \brief exportKeyImages - exports key images to file + * \param filename + * \return - true on success + */ + virtual bool exportKeyImages(const std::string &filename) = 0; + + /*! + * \brief importKeyImages - imports key images from file + * \param filename + * \return - true on success + */ + virtual bool importKeyImages(const std::string &filename) = 0; + + + virtual TransactionHistory * history() = 0; + virtual AddressBook * addressBook() = 0; + virtual Subaddress * subaddress() = 0; + virtual SubaddressAccount * subaddressAccount() = 0; + virtual void setListener(WalletListener *) = 0; + /*! + * \brief defaultMixin - returns number of mixins used in transactions + * \return + */ + virtual uint32_t defaultMixin() const = 0; + /*! + * \brief setDefaultMixin - setum number of mixins to be used for new transactions + * \param arg + */ + virtual void setDefaultMixin(uint32_t arg) = 0; + + /*! + * \brief setCacheAttribute - attach an arbitrary string to a wallet cache attribute + * \param key - the key + * \param val - the value + * \return true if successful, false otherwise + */ + virtual bool setCacheAttribute(const std::string &key, const std::string &val) = 0; + /*! + * \brief getCacheAttribute - return an arbitrary string attached to a wallet cache attribute + * \param key - the key + * \return the attached string, or empty string if there is none + */ + virtual std::string getCacheAttribute(const std::string &key) const = 0; + /*! + * \brief setUserNote - attach an arbitrary string note to a txid + * \param txid - the transaction id to attach the note to + * \param note - the note + * \return true if successful, false otherwise + */ + virtual bool setUserNote(const std::string &txid, const std::string ¬e) = 0; + /*! + * \brief getUserNote - return an arbitrary string note attached to a txid + * \param txid - the transaction id to attach the note to + * \return the attached note, or empty string if there is none + */ + virtual std::string getUserNote(const std::string &txid) const = 0; + virtual std::string getTxKey(const std::string &txid) const = 0; + virtual bool checkTxKey(const std::string &txid, std::string tx_key, const std::string &address, std::map &received, bool &in_pool, uint64_t &confirmations) = 0; + virtual std::string getTxProof(const std::string &txid, const std::string &address, const std::string &message) const = 0; + virtual bool checkTxProof(const std::string &txid, const std::string &address, const std::string &message, const std::string &signature, bool &good, std::map &received, bool &in_pool, uint64_t &confirmations) = 0; + virtual std::string getSpendProof(const std::string &txid, const std::string &message) const = 0; + virtual bool checkSpendProof(const std::string &txid, const std::string &message, const std::string &signature, bool &good) const = 0; + /*! + * \brief getReserveProof - Generates a proof that proves the reserve of unspent funds + * Parameters `account_index` and `amount` are ignored when `all` is true + */ + virtual std::string getReserveProof(bool all, uint32_t account_index, uint64_t amount, const std::string &message) const = 0; + virtual bool checkReserveProof(const std::string &address, const std::string &message, const std::string &signature, bool &good, uint64_t &total, uint64_t &spent) const = 0; + + /* + * \brief signMessage - sign a message with the spend private key + * \param message - the message to sign (arbitrary byte data) + * \return the signature + */ + virtual std::string signMessage(const std::string &message) = 0; + /*! + * \brief verifySignedMessage - verify a signature matches a given message + * \param message - the message (arbitrary byte data) + * \param address - the address the signature claims to be made with + * \param signature - the signature + * \return true if the signature verified, false otherwise + */ + virtual bool verifySignedMessage(const std::string &message, const std::string &addres, const std::string &signature) const = 0; + + /*! + * \brief signMultisigParticipant signs given message with the multisig public signer key + * \param message message to sign + * \return signature in case of success. Sets status to Error and return empty string in case of error + */ + virtual std::string signMultisigParticipant(const std::string &message) const = 0; + /*! + * \brief verifyMessageWithPublicKey verifies that message was signed with the given public key + * \param message message + * \param publicKey hex encoded public key + * \param signature signature of the message + * \return true if the signature is correct. false and sets error state in case of error + */ + virtual bool verifyMessageWithPublicKey(const std::string &message, const std::string &publicKey, const std::string &signature) const = 0; + + virtual bool parse_uri(const std::string &uri, std::string &address, std::string &payment_id, uint64_t &amount, std::string &tx_description, std::string &recipient_name, std::vector &unknown_parameters, std::string &error) = 0; + + virtual std::string getDefaultDataDir() const = 0; + + /* + * \brief rescanSpent - Rescan spent outputs - Can only be used with trusted daemon + * \return true on success + */ + virtual bool rescanSpent() = 0; + + //! blackballs a set of outputs + virtual bool blackballOutputs(const std::vector &outputs, bool add) = 0; + + //! blackballs an output + virtual bool blackballOutput(const std::string &amount, const std::string &offset) = 0; + + //! unblackballs an output + virtual bool unblackballOutput(const std::string &amount, const std::string &offset) = 0; + + //! gets the ring used for a key image, if any + virtual bool getRing(const std::string &key_image, std::vector &ring) const = 0; + + //! gets the rings used for a txid, if any + virtual bool getRings(const std::string &txid, std::vector>> &rings) const = 0; + + //! sets the ring used for a key image + virtual bool setRing(const std::string &key_image, const std::vector &ring, bool relative) = 0; + + //! sets whether pre-fork outs are to be segregated + virtual void segregatePreForkOutputs(bool segregate) = 0; + + //! sets the height where segregation should occur + virtual void segregationHeight(uint64_t height) = 0; + + //! secondary key reuse mitigation + virtual void keyReuseMitigation2(bool mitigation) = 0; + + //! Light wallet authenticate and login + virtual bool lightWalletLogin(bool &isNewWallet) const = 0; + + //! Initiates a light wallet import wallet request + virtual bool lightWalletImportWalletRequest(std::string &payment_id, uint64_t &fee, bool &new_request, bool &request_fulfilled, std::string &payment_address, std::string &status) = 0; + + //! locks/unlocks the keys file; returns true on success + virtual bool lockKeysFile() = 0; + virtual bool unlockKeysFile() = 0; + //! returns true if the keys file is locked + virtual bool isKeysFileLocked() = 0; + + /*! + * \brief Queries backing device for wallet keys + * \return Device they are on + */ + virtual Device getDeviceType() const = 0; + + //! cold-device protocol key image sync + virtual uint64_t coldKeyImageSync(uint64_t &spent, uint64_t &unspent) = 0; + + //! shows address on device display + virtual void deviceShowAddress(uint32_t accountIndex, uint32_t addressIndex, const std::string &paymentId) = 0; +}; + +/** + * @brief WalletManager - provides functions to manage wallets + */ +struct WalletManager +{ + + /*! + * \brief Creates new wallet + * \param path Name of wallet file + * \param password Password of wallet file + * \param language Language to be used to generate electrum seed mnemonic + * \param nettype Network type + * \param kdf_rounds Number of rounds for key derivation function + * \return Wallet instance (Wallet::status() needs to be called to check if created successfully) + */ + virtual Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, NetworkType nettype, uint64_t kdf_rounds = 1) = 0; + Wallet * createWallet(const std::string &path, const std::string &password, const std::string &language, bool testnet = false) // deprecated + { + return createWallet(path, password, language, testnet ? TESTNET : MAINNET); + } + + /*! + * \brief Opens existing wallet + * \param path Name of wallet file + * \param password Password of wallet file + * \param nettype Network type + * \param kdf_rounds Number of rounds for key derivation function + * \param listener Wallet listener to set to the wallet after creation + * \return Wallet instance (Wallet::status() needs to be called to check if opened successfully) + */ + virtual Wallet * openWallet(const std::string &path, const std::string &password, NetworkType nettype, uint64_t kdf_rounds = 1, WalletListener * listener = nullptr) = 0; + Wallet * openWallet(const std::string &path, const std::string &password, bool testnet = false) // deprecated + { + return openWallet(path, password, testnet ? TESTNET : MAINNET); + } + + /*! + * \brief recovers existing wallet using mnemonic (electrum seed) + * \param path Name of wallet file to be created + * \param password Password of wallet file + * \param mnemonic mnemonic (25 words electrum seed) + * \param nettype Network type + * \param restoreHeight restore from start height + * \param kdf_rounds Number of rounds for key derivation function + * \param seed_offset Seed offset passphrase (optional) + * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) + */ + virtual Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, + NetworkType nettype = MAINNET, uint64_t restoreHeight = 0, uint64_t kdf_rounds = 1, + const std::string &seed_offset = {}) = 0; + Wallet * recoveryWallet(const std::string &path, const std::string &password, const std::string &mnemonic, + bool testnet = false, uint64_t restoreHeight = 0) // deprecated + { + return recoveryWallet(path, password, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); + } + + /*! + * \deprecated this method creates a wallet WITHOUT a passphrase, use the alternate recoverWallet() method + * \brief recovers existing wallet using mnemonic (electrum seed) + * \param path Name of wallet file to be created + * \param mnemonic mnemonic (25 words electrum seed) + * \param nettype Network type + * \param restoreHeight restore from start height + * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) + */ + virtual Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, NetworkType nettype, uint64_t restoreHeight = 0) = 0; + Wallet * recoveryWallet(const std::string &path, const std::string &mnemonic, bool testnet = false, uint64_t restoreHeight = 0) // deprecated + { + return recoveryWallet(path, mnemonic, testnet ? TESTNET : MAINNET, restoreHeight); + } + + /*! + * \brief recovers existing wallet using keys. Creates a view only wallet if spend key is omitted + * \param path Name of wallet file to be created + * \param password Password of wallet file + * \param language language + * \param nettype Network type + * \param restoreHeight restore from start height + * \param addressString public address + * \param viewKeyString view key + * \param spendKeyString spend key (optional) + * \param kdf_rounds Number of rounds for key derivation function + * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) + */ + virtual Wallet * createWalletFromKeys(const std::string &path, + const std::string &password, + const std::string &language, + NetworkType nettype, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "", + uint64_t kdf_rounds = 1) = 0; + Wallet * createWalletFromKeys(const std::string &path, + const std::string &password, + const std::string &language, + bool testnet, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "") // deprecated + { + return createWalletFromKeys(path, password, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); + } + + /*! + * \deprecated this method creates a wallet WITHOUT a passphrase, use createWalletFromKeys(..., password, ...) instead + * \brief recovers existing wallet using keys. Creates a view only wallet if spend key is omitted + * \param path Name of wallet file to be created + * \param language language + * \param nettype Network type + * \param restoreHeight restore from start height + * \param addressString public address + * \param viewKeyString view key + * \param spendKeyString spend key (optional) + * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) + */ + virtual Wallet * createWalletFromKeys(const std::string &path, + const std::string &language, + NetworkType nettype, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "") = 0; + Wallet * createWalletFromKeys(const std::string &path, + const std::string &language, + bool testnet, + uint64_t restoreHeight, + const std::string &addressString, + const std::string &viewKeyString, + const std::string &spendKeyString = "") // deprecated + { + return createWalletFromKeys(path, language, testnet ? TESTNET : MAINNET, restoreHeight, addressString, viewKeyString, spendKeyString); + } + + /*! + * \brief creates wallet using hardware device. + * \param path Name of wallet file to be created + * \param password Password of wallet file + * \param nettype Network type + * \param deviceName Device name + * \param restoreHeight restore from start height (0 sets to current height) + * \param subaddressLookahead Size of subaddress lookahead (empty sets to some default low value) + * \param kdf_rounds Number of rounds for key derivation function + * \param listener Wallet listener to set to the wallet after creation + * \return Wallet instance (Wallet::status() needs to be called to check if recovered successfully) + */ + virtual Wallet * createWalletFromDevice(const std::string &path, + const std::string &password, + NetworkType nettype, + const std::string &deviceName, + uint64_t restoreHeight = 0, + const std::string &subaddressLookahead = "", + uint64_t kdf_rounds = 1, + WalletListener * listener = nullptr) = 0; + + /*! + * \brief Closes wallet. In case operation succeeded, wallet object deleted. in case operation failed, wallet object not deleted + * \param wallet previously opened / created wallet instance + * \return None + */ + virtual bool closeWallet(Wallet *wallet, bool store = true) = 0; + + /* + * ! checks if wallet with the given name already exists + */ + + /*! + * @brief TODO: delme walletExists - check if the given filename is the wallet + * @param path - filename + * @return - true if wallet exists + */ + virtual bool walletExists(const std::string &path) = 0; + + /*! + * @brief verifyWalletPassword - check if the given filename is the wallet + * @param keys_file_name - location of keys file + * @param password - password to verify + * @param no_spend_key - verify only view keys? + * @param kdf_rounds - number of rounds for key derivation function + * @return - true if password is correct + * + * @note + * This function will fail when the wallet keys file is opened because the wallet program locks the keys file. + * In this case, Wallet::unlockKeysFile() and Wallet::lockKeysFile() need to be called before and after the call to this function, respectively. + */ + virtual bool verifyWalletPassword(const std::string &keys_file_name, const std::string &password, bool no_spend_key, uint64_t kdf_rounds = 1) const = 0; + + /*! + * \brief determine the key storage for the specified wallet file + * \param device_type (OUT) wallet backend as enumerated in Wallet::Device + * \param keys_file_name Keys file to verify password for + * \param password Password to verify + * \return true if password correct, else false + * + * for verification only - determines key storage hardware + * + */ + virtual bool queryWalletDevice(Wallet::Device& device_type, const std::string &keys_file_name, const std::string &password, uint64_t kdf_rounds = 1) const = 0; + + /*! + * \brief findWallets - searches for the wallet files by given path name recursively + * \param path - starting point to search + * \return - list of strings with found wallets (absolute paths); + */ + virtual std::vector findWallets(const std::string &path) = 0; + + //! returns verbose error string regarding last error; + virtual std::string errorString() const = 0; + + //! set the daemon address (hostname and port) + virtual void setDaemonAddress(const std::string &address) = 0; + + //! returns whether the daemon can be reached, and its version number + virtual bool connected(uint32_t *version = NULL) = 0; + + //! returns current blockchain height + virtual uint64_t blockchainHeight() = 0; + + //! returns current blockchain target height + virtual uint64_t blockchainTargetHeight() = 0; + + //! returns current network difficulty + virtual uint64_t networkDifficulty() = 0; + + //! returns current mining hash rate (0 if not mining) + virtual double miningHashRate() = 0; + + //! returns current block target + virtual uint64_t blockTarget() = 0; + + //! returns true iff mining + virtual bool isMining() = 0; + + //! starts mining with the set number of threads + virtual bool startMining(const std::string &address, uint32_t threads = 1, bool background_mining = false, bool ignore_battery = true) = 0; + + //! stops mining + virtual bool stopMining() = 0; + + //! resolves an OpenAlias address to a monero address + virtual std::string resolveOpenAlias(const std::string &address, bool &dnssec_valid) const = 0; + + //! checks for an update and returns version, hash and url + static std::tuple checkUpdates( + const std::string &software, + std::string subdir, + const char *buildtag = nullptr, + const char *current_version = nullptr); +}; + + +struct WalletManagerFactory +{ + // logging levels for underlying library + enum LogLevel { + LogLevel_Silent = -1, + LogLevel_0 = 0, + LogLevel_1 = 1, + LogLevel_2 = 2, + LogLevel_3 = 3, + LogLevel_4 = 4, + LogLevel_Min = LogLevel_Silent, + LogLevel_Max = LogLevel_4 + }; + + static WalletManager * getWalletManager(); + static void setLogLevel(int level); + static void setLogCategories(const std::string &categories); +}; + + +} + +namespace Bitmonero = Monero; + diff --git a/cw_zano/ios/cw_zano.podspec b/cw_zano/ios/cw_zano.podspec new file mode 100644 index 000000000..711e45a1e --- /dev/null +++ b/cw_zano/ios/cw_zano.podspec @@ -0,0 +1,43 @@ +# +# To learn more about a Podspec see http://guides.cocoapods.org/syntax/podspec.html. +# Run `pod lib lint cw_zano.podspec` to validate before publishing. +# +Pod::Spec.new do |s| + s.name = 'cw_zano' + s.version = '0.0.1' + s.summary = 'Cake Wallet Zano' + s.description = 'Cake Wallet wrapper over Zano project' + s.homepage = 'http://cakewallet.com' + s.license = { :file => '../LICENSE' } + s.author = { 'Cake Wallet' => 'support@cakewallet.com' } + s.source = { :path => '.' } + s.source_files = 'Classes/**/*' + s.public_header_files = 'Classes/**/*.h, Classes/*.h, ../shared_external/ios/libs/monero/include/src/**/*.h, ../shared_external/ios/libs/monero/include/contrib/**/*.h, ../shared_external/ios/libs/monero/include/../shared_external/ios/**/*.h' + s.dependency 'Flutter' + # s.dependency 'cw_shared_external' + s.platform = :ios, '10.0' + s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS' => 'arm64', 'ENABLE_BITCODE' => 'NO' } + s.swift_version = '5.0' + s.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/Classes/*.h" } + + s.subspec 'OpenSSL' do |openssl| + openssl.preserve_paths = 'External/ios/include/**/*.h' + openssl.vendored_libraries = 'External/ios/lib/libcrypto.a', 'External/ios/lib/libssl.a' + openssl.libraries = 'ssl', 'crypto' + openssl.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" } + end + + s.subspec 'Boost' do |boost| + boost.preserve_paths = 'External/ios/include/**/*.h', + boost.vendored_libraries = 'External/ios/lib/libboost.a', + boost.libraries = '' + boost.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include/**" } + end + + s.subspec 'Zano' do |zano| + zano.preserve_paths = 'External/ios/include/**/*.h' + zano.vendored_libraries = 'External/ios/lib/libzano.a' + zano.libraries = '' + zano.xcconfig = { 'HEADER_SEARCH_PATHS' => "${PODS_ROOT}/#{s.name}/External/ios/include" } + end +end diff --git a/cw_zano/lib/api/api_calls.dart b/cw_zano/lib/api/api_calls.dart new file mode 100644 index 000000000..43fac9367 --- /dev/null +++ b/cw_zano/lib/api/api_calls.dart @@ -0,0 +1,301 @@ +import 'dart:ffi'; + +import 'package:cw_zano/api/utf8.dart'; +import 'package:cw_zano/api/utf8_box.dart'; +import 'package:cw_zano/api/zano_api.dart'; +import 'package:ffi/ffi.dart'; + +// char * create_wallet(char *path, char *password, char *language, int32_t networkType, char *error) +typedef _create_wallet = Pointer Function(Pointer, Pointer, Pointer, Int32, Pointer); +typedef _CreateWallet = Pointer Function(Pointer, Pointer, Pointer, int, Pointer); + +// char * restore_wallet_from_seed(char *path, char *password, char *seed, int32_t networkType, uint64_t restoreHeight, char *error) +typedef _restore_wallet_from_seed = Pointer Function(Pointer, Pointer, Pointer, Int32, Int64, Pointer); +typedef _RestoreWalletFromSeed = Pointer Function(Pointer, Pointer, Pointer, int, int, Pointer); + +// char * load_wallet(char *path, char *password, int32_t nettype) +typedef _load_wallet = Pointer Function(Pointer, Pointer, Int8); +typedef _LoadWallet = Pointer Function(Pointer, Pointer, int); + +// is_wallet_exist(char *path) +typedef _is_wallet_exist = Int8 Function(Pointer); +typedef _IsWalletExist = int Function(Pointer); + +// void close_wallet(uint64_t hwallet) +// char *close_wallet(uint64_t hwallet) +typedef _close_wallet = Pointer Function(Int64); +typedef _closeWallet = Pointer Function(int hWallet); + +// uint64_t get_current_tx_fee(uint64_t priority) +typedef _get_current_tx_fee = Int64 Function(Int64); +typedef _getCurrentTxFee = int Function(int priority); + +// char* get_address_info(char* address) +typedef _GetAddressInfo = Pointer Function(Pointer address); + +// char* async_call(char* method_name, uint64_t instance_id, char* params) +typedef _async_call = Pointer Function(Pointer, Int64, Pointer); +typedef _AsyncCall = Pointer Function(Pointer, int, Pointer); + +// // char* try_pull_result(uint64_t job_id) +// // char *get_wallet_info(uint64_t hwallet) +// // char* get_wallet_status(uint64_t hwallet) +typedef _stringFunctionWithInt64 = Pointer Function(Int64); +typedef _StringFunctionWithIntHWallet = Pointer Function(int); + +// bool setup_node(char *address, char *login, char *password, bool use_ssl, bool is_light_wallet, char *error) +typedef _setup_node = Int8 Function(Pointer, Pointer?, Pointer?, Int8, Int8, Pointer); +typedef _SetupNode = int Function(Pointer, Pointer?, Pointer?, int, int, Pointer); + +// char* set_password(uint64_t hwallet, char *password, Utf8Box &error) +typedef _set_password = Pointer Function(Int64 hWallet, Pointer password, Pointer error); +typedef _SetPassword = Pointer Function(int hWallet, Pointer password, Pointer error); + +// char* get_connectivity_status() +// char* get_version() +// get_opened_wallets() +typedef _stringFunction = Pointer Function(); + +class ApiCalls { + static String _convertUTF8ToString({required Pointer pointer}) { + //final str = pointer.toDartString(); + final str = pointer.toDartStringAllowingMalformed(); + calloc.free(pointer); + return str; + } + + static String _performApiCall( + Pointer Function() apiCall, { + List>? pointersToFree, + }) { + try { + return _convertUTF8ToString(pointer: apiCall()); + } finally { + if (pointersToFree != null) { + for (var pointer in pointersToFree) { + calloc.free(pointer); + } + } + } + } + + static final _createWalletNative = zanoApi.lookup>('create_wallet').asFunction<_CreateWallet>(); + + static String createWallet({ + required String path, + required String password, + String language = '', + int nettype = 0, + }) { + final pathPointer = path.toNativeUtf8(); + final passwordPointer = password.toNativeUtf8(); + final languagePointer = language.toNativeUtf8(); + final errorMessagePointer = ''.toNativeUtf8(); + final result = _performApiCall( + () => _createWalletNative( + pathPointer, + passwordPointer, + languagePointer, + nettype, + errorMessagePointer, + ), + pointersToFree: [pathPointer, passwordPointer, languagePointer, errorMessagePointer]); + + return result; + } + + static final _restoreWalletFromSeedNative = zanoApi.lookup>('restore_wallet_from_seed').asFunction<_RestoreWalletFromSeed>(); + + static String restoreWalletFromSeed({ + required String path, + required String password, + required String seed, + }) { + final pathPointer = path.toNativeUtf8(); + final passwordPointer = password.toNativeUtf8(); + final seedPointer = seed.toNativeUtf8(); + final errorMessagePointer = ''.toNativeUtf8(); + final result = _performApiCall( + () => _restoreWalletFromSeedNative( + pathPointer, + passwordPointer, + seedPointer, + 0, + 0, + errorMessagePointer, + ), + pointersToFree: [ + pathPointer, + passwordPointer, + seedPointer, + errorMessagePointer, + ], + ); + return result; + } + + static final _loadWalletNative = zanoApi.lookup>('load_wallet').asFunction<_LoadWallet>(); + + static String loadWallet({ + required String path, + required String password, + int nettype = 0, + }) { + final pathPointer = path.toNativeUtf8(); + final passwordPointer = password.toNativeUtf8(); + final result = _performApiCall( + () => _loadWalletNative( + pathPointer, + passwordPointer, + nettype, + ), + pointersToFree: [ + pathPointer, + passwordPointer, + ], + ); + return result; + } + + static final _isWalletExistNative = zanoApi.lookup>('is_wallet_exist').asFunction<_IsWalletExist>(); + + static bool isWalletExist({required String path}) { + final pathPointer = path.toNativeUtf8(); + final isExist = _isWalletExistNative(pathPointer) != 0; + calloc.free(pathPointer); + return isExist; + } + + static final _closeWalletNative = zanoApi.lookup>('close_wallet').asFunction<_closeWallet>(); + + static String closeWallet({required int hWallet}) => _performApiCall(() => _closeWalletNative(hWallet)); + + static final _getWalletInfoNative = zanoApi.lookup>('get_wallet_info').asFunction<_StringFunctionWithIntHWallet>(); + + static String getWalletInfo(int hWallet) => _performApiCall(() => _getWalletInfoNative(hWallet)); + + static final _getWalletStatusNative = zanoApi.lookup>('get_wallet_status').asFunction<_StringFunctionWithIntHWallet>(); + + static String getWalletStatus({required int hWallet}) => _performApiCall(() => _getWalletStatusNative(hWallet)); + + static final _getCurrentTxFeeNative = zanoApi.lookup>('get_current_tx_fee').asFunction<_getCurrentTxFee>(); + + static int getCurrentTxFee({required int priority}) => _getCurrentTxFeeNative(priority); + + static final _getConnectivityStatusNative = zanoApi.lookup>('get_connectivity_status').asFunction<_stringFunction>(); + + static String getConnectivityStatus() => _performApiCall(() => _getConnectivityStatusNative()); + + static final _getOpenedWalletsNative = zanoApi.lookup>('get_opened_wallets').asFunction<_stringFunction>(); + static String getOpenedWallets() => _performApiCall(() => _getOpenedWalletsNative()); + + static final _getAddressInfoNative = zanoApi.lookup>('get_address_info').asFunction<_GetAddressInfo>(); + + static String getAddressInfo({required String address}) { + final addressPointer = address.toNativeUtf8(); + final result = _performApiCall( + () => _getAddressInfoNative(addressPointer), + pointersToFree: [addressPointer], + ); + return result; + } + + static final _asyncCallNative = zanoApi.lookup>('async_call').asFunction<_AsyncCall>(); + static final _syncCallNative = zanoApi.lookup>('sync_call').asFunction<_AsyncCall>(); + + static String syncCall({required String methodName, required int hWallet, required String params}) { + final methodNamePointer = methodName.toNativeUtf8(); + final paramsPointer = params.toNativeUtf8(); + final result = _performApiCall( + () => _syncCallNative( + methodNamePointer, + hWallet, + paramsPointer, + ), + pointersToFree: [ + methodNamePointer, + paramsPointer, + ], + ); + return result; + } + + static String asyncCall({required String methodName, required int hWallet, required String params}) { + final methodNamePointer = methodName.toNativeUtf8(); + final paramsPointer = params.toNativeUtf8(); + final result = _performApiCall( + () => _asyncCallNative( + methodNamePointer, + hWallet, + paramsPointer, + ), + pointersToFree: [ + methodNamePointer, + paramsPointer, + ], + ); + return result; + } + + static final _tryPullResultNative = zanoApi.lookup>('try_pull_result').asFunction<_StringFunctionWithIntHWallet>(); + + static String tryPullResult(int jobId) { + final result = _performApiCall(() => _tryPullResultNative(jobId)); + return result; + } + + static final _setupNodeNative = zanoApi.lookup>('setup_node').asFunction<_SetupNode>(); + + static bool setupNode({ + required String address, + required String login, + required String password, + bool useSSL = false, + bool isLightWallet = false, + }) { + final addressPointer = address.toNativeUtf8(); + final loginPointer = login.toNativeUtf8(); + final passwordPointer = password.toNativeUtf8(); + final errorMessagePointer = ''.toNativeUtf8(); + final isSetupNode = _setupNodeNative( + addressPointer, + loginPointer, + passwordPointer, + _boolToInt(useSSL), + _boolToInt(isLightWallet), + errorMessagePointer, + ) != + 0; + + calloc.free(addressPointer); + calloc.free(loginPointer); + calloc.free(passwordPointer); + return isSetupNode; + } + + static final _setPasswordNative = zanoApi.lookup>('set_password').asFunction<_SetPassword>(); + + static String setPassword({required int hWallet, required String password}) { + final passwordPointer = password.toNativeUtf8(); + final errorMessagePointer = calloc(); + final result = _performApiCall( + () => _setPasswordNative( + hWallet, + passwordPointer, + errorMessagePointer, + ), + pointersToFree: [passwordPointer], + ); + calloc.free(errorMessagePointer); + return result; + } + + static final _getVersionNative = zanoApi.lookup>('get_version').asFunction<_stringFunction>(); + + static String getVersion() { + final result = _performApiCall(() => _getVersionNative()); + return result; + } + + static int _boolToInt(bool value) => value ? 1 : 0; +} diff --git a/cw_zano/lib/api/consts.dart b/cw_zano/lib/api/consts.dart new file mode 100644 index 000000000..80002b880 --- /dev/null +++ b/cw_zano/lib/api/consts.dart @@ -0,0 +1,6 @@ +class Consts { + static const errorWrongSeed = 'WRONG_SEED'; + static const errorAlreadyExists = 'ALREADY_EXISTS'; + static const errorWalletWrongId = 'WALLET_WRONG_ID'; + static const errorBusy = 'BUSY'; +} \ No newline at end of file diff --git a/cw_zano/lib/api/model/asset_id_params.dart b/cw_zano/lib/api/model/asset_id_params.dart new file mode 100644 index 000000000..3856f5f4e --- /dev/null +++ b/cw_zano/lib/api/model/asset_id_params.dart @@ -0,0 +1,9 @@ +class AssetIdParams { + final String assetId; + + AssetIdParams({required this.assetId}); + + Map toJson() => { + 'asset_id': assetId, + }; +} \ No newline at end of file diff --git a/cw_zano/lib/api/model/balance.dart b/cw_zano/lib/api/model/balance.dart new file mode 100644 index 000000000..8ea48d2a4 --- /dev/null +++ b/cw_zano/lib/api/model/balance.dart @@ -0,0 +1,31 @@ +import 'package:cw_zano/model/zano_asset.dart'; +import 'package:cw_zano/zano_formatter.dart'; + +class Balance { + final ZanoAsset assetInfo; + final BigInt awaitingIn; + final BigInt awaitingOut; + final BigInt total; + final BigInt unlocked; + + Balance( + {required this.assetInfo, + required this.awaitingIn, + required this.awaitingOut, + required this.total, + required this.unlocked}); + + String get assetId => assetInfo.assetId; + + @override + String toString() => '$assetInfo: $total/$unlocked'; + + factory Balance.fromJson(Map json) => Balance( + assetInfo: + ZanoAsset.fromJson(json['asset_info'] as Map? ?? {}), + awaitingIn: ZanoFormatter.bigIntFromDynamic(json['awaiting_in']), + awaitingOut: ZanoFormatter.bigIntFromDynamic(json['awaiting_out']), + total: ZanoFormatter.bigIntFromDynamic(json['total']), + unlocked: ZanoFormatter.bigIntFromDynamic(json['unlocked']), + ); +} diff --git a/cw_zano/lib/api/model/create_wallet_result.dart b/cw_zano/lib/api/model/create_wallet_result.dart new file mode 100644 index 000000000..91b6fc00b --- /dev/null +++ b/cw_zano/lib/api/model/create_wallet_result.dart @@ -0,0 +1,39 @@ +import 'package:cw_zano/api/model/recent_history.dart'; +import 'package:cw_zano/api/model/wi.dart'; + +class CreateWalletResult { + final String name; + final String pass; + final RecentHistory recentHistory; + final bool recovered; + final String seed; + final int walletFileSize; + final int walletId; + final int walletLocalBcSize; + final Wi wi; + + CreateWalletResult( + {required this.name, + required this.pass, + required this.recentHistory, + required this.recovered, + required this.seed, + required this.walletFileSize, + required this.walletId, + required this.walletLocalBcSize, + required this.wi}); + + factory CreateWalletResult.fromJson(Map json) => + CreateWalletResult( + name: json['name'] as String? ?? '', + pass: json['pass'] as String? ?? '', + recentHistory: RecentHistory.fromJson( + json['recent_history'] as Map? ?? {}), + recovered: json['recovered'] as bool? ?? false, + seed: json['seed'] as String? ?? '', + walletFileSize: json['wallet_file_size'] as int? ?? 0, + walletId: json['wallet_id'] as int? ?? 0, + walletLocalBcSize: json['wallet_local_bc_size'] as int? ?? 0, + wi: Wi.fromJson(json['wi'] as Map? ?? {}), + ); +} diff --git a/cw_zano/lib/api/model/destination.dart b/cw_zano/lib/api/model/destination.dart new file mode 100644 index 000000000..3db4f6652 --- /dev/null +++ b/cw_zano/lib/api/model/destination.dart @@ -0,0 +1,20 @@ +class Destination { + final BigInt amount; // transfered as string + final String address; + final String assetId; + + Destination( + {required this.amount, required this.address, required this.assetId}); + + factory Destination.fromJson(Map json) => Destination( + amount: BigInt.parse(json['amount'] as String? ?? '0'), + address: json['address'] as String? ?? '', + assetId: json['asset_id'] as String? ?? '', + ); + + Map toJson() => { + 'amount': amount.toString(), + 'address': address, + 'asset_id': assetId, + }; +} diff --git a/cw_zano/lib/api/model/employed_entries.dart b/cw_zano/lib/api/model/employed_entries.dart new file mode 100644 index 000000000..59e5fe34d --- /dev/null +++ b/cw_zano/lib/api/model/employed_entries.dart @@ -0,0 +1,18 @@ +import 'package:cw_zano/api/model/receive.dart'; + +class EmployedEntries { + final List receive; + final List send; + + EmployedEntries({required this.receive, required this.send}); + + factory EmployedEntries.fromJson(Map json) => + EmployedEntries( + receive: json['receive'] == null ? [] : (json['receive'] as List) + .map((e) => Receive.fromJson(e as Map)) + .toList(), + send: json['spent'] == null ? [] : (json['spent'] as List) + .map((e) => Receive.fromJson(e as Map)) + .toList(), + ); +} diff --git a/cw_zano/lib/api/model/get_address_info_result.dart b/cw_zano/lib/api/model/get_address_info_result.dart new file mode 100644 index 000000000..e8399adb1 --- /dev/null +++ b/cw_zano/lib/api/model/get_address_info_result.dart @@ -0,0 +1,16 @@ +class GetAddressInfoResult { + final bool valid; + final bool auditable; + final bool paymentId; + final bool wrap; + + GetAddressInfoResult( + {required this.valid, required this.auditable, required this.paymentId, required this.wrap}); + + factory GetAddressInfoResult.fromJson(Map json) => GetAddressInfoResult( + valid: json['valid'] as bool? ?? false, + auditable: json['auditable'] as bool? ?? false, + paymentId: json['payment_id'] as bool? ?? false, + wrap: json['wrap'] as bool? ?? false, + ); +} diff --git a/cw_zano/lib/api/model/get_recent_txs_and_info_params.dart b/cw_zano/lib/api/model/get_recent_txs_and_info_params.dart new file mode 100644 index 000000000..1ad9fc155 --- /dev/null +++ b/cw_zano/lib/api/model/get_recent_txs_and_info_params.dart @@ -0,0 +1,14 @@ +class GetRecentTxsAndInfoParams { + final int offset; + final int count; + final bool updateProvisionInfo; + + GetRecentTxsAndInfoParams({required this.offset, required this.count, this.updateProvisionInfo = true}); + + Map toJson() => { + 'offset': offset, + 'count': count, + 'update_provision_info': updateProvisionInfo, + 'order': 'FROM_BEGIN_TO_END', + }; +} \ No newline at end of file diff --git a/cw_zano/lib/api/model/get_recent_txs_and_info_result.dart b/cw_zano/lib/api/model/get_recent_txs_and_info_result.dart new file mode 100644 index 000000000..6b725490c --- /dev/null +++ b/cw_zano/lib/api/model/get_recent_txs_and_info_result.dart @@ -0,0 +1,12 @@ +import 'package:cw_zano/api/model/transfer.dart'; + +class GetRecentTxsAndInfoResult { + final List transfers; + final int lastItemIndex; + final int totalTransfers; + + GetRecentTxsAndInfoResult({required this.transfers, required this.lastItemIndex, required this.totalTransfers}); + + GetRecentTxsAndInfoResult.empty(): this.transfers = [], this.lastItemIndex = 0, this.totalTransfers = 0; + +} \ No newline at end of file diff --git a/cw_zano/lib/api/model/get_wallet_info_result.dart b/cw_zano/lib/api/model/get_wallet_info_result.dart new file mode 100644 index 000000000..e14d19375 --- /dev/null +++ b/cw_zano/lib/api/model/get_wallet_info_result.dart @@ -0,0 +1,14 @@ +import 'package:cw_zano/api/model/wi.dart'; +import 'package:cw_zano/api/model/wi_extended.dart'; + +class GetWalletInfoResult { + final Wi wi; + final WiExtended wiExtended; + + GetWalletInfoResult({required this.wi, required this.wiExtended}); + + factory GetWalletInfoResult.fromJson(Map json) => GetWalletInfoResult( + wi: Wi.fromJson(json['wi'] as Map? ?? {}), + wiExtended: WiExtended.fromJson(json['wi_extended'] as Map? ?? {}), + ); +} diff --git a/cw_zano/lib/api/model/get_wallet_status_result.dart b/cw_zano/lib/api/model/get_wallet_status_result.dart new file mode 100644 index 000000000..da11c4c93 --- /dev/null +++ b/cw_zano/lib/api/model/get_wallet_status_result.dart @@ -0,0 +1,26 @@ +class GetWalletStatusResult { + final int currentDaemonHeight; + final int currentWalletHeight; + final bool isDaemonConnected; + final bool isInLongRefresh; + final int progress; + final int walletState; + + GetWalletStatusResult( + {required this.currentDaemonHeight, + required this.currentWalletHeight, + required this.isDaemonConnected, + required this.isInLongRefresh, + required this.progress, + required this.walletState}); + + factory GetWalletStatusResult.fromJson(Map json) => + GetWalletStatusResult( + currentDaemonHeight: json['current_daemon_height'] as int? ?? 0, + currentWalletHeight: json['current_wallet_height'] as int? ?? 0, + isDaemonConnected: json['is_daemon_connected'] as bool? ?? false, + isInLongRefresh: json['is_in_long_refresh'] as bool? ?? false, + progress: json['progress'] as int? ?? 0, + walletState: json['wallet_state'] as int? ?? 0, + ); +} diff --git a/cw_zano/lib/api/model/proxy_to_daemon_params.dart b/cw_zano/lib/api/model/proxy_to_daemon_params.dart new file mode 100644 index 000000000..328187cfa --- /dev/null +++ b/cw_zano/lib/api/model/proxy_to_daemon_params.dart @@ -0,0 +1,13 @@ +import 'dart:convert'; + +class ProxyToDaemonParams { + final String body; + final String uri; + + ProxyToDaemonParams({required this.body, required this.uri}); + + Map toJson() => { + 'base64_body': base64Encode(utf8.encode(body)), + 'uri': uri, + }; +} diff --git a/cw_zano/lib/api/model/proxy_to_daemon_result.dart b/cw_zano/lib/api/model/proxy_to_daemon_result.dart new file mode 100644 index 000000000..bf8da7c8d --- /dev/null +++ b/cw_zano/lib/api/model/proxy_to_daemon_result.dart @@ -0,0 +1,13 @@ +import 'dart:convert'; + +class ProxyToDaemonResult { + final String body; + final int responseCode; + + ProxyToDaemonResult({required this.body, required this.responseCode}); + + factory ProxyToDaemonResult.fromJson(Map json) => ProxyToDaemonResult( + body: utf8.decode(base64Decode(json['base64_body'] as String? ?? '')), + responseCode: json['response_code'] as int? ?? 0, + ); +} diff --git a/cw_zano/lib/api/model/receive.dart b/cw_zano/lib/api/model/receive.dart new file mode 100644 index 000000000..6364bf181 --- /dev/null +++ b/cw_zano/lib/api/model/receive.dart @@ -0,0 +1,15 @@ +import 'package:cw_zano/zano_formatter.dart'; + +class Receive { + final BigInt amount; + final String assetId; + final int index; + + Receive({required this.amount, required this.assetId, required this.index}); + + factory Receive.fromJson(Map json) => Receive( + amount: ZanoFormatter.bigIntFromDynamic(json['amount']), + assetId: json['asset_id'] as String? ?? '', + index: json['index'] as int? ?? 0, + ); +} diff --git a/cw_zano/lib/api/model/recent_history.dart b/cw_zano/lib/api/model/recent_history.dart new file mode 100644 index 000000000..6591f426d --- /dev/null +++ b/cw_zano/lib/api/model/recent_history.dart @@ -0,0 +1,20 @@ +import 'package:cw_zano/api/model/transfer.dart'; + +class RecentHistory { + final List? history; + final int lastItemIndex; + final int totalHistoryItems; + + RecentHistory( + {required this.history, + required this.lastItemIndex, + required this.totalHistoryItems}); + + factory RecentHistory.fromJson(Map json) => RecentHistory( + history: json['history'] == null ? null : (json['history'] as List) + .map((e) => Transfer.fromJson(e as Map)) + .toList(), + lastItemIndex: json['last_item_index'] as int? ?? 0, + totalHistoryItems: json['total_history_items'] as int? ?? 0, + ); +} diff --git a/cw_zano/lib/api/model/store_result.dart b/cw_zano/lib/api/model/store_result.dart new file mode 100644 index 000000000..0ff6625c1 --- /dev/null +++ b/cw_zano/lib/api/model/store_result.dart @@ -0,0 +1,9 @@ +class StoreResult { + final int walletFileSize; + + StoreResult({required this.walletFileSize}); + + factory StoreResult.fromJson(Map json) => StoreResult( + walletFileSize: json['wallet_file_size'] as int? ?? 0, + ); +} \ No newline at end of file diff --git a/cw_zano/lib/api/model/subtransfer.dart b/cw_zano/lib/api/model/subtransfer.dart new file mode 100644 index 000000000..d92f1407a --- /dev/null +++ b/cw_zano/lib/api/model/subtransfer.dart @@ -0,0 +1,16 @@ +import 'package:cw_zano/zano_formatter.dart'; + +class Subtransfer { + final BigInt amount; + final String assetId; + final bool isIncome; + + Subtransfer( + {required this.amount, required this.assetId, required this.isIncome}); + + factory Subtransfer.fromJson(Map json) => Subtransfer( + amount: ZanoFormatter.bigIntFromDynamic(json['amount']), + assetId: json['asset_id'] as String? ?? '', + isIncome: json['is_income'] as bool? ?? false, + ); +} diff --git a/cw_zano/lib/api/model/transfer.dart b/cw_zano/lib/api/model/transfer.dart new file mode 100644 index 000000000..460afcfef --- /dev/null +++ b/cw_zano/lib/api/model/transfer.dart @@ -0,0 +1,125 @@ +import 'package:cw_zano/api/model/employed_entries.dart'; +import 'package:cw_zano/api/model/subtransfer.dart'; +import 'package:collection/collection.dart'; +import 'package:cw_zano/model/zano_asset.dart'; +import 'package:cw_zano/model/zano_transaction_info.dart'; +import 'package:cw_zano/zano_formatter.dart'; +import 'package:cw_zano/zano_wallet.dart'; +import 'package:cw_zano/zano_wallet_api.dart'; + +class Transfer { + final String comment; + final EmployedEntries employedEntries; + final int fee; + final int height; + final bool isMining; + final bool isMixing; + final bool isService; + final String paymentId; + final List remoteAddresses; + final List remoteAliases; + final bool showSender; + final List subtransfers; + final int timestamp; + final int transferInternalIndex; + final int txBlobSize; + final String txHash; + final int txType; + final int unlockTime; + + Transfer({ + required this.comment, + required this.employedEntries, + required this.fee, + required this.height, + required this.isMining, + required this.isMixing, + required this.isService, + required this.paymentId, + required this.remoteAddresses, + required this.remoteAliases, + required this.showSender, + required this.subtransfers, + required this.timestamp, + required this.transferInternalIndex, + required this.txBlobSize, + required this.txHash, + required this.txType, + required this.unlockTime, + }); + + factory Transfer.fromJson(Map json) => Transfer( + comment: json['comment'] as String? ?? '', + employedEntries: EmployedEntries.fromJson(json['employed_entries'] as Map? ?? {}), + fee: json['fee'] as int? ?? 0, + height: json['height'] as int? ?? 0, + isMining: json['is_mining'] as bool? ?? false, + isMixing: json['is_mixing'] as bool? ?? false, + isService: json['is_service'] as bool? ?? false, + paymentId: json['payment_id'] as String? ?? '', + remoteAddresses: json['remote_addresses'] == null ? [] : (json['remote_addresses'] as List).cast(), + remoteAliases: json['remote_aliases'] == null ? [] : (json['remote_aliases'] as List).cast(), + showSender: json['show_sender'] as bool? ?? false, + subtransfers: (json['subtransfers'] as List? ?? []).map((e) => Subtransfer.fromJson(e as Map)).toList(), + timestamp: json['timestamp'] as int? ?? 0, + transferInternalIndex: json['transfer_internal_index'] == null + ? 0 + : json['transfer_internal_index'] is double + ? (json['transfer_internal_index'] as double).toInt() + : json['transfer_internal_index'] as int, + txBlobSize: json['tx_blob_size'] as int? ?? 0, + txHash: json['tx_hash'] as String? ?? '', + txType: json['tx_type'] as int? ?? 0, + unlockTime: json['unlock_time'] as int? ?? 0, + ); + + static Map makeMap(List transfers, Map zanoAssets, int currentDaemonHeight) { + return Map.fromIterable( + transfers, + key: (item) => (item as Transfer).txHash, + value: (transfer) { + transfer as Transfer; + // Simple (only one subtransfer OR two subtransfers and the second is Zano, outgoing and amount equals to fee) or complex? + Subtransfer? single = transfer.subtransfers.singleOrNull; + if (transfer.subtransfers.length == 2) { + final zano = transfer.subtransfers.firstWhereOrNull((element) => element.assetId == ZanoWalletBase.zanoAssetId); + if (zano != null && !zano.isIncome && zano.amount == BigInt.from(transfer.fee)) { + single = transfer.subtransfers.firstWhere((element) => element.assetId != ZanoWalletBase.zanoAssetId); + } + } + bool isSimple = single != null; + // TODO: for complex transactions we show zano or any other transaction, will fix it later + if (!isSimple) { + single = + transfer.subtransfers.firstWhereOrNull((element) => element.assetId == ZanoWalletBase.zanoAssetId) ?? transfer.subtransfers.first; + } + if (single.assetId != ZanoWalletBase.zanoAssetId) { + final asset = zanoAssets[single.assetId]; + if (asset == null) { + ZanoWalletApi.error('unknown asset ${single.assetId}'); + } + final ticker = asset == null ? '***' : asset.ticker; + final decimalPoint = asset == null ? ZanoFormatter.defaultDecimalPoint : asset.decimalPoint; + return ZanoTransactionInfo.fromTransfer( + transfer, + confirmations: currentDaemonHeight - transfer.height, + isIncome: single.isIncome, + assetId: single.assetId, + amount: single.amount, + tokenSymbol: isSimple ? ticker : '*${ticker}', + decimalPoint: decimalPoint, + ); + } + final amount = single.isIncome ? single.amount : single.amount - BigInt.from(transfer.fee); + return ZanoTransactionInfo.fromTransfer( + transfer, + confirmations: currentDaemonHeight - transfer.height, + isIncome: single.isIncome, + assetId: single.assetId, + amount: amount, + tokenSymbol: isSimple ? 'ZANO' : '*ZANO', + ); + }, + ); + } +} diff --git a/cw_zano/lib/api/model/transfer_params.dart b/cw_zano/lib/api/model/transfer_params.dart new file mode 100644 index 000000000..586d5ddb8 --- /dev/null +++ b/cw_zano/lib/api/model/transfer_params.dart @@ -0,0 +1,41 @@ +import 'package:cw_zano/api/model/destination.dart'; + +class TransferParams { + final List destinations; + final BigInt fee; + final int mixin; + final String paymentId; + final String comment; + final bool pushPayer; + final bool hideReceiver; + + TransferParams({ + required this.destinations, + required this.fee, + required this.mixin, + required this.paymentId, + required this.comment, + required this.pushPayer, + required this.hideReceiver, + }); + + Map toJson() => { + 'destinations': destinations, + 'fee': fee.toInt(), + 'mixin': mixin, + 'payment_id': paymentId, + 'comment': comment, + 'push_payer': pushPayer, + 'hide_receiver': hideReceiver, + }; + + factory TransferParams.fromJson(Map json) => TransferParams( + destinations: (json['destinations'] as List?)?.map((e) => Destination.fromJson(e as Map)).toList() ?? [], + fee: BigInt.from(json['fee'] as int? ?? 0), + mixin: json['mixin'] as int? ?? 0, + paymentId: json['payment_id'] as String? ?? '', + comment: json['comment'] as String? ?? '', + pushPayer: json['push_payer'] as bool? ?? false, + hideReceiver: json['hide_receiver'] as bool? ?? false, + ); +} diff --git a/cw_zano/lib/api/model/transfer_result.dart b/cw_zano/lib/api/model/transfer_result.dart new file mode 100644 index 000000000..e0259fecc --- /dev/null +++ b/cw_zano/lib/api/model/transfer_result.dart @@ -0,0 +1,13 @@ +class TransferResult { + final String txHash; + final int txSize; + final String txUnsignedHex; + + TransferResult({required this.txHash, required this.txSize, required this.txUnsignedHex}); + + factory TransferResult.fromJson(Map json) => TransferResult( + txHash: json['tx_hash'] as String? ?? '', + txSize: json['tx_size'] as int? ?? 0, + txUnsignedHex: json['tx_unsigned_hex'] as String? ?? '', + ); +} diff --git a/cw_zano/lib/api/model/wi.dart b/cw_zano/lib/api/model/wi.dart new file mode 100644 index 000000000..0375cdf96 --- /dev/null +++ b/cw_zano/lib/api/model/wi.dart @@ -0,0 +1,32 @@ +import 'package:cw_zano/api/model/balance.dart'; + +class Wi { + final String address; + final List balances; + final bool isAuditable; + final bool isWatchOnly; + final int minedTotal; + final String path; + final String viewSecKey; + + Wi( + {required this.address, + required this.balances, + required this.isAuditable, + required this.isWatchOnly, + required this.minedTotal, + required this.path, + required this.viewSecKey}); + + factory Wi.fromJson(Map json) => Wi( + address: json['address'] as String? ?? '', + balances: (json['balances'] as List? ?? []) + .map((e) => Balance.fromJson(e as Map)) + .toList(), + isAuditable: json['is_auditable'] as bool? ?? false, + isWatchOnly: json['is_watch_only'] as bool? ?? false, + minedTotal: json['mined_total'] as int? ?? 0, + path: json['path'] as String? ?? '', + viewSecKey: json['view_sec_key'] as String? ?? '', + ); +} diff --git a/cw_zano/lib/api/model/wi_extended.dart b/cw_zano/lib/api/model/wi_extended.dart new file mode 100644 index 000000000..ab7e8efbd --- /dev/null +++ b/cw_zano/lib/api/model/wi_extended.dart @@ -0,0 +1,17 @@ +class WiExtended { + final String seed; + final String spendPrivateKey; + final String spendPublicKey; + final String viewPrivateKey; + final String viewPublicKey; + + WiExtended({required this.seed, required this.spendPrivateKey, required this.spendPublicKey, required this.viewPrivateKey, required this.viewPublicKey}); + + factory WiExtended.fromJson(Map json) => WiExtended( + seed: json['seed'] as String? ?? '', + spendPrivateKey: json['spend_private_key'] as String? ?? '', + spendPublicKey: json['spend_public_key'] as String? ?? '', + viewPrivateKey: json['view_private_key'] as String? ?? '', + viewPublicKey: json['view_public_key'] as String? ?? '', + ); +} \ No newline at end of file diff --git a/cw_zano/lib/api/utf8.dart b/cw_zano/lib/api/utf8.dart new file mode 100644 index 000000000..fced763cc --- /dev/null +++ b/cw_zano/lib/api/utf8.dart @@ -0,0 +1,25 @@ +import 'dart:convert'; +import 'dart:ffi'; + +import 'package:ffi/ffi.dart'; + +extension Utf8Pointer on Pointer { + String toDartStringAllowingMalformed({int? length}) { + //_ensureNotNullptr('toDartString'); + final codeUnits = cast(); + if (length != null) { + RangeError.checkNotNegative(length, 'length'); + } else { + length = _length(codeUnits); + } + return utf8.decode(codeUnits.asTypedList(length), allowMalformed: true); + } + + static int _length(Pointer codeUnits) { + var length = 0; + while (codeUnits[length] != 0) { + length++; + } + return length; + } +} \ No newline at end of file diff --git a/cw_zano/lib/api/utf8_box.dart b/cw_zano/lib/api/utf8_box.dart new file mode 100644 index 000000000..53e678c88 --- /dev/null +++ b/cw_zano/lib/api/utf8_box.dart @@ -0,0 +1,8 @@ +import 'dart:ffi'; +import 'package:ffi/ffi.dart'; + +class Utf8Box extends Struct { + external Pointer value; + + String getValue() => value.toDartString(); +} diff --git a/cw_zano/lib/api/zano_api.dart b/cw_zano/lib/api/zano_api.dart new file mode 100644 index 000000000..0bcff04e1 --- /dev/null +++ b/cw_zano/lib/api/zano_api.dart @@ -0,0 +1,6 @@ +import 'dart:ffi'; +import 'dart:io'; + +final DynamicLibrary zanoApi = Platform.isAndroid + ? DynamicLibrary.open('libcw_zano.so') + : DynamicLibrary.open('cw_zano.framework/cw_zano'); diff --git a/cw_zano/lib/mnemonics/english.dart b/cw_zano/lib/mnemonics/english.dart new file mode 100644 index 000000000..9749f974b --- /dev/null +++ b/cw_zano/lib/mnemonics/english.dart @@ -0,0 +1,1630 @@ +class EnglishMnemonics { + static const words = [ + "like", + "just", + "love", + "know", + "never", + "want", + "time", + "out", + "there", + "make", + "look", + "eye", + "down", + "only", + "think", + "heart", + "back", + "then", + "into", + "about", + "more", + "away", + "still", + "them", + "take", + "thing", + "even", + "through", + "long", + "always", + "world", + "too", + "friend", + "tell", + "try", + "hand", + "thought", + "over", + "here", + "other", + "need", + "smile", + "again", + "much", + "cry", + "been", + "night", + "ever", + "little", + "said", + "end", + "some", + "those", + "around", + "mind", + "people", + "girl", + "leave", + "dream", + "left", + "turn", + "myself", + "give", + "nothing", + "really", + "off", + "before", + "something", + "find", + "walk", + "wish", + "good", + "once", + "place", + "ask", + "stop", + "keep", + "watch", + "seem", + "everything", + "wait", + "got", + "yet", + "made", + "remember", + "start", + "alone", + "run", + "hope", + "maybe", + "believe", + "body", + "hate", + "after", + "close", + "talk", + "stand", + "own", + "each", + "hurt", + "help", + "home", + "god", + "soul", + "new", + "many", + "two", + "inside", + "should", + "true", + "first", + "fear", + "mean", + "better", + "play", + "another", + "gone", + "change", + "use", + "wonder", + "someone", + "hair", + "cold", + "open", + "best", + "any", + "behind", + "happen", + "water", + "dark", + "laugh", + "stay", + "forever", + "name", + "work", + "show", + "sky", + "break", + "came", + "deep", + "door", + "put", + "black", + "together", + "upon", + "happy", + "such", + "great", + "white", + "matter", + "fill", + "past", + "please", + "burn", + "cause", + "enough", + "touch", + "moment", + "soon", + "voice", + "scream", + "anything", + "stare", + "sound", + "red", + "everyone", + "hide", + "kiss", + "truth", + "death", + "beautiful", + "mine", + "blood", + "broken", + "very", + "pass", + "next", + "forget", + "tree", + "wrong", + "air", + "mother", + "understand", + "lip", + "hit", + "wall", + "memory", + "sleep", + "free", + "high", + "realize", + "school", + "might", + "skin", + "sweet", + "perfect", + "blue", + "kill", + "breath", + "dance", + "against", + "fly", + "between", + "grow", + "strong", + "under", + "listen", + "bring", + "sometimes", + "speak", + "pull", + "person", + "become", + "family", + "begin", + "ground", + "real", + "small", + "father", + "sure", + "feet", + "rest", + "young", + "finally", + "land", + "across", + "today", + "different", + "guy", + "line", + "fire", + "reason", + "reach", + "second", + "slowly", + "write", + "eat", + "smell", + "mouth", + "step", + "learn", + "three", + "floor", + "promise", + "breathe", + "darkness", + "push", + "earth", + "guess", + "save", + "song", + "above", + "along", + "both", + "color", + "house", + "almost", + "sorry", + "anymore", + "brother", + "okay", + "dear", + "game", + "fade", + "already", + "apart", + "warm", + "beauty", + "heard", + "notice", + "question", + "shine", + "began", + "piece", + "whole", + "shadow", + "secret", + "street", + "within", + "finger", + "point", + "morning", + "whisper", + "child", + "moon", + "green", + "story", + "glass", + "kid", + "silence", + "since", + "soft", + "yourself", + "empty", + "shall", + "angel", + "answer", + "baby", + "bright", + "dad", + "path", + "worry", + "hour", + "drop", + "follow", + "power", + "war", + "half", + "flow", + "heaven", + "act", + "chance", + "fact", + "least", + "tired", + "children", + "near", + "quite", + "afraid", + "rise", + "sea", + "taste", + "window", + "cover", + "nice", + "trust", + "lot", + "sad", + "cool", + "force", + "peace", + "return", + "blind", + "easy", + "ready", + "roll", + "rose", + "drive", + "held", + "music", + "beneath", + "hang", + "mom", + "paint", + "emotion", + "quiet", + "clear", + "cloud", + "few", + "pretty", + "bird", + "outside", + "paper", + "picture", + "front", + "rock", + "simple", + "anyone", + "meant", + "reality", + "road", + "sense", + "waste", + "bit", + "leaf", + "thank", + "happiness", + "meet", + "men", + "smoke", + "truly", + "decide", + "self", + "age", + "book", + "form", + "alive", + "carry", + "escape", + "damn", + "instead", + "able", + "ice", + "minute", + "throw", + "catch", + "leg", + "ring", + "course", + "goodbye", + "lead", + "poem", + "sick", + "corner", + "desire", + "known", + "problem", + "remind", + "shoulder", + "suppose", + "toward", + "wave", + "drink", + "jump", + "woman", + "pretend", + "sister", + "week", + "human", + "joy", + "crack", + "grey", + "pray", + "surprise", + "dry", + "knee", + "less", + "search", + "bleed", + "caught", + "clean", + "embrace", + "future", + "king", + "son", + "sorrow", + "chest", + "hug", + "remain", + "sat", + "worth", + "blow", + "daddy", + "final", + "parent", + "tight", + "also", + "create", + "lonely", + "safe", + "cross", + "dress", + "evil", + "silent", + "bone", + "fate", + "perhaps", + "anger", + "class", + "scar", + "snow", + "tiny", + "tonight", + "continue", + "control", + "dog", + "edge", + "mirror", + "month", + "suddenly", + "comfort", + "given", + "loud", + "quickly", + "gaze", + "plan", + "rush", + "stone", + "town", + "battle", + "ignore", + "spirit", + "stood", + "stupid", + "yours", + "brown", + "build", + "dust", + "hey", + "kept", + "pay", + "phone", + "twist", + "although", + "ball", + "beyond", + "hidden", + "nose", + "taken", + "fail", + "float", + "pure", + "somehow", + "wash", + "wrap", + "angry", + "cheek", + "creature", + "forgotten", + "heat", + "rip", + "single", + "space", + "special", + "weak", + "whatever", + "yell", + "anyway", + "blame", + "job", + "choose", + "country", + "curse", + "drift", + "echo", + "figure", + "grew", + "laughter", + "neck", + "suffer", + "worse", + "yeah", + "disappear", + "foot", + "forward", + "knife", + "mess", + "somewhere", + "stomach", + "storm", + "beg", + "idea", + "lift", + "offer", + "breeze", + "field", + "five", + "often", + "simply", + "stuck", + "win", + "allow", + "confuse", + "enjoy", + "except", + "flower", + "seek", + "strength", + "calm", + "grin", + "gun", + "heavy", + "hill", + "large", + "ocean", + "shoe", + "sigh", + "straight", + "summer", + "tongue", + "accept", + "crazy", + "everyday", + "exist", + "grass", + "mistake", + "sent", + "shut", + "surround", + "table", + "ache", + "brain", + "destroy", + "heal", + "nature", + "shout", + "sign", + "stain", + "choice", + "doubt", + "glance", + "glow", + "mountain", + "queen", + "stranger", + "throat", + "tomorrow", + "city", + "either", + "fish", + "flame", + "rather", + "shape", + "spin", + "spread", + "ash", + "distance", + "finish", + "image", + "imagine", + "important", + "nobody", + "shatter", + "warmth", + "became", + "feed", + "flesh", + "funny", + "lust", + "shirt", + "trouble", + "yellow", + "attention", + "bare", + "bite", + "money", + "protect", + "amaze", + "appear", + "born", + "choke", + "completely", + "daughter", + "fresh", + "friendship", + "gentle", + "probably", + "six", + "deserve", + "expect", + "grab", + "middle", + "nightmare", + "river", + "thousand", + "weight", + "worst", + "wound", + "barely", + "bottle", + "cream", + "regret", + "relationship", + "stick", + "test", + "crush", + "endless", + "fault", + "itself", + "rule", + "spill", + "art", + "circle", + "join", + "kick", + "mask", + "master", + "passion", + "quick", + "raise", + "smooth", + "unless", + "wander", + "actually", + "broke", + "chair", + "deal", + "favorite", + "gift", + "note", + "number", + "sweat", + "box", + "chill", + "clothes", + "lady", + "mark", + "park", + "poor", + "sadness", + "tie", + "animal", + "belong", + "brush", + "consume", + "dawn", + "forest", + "innocent", + "pen", + "pride", + "stream", + "thick", + "clay", + "complete", + "count", + "draw", + "faith", + "press", + "silver", + "struggle", + "surface", + "taught", + "teach", + "wet", + "bless", + "chase", + "climb", + "enter", + "letter", + "melt", + "metal", + "movie", + "stretch", + "swing", + "vision", + "wife", + "beside", + "crash", + "forgot", + "guide", + "haunt", + "joke", + "knock", + "plant", + "pour", + "prove", + "reveal", + "steal", + "stuff", + "trip", + "wood", + "wrist", + "bother", + "bottom", + "crawl", + "crowd", + "fix", + "forgive", + "frown", + "grace", + "loose", + "lucky", + "party", + "release", + "surely", + "survive", + "teacher", + "gently", + "grip", + "speed", + "suicide", + "travel", + "treat", + "vein", + "written", + "cage", + "chain", + "conversation", + "date", + "enemy", + "however", + "interest", + "million", + "page", + "pink", + "proud", + "sway", + "themselves", + "winter", + "church", + "cruel", + "cup", + "demon", + "experience", + "freedom", + "pair", + "pop", + "purpose", + "respect", + "shoot", + "softly", + "state", + "strange", + "bar", + "birth", + "curl", + "dirt", + "excuse", + "lord", + "lovely", + "monster", + "order", + "pack", + "pants", + "pool", + "scene", + "seven", + "shame", + "slide", + "ugly", + "among", + "blade", + "blonde", + "closet", + "creek", + "deny", + "drug", + "eternity", + "gain", + "grade", + "handle", + "key", + "linger", + "pale", + "prepare", + "swallow", + "swim", + "tremble", + "wheel", + "won", + "cast", + "cigarette", + "claim", + "college", + "direction", + "dirty", + "gather", + "ghost", + "hundred", + "loss", + "lung", + "orange", + "present", + "swear", + "swirl", + "twice", + "wild", + "bitter", + "blanket", + "doctor", + "everywhere", + "flash", + "grown", + "knowledge", + "numb", + "pressure", + "radio", + "repeat", + "ruin", + "spend", + "unknown", + "buy", + "clock", + "devil", + "early", + "false", + "fantasy", + "pound", + "precious", + "refuse", + "sheet", + "teeth", + "welcome", + "add", + "ahead", + "block", + "bury", + "caress", + "content", + "depth", + "despite", + "distant", + "marry", + "purple", + "threw", + "whenever", + "bomb", + "dull", + "easily", + "grasp", + "hospital", + "innocence", + "normal", + "receive", + "reply", + "rhyme", + "shade", + "someday", + "sword", + "toe", + "visit", + "asleep", + "bought", + "center", + "consider", + "flat", + "hero", + "history", + "ink", + "insane", + "muscle", + "mystery", + "pocket", + "reflection", + "shove", + "silently", + "smart", + "soldier", + "spot", + "stress", + "train", + "type", + "view", + "whether", + "bus", + "energy", + "explain", + "holy", + "hunger", + "inch", + "magic", + "mix", + "noise", + "nowhere", + "prayer", + "presence", + "shock", + "snap", + "spider", + "study", + "thunder", + "trail", + "admit", + "agree", + "bag", + "bang", + "bound", + "butterfly", + "cute", + "exactly", + "explode", + "familiar", + "fold", + "further", + "pierce", + "reflect", + "scent", + "selfish", + "sharp", + "sink", + "spring", + "stumble", + "universe", + "weep", + "women", + "wonderful", + "action", + "ancient", + "attempt", + "avoid", + "birthday", + "branch", + "chocolate", + "core", + "depress", + "drunk", + "especially", + "focus", + "fruit", + "honest", + "match", + "palm", + "perfectly", + "pillow", + "pity", + "poison", + "roar", + "shift", + "slightly", + "thump", + "truck", + "tune", + "twenty", + "unable", + "wipe", + "wrote", + "coat", + "constant", + "dinner", + "drove", + "egg", + "eternal", + "flight", + "flood", + "frame", + "freak", + "gasp", + "glad", + "hollow", + "motion", + "peer", + "plastic", + "root", + "screen", + "season", + "sting", + "strike", + "team", + "unlike", + "victim", + "volume", + "warn", + "weird", + "attack", + "await", + "awake", + "built", + "charm", + "crave", + "despair", + "fought", + "grant", + "grief", + "horse", + "limit", + "message", + "ripple", + "sanity", + "scatter", + "serve", + "split", + "string", + "trick", + "annoy", + "blur", + "boat", + "brave", + "clearly", + "cling", + "connect", + "fist", + "forth", + "imagination", + "iron", + "jock", + "judge", + "lesson", + "milk", + "misery", + "nail", + "naked", + "ourselves", + "poet", + "possible", + "princess", + "sail", + "size", + "snake", + "society", + "stroke", + "torture", + "toss", + "trace", + "wise", + "bloom", + "bullet", + "cell", + "check", + "cost", + "darling", + "during", + "footstep", + "fragile", + "hallway", + "hardly", + "horizon", + "invisible", + "journey", + "midnight", + "mud", + "nod", + "pause", + "relax", + "shiver", + "sudden", + "value", + "youth", + "abuse", + "admire", + "blink", + "breast", + "bruise", + "constantly", + "couple", + "creep", + "curve", + "difference", + "dumb", + "emptiness", + "gotta", + "honor", + "plain", + "planet", + "recall", + "rub", + "ship", + "slam", + "soar", + "somebody", + "tightly", + "weather", + "adore", + "approach", + "bond", + "bread", + "burst", + "candle", + "coffee", + "cousin", + "crime", + "desert", + "flutter", + "frozen", + "grand", + "heel", + "hello", + "language", + "level", + "movement", + "pleasure", + "powerful", + "random", + "rhythm", + "settle", + "silly", + "slap", + "sort", + "spoken", + "steel", + "threaten", + "tumble", + "upset", + "aside", + "awkward", + "bee", + "blank", + "board", + "button", + "card", + "carefully", + "complain", + "crap", + "deeply", + "discover", + "drag", + "dread", + "effort", + "entire", + "fairy", + "giant", + "gotten", + "greet", + "illusion", + "jeans", + "leap", + "liquid", + "march", + "mend", + "nervous", + "nine", + "replace", + "rope", + "spine", + "stole", + "terror", + "accident", + "apple", + "balance", + "boom", + "childhood", + "collect", + "demand", + "depression", + "eventually", + "faint", + "glare", + "goal", + "group", + "honey", + "kitchen", + "laid", + "limb", + "machine", + "mere", + "mold", + "murder", + "nerve", + "painful", + "poetry", + "prince", + "rabbit", + "shelter", + "shore", + "shower", + "soothe", + "stair", + "steady", + "sunlight", + "tangle", + "tease", + "treasure", + "uncle", + "begun", + "bliss", + "canvas", + "cheer", + "claw", + "clutch", + "commit", + "crimson", + "crystal", + "delight", + "doll", + "existence", + "express", + "fog", + "football", + "gay", + "goose", + "guard", + "hatred", + "illuminate", + "mass", + "math", + "mourn", + "rich", + "rough", + "skip", + "stir", + "student", + "style", + "support", + "thorn", + "tough", + "yard", + "yearn", + "yesterday", + "advice", + "appreciate", + "autumn", + "bank", + "beam", + "bowl", + "capture", + "carve", + "collapse", + "confusion", + "creation", + "dove", + "feather", + "girlfriend", + "glory", + "government", + "harsh", + "hop", + "inner", + "loser", + "moonlight", + "neighbor", + "neither", + "peach", + "pig", + "praise", + "screw", + "shield", + "shimmer", + "sneak", + "stab", + "subject", + "throughout", + "thrown", + "tower", + "twirl", + "wow", + "army", + "arrive", + "bathroom", + "bump", + "cease", + "cookie", + "couch", + "courage", + "dim", + "guilt", + "howl", + "hum", + "husband", + "insult", + "led", + "lunch", + "mock", + "mostly", + "natural", + "nearly", + "needle", + "nerd", + "peaceful", + "perfection", + "pile", + "price", + "remove", + "roam", + "sanctuary", + "serious", + "shiny", + "shook", + "sob", + "stolen", + "tap", + "vain", + "void", + "warrior", + "wrinkle", + "affection", + "apologize", + "blossom", + "bounce", + "bridge", + "cheap", + "crumble", + "decision", + "descend", + "desperately", + "dig", + "dot", + "flip", + "frighten", + "heartbeat", + "huge", + "lazy", + "lick", + "odd", + "opinion", + "process", + "puzzle", + "quietly", + "retreat", + "score", + "sentence", + "separate", + "situation", + "skill", + "soak", + "square", + "stray", + "taint", + "task", + "tide", + "underneath", + "veil", + "whistle", + "anywhere", + "bedroom", + "bid", + "bloody", + "burden", + "careful", + "compare", + "concern", + "curtain", + "decay", + "defeat", + "describe", + "double", + "dreamer", + "driver", + "dwell", + "evening", + "flare", + "flicker", + "grandma", + "guitar", + "harm", + "horrible", + "hungry", + "indeed", + "lace", + "melody", + "monkey", + "nation", + "object", + "obviously", + "rainbow", + "salt", + "scratch", + "shown", + "shy", + "stage", + "stun", + "third", + "tickle", + "useless", + "weakness", + "worship", + "worthless", + "afternoon", + "beard", + "boyfriend", + "bubble", + "busy", + "certain", + "chin", + "concrete", + "desk", + "diamond", + "doom", + "drawn", + "due", + "felicity", + "freeze", + "frost", + "garden", + "glide", + "harmony", + "hopefully", + "hunt", + "jealous", + "lightning", + "mama", + "mercy", + "peel", + "physical", + "position", + "pulse", + "punch", + "quit", + "rant", + "respond", + "salty", + "sane", + "satisfy", + "savior", + "sheep", + "slept", + "social", + "sport", + "tuck", + "utter", + "valley", + "wolf", + "aim", + "alas", + "alter", + "arrow", + "awaken", + "beaten", + "belief", + "brand", + "ceiling", + "cheese", + "clue", + "confidence", + "connection", + "daily", + "disguise", + "eager", + "erase", + "essence", + "everytime", + "expression", + "fan", + "flag", + "flirt", + "foul", + "fur", + "giggle", + "glorious", + "ignorance", + "law", + "lifeless", + "measure", + "mighty", + "muse", + "north", + "opposite", + "paradise", + "patience", + "patient", + "pencil", + "petal", + "plate", + "ponder", + "possibly", + "practice", + "slice", + "spell", + "stock", + "strife", + "strip", + "suffocate", + "suit", + "tender", + "tool", + "trade", + "velvet", + "verse", + "waist", + "witch", + "aunt", + "bench", + "bold", + "cap", + "certainly", + "click", + "companion", + "creator", + "dart", + "delicate", + "determine", + "dish", + "dragon", + "drama", + "drum", + "dude", + "everybody", + "feast", + "forehead", + "former", + "fright", + "fully", + "gas", + "hook", + "hurl", + "invite", + "juice", + "manage", + "moral", + "possess", + "raw", + "rebel", + "royal", + "scale", + "scary", + "several", + "slight", + "stubborn", + "swell", + "talent", + "tea", + "terrible", + "thread", + "torment", + "trickle", + "usually", + "vast", + "violence", + "weave", + "acid", + "agony", + "ashamed", + "awe", + "belly", + "blend", + "blush", + "character", + "cheat", + "common", + "company", + "coward", + "creak", + "danger", + "deadly", + "defense", + "define", + "depend", + "desperate", + "destination", + "dew", + "duck", + "dusty", + "embarrass", + "engine", + "example", + "explore", + "foe", + "freely", + "frustrate", + "generation", + "glove", + "guilty", + "health", + "hurry", + "idiot", + "impossible", + "inhale", + "jaw", + "kingdom", + "mention", + "mist", + "moan", + "mumble", + "mutter", + "observe", + "ode", + "pathetic", + "pattern", + "pie", + "prefer", + "puff", + "rape", + "rare", + "revenge", + "rude", + "scrape", + "spiral", + "squeeze", + "strain", + "sunset", + "suspend", + "sympathy", + "thigh", + "throne", + "total", + "unseen", + "weapon", + "weary" + ]; +} diff --git a/cw_zano/lib/model/pending_zano_transaction.dart b/cw_zano/lib/model/pending_zano_transaction.dart new file mode 100644 index 000000000..2addbdb31 --- /dev/null +++ b/cw_zano/lib/model/pending_zano_transaction.dart @@ -0,0 +1,47 @@ +import 'package:cw_core/pending_transaction.dart'; +import 'package:cw_zano/api/model/destination.dart'; +import 'package:cw_zano/api/model/transfer_result.dart'; +import 'package:cw_zano/zano_formatter.dart'; +import 'package:cw_zano/zano_wallet.dart'; + +class PendingZanoTransaction with PendingTransaction { + PendingZanoTransaction({ + required this.zanoWallet, + required this.destinations, + required this.fee, + required this.comment, + required this.assetId, + required this.ticker, + this.decimalPoint = ZanoFormatter.defaultDecimalPoint, + required this.amount, + }); + + final ZanoWalletBase zanoWallet; + final List destinations; + final BigInt fee; + final String comment; + final String assetId; + final String ticker; + final int decimalPoint; + final BigInt amount; + + @override + String get id => transferResult?.txHash ?? ''; + + @override + String get hex => ''; + + @override + String get amountFormatted => '${ZanoFormatter.bigIntAmountToString(amount, decimalPoint)} $ticker'; + + @override + String get feeFormatted => '${ZanoFormatter.bigIntAmountToString(fee)} ZANO'; + + TransferResult? transferResult; + + @override + Future commit() async { + await zanoWallet.transfer(destinations, fee, comment); + zanoWallet.fetchTransactions(); + } +} diff --git a/cw_zano/lib/model/zano_asset.dart b/cw_zano/lib/model/zano_asset.dart new file mode 100644 index 000000000..58f53738e --- /dev/null +++ b/cw_zano/lib/model/zano_asset.dart @@ -0,0 +1,105 @@ +import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/hive_type_ids.dart'; +import 'package:cw_zano/zano_formatter.dart'; +import 'package:hive/hive.dart'; + +part 'zano_asset.g.dart'; + +@HiveType(typeId: ZanoAsset.typeId) +class ZanoAsset extends CryptoCurrency with HiveObjectMixin { + @HiveField(0) + final String fullName; + @HiveField(1) + final String ticker; + @HiveField(2) + final String assetId; + @HiveField(3) + final int decimalPoint; + @HiveField(4, defaultValue: true) + bool _enabled; + @HiveField(5) + final String? iconPath; + // @HiveField(6) + // final String? tag; + @HiveField(6) + final String owner; + @HiveField(7) + final String metaInfo; + @HiveField(8) + final BigInt currentSupply; + @HiveField(9) + final bool hiddenSupply; + @HiveField(10) + final BigInt totalMaxSupply; + @HiveField(11) + final bool isInGlobalWhitelist; + + bool get enabled => _enabled; + + set enabled(bool value) => _enabled = value; + + ZanoAsset({ + this.fullName = '', + this.ticker = '', + required this.assetId, + this.decimalPoint = ZanoFormatter.defaultDecimalPoint, + bool enabled = true, + this.iconPath, + this.owner = defaultOwner, + this.metaInfo = '', + required this.currentSupply, + this.hiddenSupply = false, + required this.totalMaxSupply, + this.isInGlobalWhitelist = false, + }) : _enabled = enabled, + super( + name: fullName, + title: ticker.toUpperCase(), + fullName: fullName, + tag: 'ZANO', + iconPath: iconPath, + decimals: decimalPoint, + ); + + ZanoAsset.copyWith(ZanoAsset other, {String? icon, String? assetId, bool enabled = true}) + : this.fullName = other.fullName, + this.ticker = other.ticker, + this.assetId = assetId ?? other.assetId, + this.decimalPoint = other.decimalPoint, + this._enabled = enabled && other.enabled, + this.iconPath = icon, + this.currentSupply = other.currentSupply, + this.hiddenSupply = other.hiddenSupply, + this.metaInfo = other.metaInfo, + this.owner = other.owner, + this.totalMaxSupply = other.totalMaxSupply, + this.isInGlobalWhitelist = other.isInGlobalWhitelist, + super( + name: other.name, + title: other.ticker.toUpperCase(), + fullName: other.name, + tag: 'ZANO', + iconPath: icon, + decimals: other.decimalPoint, + enabled: enabled, + ); + + factory ZanoAsset.fromJson(Map json, {bool isInGlobalWhitelist = false}) => ZanoAsset( + assetId: json['asset_id'] as String? ?? '', + currentSupply: ZanoFormatter.bigIntFromDynamic(json['current_supply']), + decimalPoint: json['decimal_point'] as int? ?? ZanoFormatter.defaultDecimalPoint, + fullName: json['full_name'] as String? ?? '', + hiddenSupply: json['hidden_supply'] as bool? ?? false, + metaInfo: json['meta_info'] as String? ?? '', + owner: json['owner'] as String? ?? '', + ticker: json['ticker'] as String? ?? '', + totalMaxSupply: ZanoFormatter.bigIntFromDynamic(json['total_max_supply']), + isInGlobalWhitelist: isInGlobalWhitelist, + ); + + + + static const typeId = ZANO_ASSET_TYPE_ID; + static const zanoAssetsBoxName = 'zanoAssetsBox'; + static const defaultOwner = '0000000000000000000000000000000000000000000000000000000000000000'; +} diff --git a/cw_zano/lib/model/zano_balance.dart b/cw_zano/lib/model/zano_balance.dart new file mode 100644 index 000000000..882c0e11b --- /dev/null +++ b/cw_zano/lib/model/zano_balance.dart @@ -0,0 +1,17 @@ +import 'package:cw_core/balance.dart'; +import 'package:cw_zano/zano_formatter.dart'; + +class ZanoBalance extends Balance { + final BigInt total; + final BigInt unlocked; + final int decimalPoint; + ZanoBalance({required this.total, required this.unlocked, this.decimalPoint = ZanoFormatter.defaultDecimalPoint}) : super(unlocked.isValidInt ? unlocked.toInt() : 0, (total - unlocked).isValidInt ? (total - unlocked).toInt() : 0); + + ZanoBalance.empty({this.decimalPoint = ZanoFormatter.defaultDecimalPoint}): total = BigInt.zero, unlocked = BigInt.zero, super(0, 0); + + @override + String get formattedAdditionalBalance => ZanoFormatter.bigIntAmountToString(total - unlocked, decimalPoint); + + @override + String get formattedAvailableBalance => ZanoFormatter.bigIntAmountToString(unlocked, decimalPoint); +} diff --git a/cw_zano/lib/model/zano_transaction_creation_exception.dart b/cw_zano/lib/model/zano_transaction_creation_exception.dart new file mode 100644 index 000000000..74a5f77c6 --- /dev/null +++ b/cw_zano/lib/model/zano_transaction_creation_exception.dart @@ -0,0 +1,8 @@ +class ZanoTransactionCreationException implements Exception { + ZanoTransactionCreationException(this.message); + + final String message; + + @override + String toString() => message; +} \ No newline at end of file diff --git a/cw_zano/lib/model/zano_transaction_credentials.dart b/cw_zano/lib/model/zano_transaction_credentials.dart new file mode 100644 index 000000000..dbbfe53c6 --- /dev/null +++ b/cw_zano/lib/model/zano_transaction_credentials.dart @@ -0,0 +1,11 @@ +import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; +import 'package:cw_core/output_info.dart'; + +class ZanoTransactionCredentials { + ZanoTransactionCredentials({required this.outputs, required this.priority, required this.currency}); + + final List outputs; + final MoneroTransactionPriority priority; + final CryptoCurrency currency; +} diff --git a/cw_zano/lib/model/zano_transaction_info.dart b/cw_zano/lib/model/zano_transaction_info.dart new file mode 100644 index 000000000..8b0d4c3cd --- /dev/null +++ b/cw_zano/lib/model/zano_transaction_info.dart @@ -0,0 +1,74 @@ +import 'package:cw_core/format_amount.dart'; +import 'package:cw_core/transaction_direction.dart'; +import 'package:cw_core/transaction_info.dart'; +import 'package:cw_zano/api/model/transfer.dart'; +import 'package:cw_zano/zano_formatter.dart'; + +class ZanoTransactionInfo extends TransactionInfo { + ZanoTransactionInfo({ + required this.id, + required this.height, + required this.direction, + required this.date, + required this.isPending, + required this.zanoAmount, + required this.fee, + required this.assetId, + required this.confirmations, + required this.tokenSymbol, + required this.decimalPoint, + }) : amount = zanoAmount.isValidInt ? zanoAmount.toInt() : 0; + + ZanoTransactionInfo.fromTransfer(Transfer transfer, + {required int confirmations, + required bool isIncome, + required String assetId, + required BigInt amount, + this.tokenSymbol = 'ZANO', + this.decimalPoint = ZanoFormatter.defaultDecimalPoint}) + : id = transfer.txHash, + height = transfer.height, + direction = isIncome ? TransactionDirection.incoming : TransactionDirection.outgoing, + date = DateTime.fromMillisecondsSinceEpoch(transfer.timestamp * 1000), + zanoAmount = amount, + amount = amount.isValidInt ? amount.toInt() : 0, + fee = transfer.fee, + assetId = assetId, + confirmations = confirmations, + isPending = false, + recipientAddress = transfer.remoteAddresses.isNotEmpty ? transfer.remoteAddresses.first : '' { + additionalInfo = { + 'comment': transfer.comment, + }; + } + + final String id; + final int height; + final TransactionDirection direction; + final DateTime date; + final bool isPending; + final BigInt zanoAmount; + final int amount; + final int fee; + final int confirmations; + final int decimalPoint; + late String recipientAddress; + final String tokenSymbol; + late String assetId; + String? _fiatAmount; + String? key; + + @override + String amountFormatted() => '${formatAmount(ZanoFormatter.bigIntAmountToString(zanoAmount, decimalPoint))} $tokenSymbol'; + + @override + String fiatAmount() => _fiatAmount ?? ''; + + @override + void changeFiatAmount(String amount) => _fiatAmount = formatAmount(amount); + + @override + String feeFormatted() => '${formatAmount(ZanoFormatter.intAmountToString(fee))} $feeCurrency'; + + String get feeCurrency => 'ZANO'; +} diff --git a/cw_zano/lib/model/zano_wallet_keys.dart b/cw_zano/lib/model/zano_wallet_keys.dart new file mode 100644 index 000000000..5a224633b --- /dev/null +++ b/cw_zano/lib/model/zano_wallet_keys.dart @@ -0,0 +1,12 @@ +class ZanoWalletKeys { + const ZanoWalletKeys( + {required this.privateSpendKey, + required this.privateViewKey, + required this.publicSpendKey, + required this.publicViewKey}); + + final String publicViewKey; + final String privateViewKey; + final String publicSpendKey; + final String privateSpendKey; +} \ No newline at end of file diff --git a/cw_zano/lib/zano_formatter.dart b/cw_zano/lib/zano_formatter.dart new file mode 100644 index 000000000..ffc5d20f3 --- /dev/null +++ b/cw_zano/lib/zano_formatter.dart @@ -0,0 +1,74 @@ +import 'dart:math'; + +import 'package:cw_zano/zano_wallet_api.dart'; +import 'package:decimal/decimal.dart'; +import 'package:decimal/intl.dart'; +import 'package:fluttertoast/fluttertoast.dart'; +import 'package:intl/intl.dart'; + +class ZanoFormatter { + static const defaultDecimalPoint = 12; + + //static final numberFormat = NumberFormat() + // ..maximumFractionDigits = defaultDecimalPoint + // ..minimumFractionDigits = 1; + + static Decimal _bigIntDivision({required BigInt amount, required BigInt divider}) { + return (Decimal.fromBigInt(amount) / Decimal.fromBigInt(divider)).toDecimal(); + } + + static String intAmountToString(int amount, [int decimalPoint = defaultDecimalPoint]) { + final numberFormat = NumberFormat()..maximumFractionDigits = decimalPoint + ..minimumFractionDigits = 1; + return numberFormat.format( + DecimalIntl( + _bigIntDivision( + amount: BigInt.from(amount), + divider: BigInt.from(pow(10, decimalPoint)), + ), + ), + ) + .replaceAll(',', ''); + } + + static String bigIntAmountToString(BigInt amount, [int decimalPoint = defaultDecimalPoint]) { + final numberFormat = NumberFormat()..maximumFractionDigits = decimalPoint + ..minimumFractionDigits = 1; + return numberFormat.format( + DecimalIntl( + _bigIntDivision( + amount: amount, + divider: BigInt.from(pow(10, decimalPoint)), + ), + ), + ) + .replaceAll(',', ''); + } + + static double intAmountToDouble(int amount, [int decimalPoint = defaultDecimalPoint]) => _bigIntDivision( + amount: BigInt.from(amount), + divider: BigInt.from(pow(10, decimalPoint)), + ).toDouble(); + + static int parseAmount(String amount, [int decimalPoint = defaultDecimalPoint]) { + final resultBigInt = (Decimal.parse(amount) * Decimal.fromBigInt(BigInt.from(10).pow(decimalPoint))).toBigInt(); + if (!resultBigInt.isValidInt) { + Fluttertoast.showToast(msg: 'Cannot transfer $amount. Maximum is ${intAmountToString(resultBigInt.toInt(), decimalPoint)}.'); + } + return resultBigInt.toInt(); + } + + static BigInt bigIntFromDynamic(dynamic d) { + if (d is int) { + return BigInt.from(d); + } else if (d is BigInt) { + return d; + } else if (d == null) { + return BigInt.zero; + } else { + ZanoWalletApi.error('cannot cast value of type ${d.runtimeType} to BigInt'); + throw 'cannot cast value of type ${d.runtimeType} to BigInt'; + //return BigInt.zero; + } + } +} diff --git a/cw_zano/lib/zano_transaction_history.dart b/cw_zano/lib/zano_transaction_history.dart new file mode 100644 index 000000000..4c6a2d554 --- /dev/null +++ b/cw_zano/lib/zano_transaction_history.dart @@ -0,0 +1,27 @@ +import 'dart:core'; +import 'package:mobx/mobx.dart'; +import 'package:cw_core/transaction_history.dart'; +import 'package:cw_zano/model/zano_transaction_info.dart'; + +part 'zano_transaction_history.g.dart'; + +class ZanoTransactionHistory = ZanoTransactionHistoryBase + with _$ZanoTransactionHistory; + +abstract class ZanoTransactionHistoryBase + extends TransactionHistoryBase with Store { + ZanoTransactionHistoryBase() { + transactions = ObservableMap(); + } + + @override + Future save() async {} + + @override + void addOne(ZanoTransactionInfo transaction) => + transactions[transaction.id] = transaction; + + @override + void addMany(Map transactions) => + this.transactions.addAll(transactions); +} diff --git a/cw_zano/lib/zano_utils.dart b/cw_zano/lib/zano_utils.dart new file mode 100644 index 000000000..57ea72279 --- /dev/null +++ b/cw_zano/lib/zano_utils.dart @@ -0,0 +1,17 @@ +import 'dart:convert'; + +import 'package:cw_zano/api/api_calls.dart'; +import 'package:cw_zano/api/model/get_address_info_result.dart'; + +class ZanoUtils { + static bool validateAddress(String address) { + try { + final result = GetAddressInfoResult.fromJson( + jsonDecode(ApiCalls.getAddressInfo(address: address)) as Map, + ); + return result.valid; + } catch (err) { + return false; + } + } +} diff --git a/cw_zano/lib/zano_wallet.dart b/cw_zano/lib/zano_wallet.dart new file mode 100644 index 000000000..fcc503c2a --- /dev/null +++ b/cw_zano/lib/zano_wallet.dart @@ -0,0 +1,499 @@ +import 'dart:async'; +import 'dart:io'; + +import 'package:cw_core/cake_hive.dart'; +import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/node.dart'; +import 'package:cw_core/pathForWallet.dart'; +import 'package:cw_core/pending_transaction.dart'; +import 'package:cw_core/sync_status.dart'; +import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:cw_core/wallet_credentials.dart'; +import 'package:cw_core/wallet_info.dart'; +import 'package:cw_zano/api/model/create_wallet_result.dart'; +import 'package:cw_zano/api/model/destination.dart'; +import 'package:cw_zano/api/model/get_recent_txs_and_info_result.dart'; +import 'package:cw_zano/api/model/get_wallet_info_result.dart'; +import 'package:cw_zano/api/model/get_wallet_status_result.dart'; +import 'package:cw_zano/api/model/transfer.dart'; +import 'package:cw_zano/model/pending_zano_transaction.dart'; +import 'package:cw_zano/model/zano_asset.dart'; +import 'package:cw_zano/model/zano_balance.dart'; +import 'package:cw_zano/model/zano_transaction_creation_exception.dart'; +import 'package:cw_zano/model/zano_transaction_credentials.dart'; +import 'package:cw_zano/model/zano_transaction_info.dart'; +import 'package:cw_zano/model/zano_wallet_keys.dart'; +import 'package:cw_zano/zano_formatter.dart'; +import 'package:cw_zano/zano_transaction_history.dart'; +import 'package:cw_zano/zano_wallet_addresses.dart'; +import 'package:cw_zano/zano_wallet_api.dart'; +import 'package:cw_zano/zano_wallet_exceptions.dart'; +import 'package:cw_zano/zano_wallet_service.dart'; +import 'package:cw_zano/api/model/balance.dart'; + +import 'package:flutter/material.dart'; +import 'package:mobx/mobx.dart'; + +part 'zano_wallet.g.dart'; + +class ZanoWallet = ZanoWalletBase with _$ZanoWallet; + +abstract class ZanoWalletBase extends WalletBase with Store, ZanoWalletApi { + static const int _autoSaveIntervalSeconds = 30; + static const int _pollIntervalMilliseconds = 2000; + static const int _maxLoadAssetsRetries = 5; + + @override + ZanoWalletAddresses walletAddresses; + + @override + @observable + SyncStatus syncStatus; + + @override + @observable + ObservableMap balance; + + @override + String seed = ''; + + @override + ZanoWalletKeys keys = ZanoWalletKeys(privateSpendKey: '', privateViewKey: '', publicSpendKey: '', publicViewKey: ''); + + static const String zanoAssetId = 'd6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a'; + + Map zanoAssets = {}; + + Timer? _updateSyncInfoTimer; + + int _lastKnownBlockHeight = 0; + int _initialSyncHeight = 0; + int currentDaemonHeight = 0; + bool _isTransactionUpdating; + bool _hasSyncAfterStartup; + Timer? _autoSaveTimer; + + /// index of last transaction fetched + int _lastTxIndex = 0; + /// number of transactions in each request + static const int _txChunkSize = 30; + + ZanoWalletBase(WalletInfo walletInfo) + : balance = ObservableMap.of({CryptoCurrency.zano: ZanoBalance.empty()}), + _isTransactionUpdating = false, + _hasSyncAfterStartup = false, + walletAddresses = ZanoWalletAddresses(walletInfo), + syncStatus = NotConnectedSyncStatus(), + super(walletInfo) { + transactionHistory = ZanoTransactionHistory(); + if (!CakeHive.isAdapterRegistered(ZanoAsset.typeId)) { + CakeHive.registerAdapter(ZanoAssetAdapter()); + } + } + + @override + int calculateEstimatedFee(TransactionPriority priority, [int? amount = null]) => getCurrentTxFee(priority); + + @override + Future changePassword(String password) async { + setPassword(password); + } + + static Future create({required WalletCredentials credentials}) async { + final wallet = ZanoWallet(credentials.walletInfo!); + await wallet.connectToNode(node: Node()); + final path = await pathForWallet(name: credentials.name, type: credentials.walletInfo!.type); + final createWalletResult = await wallet.createWallet(path, credentials.password!); + await wallet.parseCreateWalletResult(createWalletResult); + await wallet.init(createWalletResult.wi.address); + return wallet; + } + + static Future restore({required ZanoRestoreWalletFromSeedCredentials credentials}) async { + final wallet = ZanoWallet(credentials.walletInfo!); + await wallet.connectToNode(node: Node()); + final path = await pathForWallet(name: credentials.name, type: credentials.walletInfo!.type); + final createWalletResult = await wallet.restoreWalletFromSeed(path, credentials.password!, credentials.mnemonic); + await wallet.parseCreateWalletResult(createWalletResult); + await wallet.init(createWalletResult.wi.address); + return wallet; + } + + static Future open({required String name, required String password, required WalletInfo walletInfo}) async { + final path = await pathForWallet(name: name, type: walletInfo.type); + final wallet = ZanoWallet(walletInfo); + await wallet.connectToNode(node: Node()); + final createWalletResult = await wallet.loadWallet(path, password); + await wallet.parseCreateWalletResult(createWalletResult); + await wallet.init(createWalletResult.wi.address); + return wallet; + } + + Future parseCreateWalletResult(CreateWalletResult result) async { + hWallet = result.walletId; + seed = result.seed; + ZanoWalletApi.info('setting hWallet = ${result.walletId}'); + walletAddresses.address = result.wi.address; + await loadAssets(result.wi.balances, maxRetries: _maxLoadAssetsRetries); + for (final item in result.wi.balances) { + if (item.assetInfo.assetId == zanoAssetId) { + balance[CryptoCurrency.zano] = ZanoBalance( + total: item.total, + unlocked: item.unlocked, + ); + } + } + if (result.recentHistory.history != null) { + final transfers = result.recentHistory.history!; + final transactions = Transfer.makeMap(transfers, zanoAssets, currentDaemonHeight); + transactionHistory.addMany(transactions); + await transactionHistory.save(); + } + } + + @override + void close() { + closeWallet(); + _updateSyncInfoTimer?.cancel(); + _autoSaveTimer?.cancel(); + } + + @override + Future connectToNode({required Node node}) async { + syncStatus = ConnectingSyncStatus(); + await setupNode(); + syncStatus = ConnectedSyncStatus(); + } + + @override + Future createTransaction(Object credentials) async { + credentials as ZanoTransactionCredentials; + final isZano = credentials.currency == CryptoCurrency.zano; + final outputs = credentials.outputs; + final hasMultiDestination = outputs.length > 1; + final unlockedBalanceZano = balance[CryptoCurrency.zano]?.unlocked ?? BigInt.zero; + final unlockedBalanceCurrency = balance[credentials.currency]?.unlocked ?? BigInt.zero; + final fee = BigInt.from(calculateEstimatedFee(credentials.priority)); + late BigInt totalAmount; + void checkForEnoughBalances() { + if (isZano) { + if (totalAmount + fee > unlockedBalanceZano) { + throw ZanoTransactionCreationException( + "You don't have enough coins (required: ${ZanoFormatter.bigIntAmountToString(totalAmount + fee)} ZANO, unlocked ${ZanoFormatter.bigIntAmountToString(unlockedBalanceZano)} ZANO)."); + } + } else { + if (fee > unlockedBalanceZano) { + throw ZanoTransactionCreationException( + "You don't have enough coins (required: ${ZanoFormatter.bigIntAmountToString(fee)} ZANO, unlocked ${ZanoFormatter.bigIntAmountToString(unlockedBalanceZano)} ZANO)."); + } + if (totalAmount > unlockedBalanceCurrency) { + throw ZanoTransactionCreationException( + "You don't have enough coins (required: ${ZanoFormatter.bigIntAmountToString(totalAmount, credentials.currency.decimals)} ${credentials.currency.title}, unlocked ${ZanoFormatter.bigIntAmountToString(unlockedBalanceCurrency, credentials.currency.decimals)} ${credentials.currency.title})."); + } + } + } + + final assetId = isZano ? zanoAssetId : (credentials.currency as ZanoAsset).assetId; + late List destinations; + if (hasMultiDestination) { + if (outputs.any((output) => output.sendAll || (output.formattedCryptoAmount ?? 0) <= 0)) { + throw ZanoTransactionCreationException("You don't have enough coins."); + } + totalAmount = outputs.fold(BigInt.zero, (acc, value) => acc + BigInt.from(value.formattedCryptoAmount ?? 0)); + checkForEnoughBalances(); + destinations = outputs + .map((output) => Destination( + amount: BigInt.from(output.formattedCryptoAmount ?? 0), + address: output.isParsedAddress ? output.extractedAddress! : output.address, + assetId: assetId, + )) + .toList(); + } else { + final output = outputs.first; + if (output.sendAll) { + if (isZano) { + totalAmount = unlockedBalanceZano - fee; + } else { + totalAmount = unlockedBalanceCurrency; + } + } else { + totalAmount = BigInt.from(output.formattedCryptoAmount!); + } + checkForEnoughBalances(); + destinations = [ + Destination( + amount: totalAmount, + address: output.isParsedAddress ? output.extractedAddress! : output.address, + assetId: assetId, + ) + ]; + } + return PendingZanoTransaction( + zanoWallet: this, + destinations: destinations, + fee: fee, + comment: outputs.first.note ?? '', + assetId: assetId, + ticker: credentials.currency.title, + decimalPoint: credentials.currency.decimals, + amount: totalAmount, + ); + } + + @override + Future> fetchTransactions() async { + try { + final transfers = []; + late GetRecentTxsAndInfoResult result; + do { + result = await getRecentTxsAndInfo(offset: _lastTxIndex, count: _txChunkSize); + _lastTxIndex += result.transfers.length; + transfers.addAll(result.transfers); + } while (result.lastItemIndex + 1 < result.totalTransfers); + return Transfer.makeMap(transfers, zanoAssets, currentDaemonHeight); + } catch (e) { + ZanoWalletApi.error(e.toString()); + return {}; + } + } + + Future init(String address) async { + await walletAddresses.init(); + await walletAddresses.updateAddress(address); + await updateTransactions(); + _autoSaveTimer = Timer.periodic(Duration(seconds: _autoSaveIntervalSeconds), (_) async => await save()); + } + + @override + Future renameWalletFiles(String newWalletName) async { + final currentWalletPath = await pathForWallet(name: name, type: type); + final currentCacheFile = File(currentWalletPath); + final currentKeysFile = File('$currentWalletPath.keys'); + final currentAddressListFile = File('$currentWalletPath.address.txt'); + + final newWalletPath = await pathForWallet(name: newWalletName, type: type); + + // Copies current wallet files into new wallet name's dir and files + if (currentCacheFile.existsSync()) { + await currentCacheFile.copy(newWalletPath); + } + if (currentKeysFile.existsSync()) { + await currentKeysFile.copy('$newWalletPath.keys'); + } + if (currentAddressListFile.existsSync()) { + await currentAddressListFile.copy('$newWalletPath.address.txt'); + } + + // Delete old name's dir and files + await Directory(currentWalletPath).delete(recursive: true); + } + + @override + Future rescan({required int height}) => throw UnimplementedError(); + + @override + Future save() async { + try { + await store(); + await walletAddresses.updateAddressesInBox(); + } catch (e) { + ZanoWalletApi.error('Error while saving Zano wallet file ${e.toString()}'); + } + } + + Future loadAssets(List balances, {int maxRetries = 1}) async { + List assets = []; + int retryCount = 0; + + while (retryCount < maxRetries) { + try { + assets = await getAssetsWhitelist(); + break; + } on ZanoWalletBusyException { + if (retryCount < maxRetries - 1) { + retryCount++; + await Future.delayed(Duration(seconds: 1)); + } else { + ZanoWalletApi.error('failed to load assets after $retryCount retries'); + break; + } + } + } + zanoAssets = {}; + for (final asset in assets) { + final newAsset = ZanoAsset.copyWith(asset, + icon: _getIconPath(asset.title), enabled: balances.any((element) => element.assetId == asset.assetId)); + zanoAssets.putIfAbsent(asset.assetId, () => newAsset); + } + } + + @override + Future startSync() async { + try { + syncStatus = AttemptingSyncStatus(); + _lastKnownBlockHeight = 0; + _initialSyncHeight = 0; + _updateSyncInfoTimer ??= Timer.periodic(Duration(milliseconds: _pollIntervalMilliseconds), (_) async { + GetWalletStatusResult walletStatus; + // ignoring get wallet status exception (in case of wrong wallet id) + try { + walletStatus = await getWalletStatus(); + } on ZanoWalletException { + return; + } + currentDaemonHeight = walletStatus.currentDaemonHeight; + _updateSyncProgress(walletStatus); + + // we can call getWalletInfo ONLY if getWalletStatus returns NOT is in long refresh and wallet state is 2 (ready) + if (!walletStatus.isInLongRefresh && walletStatus.walletState == 2) { + final walletInfo = await getWalletInfo(); + seed = walletInfo.wiExtended.seed; + keys = ZanoWalletKeys( + privateSpendKey: walletInfo.wiExtended.spendPrivateKey, + privateViewKey: walletInfo.wiExtended.viewPrivateKey, + publicSpendKey: walletInfo.wiExtended.spendPublicKey, + publicViewKey: walletInfo.wiExtended.viewPublicKey, + ); + loadAssets(walletInfo.wi.balances); + // matching balances and whitelists + // 1. show only balances available in whitelists + // 2. set whitelists available in balances as 'enabled' ('disabled' by default) + for (final b in walletInfo.wi.balances) { + if (b.assetId == zanoAssetId) { + balance[CryptoCurrency.zano] = ZanoBalance(total: b.total, unlocked: b.unlocked); + } else { + final asset = zanoAssets[b.assetId]; + if (asset == null) { + ZanoWalletApi.error('balance for an unknown asset ${b.assetInfo.assetId}'); + continue; + } + if (balance.keys.any((element) => element is ZanoAsset && element.assetId == b.assetInfo.assetId)) { + balance[balance.keys.firstWhere((element) => element is ZanoAsset && element.assetId == b.assetInfo.assetId)] = + ZanoBalance(total: b.total, unlocked: b.unlocked, decimalPoint: asset.decimalPoint); + } else { + balance[asset] = ZanoBalance(total: b.total, unlocked: b.unlocked, decimalPoint: asset.decimalPoint); + } + } + } + // removing balances for assets missing in wallet info balances + balance.removeWhere( + (key, _) => key != CryptoCurrency.zano && !walletInfo.wi.balances.any((element) => element.assetId == (key as ZanoAsset).assetId), + ); + } + }); + } catch (e) { + syncStatus = FailedSyncStatus(); + ZanoWalletApi.error(e.toString()); + //rethrow; // TODO: we don't need to propagate exception here + } + } + + @override + Future? updateBalance() => null; + + Future updateTransactions() async { + try { + if (_isTransactionUpdating) { + return; + } + _isTransactionUpdating = true; + final transactions = await fetchTransactions(); + transactionHistory.addMany(transactions); + await transactionHistory.save(); + _isTransactionUpdating = false; + } catch (e) { + ZanoWalletApi.error(e.toString()); + _isTransactionUpdating = false; + } + } + + Future addZanoAssetById(String assetId) async { + if (zanoAssets.containsKey(assetId)) { + throw ZanoWalletException('zano asset with id $assetId already added'); + } + final assetDescriptor = await addAssetsWhitelist(assetId); + if (assetDescriptor == null) { + throw ZanoWalletException("there's no zano asset with id $assetId"); + } + final asset = ZanoAsset.copyWith(assetDescriptor, icon: _getIconPath(assetDescriptor.title), assetId: assetId, enabled: true); + zanoAssets[asset.assetId] = asset; + balance[asset] = ZanoBalance.empty(decimalPoint: asset.decimalPoint); + return asset; + } + + String? _getIconPath(String title) { + try { + return CryptoCurrency.all.firstWhere((element) => element.title.toUpperCase() == title.toUpperCase()).iconPath; + } catch (_) {} + return null; + } + + Future changeZanoAssetAvailability(ZanoAsset asset) async { + if (asset.enabled) { + final assetDescriptor = await addAssetsWhitelist(asset.assetId); + if (assetDescriptor == null) { + ZanoWalletApi.error('Error adding zano asset'); + } + } else { + final result = await removeAssetsWhitelist(asset.assetId); + if (result == false) { + ZanoWalletApi.error('Error removing zano asset'); + } + } + } + + Future deleteZanoAsset(ZanoAsset asset) async { + final _ = await removeAssetsWhitelist(asset.assetId); + } + + Future getZanoAsset(String assetId) async { + return await getAssetInfo(assetId); + } + + Future _askForUpdateTransactionHistory() async => await updateTransactions(); + + void _onNewBlock(int height, int blocksLeft, double ptc) async { + try { + if (blocksLeft < 1000) { + await _askForUpdateTransactionHistory(); + syncStatus = SyncedSyncStatus(); + + if (!_hasSyncAfterStartup) { + _hasSyncAfterStartup = true; + await save(); + } + } else { + syncStatus = SyncingSyncStatus(blocksLeft, ptc); + } + } catch (e) { + ZanoWalletApi.error(e.toString()); + } + } + + void _updateSyncProgress(GetWalletStatusResult walletStatus) { + final syncHeight = walletStatus.currentWalletHeight; + if (_initialSyncHeight <= 0) { + _initialSyncHeight = syncHeight; + } + final bchHeight = walletStatus.currentDaemonHeight; + + if (_lastKnownBlockHeight == syncHeight) { + return; + } + + _lastKnownBlockHeight = syncHeight; + final track = bchHeight - _initialSyncHeight; + final diff = track - (bchHeight - syncHeight); + final ptc = diff <= 0 ? 0.0 : diff / track; + final left = bchHeight - syncHeight; + + if (syncHeight < 0 || left < 0) { + return; + } + + // 1. Actual new height; 2. Blocks left to finish; 3. Progress in percents; + _onNewBlock.call(syncHeight, left, ptc); + } + +} diff --git a/cw_zano/lib/zano_wallet_addresses.dart b/cw_zano/lib/zano_wallet_addresses.dart new file mode 100644 index 000000000..e485e8525 --- /dev/null +++ b/cw_zano/lib/zano_wallet_addresses.dart @@ -0,0 +1,40 @@ +import 'package:cw_core/wallet_addresses.dart'; +import 'package:cw_core/wallet_info.dart'; +import 'package:cw_zano/zano_wallet_api.dart'; +import 'package:mobx/mobx.dart'; + +part 'zano_wallet_addresses.g.dart'; + +class ZanoWalletAddresses = ZanoWalletAddressesBase with _$ZanoWalletAddresses; + +abstract class ZanoWalletAddressesBase extends WalletAddresses with Store { + ZanoWalletAddressesBase(WalletInfo walletInfo) + : address = '', + super(walletInfo); + + @override + @observable + String address; + + @override + Future init() async { + address = walletInfo.address; + await updateAddressesInBox(); + } + + Future updateAddress(String address) async { + this.address = address; + await updateAddressesInBox(); + } + + @override + Future updateAddressesInBox() async { + try { + addressesMap.clear(); + addressesMap[address] = ''; + await saveAddressesInBox(); + } catch (e) { + ZanoWalletApi.error(e.toString()); + } + } +} diff --git a/cw_zano/lib/zano_wallet_api.dart b/cw_zano/lib/zano_wallet_api.dart new file mode 100644 index 000000000..aef8dd17f --- /dev/null +++ b/cw_zano/lib/zano_wallet_api.dart @@ -0,0 +1,405 @@ +import 'dart:convert' as convert; + +import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_zano/api/api_calls.dart'; +import 'package:cw_zano/api/consts.dart'; +import 'package:cw_zano/api/model/asset_id_params.dart'; +import 'package:cw_zano/api/model/create_wallet_result.dart'; +import 'package:cw_zano/api/model/destination.dart'; +import 'package:cw_zano/api/model/get_address_info_result.dart'; +import 'package:cw_zano/api/model/get_recent_txs_and_info_params.dart'; +import 'package:cw_zano/api/model/get_recent_txs_and_info_result.dart'; +import 'package:cw_zano/api/model/get_wallet_info_result.dart'; +import 'package:cw_zano/api/model/get_wallet_status_result.dart'; +import 'package:cw_zano/api/model/proxy_to_daemon_params.dart'; +import 'package:cw_zano/api/model/proxy_to_daemon_result.dart'; +import 'package:cw_zano/api/model/store_result.dart'; +import 'package:cw_zano/api/model/transfer.dart'; +import 'package:cw_zano/api/model/transfer_params.dart'; +import 'package:cw_zano/api/model/transfer_result.dart'; +import 'package:cw_zano/model/zano_asset.dart'; +import 'package:cw_zano/zano_wallet_exceptions.dart'; +import 'package:flutter/foundation.dart'; +import 'package:json_bigint/json_bigint.dart'; + +mixin ZanoWalletApi { + static const _defaultNodeUri = '195.201.107.230:33336'; + static const _statusDelivered = 'delivered'; + static const _maxInvokeAttempts = 10; + static const _maxReopenAttempts = 5; + static const _logInfo = true; + static const _logError = true; + static const _logJson = false; + static const int _zanoMixinValue = 10; + + int _hWallet = 0; + + int get hWallet => _hWallet; + + set hWallet(int value) { + _hWallet = value; + } + + int getCurrentTxFee(TransactionPriority priority) => ApiCalls.getCurrentTxFee(priority: priority.raw); + + String getOpenedWallets() => ApiCalls.getOpenedWallets(); + String getConnectivityStatus() => ApiCalls.getConnectivityStatus(); + + void setPassword(String password) => ApiCalls.setPassword(hWallet: hWallet, password: password); + + void closeWallet([int? walletToClose]) { + info('close_wallet ${walletToClose ?? hWallet}'); + final result = ApiCalls.closeWallet(hWallet: walletToClose ?? hWallet); + info('close_wallet result $result'); + } + + Future setupNode() async { + info('init $_defaultNodeUri'); + final result = ApiCalls.setupNode( + address: _defaultNodeUri, + login: '', + password: '', + useSSL: false, + isLightWallet: false, + ); + info('init result $result'); + return result; + } + + Future getWalletInfo() async { + final json = ApiCalls.getWalletInfo(hWallet); + final result = GetWalletInfoResult.fromJson(jsonDecode(json) as Map); + _json('get_wallet_info', json); + info('get_wallet_info got ${result.wi.balances.length} balances: ${result.wi.balances} seed: ${_shorten(result.wiExtended.seed)}'); + return result; + } + + Future getWalletStatus() async { + final json = ApiCalls.getWalletStatus(hWallet: hWallet); + if (json == Consts.errorWalletWrongId) { + error('wrong wallet id'); + throw ZanoWalletException('Wrong wallet id'); + } + final status = GetWalletStatusResult.fromJson(jsonDecode(json) as Map); + _json('get_wallet_status', json); + if (_logInfo) + info( + 'get_wallet_status connected: ${status.isDaemonConnected} in refresh: ${status.isInLongRefresh} progress: ${status.progress} wallet state: ${status.walletState}'); + return status; + } + + Future invokeMethod(String methodName, Object params) async { + var invokeResult = + ApiCalls.asyncCall(methodName: 'invoke', hWallet: hWallet, params: '{"method": "$methodName","params": ${jsonEncode(params)}}'); + Map map; + try { + map = jsonDecode(invokeResult) as Map; + } catch (e) { + if (invokeResult.contains(Consts.errorWalletWrongId)) throw ZanoWalletException('Wrong wallet id'); + error('exception in parsing json in invokeMethod: $invokeResult'); + rethrow; + } + int attempts = 0; + if (map['job_id'] != null) { + final jobId = map['job_id'] as int; + do { + await Future.delayed(Duration(milliseconds: attempts < 2 ? 100 : 500)); + final result = ApiCalls.tryPullResult(jobId); + try { + map = jsonDecode(result) as Map; + } catch (e) { + if (result.contains(Consts.errorWalletWrongId)) throw ZanoWalletException('Wrong wallet id'); + error('exception in parsing json in invokeMethod: $result'); + rethrow; + } + if (map['status'] != null && map['status'] == _statusDelivered && map['result'] != null) { + return result; + } + } while (++attempts < _maxInvokeAttempts); + } + return invokeResult; + } + + Future> getAssetsWhitelist() async { + try { + final json = await invokeMethod('assets_whitelist_get', '{}'); + _json('assets_whitelist_get', json); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + List assets(String type, bool isGlobalWhitelist) => + (map?['result']?['result']?[type] as List?) + ?.map((e) => ZanoAsset.fromJson(e as Map, isInGlobalWhitelist: isGlobalWhitelist)) + .toList() ?? + []; + final localWhitelist = assets('local_whitelist', false); + final globalWhitelist = assets('global_whitelist', true); + final ownAssets = assets('own_assets', false); + if (_logInfo) + info('assets_whitelist_get got local whitelist: ${localWhitelist.length} ($localWhitelist); ' + 'global whitelist: ${globalWhitelist.length} ($globalWhitelist); ' + 'own assets: ${ownAssets.length} ($ownAssets)'); + return [...globalWhitelist, ...localWhitelist, ...ownAssets]; + } catch (e) { + error('assets_whitelist_get $e'); + //return []; + rethrow; + } + } + + Future addAssetsWhitelist(String assetId) async { + try { + final json = await invokeMethod('assets_whitelist_add', AssetIdParams(assetId: assetId)); + _json('assets_whitelist_add $assetId', json); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + if (map!['result']!['result']!['status']! == 'OK') { + final assetDescriptor = ZanoAsset.fromJson(map['result']!['result']!['asset_descriptor']! as Map); + info('assets_whitelist_add added ${assetDescriptor.fullName} ${assetDescriptor.ticker}'); + return assetDescriptor; + } else { + info('assets_whitelist_add status ${map['result']!['result']!['status']!}'); + return null; + } + } catch (e) { + error('assets_whitelist_add $e'); + return null; + } + } + + Future removeAssetsWhitelist(String assetId) async { + try { + final json = await invokeMethod('assets_whitelist_remove', AssetIdParams(assetId: assetId)); + _json('assets_whitelist_remove $assetId', json); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + info('assets_whitelist_remove status ${map!['result']!['result']!['status']!}'); + return (map['result']!['result']!['status']! == 'OK'); + } catch (e) { + error('assets_whitelist_remove $e'); + return false; + } + } + + Future _proxyToDaemon(String uri, String body) async { + final json = await invokeMethod('proxy_to_daemon', ProxyToDaemonParams(body: body, uri: uri)); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + return ProxyToDaemonResult.fromJson(map!['result']['result'] as Map); + } + + Future getAssetInfo(String assetId) async { + final methodName = 'get_asset_info'; + final params = AssetIdParams(assetId: assetId); + final result = await _proxyToDaemon('/json_rpc', '{"method": "$methodName","params": ${jsonEncode(params)}}'); + _json('$methodName $assetId', result?.body ?? ''); + if (result == null) { + error('get_asset_info empty result'); + return null; + } + final map = jsonDecode(result.body) as Map?; + if (map!['error'] != null) { + info('get_asset_info $assetId error ${map['error']!['code']} ${map['error']!['message']}'); + return null; + } else if (map['result']!['status']! == 'OK') { + final assetDescriptor = ZanoAsset.fromJson(map['result']!['asset_descriptor']! as Map); + info('get_asset_info $assetId ${assetDescriptor.fullName} ${assetDescriptor.ticker}'); + return assetDescriptor; + } else { + info('get_asset_info $assetId status ${map['result']!['status']!}'); + return null; + } + } + + Future store() async { + try { + final json = await invokeMethod('store', '{}'); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + return StoreResult.fromJson(map!['result']['result'] as Map); + } catch (e) { + error('store $e'); + return null; + } + } + + Future getRecentTxsAndInfo({required int offset, required int count}) async { + info('get_recent_txs_and_info $offset $count'); + try { + final json = await invokeMethod('get_recent_txs_and_info', GetRecentTxsAndInfoParams(offset: offset, count: count)); + _json('get_recent_txs_and_info', json); + final map = jsonDecode(json) as Map?; + _checkForErrors(map); + final lastItemIndex = map?['result']?['result']?['last_item_index'] as int?; + final totalTransfers = map?['result']?['result']?['total_transfers'] as int?; + final transfers = map?['result']?['result']?['transfers'] as List?; + if (transfers == null || lastItemIndex == null || totalTransfers == null) { + error('get_recent_txs_and_info empty transfers'); + return GetRecentTxsAndInfoResult.empty(); + } + info('get_recent_txs_and_info transfers.length: ${transfers.length}'); + return GetRecentTxsAndInfoResult( + transfers: transfers.map((e) => Transfer.fromJson(e as Map)).toList(), + lastItemIndex: lastItemIndex, + totalTransfers: totalTransfers, + ); + } catch (e) { + error('get_recent_txs_and_info $e'); + return GetRecentTxsAndInfoResult.empty(); + } + } + + GetAddressInfoResult getAddressInfo(String address) => GetAddressInfoResult.fromJson( + jsonDecode(ApiCalls.getAddressInfo(address: address)) as Map, + ); + + String _shorten(String s) => s.length > 10 ? '${s.substring(0, 4)}...${s.substring(s.length - 4)}' : s; + + Future createWallet(String path, String password) async { + info('create_wallet path $path password ${_shorten(password)}'); + final json = ApiCalls.createWallet(path: path, password: password); + _json('create_wallet', json); + final map = jsonDecode(json) as Map?; + if (map?['error'] != null) { + final code = map!['error']!['code'] ?? ''; + final message = map['error']!['message'] ?? ''; + throw ZanoWalletException('Error creating wallet file, $message ($code)'); + } + if (map?['result'] == null) { + throw ZanoWalletException('Error creating wallet file, empty response'); + } + final result = CreateWalletResult.fromJson(map!['result'] as Map); + info('create_wallet ${result.name} ${result.seed}'); + return result; + } + + Future restoreWalletFromSeed(String path, String password, String seed) async { + info('restore_wallet path $path password ${_shorten(password)} seed ${_shorten(seed)}'); + final json = ApiCalls.restoreWalletFromSeed(path: path, password: password, seed: seed); + _json('restore_wallet', json); + final map = jsonDecode(json) as Map?; + if (map?['error'] != null) { + final code = map!['error']!['code'] ?? ''; + final message = map['error']!['message'] ?? ''; + if (code == Consts.errorWrongSeed) { + throw RestoreFromKeysException('Error restoring wallet, wrong seed'); + } else if (code == Consts.errorAlreadyExists) { + throw RestoreFromKeysException('Error restoring wallet, already exists'); + } + throw RestoreFromKeysException('Error restoring wallet, $message ($code)'); + } + if (map?['result'] == null) { + throw RestoreFromKeysException('Error restoring wallet, empty response'); + } + final result = CreateWalletResult.fromJson(map!['result'] as Map); + info('restore_wallet ${result.name} ${result.wi.address}'); + return result; + } + + Future loadWallet(String path, String password, [int attempt = 0]) async { + info('load_wallet path $path password ${_shorten(password)}'); + final String json; + try { + json = ApiCalls.loadWallet(path: path, password: password); + } catch (e) { + error('error in loadingWallet $e'); + rethrow; + } + _json('load_wallet', json); + final map = jsonDecode(json) as Map?; + if (map?['error'] != null) { + final code = map?['error']!['code'] ?? ''; + final message = map?['error']!['message'] ?? ''; + if (code == Consts.errorAlreadyExists && attempt <= _maxReopenAttempts) { + // already connected to this wallet. closing and trying to reopen + info('already connected. closing and reopen wallet (attempt $attempt)'); + closeWallet(attempt); + await Future.delayed(const Duration(milliseconds: 500)); + return await loadWallet(path, password, attempt + 1); + } + throw ZanoWalletException('Error loading wallet, $message ($code)'); + } + if (map?['result'] == null) { + throw ZanoWalletException('Error loading wallet, empty response'); + } + final result = CreateWalletResult.fromJson(map!['result'] as Map); + info('load_wallet ${result.name} ${result.wi.address}'); + return result; + } + + Future transfer(List destinations, BigInt fee, String comment) async { + final params = TransferParams( + destinations: destinations, + fee: fee, + mixin: _zanoMixinValue, + paymentId: '', + comment: comment, + pushPayer: false, + hideReceiver: true, + ); + final json = await invokeMethod('transfer', params); + _json('transfer', json); + final map = jsonDecode(json); + final resultMap = map['result'] as Map?; + if (resultMap != null) { + final transferResultMap = resultMap['result'] as Map?; + if (transferResultMap != null) { + final transferResult = TransferResult.fromJson(transferResultMap); + info('transfer success hash ${transferResult.txHash}'); + return transferResult; + } else { + final errorCode = resultMap['error']['code']; + final code = errorCode is int ? errorCode.toString() : errorCode as String? ?? ''; + final message = resultMap['error']['message'] as String? ?? ''; + error('transfer error $code $message'); + throw TransferException('Transfer error, $message ($code)'); + } + } + error('transfer error empty result'); + throw TransferException('Transfer error, empty result'); + } + + void _checkForErrors(Map? map) { + if (map == null) { + throw ZanoWalletException('Empty response'); + } + final result = map['result']; + if (result == null) { + throw ZanoWalletException('Empty response'); + } + if (result['error'] != null) { + final code = result['error']!['code'] ?? ''; + final message = result['error']!['message'] ?? ''; + if (code == -1 && message == Consts.errorBusy) { + throw ZanoWalletBusyException(); + } + throw ZanoWalletException('Error, $message ($code)'); + } + } + + /*Future _writeLog(String method, String logMessage) async { + final dir = await getDownloadsDirectory(); + final logFile = File('${dir!.path}/$method.txt'); + final date = DateTime.now(); + String twoDigits(int value) => value.toString().padLeft(2, '0'); + String removeCRandLF(String input) => input.replaceAll(RegExp('\r|\n'), ''); + await logFile.writeAsString('${twoDigits(date.hour)}:${twoDigits(date.minute)}:${twoDigits(date.second)} ${removeCRandLF(logMessage)}\n', + mode: FileMode.append); + }*/ + + static void info(String s) => _logInfo ? debugPrint('[info] $s') : null; + static void error(String s) => _logError ? debugPrint('[error] $s') : null; + static void printWrapped(String text) => RegExp('.{1,800}').allMatches(text).map((m) => m.group(0)).forEach(print); + static void _json(String methodName, String json) => _logJson ? printWrapped('$methodName $json') : null; + + Map jsonDecode(String json) { + try { + return decodeJson(json.replaceAll("\\/", "/")) as Map; + } catch (e) { + return convert.jsonDecode(json) as Map; + } + } + + String jsonEncode(Object? object) { + return convert.jsonEncode(object); + } +} diff --git a/cw_zano/lib/zano_wallet_exceptions.dart b/cw_zano/lib/zano_wallet_exceptions.dart new file mode 100644 index 000000000..57767ef90 --- /dev/null +++ b/cw_zano/lib/zano_wallet_exceptions.dart @@ -0,0 +1,19 @@ +class ZanoWalletException implements Exception { + final String message; + + ZanoWalletException(this.message); + @override + String toString() => '${this.runtimeType} (message: $message)'; +} + +class RestoreFromKeysException extends ZanoWalletException { + RestoreFromKeysException(String message) : super(message); +} + +class TransferException extends ZanoWalletException { + TransferException(String message): super(message); +} + +class ZanoWalletBusyException extends ZanoWalletException { + ZanoWalletBusyException(): super(''); +} \ No newline at end of file diff --git a/cw_zano/lib/zano_wallet_service.dart b/cw_zano/lib/zano_wallet_service.dart new file mode 100644 index 000000000..3c4f60685 --- /dev/null +++ b/cw_zano/lib/zano_wallet_service.dart @@ -0,0 +1,123 @@ +import 'dart:io'; + +import 'package:collection/collection.dart'; +import 'package:cw_core/pathForWallet.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:cw_core/wallet_credentials.dart'; +import 'package:cw_core/wallet_info.dart'; +import 'package:cw_core/wallet_service.dart'; +import 'package:cw_core/wallet_type.dart'; +import 'package:cw_zano/api/api_calls.dart'; +import 'package:cw_zano/zano_wallet.dart'; +import 'package:cw_zano/zano_wallet_api.dart'; +import 'package:hive/hive.dart'; + +class ZanoNewWalletCredentials extends WalletCredentials { + ZanoNewWalletCredentials({required String name, String? password}) : super(name: name, password: password); +} + +class ZanoRestoreWalletFromSeedCredentials extends WalletCredentials { + ZanoRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required this.mnemonic}) + : super(name: name, password: password, height: height); + + final String mnemonic; +} + +class ZanoRestoreWalletFromKeysCredentials extends WalletCredentials { + ZanoRestoreWalletFromKeysCredentials( + {required String name, + required String password, + required this.language, + required this.address, + required this.viewKey, + required this.spendKey, + required int height}) + : super(name: name, password: password, height: height); + + final String language; + final String address; + final String viewKey; + final String spendKey; +} + +class ZanoWalletService extends WalletService { + ZanoWalletService(this.walletInfoSource); + + final Box walletInfoSource; + + static bool walletFilesExist(String path) => !File(path).existsSync() && !File('$path.keys').existsSync(); + + int hWallet = 0; + + @override + WalletType getType() => WalletType.zano; + + @override + Future create(WalletCredentials credentials, {bool? isTestnet}) async { + ZanoWalletApi.info('zanowallet service create isTestnet $isTestnet'); + return await ZanoWalletBase.create(credentials: credentials); + } + + @override + Future isWalletExit(String name) async { + final path = await pathForWallet(name: name, type: getType()); + return ApiCalls.isWalletExist(path: path); + } + + @override + Future openWallet(String name, String password) async { + final walletInfo = walletInfoSource.values.firstWhereOrNull((info) => info.id == WalletBase.idFor(name, getType()))!; + try { + final wallet = await ZanoWalletBase.open(name: name, password: password, walletInfo: walletInfo); + saveBackup(name); + return wallet; + } catch (e) { + await restoreWalletFilesFromBackup(name); + return await ZanoWalletBase.open(name: name, password: password, walletInfo: walletInfo); + } + } + + @override + Future remove(String wallet) async { + final path = await pathForWalletDir(name: wallet, type: getType()); + final file = Directory(path); + final isExist = file.existsSync(); + + if (isExist) { + await file.delete(recursive: true); + } + + final walletInfo = walletInfoSource.values.firstWhere((info) => info.id == WalletBase.idFor(wallet, getType())); + await walletInfoSource.delete(walletInfo.key); + } + + @override + Future rename(String currentName, String password, String newName) async { + final currentWalletInfo = walletInfoSource.values.firstWhere((info) => info.id == WalletBase.idFor(currentName, getType())); + final currentWallet = ZanoWallet(currentWalletInfo); + + await currentWallet.renameWalletFiles(newName); + + final newWalletInfo = currentWalletInfo; + newWalletInfo.id = WalletBase.idFor(newName, getType()); + newWalletInfo.name = newName; + + await walletInfoSource.put(currentWalletInfo.key, newWalletInfo); + } + + @override + Future restoreFromKeys(ZanoRestoreWalletFromKeysCredentials credentials, {bool? isTestnet}) async { + throw UnimplementedError(); + } + + @override + Future restoreFromSeed(ZanoRestoreWalletFromSeedCredentials credentials, {bool? isTestnet}) async { + return ZanoWalletBase.restore(credentials: credentials); + } + + @override + Future restoreFromHardwareWallet(ZanoNewWalletCredentials credentials) { + throw UnimplementedError("Restoring a Zano wallet from a hardware wallet is not yet supported!"); + } +} diff --git a/cw_zano/pubspec.lock b/cw_zano/pubspec.lock new file mode 100644 index 000000000..e1c5eb2f3 --- /dev/null +++ b/cw_zano/pubspec.lock @@ -0,0 +1,769 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + _fe_analyzer_shared: + dependency: transitive + description: + name: _fe_analyzer_shared + sha256: "4897882604d919befd350648c7f91926a9d5de99e67b455bf0917cc2362f4bb8" + url: "https://pub.dev" + source: hosted + version: "47.0.0" + analyzer: + dependency: transitive + description: + name: analyzer + sha256: "690e335554a8385bc9d787117d9eb52c0c03ee207a607e593de3c9d71b1cfe80" + url: "https://pub.dev" + source: hosted + version: "4.7.0" + args: + dependency: transitive + description: + name: args + sha256: "139d809800a412ebb26a3892da228b2d0ba36f0ef5d9a82166e5e52ec8d61611" + url: "https://pub.dev" + source: hosted + version: "2.3.2" + asn1lib: + dependency: transitive + description: + name: asn1lib + sha256: ab96a1cb3beeccf8145c52e449233fe68364c9641623acd3adad66f8184f1039 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + async: + dependency: transitive + description: + name: async + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c" + url: "https://pub.dev" + source: hosted + version: "2.11.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + build: + dependency: transitive + description: + name: build + sha256: "3fbda25365741f8251b39f3917fb3c8e286a96fd068a5a242e11c2012d495777" + url: "https://pub.dev" + source: hosted + version: "2.3.1" + build_config: + dependency: transitive + description: + name: build_config + sha256: bf80fcfb46a29945b423bd9aad884590fb1dc69b330a4d4700cac476af1708d1 + url: "https://pub.dev" + source: hosted + version: "1.1.1" + build_daemon: + dependency: transitive + description: + name: build_daemon + sha256: "5f02d73eb2ba16483e693f80bee4f088563a820e47d1027d4cdfe62b5bb43e65" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + build_resolvers: + dependency: "direct dev" + description: + name: build_resolvers + sha256: "687cf90a3951affac1bd5f9ecb5e3e90b60487f3d9cdc359bb310f8876bb02a6" + url: "https://pub.dev" + source: hosted + version: "2.0.10" + build_runner: + dependency: "direct dev" + description: + name: build_runner + sha256: "3ac61a79bfb6f6cc11f693591063a7f19a7af628dc52f141743edac5c16e8c22" + url: "https://pub.dev" + source: hosted + version: "2.4.9" + build_runner_core: + dependency: transitive + description: + name: build_runner_core + sha256: "14febe0f5bac5ae474117a36099b4de6f1dbc52df6c5e55534b3da9591bf4292" + url: "https://pub.dev" + source: hosted + version: "7.2.7" + built_collection: + dependency: transitive + description: + name: built_collection + sha256: "376e3dd27b51ea877c28d525560790aee2e6fbb5f20e2f85d5081027d94e2100" + url: "https://pub.dev" + source: hosted + version: "5.1.1" + built_value: + dependency: transitive + description: + name: built_value + sha256: "169565c8ad06adb760c3645bf71f00bff161b00002cace266cad42c5d22a7725" + url: "https://pub.dev" + source: hosted + version: "8.4.3" + characters: + dependency: transitive + description: + name: characters + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605" + url: "https://pub.dev" + source: hosted + version: "1.3.0" + checked_yaml: + dependency: transitive + description: + name: checked_yaml + sha256: "3d1505d91afa809d177efd4eed5bb0eb65805097a1463abdd2add076effae311" + url: "https://pub.dev" + source: hosted + version: "2.0.2" + clock: + dependency: transitive + description: + name: clock + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf + url: "https://pub.dev" + source: hosted + version: "1.1.1" + code_builder: + dependency: transitive + description: + name: code_builder + sha256: "0d43dd1288fd145de1ecc9a3948ad4a6d5a82f0a14c4fdd0892260787d975cbe" + url: "https://pub.dev" + source: hosted + version: "4.4.0" + collection: + dependency: transitive + description: + name: collection + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a + url: "https://pub.dev" + source: hosted + version: "1.18.0" + convert: + dependency: transitive + description: + name: convert + sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592" + url: "https://pub.dev" + source: hosted + version: "3.1.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: aa274aa7774f8964e4f4f38cc994db7b6158dd36e9187aaceaddc994b35c6c67 + url: "https://pub.dev" + source: hosted + version: "3.0.2" + cw_core: + dependency: "direct main" + description: + path: "../cw_core" + relative: true + source: path + version: "0.0.1" + dart_style: + dependency: transitive + description: + name: dart_style + sha256: "7a03456c3490394c8e7665890333e91ae8a49be43542b616e414449ac358acd4" + url: "https://pub.dev" + source: hosted + version: "2.2.4" + decimal: + dependency: "direct main" + description: + name: decimal + sha256: "24a261d5d5c87e86c7651c417a5dbdf8bcd7080dd592533910e8d0505a279f21" + url: "https://pub.dev" + source: hosted + version: "2.3.3" + encrypt: + dependency: transitive + description: + name: encrypt + sha256: "4fd4e4fdc21b9d7d4141823e1e6515cd94e7b8d84749504c232999fba25d9bbb" + url: "https://pub.dev" + source: hosted + version: "5.0.1" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + ffi: + dependency: "direct main" + description: + name: ffi + sha256: a38574032c5f1dd06c4aee541789906c12ccaab8ba01446e800d9c5b79c4a978 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d" + url: "https://pub.dev" + source: hosted + version: "6.1.4" + fixnum: + dependency: transitive + description: + name: fixnum + sha256: "25517a4deb0c03aa0f32fd12db525856438902d9c16536311e76cdc57b31d7d1" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_mobx: + dependency: "direct main" + description: + name: flutter_mobx + sha256: "0da4add0016387a7bf309a0d0c41d36c6b3ae25ed7a176409267f166509e723e" + url: "https://pub.dev" + source: hosted + version: "2.0.6+5" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + fluttertoast: + dependency: "direct main" + description: + name: fluttertoast + sha256: "4215b0085ebf737120ab6b06fefeadfae709c74f880a351a73d6d007f74e7631" + url: "https://pub.dev" + source: hosted + version: "8.1.4" + frontend_server_client: + dependency: transitive + description: + name: frontend_server_client + sha256: "408e3ca148b31c20282ad6f37ebfa6f4bdc8fede5b74bc2f08d9d92b55db3612" + url: "https://pub.dev" + source: hosted + version: "3.2.0" + glob: + dependency: transitive + description: + name: glob + sha256: "4515b5b6ddb505ebdd242a5f2cc5d22d3d6a80013789debfbda7777f47ea308c" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + graphs: + dependency: transitive + description: + name: graphs + sha256: f9e130f3259f52d26f0cfc0e964513796dafed572fa52e45d2f8d6ca14db39b2 + url: "https://pub.dev" + source: hosted + version: "2.2.0" + hive: + dependency: transitive + description: + name: hive + sha256: "8dcf6db979d7933da8217edcec84e9df1bdb4e4edc7fc77dbd5aa74356d6d941" + url: "https://pub.dev" + source: hosted + version: "2.2.3" + hive_generator: + dependency: "direct dev" + description: + name: hive_generator + sha256: "81fd20125cb2ce8fd23623d7744ffbaf653aae93706c9bd3bf7019ea0ace3938" + url: "https://pub.dev" + source: hosted + version: "1.1.3" + http: + dependency: "direct main" + description: + name: http + sha256: "759d1a329847dd0f39226c688d3e06a6b8679668e350e2891a6474f8b4bb8525" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + http_multi_server: + dependency: transitive + description: + name: http_multi_server + sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b" + url: "https://pub.dev" + source: hosted + version: "3.2.1" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b" + url: "https://pub.dev" + source: hosted + version: "4.0.2" + intl: + dependency: "direct main" + description: + name: intl + sha256: "3bc132a9dbce73a7e4a21a17d06e1878839ffbf975568bc875c60537824b0c4d" + url: "https://pub.dev" + source: hosted + version: "0.18.1" + io: + dependency: transitive + description: + name: io + sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + json_annotation: + dependency: transitive + description: + name: json_annotation + sha256: c33da08e136c3df0190bd5bbe51ae1df4a7d96e7954d1d7249fea2968a72d317 + url: "https://pub.dev" + source: hosted + version: "4.8.0" + json_bigint: + dependency: "direct main" + description: + name: json_bigint + sha256: "77f5cc47ec936b37ff5016394b0ed136fe2231e35dcbaed32fe749c221264cac" + url: "https://pub.dev" + source: hosted + version: "3.0.0" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: "78eb209deea09858f5269f5a5b02be4049535f568c07b275096836f01ea323fa" + url: "https://pub.dev" + source: hosted + version: "10.0.0" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: b46c5e37c19120a8a01918cfaf293547f47269f7cb4b0058f21531c2465d6ef0 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: a597f72a664dbd293f3bfc51f9ba69816f84dcd403cdac7066cb3f6003f3ab47 + url: "https://pub.dev" + source: hosted + version: "2.0.1" + logging: + dependency: transitive + description: + name: logging + sha256: "04094f2eb032cbb06c6f6e8d3607edcfcb0455e2bb6cbc010cb01171dcb64e6d" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + matcher: + dependency: transitive + description: + name: matcher + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb + url: "https://pub.dev" + source: hosted + version: "0.12.16+1" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a" + url: "https://pub.dev" + source: hosted + version: "0.8.0" + meta: + dependency: transitive + description: + name: meta + sha256: d584fa6707a52763a52446f02cc621b077888fb63b93bbcb1143a7be5a0c0c04 + url: "https://pub.dev" + source: hosted + version: "1.11.0" + mime: + dependency: transitive + description: + name: mime + sha256: e4ff8e8564c03f255408decd16e7899da1733852a9110a58fe6d1b817684a63e + url: "https://pub.dev" + source: hosted + version: "1.0.4" + mobx: + dependency: "direct main" + description: + name: mobx + sha256: "63920b27b32ad1910adfe767ab1750e4c212e8923232a1f891597b362074ea5e" + url: "https://pub.dev" + source: hosted + version: "2.3.3+2" + mobx_codegen: + dependency: "direct dev" + description: + name: mobx_codegen + sha256: "86122e410d8ea24dda0c69adb5c2a6ccadd5ce02ad46e144764e0d0184a06181" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + package_config: + dependency: transitive + description: + name: package_config + sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + path: + dependency: transitive + description: + name: path + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af" + url: "https://pub.dev" + source: hosted + version: "1.9.0" + path_provider: + dependency: "direct main" + description: + name: path_provider + sha256: dcea5feb97d8abf90cab9e9030b497fb7c3cbf26b7a1fe9e3ef7dcb0a1ddec95 + url: "https://pub.dev" + source: hosted + version: "2.0.12" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: a776c088d671b27f6e3aa8881d64b87b3e80201c64e8869b811325de7a76c15e + url: "https://pub.dev" + source: hosted + version: "2.0.22" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "62a68e7e1c6c459f9289859e2fae58290c981ce21d1697faf54910fe1faa4c74" + url: "https://pub.dev" + source: hosted + version: "2.1.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: ab0987bf95bc591da42dffb38c77398fc43309f0b9b894dcc5d6f40c4b26c379 + url: "https://pub.dev" + source: hosted + version: "2.1.7" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: f0abc8ebd7253741f05488b4813d936b4d07c6bae3e86148a09e342ee4b08e76 + url: "https://pub.dev" + source: hosted + version: "2.0.5" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: f53720498d5a543f9607db4b0e997c4b5438884de25b0f73098cc2671a51b130 + url: "https://pub.dev" + source: hosted + version: "2.1.5" + petitparser: + dependency: transitive + description: + name: petitparser + sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750 + url: "https://pub.dev" + source: hosted + version: "5.4.0" + platform: + dependency: transitive + description: + name: platform + sha256: "4a451831508d7d6ca779f7ac6e212b4023dd5a7d08a27a63da33756410e32b76" + url: "https://pub.dev" + source: hosted + version: "3.1.0" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: dbf0f707c78beedc9200146ad3cb0ab4d5da13c246336987be6940f026500d3a + url: "https://pub.dev" + source: hosted + version: "2.1.3" + pointycastle: + dependency: transitive + description: + name: pointycastle + sha256: db7306cf0249f838d1a24af52b5a5887c5bf7f31d8bb4e827d071dc0939ad346 + url: "https://pub.dev" + source: hosted + version: "3.6.2" + pool: + dependency: transitive + description: + name: pool + sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a" + url: "https://pub.dev" + source: hosted + version: "1.5.1" + process: + dependency: transitive + description: + name: process + sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09" + url: "https://pub.dev" + source: hosted + version: "4.2.4" + pub_semver: + dependency: transitive + description: + name: pub_semver + sha256: "307de764d305289ff24ad257ad5c5793ce56d04947599ad68b3baa124105fc17" + url: "https://pub.dev" + source: hosted + version: "2.1.3" + pubspec_parse: + dependency: transitive + description: + name: pubspec_parse + sha256: "75f6614d6dde2dc68948dffbaa4fe5dae32cd700eb9fb763fe11dfb45a3c4d0a" + url: "https://pub.dev" + source: hosted + version: "1.2.1" + rational: + dependency: transitive + description: + name: rational + sha256: ba58e9e18df9abde280e8b10051e4bce85091e41e8e7e411b6cde2e738d357cf + url: "https://pub.dev" + source: hosted + version: "2.2.2" + shelf: + dependency: transitive + description: + name: shelf + sha256: c24a96135a2ccd62c64b69315a14adc5c3419df63b4d7c05832a346fdb73682c + url: "https://pub.dev" + source: hosted + version: "1.4.0" + shelf_web_socket: + dependency: transitive + description: + name: shelf_web_socket + sha256: a988c0e8d8ffbdb8a28aa7ec8e449c260f3deb808781fe1284d22c5bba7156e8 + url: "https://pub.dev" + source: hosted + version: "1.0.3" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + socks5_proxy: + dependency: transitive + description: + name: socks5_proxy + sha256: "1d21b5606169654bbf4cfb904e8e6ed897e9f763358709f87310c757096d909a" + url: "https://pub.dev" + source: hosted + version: "1.0.4" + source_gen: + dependency: transitive + description: + name: source_gen + sha256: "2d79738b6bbf38a43920e2b8d189e9a3ce6cc201f4b8fc76be5e4fe377b1c38d" + url: "https://pub.dev" + source: hosted + version: "1.2.6" + source_helper: + dependency: transitive + description: + name: source_helper + sha256: "3b67aade1d52416149c633ba1bb36df44d97c6b51830c2198e934e3fca87ca1f" + url: "https://pub.dev" + source: hosted + version: "1.3.3" + source_span: + dependency: transitive + description: + name: source_span + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c" + url: "https://pub.dev" + source: hosted + version: "1.10.0" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b" + url: "https://pub.dev" + source: hosted + version: "1.11.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7 + url: "https://pub.dev" + source: hosted + version: "2.1.2" + stream_transform: + dependency: transitive + description: + name: stream_transform + sha256: "14a00e794c7c11aa145a170587321aedce29769c08d7f58b1d141da75e3b1c6f" + url: "https://pub.dev" + source: hosted + version: "2.1.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde" + url: "https://pub.dev" + source: hosted + version: "1.2.0" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + test_api: + dependency: transitive + description: + name: test_api + sha256: "5c2f730018264d276c20e4f1503fd1308dfbbae39ec8ee63c5236311ac06954b" + url: "https://pub.dev" + source: hosted + version: "0.6.1" + timing: + dependency: transitive + description: + name: timing + sha256: "70a3b636575d4163c477e6de42f247a23b315ae20e86442bebe32d3cabf61c32" + url: "https://pub.dev" + source: hosted + version: "1.0.1" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: "26f87ade979c47a150c9eaab93ccd2bebe70a27dc0b4b29517f2904f04eb11a5" + url: "https://pub.dev" + source: hosted + version: "1.3.1" + unorm_dart: + dependency: transitive + description: + name: unorm_dart + sha256: "23d8bf65605401a6a32cff99435fed66ef3dab3ddcad3454059165df46496a3b" + url: "https://pub.dev" + source: hosted + version: "0.3.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: b3d56ff4341b8f182b96aceb2fa20e3dcb336b9f867bc0eafc0de10f1048e957 + url: "https://pub.dev" + source: hosted + version: "13.0.0" + watcher: + dependency: "direct overridden" + description: + name: watcher + sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8" + url: "https://pub.dev" + source: hosted + version: "1.1.0" + web_socket_channel: + dependency: transitive + description: + name: web_socket_channel + sha256: ca49c0bc209c687b887f30527fb6a9d80040b072cc2990f34b9bec3e7663101b + url: "https://pub.dev" + source: hosted + version: "2.3.0" + win32: + dependency: transitive + description: + name: win32 + sha256: c9ebe7ee4ab0c2194e65d3a07d8c54c5d00bb001b76081c4a04cdb8448b59e46 + url: "https://pub.dev" + source: hosted + version: "3.1.3" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: bd512f03919aac5f1313eb8249f223bacf4927031bf60b02601f81f687689e86 + url: "https://pub.dev" + source: hosted + version: "0.2.0+3" + yaml: + dependency: transitive + description: + name: yaml + sha256: "23812a9b125b48d4007117254bca50abb6c712352927eece9e155207b1db2370" + url: "https://pub.dev" + source: hosted + version: "3.1.1" +sdks: + dart: ">=3.2.0-0 <4.0.0" + flutter: ">=3.7.0" diff --git a/cw_zano/pubspec.yaml b/cw_zano/pubspec.yaml new file mode 100644 index 000000000..f8ecb3150 --- /dev/null +++ b/cw_zano/pubspec.yaml @@ -0,0 +1,85 @@ +name: cw_zano +description: A new flutter plugin project. +version: 0.0.1 +publish_to: none +author: Cake Wallet +homepage: https://cakewallet.com + +environment: + sdk: ">=2.19.0 <3.0.0" + flutter: ">=1.20.0" + +dependencies: + flutter: + sdk: flutter + ffi: ^2.0.1 + http: ^1.1.0 + path_provider: ^2.0.11 + mobx: ^2.1.4 + flutter_mobx: ^2.0.6+1 + intl: ^0.18.0 + decimal: ^2.3.3 + cw_core: + path: ../cw_core + json_bigint: ^3.0.0 + fluttertoast: 8.1.4 + +dev_dependencies: + flutter_test: + sdk: flutter + build_runner: ^2.4.7 + mobx_codegen: ^2.1.1 + build_resolvers: ^2.0.9 + hive_generator: ^1.1.3 + +dependency_overrides: + watcher: ^1.1.0 + + +# For information on the generic Dart part of this file, see the +# following page: https://dart.dev/tools/pub/pubspec + +# The following section is specific to Flutter. +flutter: + # This section identifies this Flutter project as a plugin project. + # The 'pluginClass' and Android 'package' identifiers should not ordinarily + # be modified. They are used by the tooling to maintain consistency when + # adding or updating assets for this project. + plugin: + platforms: + android: + package: com.cakewallet.cw_zano + pluginClass: CwZanoPlugin + ios: + pluginClass: CwZanoPlugin + + # To add assets to your plugin package, add an assets section, like this: + # assets: + # - images/a_dot_burr.jpeg + # - images/a_dot_ham.jpeg + # + # For details regarding assets in packages, see + # https://flutter.dev/assets-and-images/#from-packages + # + # An image asset can refer to one or more resolution-specific "variants", see + # https://flutter.dev/assets-and-images/#resolution-aware. + + # To add custom fonts to your plugin package, add a fonts section here, + # in this "flutter" section. Each entry in this list should have a + # "family" key with the font family name, and a "fonts" key with a + # list giving the asset and other descriptors for the font. For + # example: + # fonts: + # - family: Schyler + # fonts: + # - asset: fonts/Schyler-Regular.ttf + # - asset: fonts/Schyler-Italic.ttf + # style: italic + # - family: Trajan Pro + # fonts: + # - asset: fonts/TrajanPro.ttf + # - asset: fonts/TrajanPro_Bold.ttf + # weight: 700 + # + # For details regarding fonts in packages, see + # https://flutter.dev/custom-fonts/#from-packages diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 8046ba307..6a497bf80 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,39 +1,23 @@ PODS: + - barcode_scan2 (0.0.1): + - Flutter + - MTBBarcodeScanner + - SwiftProtobuf + - BigInt (5.2.0) - connectivity_plus (0.0.1): - Flutter - ReachabilitySwift - CryptoSwift (1.8.3) - - cw_haven (0.0.1): - - cw_haven/Boost (= 0.0.1) - - cw_haven/Haven (= 0.0.1) - - cw_haven/OpenSSL (= 0.0.1) - - cw_haven/Sodium (= 0.0.1) - - cw_shared_external + - cw_zano (0.0.1): + - cw_zano/Boost (= 0.0.1) + - cw_zano/OpenSSL (= 0.0.1) + - cw_zano/Zano (= 0.0.1) - Flutter - - cw_haven/Boost (0.0.1): - - cw_shared_external + - cw_zano/Boost (0.0.1): - Flutter - - cw_haven/Haven (0.0.1): - - cw_shared_external + - cw_zano/OpenSSL (0.0.1): - Flutter - - cw_haven/OpenSSL (0.0.1): - - cw_shared_external - - Flutter - - cw_haven/Sodium (0.0.1): - - cw_shared_external - - Flutter - - cw_mweb (0.0.1): - - Flutter - - cw_shared_external (0.0.1): - - cw_shared_external/Boost (= 0.0.1) - - cw_shared_external/OpenSSL (= 0.0.1) - - cw_shared_external/Sodium (= 0.0.1) - - Flutter - - cw_shared_external/Boost (0.0.1): - - Flutter - - cw_shared_external/OpenSSL (0.0.1): - - Flutter - - cw_shared_external/Sodium (0.0.1): + - cw_zano/Zano (0.0.1): - Flutter - device_display_brightness (0.0.1): - Flutter @@ -72,8 +56,6 @@ PODS: - DKPhotoGallery/Resource (0.0.19): - SDWebImage - SwiftyGif - - fast_scanner (5.1.1): - - Flutter - file_picker (0.0.1): - DKImagePickerController/PhotoGallery - Flutter @@ -81,10 +63,10 @@ PODS: - flutter_inappwebview_ios (0.0.1): - Flutter - flutter_inappwebview_ios/Core (= 0.0.1) - - OrderedSet (~> 6.0.3) + - OrderedSet (~> 5.0) - flutter_inappwebview_ios/Core (0.0.1): - Flutter - - OrderedSet (~> 6.0.3) + - OrderedSet (~> 5.0) - flutter_local_authentication (1.2.0): - Flutter - flutter_mailer (0.0.1): @@ -94,11 +76,12 @@ PODS: - fluttertoast (0.0.2): - Flutter - Toast - - in_app_review (2.0.0): + - in_app_review (0.2.0): - Flutter - - integration_test (0.0.1): + - MTBBarcodeScanner (5.0.11) + - OrderedSet (5.0.0) + - package_info (0.0.1): - Flutter - - OrderedSet (6.0.3) - package_info_plus (0.4.5): - Flutter - path_provider_foundation (0.0.1): @@ -106,10 +89,15 @@ PODS: - FlutterMacOS - permission_handler_apple (9.1.1): - Flutter - - ReachabilitySwift (5.2.4) - - SDWebImage (5.19.7): - - SDWebImage/Core (= 5.19.7) - - SDWebImage/Core (5.19.7) + - Protobuf (3.27.3) + - ReachabilitySwift (5.2.3) + - reactive_ble_mobile (0.0.1): + - Flutter + - Protobuf (~> 3.5) + - SwiftProtobuf (~> 1.0) + - SDWebImage (5.19.6): + - SDWebImage/Core (= 5.19.6) + - SDWebImage/Core (5.19.6) - sensitive_clipboard (0.0.1): - Flutter - share_plus (0.0.1): @@ -119,13 +107,14 @@ PODS: - FlutterMacOS - sp_scanner (0.0.1): - Flutter + - SwiftProtobuf (1.27.1) - SwiftyGif (5.4.5) - Toast (4.1.1) - uni_links (0.0.1): - Flutter - - universal_ble (0.0.1): - - Flutter - - FlutterMacOS + - UnstoppableDomainsResolution (4.0.0): + - BigInt + - CryptoSwift - url_launcher_ios (0.0.1): - Flutter - wakelock_plus (0.0.1): @@ -134,15 +123,13 @@ PODS: - Flutter DEPENDENCIES: + - barcode_scan2 (from `.symlinks/plugins/barcode_scan2/ios`) - connectivity_plus (from `.symlinks/plugins/connectivity_plus/ios`) - CryptoSwift - - cw_haven (from `.symlinks/plugins/cw_haven/ios`) - - cw_mweb (from `.symlinks/plugins/cw_mweb/ios`) - - cw_shared_external (from `.symlinks/plugins/cw_shared_external/ios`) + - cw_zano (from `.symlinks/plugins/cw_zano/ios`) - device_display_brightness (from `.symlinks/plugins/device_display_brightness/ios`) - device_info_plus (from `.symlinks/plugins/device_info_plus/ios`) - devicelocale (from `.symlinks/plugins/devicelocale/ios`) - - fast_scanner (from `.symlinks/plugins/fast_scanner/ios`) - file_picker (from `.symlinks/plugins/file_picker/ios`) - Flutter (from `Flutter`) - flutter_inappwebview_ios (from `.symlinks/plugins/flutter_inappwebview_ios/ios`) @@ -151,48 +138,50 @@ DEPENDENCIES: - flutter_secure_storage (from `.symlinks/plugins/flutter_secure_storage/ios`) - fluttertoast (from `.symlinks/plugins/fluttertoast/ios`) - in_app_review (from `.symlinks/plugins/in_app_review/ios`) - - integration_test (from `.symlinks/plugins/integration_test/ios`) + - package_info (from `.symlinks/plugins/package_info/ios`) - package_info_plus (from `.symlinks/plugins/package_info_plus/ios`) - path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`) - permission_handler_apple (from `.symlinks/plugins/permission_handler_apple/ios`) + - reactive_ble_mobile (from `.symlinks/plugins/reactive_ble_mobile/ios`) - sensitive_clipboard (from `.symlinks/plugins/sensitive_clipboard/ios`) - share_plus (from `.symlinks/plugins/share_plus/ios`) - shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`) - sp_scanner (from `.symlinks/plugins/sp_scanner/ios`) - uni_links (from `.symlinks/plugins/uni_links/ios`) - - universal_ble (from `.symlinks/plugins/universal_ble/darwin`) + - UnstoppableDomainsResolution (~> 4.0.0) - url_launcher_ios (from `.symlinks/plugins/url_launcher_ios/ios`) - wakelock_plus (from `.symlinks/plugins/wakelock_plus/ios`) - workmanager (from `.symlinks/plugins/workmanager/ios`) SPEC REPOS: https://github.com/CocoaPods/Specs.git: + - BigInt - CryptoSwift - DKImagePickerController - DKPhotoGallery + - MTBBarcodeScanner - OrderedSet + - Protobuf - ReachabilitySwift - SDWebImage + - SwiftProtobuf - SwiftyGif - Toast + - UnstoppableDomainsResolution EXTERNAL SOURCES: + barcode_scan2: + :path: ".symlinks/plugins/barcode_scan2/ios" connectivity_plus: :path: ".symlinks/plugins/connectivity_plus/ios" - cw_haven: - :path: ".symlinks/plugins/cw_haven/ios" - cw_mweb: - :path: ".symlinks/plugins/cw_mweb/ios" - cw_shared_external: - :path: ".symlinks/plugins/cw_shared_external/ios" + cw_zano: + :path: ".symlinks/plugins/cw_zano/ios" device_display_brightness: :path: ".symlinks/plugins/device_display_brightness/ios" device_info_plus: :path: ".symlinks/plugins/device_info_plus/ios" devicelocale: :path: ".symlinks/plugins/devicelocale/ios" - fast_scanner: - :path: ".symlinks/plugins/fast_scanner/ios" file_picker: :path: ".symlinks/plugins/file_picker/ios" Flutter: @@ -209,14 +198,16 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/fluttertoast/ios" in_app_review: :path: ".symlinks/plugins/in_app_review/ios" - integration_test: - :path: ".symlinks/plugins/integration_test/ios" + package_info: + :path: ".symlinks/plugins/package_info/ios" package_info_plus: :path: ".symlinks/plugins/package_info_plus/ios" path_provider_foundation: :path: ".symlinks/plugins/path_provider_foundation/darwin" permission_handler_apple: :path: ".symlinks/plugins/permission_handler_apple/ios" + reactive_ble_mobile: + :path: ".symlinks/plugins/reactive_ble_mobile/ios" sensitive_clipboard: :path: ".symlinks/plugins/sensitive_clipboard/ios" share_plus: @@ -227,8 +218,6 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/sp_scanner/ios" uni_links: :path: ".symlinks/plugins/uni_links/ios" - universal_ble: - :path: ".symlinks/plugins/universal_ble/darwin" url_launcher_ios: :path: ".symlinks/plugins/url_launcher_ios/ios" wakelock_plus: @@ -237,44 +226,47 @@ EXTERNAL SOURCES: :path: ".symlinks/plugins/workmanager/ios" SPEC CHECKSUMS: + barcode_scan2: 0af2bb63c81b4565aab6cd78278e4c0fa136dbb0 + BigInt: f668a80089607f521586bbe29513d708491ef2f7 connectivity_plus: bf0076dd84a130856aa636df1c71ccaff908fa1d CryptoSwift: 967f37cea5a3294d9cce358f78861652155be483 - cw_haven: b3e54e1fbe7b8e6fda57a93206bc38f8e89b898a - cw_mweb: 87af74f9659fed0c1a2cbfb44413f1070e79e3ae - cw_shared_external: 2972d872b8917603478117c9957dfca611845a92 + cw_zano: e13e2987734da2e94770540121762c288cdcf5b3 device_display_brightness: 1510e72c567a1f6ce6ffe393dcd9afd1426034f7 device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6 - devicelocale: 35ba84dc7f45f527c3001535d8c8d104edd5d926 + devicelocale: b22617f40038496deffba44747101255cee005b0 DKImagePickerController: 946cec48c7873164274ecc4624d19e3da4c1ef3c DKPhotoGallery: b3834fecb755ee09a593d7c9e389d8b5d6deed60 - fast_scanner: 44c00940355a51258cd6c2085734193cd23d95bc file_picker: 15fd9539e4eb735dc54bae8c0534a7a9511a03de Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 - flutter_inappwebview_ios: 6f63631e2c62a7c350263b13fa5427aedefe81d4 + flutter_inappwebview_ios: 97215cf7d4677db55df76782dbd2930c5e1c1ea0 flutter_local_authentication: 1172a4dd88f6306dadce067454e2c4caf07977bb flutter_mailer: 2ef5a67087bc8c6c4cefd04a178bf1ae2c94cd83 flutter_secure_storage: 23fc622d89d073675f2eaa109381aefbcf5a49be - fluttertoast: e9a18c7be5413da53898f660530c56f35edfba9c - in_app_review: a31b5257259646ea78e0e35fc914979b0031d011 - integration_test: 252f60fa39af5e17c3aa9899d35d908a0721b573 - OrderedSet: e539b66b644ff081c73a262d24ad552a69be3a94 - package_info_plus: c0502532a26c7662a62a356cebe2692ec5fe4ec4 + fluttertoast: 48c57db1b71b0ce9e6bba9f31c940ff4b001293c + in_app_review: 318597b3a06c22bb46dc454d56828c85f444f99d + MTBBarcodeScanner: f453b33c4b7dfe545d8c6484ed744d55671788cb + OrderedSet: aaeb196f7fef5a9edf55d89760da9176ad40b93c + package_info: 873975fc26034f0b863a300ad47e7f1ac6c7ec62 + package_info_plus: 58f0028419748fad15bf008b270aaa8e54380b1c path_provider_foundation: 2b6b4c569c0fb62ec74538f866245ac84301af46 permission_handler_apple: e76247795d700c14ea09e3a2d8855d41ee80a2e6 - ReachabilitySwift: 32793e867593cfc1177f5d16491e3a197d2fccda - SDWebImage: 8a6b7b160b4d710e2a22b6900e25301075c34cb3 + Protobuf: c1cbc880ea7c4e9b157e113515c720a22ee7cf50 + ReachabilitySwift: 7f151ff156cea1481a8411701195ac6a984f4979 + reactive_ble_mobile: 9ce6723d37ccf701dbffd202d487f23f5de03b4c + SDWebImage: a79252b60f4678812d94316c91da69ec83089c9f sensitive_clipboard: d4866e5d176581536c27bb1618642ee83adca986 - share_plus: 8b6f8b3447e494cca5317c8c3073de39b3600d1f + share_plus: 056a1e8ac890df3e33cb503afffaf1e9b4fbae68 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 sp_scanner: eaa617fa827396b967116b7f1f43549ca62e9a12 + SwiftProtobuf: b109bd17979d7993a84da14b1e1fdd8b0ded934a SwiftyGif: 706c60cf65fa2bc5ee0313beece843c8eb8194d4 Toast: 1f5ea13423a1e6674c4abdac5be53587ae481c4e uni_links: d97da20c7701486ba192624d99bffaaffcfc298a - universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6 + UnstoppableDomainsResolution: c3c67f4d0a5e2437cb00d4bd50c2e00d6e743841 url_launcher_ios: 5334b05cef931de560670eeae103fd3e431ac3fe wakelock_plus: 78ec7c5b202cab7761af8e2b2b3d0671be6c4ae1 workmanager: 0afdcf5628bbde6924c21af7836fed07b42e30e6 -PODFILE CHECKSUM: e448f662d4c41f0c0b1ccbb78afd57dbf895a597 +PODFILE CHECKSUM: a2fe518be61cdbdc5b0e2da085ab543d556af2d3 COCOAPODS: 1.15.2 diff --git a/lib/core/address_validator.dart b/lib/core/address_validator.dart index dbb6f9541..e92f45a14 100644 --- a/lib/core/address_validator.dart +++ b/lib/core/address_validator.dart @@ -4,6 +4,7 @@ import 'package:cake_wallet/core/validator.dart'; import 'package:cake_wallet/solana/solana.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/erc20_token.dart'; +import 'package:cw_zano/zano_utils.dart'; const BEFORE_REGEX = '(^|\\s)'; const AFTER_REGEX = '(\$|\\s)'; @@ -19,7 +20,9 @@ class AddressValidator extends TextValidator { ? BitcoinNetwork.mainnet : LitecoinNetwork.mainnet, ) - : null, + : type == CryptoCurrency.zano + ? ZanoUtils.validateAddress + : null, pattern: getPattern(type), length: getLength(type)); @@ -132,6 +135,8 @@ class AddressValidator extends TextValidator { pattern = 'D([1-9a-km-zA-HJ-NP-Z]){33}'; case CryptoCurrency.btcln: pattern = '(lnbc|LNBC)([0-9]{1,}[a-zA-Z0-9]+)'; + case CryptoCurrency.zano: + pattern = '([1-9A-HJ-NP-Za-km-z]{90,200})|(@[\w\d-.]+)'; default: return ''; } @@ -271,6 +276,7 @@ class AddressValidator extends TextValidator { return [64]; case CryptoCurrency.btcln: case CryptoCurrency.kaspa: + case CryptoCurrency.zano: default: return null; } @@ -310,6 +316,8 @@ class AddressValidator extends TextValidator { pattern = '[1-9A-HJ-NP-Za-km-z]+'; case CryptoCurrency.trx: pattern = '(T|t)[1-9A-HJ-NP-Za-km-z]{33}'; + case CryptoCurrency.zano: + pattern = '([1-9A-HJ-NP-Za-km-z]{90,200})|(@[\w\d-.]+)'; default: if (type.tag == CryptoCurrency.eth.title) { pattern = '0x[0-9a-zA-Z]{42}'; diff --git a/lib/core/amount_validator.dart b/lib/core/amount_validator.dart index 38983dfb2..f85df483f 100644 --- a/lib/core/amount_validator.dart +++ b/lib/core/amount_validator.dart @@ -76,6 +76,8 @@ class DecimalAmountValidator extends TextValidator { return '^([0-9]+([.\,][0-9]{1,12})?|[.\,][0-9]{1,12})\$'; case CryptoCurrency.btc: return '^([0-9]+([.\,][0-9]{1,8})?|[.\,][0-9]{1,8})\$'; + case CryptoCurrency.zano: + return '^([0-9]+([.\,][0-9]{1,12})?|[.\,][0-9]{1,18})\$'; default: return '^([0-9]+([.\,][0-9]{1,12})?|[.\,][0-9]{1,12})\$'; } diff --git a/lib/core/seed_validator.dart b/lib/core/seed_validator.dart index 2d2a0c6ee..d963fb523 100644 --- a/lib/core/seed_validator.dart +++ b/lib/core/seed_validator.dart @@ -9,6 +9,7 @@ import 'package:cake_wallet/polygon/polygon.dart'; import 'package:cake_wallet/solana/solana.dart'; import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cake_wallet/utils/language_list.dart'; import 'package:cw_core/wallet_type.dart'; @@ -21,7 +22,8 @@ class SeedValidator extends Validator { final String language; final List _words; - static List getWordList({required WalletType type, required String language}) { + static List getWordList( + {required WalletType type, required String language}) { switch (type) { case WalletType.bitcoin: return getBitcoinWordList(language); @@ -46,6 +48,8 @@ class SeedValidator extends Validator { return tron!.getTronWordList(language); case WalletType.wownero: return wownero!.getWowneroWordList(language); + case WalletType.zano: + return zano!.getWordList(language); case WalletType.none: return []; } diff --git a/lib/core/wallet_creation_service.dart b/lib/core/wallet_creation_service.dart index 3ee630b33..3fb4b5b1d 100644 --- a/lib/core/wallet_creation_service.dart +++ b/lib/core/wallet_creation_service.dart @@ -89,6 +89,7 @@ class WalletCreationService { case WalletType.haven: case WalletType.nano: case WalletType.banano: + case WalletType.zano: return false; } } diff --git a/lib/di.dart b/lib/di.dart index 358f72a77..c81ed273e 100644 --- a/lib/di.dart +++ b/lib/di.dart @@ -246,6 +246,7 @@ import 'package:cake_wallet/view_model/wallet_seed_view_model.dart'; import 'package:cake_wallet/view_model/wallet_unlock_loadable_view_model.dart'; import 'package:cake_wallet/view_model/wallet_unlock_verifiable_view_model.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/wallet_info.dart'; import 'package:cw_core/wallet_type.dart'; @@ -1093,6 +1094,8 @@ Future setup({ return tron!.createTronWalletService(_walletInfoSource, SettingsStoreBase.walletPasswordDirectInput); case WalletType.wownero: return wownero!.createWowneroWalletService(_walletInfoSource, _unspentCoinsInfoSource); + case WalletType.zano: + return zano!.createZanoWalletService(_walletInfoSource); case WalletType.none: throw Exception('Unexpected token: ${param1.toString()} for generating of WalletService'); } @@ -1421,4 +1424,4 @@ Future setup({ getIt.registerFactory(() => SeedVerificationPage(getIt.get())); _isSetupFinished = true; -} +} \ No newline at end of file diff --git a/lib/entities/default_settings_migration.dart b/lib/entities/default_settings_migration.dart index 64370503f..e969230e8 100644 --- a/lib/entities/default_settings_migration.dart +++ b/lib/entities/default_settings_migration.dart @@ -45,6 +45,7 @@ const tronDefaultNodeUri = 'api.trongrid.io'; const newCakeWalletBitcoinUri = 'btc-electrum.cakewallet.com:50002'; const wowneroDefaultNodeUri = 'node3.monerodevs.org:34568'; const moneroWorldNodeUri = '.moneroworld.com'; +const zanoDefaultNodeUri = 'zano.org'; Future defaultSettingsMigration( {required int version, @@ -330,6 +331,11 @@ Future defaultSettingsMigration( useSSL: true, oldUri: ['rpc.ankr.com'], ); + break; + case 46: + await addZanoNodeList(nodes: nodes); + await changeZanoCurrentNodeToDefault(sharedPreferences: sharedPreferences, nodes: nodes); + break; default: break; } @@ -667,6 +673,12 @@ Node? getBitcoinCashDefaultElectrumServer({required Box nodes}) { nodes.values.firstWhereOrNull((node) => node.type == WalletType.bitcoinCash); } +Node? getZanoDefaultNode({required Box nodes}) { + return nodes.values.firstWhereOrNull( + (Node node) => node.uriRaw == zanoDefaultNodeUri) + ?? nodes.values.firstWhereOrNull((node) => node.type == WalletType.zano); +} + Node getMoneroDefaultNode({required Box nodes}) { var nodeUri = newCakeWalletMoneroUri; @@ -1163,6 +1175,7 @@ Future checkCurrentNodes( final currentSolanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey); final currentTronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey); final currentWowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey); + final currentZanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey); final currentMoneroNode = nodeSource.values.firstWhereOrNull((node) => node.key == currentMoneroNodeId); final currentBitcoinElectrumServer = @@ -1187,6 +1200,8 @@ Future checkCurrentNodes( nodeSource.values.firstWhereOrNull((node) => node.key == currentTronNodeId); final currentWowneroNodeServer = nodeSource.values.firstWhereOrNull((node) => node.key == currentWowneroNodeId); + final currentZanoNode = nodeSource.values.firstWhereOrNull((node) => node.key == currentZanoNodeId); + if (currentMoneroNode == null) { final newCakeWalletNode = Node(uri: newCakeWalletMoneroUri, type: WalletType.monero); await nodeSource.add(newCakeWalletNode); @@ -1270,6 +1285,12 @@ Future checkCurrentNodes( await nodeSource.add(node); await sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, node.key as int); } + + if (currentZanoNode == null) { + final node = Node(uri: zanoDefaultNodeUri, type: WalletType.zano); + await nodeSource.add(node); + await sharedPreferences.setInt(PreferencesKey.currentZanoNodeIdKey, node.key as int); + } } Future resetBitcoinElectrumServer( @@ -1345,6 +1366,15 @@ Future addWowneroNodeList({required Box nodes}) async { } } +Future addZanoNodeList({required Box nodes}) async { + final nodeList = await loadDefaultZanoNodes(); + for (var node in nodeList) { + if (nodes.values.firstWhereOrNull((element) => element.uriRaw == node.uriRaw) == null) { + await nodes.add(node); + } + } +} + Future changeWowneroCurrentNodeToDefault( {required SharedPreferences sharedPreferences, required Box nodes}) async { final node = getWowneroDefaultNode(nodes: nodes); @@ -1353,6 +1383,13 @@ Future changeWowneroCurrentNodeToDefault( await sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, nodeId); } +Future changeZanoCurrentNodeToDefault( + {required SharedPreferences sharedPreferences, required Box nodes}) async { + final node = getZanoDefaultNode(nodes: nodes); + final nodeId = node?.key as int? ?? 0; + await sharedPreferences.setInt(PreferencesKey.currentZanoNodeIdKey, nodeId); +} + Future addNanoNodeList({required Box nodes}) async { final nodeList = await loadDefaultNanoNodes(); for (var node in nodeList) { diff --git a/lib/entities/node_list.dart b/lib/entities/node_list.dart index 85e37a7bc..5147aa614 100644 --- a/lib/entities/node_list.dart +++ b/lib/entities/node_list.dart @@ -200,6 +200,23 @@ Future> loadDefaultWowneroNodes() async { return nodes; } +Future> loadDefaultZanoNodes() async { + final nodesRaw = await rootBundle.loadString('assets/zano_node_list.yml'); + final loadedNodes = loadYaml(nodesRaw) as YamlList; + final nodes = []; + + for (final raw in loadedNodes) { + if (raw is Map) { + final node = Node.fromMap(Map.from(raw)); + + node.type = WalletType.zano; + nodes.add(node); + } + } + + return nodes; +} + Future resetToDefault(Box nodeSource) async { final moneroNodes = await loadDefaultNodes(); final bitcoinElectrumServerList = await loadBitcoinElectrumServerList(); @@ -211,6 +228,7 @@ Future resetToDefault(Box nodeSource) async { final polygonNodes = await loadDefaultPolygonNodes(); final solanaNodes = await loadDefaultSolanaNodes(); final tronNodes = await loadDefaultTronNodes(); + final zanoNodes = await loadDefaultZanoNodes(); final nodes = moneroNodes + bitcoinElectrumServerList + @@ -220,7 +238,7 @@ Future resetToDefault(Box nodeSource) async { bitcoinCashElectrumServerList + nanoNodes + polygonNodes + - solanaNodes + tronNodes; + solanaNodes + tronNodes + zanoNodes; await nodeSource.clear(); await nodeSource.addAll(nodes); diff --git a/lib/entities/preferences_key.dart b/lib/entities/preferences_key.dart index 58a540278..a449769ca 100644 --- a/lib/entities/preferences_key.dart +++ b/lib/entities/preferences_key.dart @@ -5,6 +5,7 @@ class PreferencesKey { static const currentBitcoinElectrumSererIdKey = 'current_node_id_btc'; static const currentLitecoinElectrumSererIdKey = 'current_node_id_ltc'; static const currentHavenNodeIdKey = 'current_node_id_xhv'; + static const currentZanoNodeIdKey = 'current_node_id_zano'; static const currentEthereumNodeIdKey = 'current_node_id_eth'; static const currentPolygonNodeIdKey = 'current_node_id_matic'; static const currentNanoNodeIdKey = 'current_node_id_nano'; @@ -45,6 +46,7 @@ class PreferencesKey { static const ethereumTransactionPriority = 'current_fee_priority_ethereum'; static const polygonTransactionPriority = 'current_fee_priority_polygon'; static const bitcoinCashTransactionPriority = 'current_fee_priority_bitcoin_cash'; + static const zanoTransactionPriority = 'current_fee_priority_zano'; static const wowneroTransactionPriority = 'current_fee_priority_wownero'; static const customBitcoinFeeRate = 'custom_electrum_fee_rate'; static const silentPaymentsCardDisplay = 'silentPaymentsCardDisplay'; diff --git a/lib/entities/priority_for_wallet_type.dart b/lib/entities/priority_for_wallet_type.dart index 534287494..bbd98d17d 100644 --- a/lib/entities/priority_for_wallet_type.dart +++ b/lib/entities/priority_for_wallet_type.dart @@ -5,6 +5,7 @@ import 'package:cake_wallet/haven/haven.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/polygon/polygon.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/wallet_type.dart'; @@ -32,6 +33,8 @@ List priorityForWalletType(WalletType type) { case WalletType.solana: case WalletType.tron: return []; + case WalletType.zano: + return zano!.getTransactionPriorities(); default: return []; } diff --git a/lib/entities/provider_types.dart b/lib/entities/provider_types.dart index 42ec74c12..c65ac267b 100644 --- a/lib/entities/provider_types.dart +++ b/lib/entities/provider_types.dart @@ -76,6 +76,7 @@ class ProvidersHelper { ]; case WalletType.none: case WalletType.haven: + case WalletType.zano: return []; } } @@ -109,6 +110,7 @@ class ProvidersHelper { case WalletType.none: case WalletType.haven: case WalletType.wownero: + case WalletType.zano: return []; } } diff --git a/lib/main.dart b/lib/main.dart index 510705105..fd25a1e9c 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -215,7 +215,7 @@ Future initializeAppConfigs() async { secureStorage: secureStorage, anonpayInvoiceInfo: anonpayInvoiceInfo, havenSeedStore: havenSeedStore, - initialMigrationVersion: 45, + initialMigrationVersion: 46, ); } diff --git a/lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart b/lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart index e5f38010d..2ea423ba6 100644 --- a/lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart +++ b/lib/src/screens/dashboard/desktop_widgets/desktop_wallet_selection_dropdown.dart @@ -46,6 +46,7 @@ class _DesktopWalletSelectionDropDownState extends State Image.asset( @@ -178,6 +179,8 @@ class _DesktopWalletSelectionDropDownState extends State { final token = await widget.homeSettingsViewModel.getToken(_contractAddressController.text); if (token != null) { - if (_tokenNameController.text.isEmpty) _tokenNameController.text = token.name; - if (_tokenSymbolController.text.isEmpty) _tokenSymbolController.text = token.title; + final isZano = widget.homeSettingsViewModel.walletType == WalletType.zano; + if (_tokenNameController.text.isEmpty || isZano) _tokenNameController.text = token.name; + if (_tokenSymbolController.text.isEmpty || isZano) _tokenSymbolController.text = token.title; if (_tokenIconPathController.text.isEmpty) _tokenIconPathController.text = token.iconPath ?? ''; - if (_tokenDecimalController.text.isEmpty) + if (_tokenDecimalController.text.isEmpty || isZano) _tokenDecimalController.text = token.decimals.toString(); } } @@ -305,7 +309,7 @@ class _EditTokenPageBodyState extends State { placeholder: S.of(context).token_contract_address, options: [AddressTextFieldOption.paste], buttonColor: Theme.of(context).hintColor, - validator: AddressValidator(type: widget.homeSettingsViewModel.nativeToken), + validator: widget.homeSettingsViewModel.walletType == WalletType.zano ? null : AddressValidator(type: widget.homeSettingsViewModel.nativeToken).call, onPushPasteButton: (_) { _pasteText(); }, diff --git a/lib/src/screens/dashboard/widgets/menu_widget.dart b/lib/src/screens/dashboard/widgets/menu_widget.dart index b49a08584..7474e9676 100644 --- a/lib/src/screens/dashboard/widgets/menu_widget.dart +++ b/lib/src/screens/dashboard/widgets/menu_widget.dart @@ -37,7 +37,8 @@ class MenuWidgetState extends State { this.polygonIcon = Image.asset('assets/images/matic_icon.png'), this.solanaIcon = Image.asset('assets/images/sol_icon.png'), this.tronIcon = Image.asset('assets/images/trx_icon.png'), - this.wowneroIcon = Image.asset('assets/images/wownero_icon.png'); + this.wowneroIcon = Image.asset('assets/images/wownero_icon.png'), + this.zanoIcon = Image.asset('assets/images/zano_icon.png'); final largeScreen = 731; @@ -62,6 +63,7 @@ class MenuWidgetState extends State { Image solanaIcon; Image tronIcon; Image wowneroIcon; + Image zanoIcon; @override void initState() { @@ -245,6 +247,8 @@ class MenuWidgetState extends State { return tronIcon; case WalletType.wownero: return wowneroIcon; + case WalletType.zano: + return zanoIcon; default: throw Exception('No icon for ${type.toString()}'); } diff --git a/lib/src/screens/wallet_list/wallet_list_page.dart b/lib/src/screens/wallet_list/wallet_list_page.dart index 9bf924f61..b76ee03da 100644 --- a/lib/src/screens/wallet_list/wallet_list_page.dart +++ b/lib/src/screens/wallet_list/wallet_list_page.dart @@ -131,6 +131,7 @@ class WalletListBodyState extends State { final solanaIcon = Image.asset('assets/images/sol_icon.png', height: 24, width: 24); final tronIcon = Image.asset('assets/images/trx_icon.png', height: 24, width: 24); final wowneroIcon = Image.asset('assets/images/wownero_icon.png', height: 24, width: 24); + final zanoIcon = Image.asset('assets/images/zano_icon.png', height: 24, width: 24); final scrollController = ScrollController(); final double tileHeight = 60; Flushbar? _progressBar; diff --git a/lib/store/settings_store.dart b/lib/store/settings_store.dart index aa7df4ba9..135ec0f77 100644 --- a/lib/store/settings_store.dart +++ b/lib/store/settings_store.dart @@ -35,6 +35,7 @@ import 'package:cake_wallet/wallet_type_utils.dart'; import 'package:cake_wallet/wownero/wownero.dart'; import 'package:cw_core/node.dart'; import 'package:cw_core/set_app_secure_native.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/transaction_priority.dart'; import 'package:cw_core/utils/print_verbose.dart'; import 'package:cw_core/wallet_type.dart'; @@ -131,6 +132,7 @@ abstract class SettingsStoreBase with Store { TransactionPriority? initialEthereumTransactionPriority, TransactionPriority? initialPolygonTransactionPriority, TransactionPriority? initialBitcoinCashTransactionPriority, + TransactionPriority? initialZanoTransactionPriority, Country? initialCakePayCountry}) : nodes = ObservableMap.of(nodes), powNodes = ObservableMap.of(powNodes), @@ -218,6 +220,10 @@ abstract class SettingsStoreBase with Store { selectedCakePayCountry = initialCakePayCountry; } + if (initialZanoTransactionPriority != null) { + priority[WalletType.zano] = initialZanoTransactionPriority; + } + initializeTrocadorProviderStates(); reaction( @@ -267,6 +273,9 @@ abstract class SettingsStoreBase with Store { case WalletType.polygon: key = PreferencesKey.polygonTransactionPriority; break; + case WalletType.zano: + key = PreferencesKey.zanoTransactionPriority; + break; default: key = null; } @@ -292,7 +301,7 @@ abstract class SettingsStoreBase with Store { reaction((_) => disableTradeOption, (bool disableTradeOption) => sharedPreferences.setBool(PreferencesKey.disableTradeOption, disableTradeOption)); - + reaction( (_) => disableBulletin, (bool disableBulletin) => @@ -870,6 +879,7 @@ abstract class SettingsStoreBase with Store { TransactionPriority? polygonTransactionPriority; TransactionPriority? bitcoinCashTransactionPriority; TransactionPriority? wowneroTransactionPriority; + TransactionPriority? zanoTransactionPriority; if (sharedPreferences.getInt(PreferencesKey.havenTransactionPriority) != null) { havenTransactionPriority = monero?.deserializeMoneroTransactionPriority( @@ -895,6 +905,10 @@ abstract class SettingsStoreBase with Store { wowneroTransactionPriority = wownero?.deserializeWowneroTransactionPriority( raw: sharedPreferences.getInt(PreferencesKey.wowneroTransactionPriority)!); } + if (sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority) != null) { + zanoTransactionPriority = monero?.deserializeMoneroTransactionPriority( + raw: sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority)!); + } moneroTransactionPriority ??= monero?.getDefaultTransactionPriority(); bitcoinTransactionPriority ??= bitcoin?.getMediumTransactionPriority(); @@ -904,6 +918,7 @@ abstract class SettingsStoreBase with Store { bitcoinCashTransactionPriority ??= bitcoinCash?.getDefaultTransactionPriority(); wowneroTransactionPriority ??= wownero?.getDefaultTransactionPriority(); polygonTransactionPriority ??= polygon?.getDefaultTransactionPriority(); + zanoTransactionPriority ??= zano?.getDefaultTransactionPriority(); final currentBalanceDisplayMode = BalanceDisplayMode.deserialize( raw: sharedPreferences.getInt(PreferencesKey.currentBalanceDisplayModeKey)!); @@ -1002,6 +1017,8 @@ abstract class SettingsStoreBase with Store { final solanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey); final tronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey); final wowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey); + final zanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey); + final moneroNode = nodeSource.get(nodeId); final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId); final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId); @@ -1014,6 +1031,7 @@ abstract class SettingsStoreBase with Store { final solanaNode = nodeSource.get(solanaNodeId); final tronNode = nodeSource.get(tronNodeId); final wowneroNode = nodeSource.get(wowneroNodeId); + final zanoNode = nodeSource.get(zanoNodeId); final packageInfo = await PackageInfo.fromPlatform(); final deviceName = await _getDeviceName() ?? ''; final shouldShowYatPopup = sharedPreferences.getBool(PreferencesKey.shouldShowYatPopup) ?? true; @@ -1095,6 +1113,10 @@ abstract class SettingsStoreBase with Store { nodes[WalletType.wownero] = wowneroNode; } + if (zanoNode != null) { + nodes[WalletType.zano] = zanoNode; + } + final savedSyncMode = SyncMode.all.firstWhere((element) { return element.type.index == (sharedPreferences.getInt(PreferencesKey.syncModeKey) ?? 0); }); @@ -1255,6 +1277,7 @@ abstract class SettingsStoreBase with Store { hasEnabledMwebBefore: hasEnabledMwebBefore, initialMoneroTransactionPriority: moneroTransactionPriority, initialWowneroTransactionPriority: wowneroTransactionPriority, + initialZanoTransactionPriority: zanoTransactionPriority, initialBitcoinTransactionPriority: bitcoinTransactionPriority, initialHavenTransactionPriority: havenTransactionPriority, initialLitecoinTransactionPriority: litecoinTransactionPriority, @@ -1329,6 +1352,10 @@ abstract class SettingsStoreBase with Store { priority[WalletType.bitcoinCash] = bitcoinCash!.deserializeBitcoinCashTransactionPriority( sharedPreferences.getInt(PreferencesKey.bitcoinCashTransactionPriority)!); } + if (zano != null && sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority) != null) { + priority[WalletType.zano] = zano!.deserializeMoneroTransactionPriority( + raw: sharedPreferences.getInt(PreferencesKey.zanoTransactionPriority)!); + } final generateSubaddresses = sharedPreferences.getInt(PreferencesKey.autoGenerateSubaddressStatusKey); @@ -1437,6 +1464,7 @@ abstract class SettingsStoreBase with Store { final solanaNodeId = sharedPreferences.getInt(PreferencesKey.currentSolanaNodeIdKey); final tronNodeId = sharedPreferences.getInt(PreferencesKey.currentTronNodeIdKey); final wowneroNodeId = sharedPreferences.getInt(PreferencesKey.currentWowneroNodeIdKey); + final zanoNodeId = sharedPreferences.getInt(PreferencesKey.currentZanoNodeIdKey); final moneroNode = nodeSource.get(nodeId); final bitcoinElectrumServer = nodeSource.get(bitcoinElectrumServerId); final litecoinElectrumServer = nodeSource.get(litecoinElectrumServerId); @@ -1448,6 +1476,8 @@ abstract class SettingsStoreBase with Store { final solanaNode = nodeSource.get(solanaNodeId); final tronNode = nodeSource.get(tronNodeId); final wowneroNode = nodeSource.get(wowneroNodeId); + final zanoNode = nodeSource.get(zanoNodeId); + if (moneroNode != null) { nodes[WalletType.monero] = moneroNode; } @@ -1490,6 +1520,11 @@ abstract class SettingsStoreBase with Store { if (wowneroNode != null) { nodes[WalletType.wownero] = wowneroNode; + + } + + if (zanoNode != null) { + nodes[WalletType.zano] = zanoNode; } // MIGRATED: @@ -1628,6 +1663,8 @@ abstract class SettingsStoreBase with Store { case WalletType.wownero: await _sharedPreferences.setInt(PreferencesKey.currentWowneroNodeIdKey, node.key as int); break; + case WalletType.zano: + await _sharedPreferences.setInt(PreferencesKey.currentZanoNodeIdKey, node.key as int); default: break; } diff --git a/lib/view_model/advanced_privacy_settings_view_model.dart b/lib/view_model/advanced_privacy_settings_view_model.dart index 85b9dbead..22933c5e3 100644 --- a/lib/view_model/advanced_privacy_settings_view_model.dart +++ b/lib/view_model/advanced_privacy_settings_view_model.dart @@ -54,6 +54,7 @@ abstract class AdvancedPrivacySettingsViewModelBase with Store { case WalletType.wownero: case WalletType.none: case WalletType.haven: + case WalletType.zano: return false; } } diff --git a/lib/view_model/dashboard/balance_view_model.dart b/lib/view_model/dashboard/balance_view_model.dart index 075cf6b75..400525aad 100644 --- a/lib/view_model/dashboard/balance_view_model.dart +++ b/lib/view_model/dashboard/balance_view_model.dart @@ -110,7 +110,8 @@ abstract class BalanceViewModelBase with Store { bool get isHomeScreenSettingsEnabled => isEVMCompatibleChain(wallet.type) || wallet.type == WalletType.solana || - wallet.type == WalletType.tron; + wallet.type == WalletType.tron || + wallet.type == WalletType.zano; @computed bool get hasAccounts => wallet.type == WalletType.monero || wallet.type == WalletType.wownero; diff --git a/lib/view_model/dashboard/home_settings_view_model.dart b/lib/view_model/dashboard/home_settings_view_model.dart index 0c3a611eb..52ac1175a 100644 --- a/lib/view_model/dashboard/home_settings_view_model.dart +++ b/lib/view_model/dashboard/home_settings_view_model.dart @@ -13,6 +13,7 @@ import 'package:cake_wallet/solana/solana.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/erc20_token.dart'; import 'package:cw_core/utils/print_verbose.dart'; @@ -48,6 +49,8 @@ abstract class HomeSettingsViewModelBase with Store { @observable bool isValidatingContractAddress; + WalletType get walletType => _balanceViewModel.wallet.type; + @observable String searchText = ''; @@ -108,6 +111,10 @@ abstract class HomeSettingsViewModelBase with Store { await tron!.addTronToken(_balanceViewModel.wallet, token, contractAddress); } + if (_balanceViewModel.wallet.type == WalletType.zano) { + await zano!.addZanoAssetById(_balanceViewModel.wallet, contractAddress); + } + _updateTokensList(); _updateFiatPrices(token); } finally { @@ -134,6 +141,10 @@ abstract class HomeSettingsViewModelBase with Store { if (_balanceViewModel.wallet.type == WalletType.tron) { await tron!.deleteTronToken(_balanceViewModel.wallet, token); } + + if (_balanceViewModel.wallet.type == WalletType.zano) { + await zano!.deleteZanoAsset(_balanceViewModel.wallet, token); + } _updateTokensList(); } finally { isDeletingToken = false; @@ -340,6 +351,10 @@ abstract class HomeSettingsViewModelBase with Store { return await tron!.getTronToken(_balanceViewModel.wallet, contractAddress); } + if (_balanceViewModel.wallet.type == WalletType.zano) { + return await zano!.getZanoAsset(_balanceViewModel.wallet, contractAddress); + } + return null; } @@ -378,6 +393,10 @@ abstract class HomeSettingsViewModelBase with Store { tron!.addTronToken(_balanceViewModel.wallet, token, address); } + if (_balanceViewModel.wallet.type == WalletType.zano) { + await zano!.changeZanoAssetAvailability(_balanceViewModel.wallet, token); + } + _refreshTokensList(); } @@ -432,6 +451,13 @@ abstract class HomeSettingsViewModelBase with Store { .toList() ..sort(_sortFunc)); } + + if (_balanceViewModel.wallet.type == WalletType.zano) { + tokens.addAll(zano!.getZanoAssets(_balanceViewModel.wallet) + .where((element) => _matchesSearchText(element)) + .toList() + ..sort(_sortFunc)); + } } @action @@ -476,6 +502,10 @@ abstract class HomeSettingsViewModelBase with Store { return polygon!.getTokenAddress(asset); } + if (_balanceViewModel.wallet.type == WalletType.zano) { + return zano!.getZanoAssetAddress(asset); + } + // We return null if it's neither Tron, Polygon, Ethereum or Solana wallet (which is actually impossible because we only display home settings for either of these three wallets). return null; } diff --git a/lib/view_model/dashboard/transaction_list_item.dart b/lib/view_model/dashboard/transaction_list_item.dart index d9b361fd2..479a2b945 100644 --- a/lib/view_model/dashboard/transaction_list_item.dart +++ b/lib/view_model/dashboard/transaction_list_item.dart @@ -8,6 +8,7 @@ import 'package:cake_wallet/reactions/wallet_connect.dart'; import 'package:cake_wallet/solana/solana.dart'; import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_info.dart'; @@ -201,7 +202,6 @@ class TransactionListItem extends ActionListItem with Keyable { price: price, ); break; - case WalletType.tron: final asset = tron!.assetOfTransaction(balanceViewModel.wallet, transaction); final price = balanceViewModel.fiatConvertationStore.prices[asset]; @@ -211,6 +211,13 @@ class TransactionListItem extends ActionListItem with Keyable { price: price, ); break; + case WalletType.zano: + final asset = zano!.assetOfTransaction(balanceViewModel.wallet, transaction); + final price = balanceViewModel.fiatConvertationStore.prices[asset]; + amount = calculateFiatAmountRaw( + cryptoAmount: zano!.formatterIntAmountToDouble(amount: transaction.amount, currency: asset, forFee: false), + price: price); + break; default: break; } diff --git a/lib/view_model/exchange/exchange_view_model.dart b/lib/view_model/exchange/exchange_view_model.dart index ee8a88b6b..996ac6d86 100644 --- a/lib/view_model/exchange/exchange_view_model.dart +++ b/lib/view_model/exchange/exchange_view_model.dart @@ -318,6 +318,8 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with return transactionPriority == bitcoinCash!.getBitcoinCashTransactionPrioritySlow(); case WalletType.polygon: return transactionPriority == polygon!.getPolygonTransactionPrioritySlow(); + case WalletType.zano: + return transactionPriority == monero!.getMoneroTransactionPrioritySlow(); default: return false; } @@ -739,6 +741,10 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with depositCurrency = CryptoCurrency.wow; receiveCurrency = CryptoCurrency.xmr; break; + case WalletType.zano: + depositCurrency = CryptoCurrency.zano; + receiveCurrency = CryptoCurrency.btc; + break; case WalletType.none: break; } @@ -830,6 +836,9 @@ abstract class ExchangeViewModelBase extends WalletChangeListenerViewModel with case WalletType.polygon: _settingsStore.priority[wallet.type] = polygon!.getDefaultTransactionPriority(); break; + case WalletType.zano: + _settingsStore.priority[wallet.type] = monero!.getMoneroTransactionPriorityAutomatic(); + break; default: break; } diff --git a/lib/view_model/node_list/node_create_or_edit_view_model.dart b/lib/view_model/node_list/node_create_or_edit_view_model.dart index 8b3c70c5e..74deb066b 100644 --- a/lib/view_model/node_list/node_create_or_edit_view_model.dart +++ b/lib/view_model/node_list/node_create_or_edit_view_model.dart @@ -85,6 +85,7 @@ abstract class NodeCreateOrEditViewModelBase with Store { case WalletType.litecoin: case WalletType.bitcoinCash: case WalletType.bitcoin: + case WalletType.zano: return false; } } diff --git a/lib/view_model/node_list/node_list_view_model.dart b/lib/view_model/node_list/node_list_view_model.dart index 2721fd7b3..71e77eb12 100644 --- a/lib/view_model/node_list/node_list_view_model.dart +++ b/lib/view_model/node_list/node_list_view_model.dart @@ -88,6 +88,9 @@ abstract class NodeListViewModelBase with Store { case WalletType.wownero: node = getWowneroDefaultNode(nodes: _nodeSource); break; + case WalletType.zano: + node = getZanoDefaultNode(nodes: _nodeSource)!; + break; default: throw Exception('Unexpected wallet type: ${_appStore.wallet!.type}'); } diff --git a/lib/view_model/restore/restore_from_qr_vm.dart b/lib/view_model/restore/restore_from_qr_vm.dart index cbdad85b8..d05a7e877 100644 --- a/lib/view_model/restore/restore_from_qr_vm.dart +++ b/lib/view_model/restore/restore_from_qr_vm.dart @@ -9,6 +9,7 @@ import 'package:cake_wallet/view_model/restore/restore_mode.dart'; import 'package:cake_wallet/view_model/restore/restore_wallet.dart'; import 'package:cake_wallet/view_model/seed_settings_view_model.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:hive/hive.dart'; import 'package:mobx/mobx.dart'; import 'package:cake_wallet/monero/monero.dart'; @@ -181,6 +182,9 @@ abstract class WalletRestorationFromQRVMBase extends WalletCreationVM with Store mnemonic: restoreWallet.mnemonicSeed ?? '', password: password, ); + case WalletType.zano: + return zano!.createZanoRestoreWalletFromSeedCredentials( + name: name, password: password, height: height, mnemonic: restoreWallet.mnemonicSeed ?? ''); default: throw Exception('Unexpected type: ${type.toString()}'); } diff --git a/lib/view_model/restore/wallet_restore_from_qr_code.dart b/lib/view_model/restore/wallet_restore_from_qr_code.dart index c1a19ea57..9fde8386b 100644 --- a/lib/view_model/restore/wallet_restore_from_qr_code.dart +++ b/lib/view_model/restore/wallet_restore_from_qr_code.dart @@ -41,6 +41,9 @@ class WalletRestoreFromQRCode { 'wownero': WalletType.wownero, 'wownero-wallet': WalletType.wownero, 'wownero_wallet': WalletType.wownero, + 'zano': WalletType.zano, + 'zano-wallet': WalletType.zano, + 'zano_wallet': WalletType.zano, }; static bool _containsAssetSpecifier(String code) => _extractWalletType(code) != null; diff --git a/lib/view_model/send/output.dart b/lib/view_model/send/output.dart index f977ef003..121ffa693 100644 --- a/lib/view_model/send/output.dart +++ b/lib/view_model/send/output.dart @@ -10,6 +10,7 @@ import 'package:cake_wallet/solana/solana.dart'; import 'package:cake_wallet/src/screens/send/widgets/extract_address_from_parsed.dart'; import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/crypto_currency.dart'; import 'package:cw_core/utils/print_verbose.dart'; import 'package:flutter/material.dart'; @@ -112,6 +113,9 @@ abstract class OutputBase with Store { case WalletType.wownero: _amount = wownero!.formatterWowneroParseAmount(amount: _cryptoAmount); break; + case WalletType.zano: + _amount = zano!.formatterParseAmount(amount: _cryptoAmount, currency: cryptoCurrencyHandler()); + break; default: break; } @@ -180,6 +184,10 @@ abstract class OutputBase with Store { if (_wallet.type == WalletType.polygon) { return polygon!.formatterPolygonAmountToDouble(amount: BigInt.from(fee)); } + + if (_wallet.type == WalletType.zano) { + return zano!.formatterIntAmountToDouble(amount: fee, currency: cryptoCurrencyHandler(), forFee: true); + } } catch (e) { printV(e.toString()); } @@ -308,6 +316,9 @@ abstract class OutputBase with Store { case WalletType.wownero: maximumFractionDigits = 11; break; + case WalletType.zano: + maximumFractionDigits = 12; + break; default: break; } diff --git a/lib/view_model/send/send_view_model.dart b/lib/view_model/send/send_view_model.dart index f8599513c..152be7dd4 100644 --- a/lib/view_model/send/send_view_model.dart +++ b/lib/view_model/send/send_view_model.dart @@ -20,6 +20,7 @@ import 'package:cake_wallet/view_model/dashboard/balance_view_model.dart'; import 'package:cake_wallet/view_model/hardware_wallet/ledger_view_model.dart'; import 'package:cake_wallet/view_model/unspent_coins/unspent_coins_list_view_model.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/exceptions.dart'; import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/transaction_priority.dart'; @@ -61,7 +62,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor selectedCryptoCurrency = wallet.currency; hasMultipleTokens = isEVMCompatibleChain(wallet.type) || wallet.type == WalletType.solana || - wallet.type == WalletType.tron; + wallet.type == WalletType.tron || + wallet.type == WalletType.zano; } UnspentCoinsListViewModel unspentCoinsListViewModel; @@ -81,7 +83,8 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor selectedCryptoCurrency = appStore.wallet!.currency, hasMultipleTokens = isEVMCompatibleChain(appStore.wallet!.type) || appStore.wallet!.type == WalletType.solana || - appStore.wallet!.type == WalletType.tron, + appStore.wallet!.type == WalletType.tron || + appStore.wallet!.type == WalletType.zano, outputs = ObservableList(), _settingsStore = appStore.settingsStore, fiatFromSettings = appStore.settingsStore.fiatCurrency, @@ -569,6 +572,9 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor .createSolanaTransactionCredentials(outputs, currency: selectedCryptoCurrency); case WalletType.tron: return tron!.createTronTransactionCredentials(outputs, currency: selectedCryptoCurrency); + case WalletType.zano: + return zano!.createZanoTransactionCredentials( + outputs: outputs, priority: priority!, currency: selectedCryptoCurrency); default: throw Exception('Unexpected wallet type: ${wallet.type}'); } @@ -715,7 +721,7 @@ abstract class SendViewModelBase extends WalletChangeListenerViewModel with Stor return S.current.insufficient_funds_for_tx; } - return + return '''${S.current.insufficient_funds_for_tx} \n\n''' '''${S.current.balance}: ${parsedErrorMessageResult.balanceEth} ${walletType == WalletType.polygon ? "POL" : "ETH"} (${parsedErrorMessageResult.balanceUsd} ${fiatFromSettings.name})\n\n''' '''${S.current.transaction_cost}: ${parsedErrorMessageResult.txCostEth} ${walletType == WalletType.polygon ? "POL" : "ETH"} (${parsedErrorMessageResult.txCostUsd} ${fiatFromSettings.name})\n\n''' diff --git a/lib/view_model/transaction_details_view_model.dart b/lib/view_model/transaction_details_view_model.dart index 9ec542361..2519c1438 100644 --- a/lib/view_model/transaction_details_view_model.dart +++ b/lib/view_model/transaction_details_view_model.dart @@ -81,6 +81,9 @@ abstract class TransactionDetailsViewModelBase with Store { case WalletType.wownero: _addWowneroListItems(tx, dateFormat); break; + case WalletType.zano: + _addZanoListItems(tx, dateFormat); + break; default: break; } @@ -181,6 +184,8 @@ abstract class TransactionDetailsViewModelBase with Store { return 'https://tronscan.org/#/transaction/${txId}'; case WalletType.wownero: return 'https://explore.wownero.com/tx/${txId}'; + case WalletType.zano: + return 'https://testnet-explorer.zano.org/transaction/${txId}'; case WalletType.none: return ''; } @@ -211,6 +216,8 @@ abstract class TransactionDetailsViewModelBase with Store { return S.current.view_transaction_on + 'tronscan.org'; case WalletType.wownero: return S.current.view_transaction_on + 'Wownero.com'; + case WalletType.zano: + return S.current.view_transaction_on + 'explorer.zano.org'; case WalletType.none: return ''; } @@ -776,4 +783,21 @@ abstract class TransactionDetailsViewModelBase with Store { items.addAll(_items); } + + void _addZanoListItems(TransactionInfo tx, DateFormat dateFormat) { + tx as ZanoTransactionInfo; + final comment = tx.additionalInfo['comment'] as String?; + items.addAll([ + StandartListItem(title: S.current.transaction_details_transaction_id, value: tx.id), + StandartListItem(title: 'Asset ID', value: tx.assetId), + StandartListItem( + title: S.current.transaction_details_date, value: dateFormat.format(tx.date)), + StandartListItem(title: S.current.transaction_details_height, value: '${tx.height}'), + StandartListItem(title: S.current.transaction_details_amount, value: tx.amountFormatted()), + if (tx.feeFormatted()?.isNotEmpty ?? false) + StandartListItem(title: S.current.transaction_details_fee, value: tx.feeFormatted()!), + if (comment != null) + StandartListItem(title: S.current.transaction_details_title, value: comment), + ]); + } } diff --git a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart index 3e399266a..f9060692b 100644 --- a/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart +++ b/lib/view_model/wallet_address_list/wallet_address_list_view_model.dart @@ -17,6 +17,7 @@ import 'package:cake_wallet/store/dashboard/fiat_conversion_store.dart'; import 'package:cake_wallet/store/settings_store.dart'; import 'package:cake_wallet/store/yat/yat_store.dart'; import 'package:cake_wallet/tron/tron.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cake_wallet/utils/list_item.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_account_list_header.dart'; import 'package:cake_wallet/view_model/wallet_address_list/wallet_address_hidden_list_header.dart'; @@ -205,6 +206,22 @@ class WowneroURI extends PaymentURI { } } +class ZanoURI extends PaymentURI { + ZanoURI({required String amount, required String address}) + : super(amount: amount, address: address); + + @override + String toString() { + var base = 'zano:' + address; + + if (amount.isNotEmpty) { + base += '?amount=${amount.replaceAll(',', '.')}'; + } + + return base; + } +} + abstract class WalletAddressListViewModelBase extends WalletChangeListenerViewModel with Store { WalletAddressListViewModelBase({ @@ -298,6 +315,8 @@ abstract class WalletAddressListViewModelBase return TronURI(amount: amount, address: address.address); case WalletType.wownero: return WowneroURI(amount: amount, address: address.address); + case WalletType.zano: + return ZanoURI(amount: amount, address: address.address); case WalletType.none: throw Exception('Unexpected type: ${type.toString()}'); } @@ -465,6 +484,12 @@ abstract class WalletAddressListViewModelBase isPrimary: true, name: null, address: primaryAddress)); } + if (wallet.type == WalletType.zano) { + final primaryAddress = zano!.getAddress(wallet); + + addressList.add(WalletAddressListItem(isPrimary: true, name: null, address: primaryAddress)); + } + for (var i = 0; i < addressList.length; i++) { if (!(addressList[i] is WalletAddressListItem)) continue; (addressList[i] as WalletAddressListItem).isHidden = wallet diff --git a/lib/view_model/wallet_keys_view_model.dart b/lib/view_model/wallet_keys_view_model.dart index 81eda7cc8..295ad6e35 100644 --- a/lib/view_model/wallet_keys_view_model.dart +++ b/lib/view_model/wallet_keys_view_model.dart @@ -5,6 +5,7 @@ import 'package:cake_wallet/reactions/wallet_connect.dart'; import 'package:cake_wallet/src/screens/transaction_details/standart_list_item.dart'; import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cw_core/transaction_direction.dart'; import 'package:cw_core/transaction_info.dart'; import 'package:cw_core/wallet_base.dart'; @@ -289,6 +290,12 @@ abstract class WalletKeysViewModelBase with Store { ), ]); } + + if (_appStore.wallet!.type == WalletType.zano) { + items.addAll([ + StandartListItem(title: S.current.wallet_seed, value: _appStore.wallet!.seed!), + ]); + } } Future _currentHeight() async { @@ -330,6 +337,8 @@ abstract class WalletKeysViewModelBase with Store { return 'tron-wallet'; case WalletType.wownero: return 'wownero-wallet'; + case WalletType.zano: + return 'zano-wallet'; default: throw Exception('Unexpected wallet type: ${_appStore.wallet!.type.toString()}'); } diff --git a/lib/view_model/wallet_new_vm.dart b/lib/view_model/wallet_new_vm.dart index be30811d9..6d423707d 100644 --- a/lib/view_model/wallet_new_vm.dart +++ b/lib/view_model/wallet_new_vm.dart @@ -1,10 +1,17 @@ import 'package:cake_wallet/core/new_wallet_arguments.dart'; import 'package:cake_wallet/ethereum/ethereum.dart'; import 'package:cake_wallet/bitcoin/bitcoin.dart'; +import 'package:cake_wallet/zano/zano.dart'; import 'package:cake_wallet/bitcoin_cash/bitcoin_cash.dart'; import 'package:cake_wallet/core/wallet_creation_service.dart'; import 'package:cake_wallet/entities/seed_type.dart'; import 'package:cake_wallet/haven/haven.dart'; +import 'package:cake_wallet/solana/solana.dart'; +import 'package:cake_wallet/tron/tron.dart'; +import 'package:cake_wallet/wownero/wownero.dart'; +import 'package:cake_wallet/zano/zano.dart'; +import 'package:hive/hive.dart'; +import 'package:mobx/mobx.dart'; import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/nano/nano.dart'; import 'package:cake_wallet/solana/solana.dart'; @@ -156,6 +163,8 @@ abstract class WalletNewVMBase extends WalletCreationVM with Store { language: options!.first as String, isPolyseed: options.last as bool, ); + case WalletType.zano: + return zano!.createZanoNewWalletCredentials(name: name); case WalletType.none: throw Exception('Unexpected type: ${type.toString()}'); } diff --git a/lib/view_model/wallet_restore_view_model.dart b/lib/view_model/wallet_restore_view_model.dart index d37b69f74..f674d8e4f 100644 --- a/lib/view_model/wallet_restore_view_model.dart +++ b/lib/view_model/wallet_restore_view_model.dart @@ -9,6 +9,10 @@ import 'package:cake_wallet/monero/monero.dart'; import 'package:cake_wallet/nano/nano.dart'; import 'package:cake_wallet/polygon/polygon.dart'; import 'package:cake_wallet/solana/solana.dart'; +import 'package:cake_wallet/tron/tron.dart'; +import 'package:cake_wallet/zano/zano.dart'; +import 'package:hive/hive.dart'; +import 'package:mobx/mobx.dart'; import 'package:cake_wallet/store/app_store.dart'; import 'package:cake_wallet/tron/tron.dart'; import 'package:cake_wallet/view_model/restore/restore_mode.dart'; @@ -61,6 +65,7 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { case WalletType.bitcoin: case WalletType.litecoin: case WalletType.bitcoinCash: + case WalletType.zano: case WalletType.none: availableModes = [WalletRestoreMode.seed]; break; @@ -162,6 +167,12 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { password: password, height: height, ); + case WalletType.zano: + return zano!.createZanoRestoreWalletFromSeedCredentials( + name: name, + password: password, + height: height, + mnemonic: seed); case WalletType.none: break; } @@ -195,6 +206,17 @@ abstract class WalletRestoreViewModelBase extends WalletCreationVM with Store { language: 'English', ); + case WalletType.zano: + return zano!.createZanoRestoreWalletFromKeysCredentials( + name: name, + height: height, + spendKey: spendKey!, + viewKey: viewKey!, + address: address!, + password: password, + language: 'English'); + + case WalletType.ethereum: return ethereum!.createEthereumRestoreWalletFromPrivateKey( name: name, diff --git a/lib/zano/cw_zano.dart b/lib/zano/cw_zano.dart new file mode 100644 index 000000000..e6207ee45 --- /dev/null +++ b/lib/zano/cw_zano.dart @@ -0,0 +1,144 @@ +part of 'zano.dart'; + +class CWZano extends Zano { + + List getZanoAssets(WalletBase wallet) => (wallet as ZanoWallet).zanoAssets.values.toList(); + + @override + Future addZanoAssetById(WalletBase wallet, String assetId) async => await (wallet as ZanoWallet).addZanoAssetById(assetId); + + @override + Future changeZanoAssetAvailability(WalletBase wallet, CryptoCurrency token) async => await (wallet as ZanoWallet).changeZanoAssetAvailability(token as ZanoAsset); + + @override + Future deleteZanoAsset(WalletBase wallet, CryptoCurrency token) async => await (wallet as ZanoWallet).deleteZanoAsset(token as ZanoAsset); + + @override + Future getZanoAsset(WalletBase wallet, String assetId) async { + final zanoWallet = wallet as ZanoWallet; + return await zanoWallet.getZanoAsset(assetId); + } + + // @override + // TransactionHistoryBase getTransactionHistory(Object wallet) { + // final zanoWallet = wallet as ZanoWallet; + // return zanoWallet.transactionHistory; + // } + + @override + TransactionPriority getDefaultTransactionPriority() { + return MoneroTransactionPriority.automatic; + } + + @override + TransactionPriority deserializeMoneroTransactionPriority({required int raw}) { + return MoneroTransactionPriority.deserialize(raw: raw); + } + + @override + List getTransactionPriorities() { + return MoneroTransactionPriority.all; + } + + @override + List getWordList(String language) { + assert(language.toLowerCase() == LanguageList.english.toLowerCase()); + return EnglishMnemonics.words; + } + + @override + WalletCredentials createZanoRestoreWalletFromKeysCredentials( + {required String name, + required String spendKey, + required String viewKey, + required String address, + required String password, + required String language, + required int height}) { + return ZanoRestoreWalletFromKeysCredentials( + name: name, spendKey: spendKey, viewKey: viewKey, address: address, password: password, language: language, height: height); + } + + @override + WalletCredentials createZanoRestoreWalletFromSeedCredentials( + {required String name, required String password, required int height, required String mnemonic}) { + return ZanoRestoreWalletFromSeedCredentials(name: name, password: password, height: height, mnemonic: mnemonic); + } + + @override + WalletCredentials createZanoNewWalletCredentials({required String name, String? password}) { + return ZanoNewWalletCredentials(name: name, password: password); + } + + // @override + // Map getKeys(Object wallet) { + // final zanoWallet = wallet as ZanoWallet; + // final keys = zanoWallet.keys; + // return { + // 'privateSpendKey': keys.privateSpendKey, + // 'privateViewKey': keys.privateViewKey, + // 'publicSpendKey': keys.publicSpendKey, + // 'publicViewKey': keys.publicViewKey + // }; + // } + + @override + Object createZanoTransactionCredentials({required List outputs, required TransactionPriority priority, required CryptoCurrency currency}) { + return ZanoTransactionCredentials( + outputs: outputs + .map((out) => OutputInfo( + fiatAmount: out.fiatAmount, + cryptoAmount: out.cryptoAmount, + address: out.address, + note: out.note, + sendAll: out.sendAll, + extractedAddress: out.extractedAddress, + isParsedAddress: out.isParsedAddress, + formattedCryptoAmount: out.formattedCryptoAmount)) + .toList(), + priority: priority as MoneroTransactionPriority, + currency: currency, + ); + } + + @override + double formatterIntAmountToDouble({required int amount, required CryptoCurrency currency, required bool forFee}) { + // fee always counted in zano with default decimal points + if (forFee) return ZanoFormatter.intAmountToDouble(amount); + if (currency is ZanoAsset) return ZanoFormatter.intAmountToDouble(amount, currency.decimalPoint); + return ZanoFormatter.intAmountToDouble(amount); + } + + @override + int formatterParseAmount({required String amount, required CryptoCurrency currency}) { + if (currency is ZanoAsset) return ZanoFormatter.parseAmount(amount, currency.decimalPoint); + return ZanoFormatter.parseAmount(amount); + } + + // @override + // int getTransactionInfoAccountId(TransactionInfo tx) { + // final zanoTransactionInfo = tx as ZanoTransactionInfo; + // return zanoTransactionInfo.accountIndex; + // } + + @override + WalletService createZanoWalletService(Box walletInfoSource) { + return ZanoWalletService(walletInfoSource); + } + + @override + CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo transaction) { + transaction as ZanoTransactionInfo; + if (transaction.tokenSymbol == CryptoCurrency.zano.title) { + return CryptoCurrency.zano; + } + wallet as ZanoWallet; + final asset = wallet.zanoAssets.values.firstWhereOrNull((element) => element.ticker == transaction.tokenSymbol); + return asset ?? CryptoCurrency.zano; + } + + String getZanoAssetAddress(CryptoCurrency asset) => (asset as ZanoAsset).assetId; + + @override + String getAddress(WalletBase wallet) => (wallet as ZanoWallet).walletAddresses.address; +} diff --git a/macos/Podfile.lock b/macos/Podfile.lock index 4445e5976..d1bda30ae 100644 --- a/macos/Podfile.lock +++ b/macos/Podfile.lock @@ -2,8 +2,6 @@ PODS: - connectivity_plus (0.0.1): - FlutterMacOS - ReachabilitySwift - - cw_mweb (0.0.1): - - FlutterMacOS - device_info_plus (0.0.1): - FlutterMacOS - devicelocale (0.0.1): @@ -32,8 +30,6 @@ PODS: - shared_preferences_foundation (0.0.1): - Flutter - FlutterMacOS - - sp_scanner (0.0.1): - - FlutterMacOS - universal_ble (0.0.1): - Flutter - FlutterMacOS @@ -44,7 +40,6 @@ PODS: DEPENDENCIES: - connectivity_plus (from `Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos`) - - cw_mweb (from `Flutter/ephemeral/.symlinks/plugins/cw_mweb/macos`) - device_info_plus (from `Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos`) - devicelocale (from `Flutter/ephemeral/.symlinks/plugins/devicelocale/macos`) - fast_scanner (from `Flutter/ephemeral/.symlinks/plugins/fast_scanner/macos`) @@ -57,7 +52,6 @@ DEPENDENCIES: - path_provider_foundation (from `Flutter/ephemeral/.symlinks/plugins/path_provider_foundation/darwin`) - share_plus (from `Flutter/ephemeral/.symlinks/plugins/share_plus/macos`) - shared_preferences_foundation (from `Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin`) - - sp_scanner (from `Flutter/ephemeral/.symlinks/plugins/sp_scanner/macos`) - universal_ble (from `Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin`) - url_launcher_macos (from `Flutter/ephemeral/.symlinks/plugins/url_launcher_macos/macos`) - wakelock_plus (from `Flutter/ephemeral/.symlinks/plugins/wakelock_plus/macos`) @@ -70,8 +64,6 @@ SPEC REPOS: EXTERNAL SOURCES: connectivity_plus: :path: Flutter/ephemeral/.symlinks/plugins/connectivity_plus/macos - cw_mweb: - :path: Flutter/ephemeral/.symlinks/plugins/cw_mweb/macos device_info_plus: :path: Flutter/ephemeral/.symlinks/plugins/device_info_plus/macos devicelocale: @@ -96,8 +88,6 @@ EXTERNAL SOURCES: :path: Flutter/ephemeral/.symlinks/plugins/share_plus/macos shared_preferences_foundation: :path: Flutter/ephemeral/.symlinks/plugins/shared_preferences_foundation/darwin - sp_scanner: - :path: Flutter/ephemeral/.symlinks/plugins/sp_scanner/macos universal_ble: :path: Flutter/ephemeral/.symlinks/plugins/universal_ble/darwin url_launcher_macos: @@ -107,7 +97,6 @@ EXTERNAL SOURCES: SPEC CHECKSUMS: connectivity_plus: 18d3c32514c886e046de60e9c13895109866c747 - cw_mweb: 7440b12ead811dda972a9918442ea2a458e8742c device_info_plus: 5401765fde0b8d062a2f8eb65510fb17e77cf07f devicelocale: 9f0f36ac651cabae2c33f32dcff4f32b61c38225 fast_scanner: d31bae07e2653403a69dac99fb710c1722b16a97 @@ -122,7 +111,6 @@ SPEC CHECKSUMS: ReachabilitySwift: 32793e867593cfc1177f5d16491e3a197d2fccda share_plus: 1fa619de8392a4398bfaf176d441853922614e89 shared_preferences_foundation: fcdcbc04712aee1108ac7fda236f363274528f78 - sp_scanner: 269d96e0ec3173e69156be7239b95182be3b8303 universal_ble: cf52a7b3fd2e7c14d6d7262e9fdadb72ab6b88a6 url_launcher_macos: c82c93949963e55b228a30115bd219499a6fe404 wakelock_plus: 4783562c9a43d209c458cb9b30692134af456269 diff --git a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index f28097b88..fd9942aa8 100644 --- a/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/macos/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -15,7 +15,7 @@ @@ -31,7 +31,7 @@ @@ -54,7 +54,7 @@ @@ -71,7 +71,7 @@ diff --git a/model_generator.sh b/model_generator.sh index 730817c24..cc34a7e49 100755 --- a/model_generator.sh +++ b/model_generator.sh @@ -11,6 +11,7 @@ cd cw_bitcoin_cash; flutter pub get; dart run build_runner build --delete-confli cd cw_solana; flutter pub get; dart run build_runner build --delete-conflicting-outputs; cd .. cd cw_tron; flutter pub get; dart run build_runner build --delete-conflicting-outputs; cd .. cd cw_wownero; flutter pub get; dart run build_runner build --delete-conflicting-outputs; cd .. +cd cw_zano; flutter pub get; flutter packages pub run build_runner build --delete-conflicting-outputs; cd .. cd cw_polygon; flutter pub get; cd .. cd cw_ethereum; flutter pub get; cd .. cd cw_mweb && flutter pub get && cd .. diff --git a/pubspec_base.yaml b/pubspec_base.yaml index 221f1d9bf..f2319cddd 100644 --- a/pubspec_base.yaml +++ b/pubspec_base.yaml @@ -174,6 +174,7 @@ flutter: - assets/solana_node_list.yml - assets/tron_node_list.yml - assets/wownero_node_list.yml + - assets/zano_node_list.yml - assets/text/ - assets/faq/ - assets/animation/ diff --git a/scripts/android/build_zano.sh b/scripts/android/build_zano.sh new file mode 100755 index 000000000..f2e22e029 --- /dev/null +++ b/scripts/android/build_zano.sh @@ -0,0 +1,99 @@ +#!/bin/sh +set -o xtrace + +ORIGINAL_DIR=$(pwd) + +. ./config.sh +#HAVEN_VERSION=tags/v3.0.7 +ZANO_SRC_DIR=${WORKDIR}/zano +ZANO_CHECKOUT_ID=develop + +git clone --recurse-submodules -b ${ZANO_CHECKOUT_ID} https://github.com/hyle-team/zano.git ${ZANO_SRC_DIR} +#git clone --recursive https://github.com/hyle-team/zano.git ${ZANO_SRC_DIR} +cd $ZANO_SRC_DIR +#git checkout ${ZANO_CHECKOUT_ID} +git submodule init +git submodule update +git pull -r +if [ $? -ne 0 ]; then + echo "Failed to git pull -r" + exit 1 +fi + +for arch in "aarch" "aarch64" "i686" "x86_64" +do +FLAGS="" +PREFIX=${WORKDIR}/prefix_${arch} +DEST_LIB_DIR=${PREFIX}/lib/zano +DEST_INCLUDE_DIR=${PREFIX}/include/zano +export CMAKE_INCLUDE_PATH="${PREFIX}/include" +export CMAKE_LIBRARY_PATH="${PREFIX}/lib" +ANDROID_STANDALONE_TOOLCHAIN_PATH="${TOOLCHAIN_BASE_DIR}_${arch}" +PATH="${ANDROID_STANDALONE_TOOLCHAIN_PATH}/bin:${ORIGINAL_PATH}" + +mkdir -p $DEST_LIB_DIR +mkdir -p $DEST_INCLUDE_DIR + +case $arch in + "aarch" ) + CLANG=arm-linux-androideabi-clang + CXXLANG=arm-linux-androideabi-clang++ + BUILD_64=OFF + TAG="android-armv7" + ARCH="armv7-a" + ARCH_ABI="armeabi-v7a" + FLAGS="-D CMAKE_ANDROID_ARM_MODE=ON -D NO_AES=true";; + "aarch64" ) + CLANG=aarch64-linux-androideabi-clang + CXXLANG=aarch64-linux-androideabi-clang++ + BUILD_64=ON + TAG="android-armv8" + ARCH="armv8-a" + ARCH_ABI="arm64-v8a";; + "i686" ) + CLANG=i686-linux-androideabi-clang + CXXLANG=i686-linux-androideabi-clang++ + BUILD_64=OFF + TAG="android-x86" + ARCH="i686" + ARCH_ABI="x86";; + "x86_64" ) + CLANG=x86_64-linux-androideabi-clang + CXXLANG=x86_64-linux-androideabi-clang++ + BUILD_64=ON + TAG="android-x86_64" + ARCH="x86-64" + ARCH_ABI="x86_64";; +esac + +cd $ZANO_SRC_DIR +rm -rf ./build/release +mkdir -p ./build/release +cd ./build/release +CC=${CLANG} CXX=${CXXLANG} cmake -S../.. -DCMAKE_INSTALL_PREFIX=./_install -D CAKEWALLET=TRUE -D TESTNET=TRUE -D USE_DEVICE_TREZOR=OFF -D BUILD_GUI_DEPS=1 -D BUILD_TESTS=OFF -D ARCH=${ARCH} -D STATIC=ON -D BUILD_64=${BUILD_64} -D CMAKE_BUILD_TYPE=release -D ANDROID=true -D INSTALL_VENDORED_LIBUNBOUND=ON -D BUILD_TAG=${TAG} -D CMAKE_SYSTEM_NAME="Android" -D CMAKE_ANDROID_STANDALONE_TOOLCHAIN="${ANDROID_STANDALONE_TOOLCHAIN_PATH}" -D CMAKE_ANDROID_ARCH_ABI=${ARCH_ABI} $FLAGS +if [ $? -ne 0 ]; then + echo "Failed to perform cmake" + exit 1 +fi + + + +# make wallet_api -j$THREADS +# find . -path ./lib -prune -o -name '*.a' -exec cp '{}' lib \; +#cd ../.. +#pwd + +cmake --build . --config Release --verbose --target install -- -j 4 +if [ $? -ne 0 ]; then + echo "Failed to perform cmake install" + exit 1 +fi +#exit 1 + +cp -r ./_install/$ARCH_ABI/lib/* $DEST_LIB_DIR +#cp ../../src/wallet/api/wallet2_api.h $DEST_INCLUDE_DIR + +cd "$ORIGINAL_DIR" +./copy_zano_libs.sh + +done diff --git a/scripts/android/build_zano_all.sh b/scripts/android/build_zano_all.sh new file mode 100755 index 000000000..211d66706 --- /dev/null +++ b/scripts/android/build_zano_all.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +./build_iconv.sh +./build_boost.sh +./build_openssl.sh +./build_sodium.sh +./build_zmq.sh +./build_zano.sh diff --git a/scripts/android/copy_monero_deps.sh b/scripts/android/copy_monero_deps.sh index ed8181e6b..c7fc8a740 100755 --- a/scripts/android/copy_monero_deps.sh +++ b/scripts/android/copy_monero_deps.sh @@ -5,6 +5,7 @@ CW_DIR=${WORKDIR}/cake_wallet CW_EXRTERNAL_DIR=${CW_DIR}/cw_shared_external/ios/External/android CW_HAVEN_EXTERNAL_DIR=${CW_DIR}/cw_haven/ios/External/android CW_MONERO_EXTERNAL_DIR=${CW_DIR}/cw_monero/ios/External/android +CW_ZANO_EXTERNAL_DIR=${CW_DIR}/cw_zano/ios/External/android for arch in "aarch" "aarch64" "i686" "x86_64" do @@ -40,5 +41,7 @@ done mkdir -p ${CW_HAVEN_EXTERNAL_DIR}/include mkdir -p ${CW_MONERO_EXTERNAL_DIR}/include +mkdir -p ${CW_ZANO_EXTERNAL_DIR}/include cp $CW_EXRTERNAL_DIR/x86/include/haven/wallet2_api.h ${CW_HAVEN_EXTERNAL_DIR}/include +# cp $CW_EXRTERNAL_DIR/x86/include/zano/wallet2_api.h ${CW_ZANO_EXTERNAL_DIR}/include diff --git a/scripts/android/copy_zano_libs.sh b/scripts/android/copy_zano_libs.sh new file mode 100755 index 000000000..2ca6f90aa --- /dev/null +++ b/scripts/android/copy_zano_libs.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +WORKDIR=/opt/android +#CW_DIR=${WORKDIR}/zano_cake_wallet +CW_DIR=$(cd ../.. && pwd) +echo "CW_DIR: $CW_DIR" +CW_EXTERNAL_DIR=${CW_DIR}/cw_shared_external/ios/External/android +for arch in "aarch" "aarch64" "i686" "x86_64" +do + +PREFIX=${WORKDIR}/prefix_${arch} +ABI="" + +case $arch in + "aarch" ) + ABI="armeabi-v7a";; + "aarch64" ) + ABI="arm64-v8a";; + "i686" ) + ABI="x86";; + "x86_64" ) + ABI="x86_64";; +esac + +LIB_DIR=${CW_EXTERNAL_DIR}/${ABI}/lib + +mkdir -p $LIB_DIR + +cp -r ${PREFIX}/lib/* $LIB_DIR + +mkdir -p ${CW_DIR}/cw_shared_external/ios/External/ios/sources/zano/src/wallet/ +cp ${WORKDIR}/zano/src/wallet/plain_wallet_api.h ${CW_DIR}/cw_shared_external/ios/External/ios/sources/zano/src/wallet/ + +done diff --git a/scripts/android/finish_boost.sh b/scripts/android/finish_boost.sh index 3cf656c55..d96de2d72 100755 --- a/scripts/android/finish_boost.sh +++ b/scripts/android/finish_boost.sh @@ -5,5 +5,5 @@ PREFIX=$2 BOOST_SRC_DIR=$3 cd $BOOST_SRC_DIR - -./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} -j$THREADS install +echo "Building boost" +./b2 --build-type=minimal link=static runtime-link=static --with-chrono --with-date_time --with-timer --with-filesystem --with-program_options --with-regex --with-serialization --with-system --with-thread --with-locale --with-log --build-dir=android --stagedir=android toolset=clang threading=multi threadapi=pthread target-os=android -sICONV_PATH=${PREFIX} -j$THREADS install diff --git a/scripts/android/pubspec_gen.sh b/scripts/android/pubspec_gen.sh index febc4f9e9..5d6a24722 100755 --- a/scripts/android/pubspec_gen.sh +++ b/scripts/android/pubspec_gen.sh @@ -10,7 +10,7 @@ case $APP_ANDROID_TYPE in CONFIG_ARGS="--monero" ;; $CAKEWALLET) - CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero" + CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero --zano" if [ "$CW_WITH_HAVEN" = true ];then CONFIG_ARGS="$CONFIG_ARGS --haven" fi diff --git a/scripts/ios/app_config.sh b/scripts/ios/app_config.sh index 396ccd7f0..4af57bbd5 100755 --- a/scripts/ios/app_config.sh +++ b/scripts/ios/app_config.sh @@ -32,7 +32,7 @@ case $APP_IOS_TYPE in CONFIG_ARGS="--monero" ;; $CAKEWALLET) - CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero" + CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero --zano" if [ "$CW_WITH_HAVEN" = true ];then CONFIG_ARGS="$CONFIG_ARGS --haven" fi diff --git a/scripts/ios/build_boost.sh b/scripts/ios/build_boost.sh index e2dc291ee..11dcead3e 100755 --- a/scripts/ios/build_boost.sh +++ b/scripts/ios/build_boost.sh @@ -1,23 +1,42 @@ -#!/bin/sh +#!/bin/bash + +set -e . ./config.sh MIN_IOS_VERSION=10.0 BOOST_URL="https://github.com/cake-tech/Apple-Boost-BuildScript.git" BOOST_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/Apple-Boost-BuildScript" -BOOST_VERSION=1.72.0 +BOOST_VERSION=1.84.0 BOOST_LIBS="random regex graph random chrono thread filesystem system date_time locale serialization program_options" echo "============================ Boost ============================" echo "Cloning Apple-Boost-BuildScript from - $BOOST_URL" -git clone -b build $BOOST_URL $BOOST_DIR_PATH -cd $BOOST_DIR_PATH + +# Check if the directory already exists. +if [ -d "$BOOST_DIR_PATH" ]; then + echo "Boost directory already exists." +else + echo "Cloning Boost from $BOOST_URL" + git clone -b build $BOOST_URL $BOOST_DIR_PATH +fi + +# Verify if the repository was cloned successfully. +if [ -d "$BOOST_DIR_PATH/.git" ]; then + echo "Boost repository cloned successfully." + cd $BOOST_DIR_PATH + git checkout build +else + echo "Failed to clone Boost repository. Exiting." + exit 1 +fi + ./boost.sh -ios \ --min-ios-version ${MIN_IOS_VERSION} \ --boost-libs "${BOOST_LIBS}" \ --boost-version ${BOOST_VERSION} \ --no-framework -mv ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/include/* $EXTERNAL_IOS_INCLUDE_DIR -mv ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/lib/* $EXTERNAL_IOS_LIB_DIR \ No newline at end of file +mv -f ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/include/* $EXTERNAL_IOS_INCLUDE_DIR +mv -f ${BOOST_DIR_PATH}/build/boost/${BOOST_VERSION}/ios/release/prefix/lib/* $EXTERNAL_IOS_LIB_DIR \ No newline at end of file diff --git a/scripts/ios/build_zano.sh b/scripts/ios/build_zano.sh new file mode 100755 index 000000000..d37ed226d --- /dev/null +++ b/scripts/ios/build_zano.sh @@ -0,0 +1,106 @@ +#!/bin/sh + +. ./config.sh + +ZANO_URL="https://github.com/hyle-team/zano.git" +ZANO_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/zano" +ZANO_VERSION=fde28efdc5d7efe8741dcb0e62ea0aebc805a373 + + +IOS_TOOLCHAIN_DIR_PATH="${EXTERNAL_IOS_SOURCE_DIR}/ios_toolchain" +IOS_TOOLCHAIN_URL="https://github.com/leetal/ios-cmake.git" +IOS_TOOLCHAIN_VERSION=06465b27698424cf4a04a5ca4904d50a3c966c45 + +export NO_DEFAULT_PATH + +BUILD_TYPE=release +PREFIX=${EXTERNAL_IOS_DIR} +DEST_LIB_DIR=${EXTERNAL_IOS_LIB_DIR}/zano +DEST_INCLUDE_DIR=${EXTERNAL_IOS_INCLUDE_DIR}/zano + +ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64="${ZANO_DIR_PATH}/build" +ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64="${ZANO_DIR_PATH}/install" + +echo "ZANO_URL: $ZANO_URL" +echo "IOS_TOOLCHAIN_DIR_PATH: $IOS_TOOLCHAIN_DIR_PATH" +echo "ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64: $ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64" +echo "ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64: $ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64" +echo "PREFIX: $PREFIX" +echo "DEST_LIB_DIR: $DEST_LIB_DIR" +echo "DEST_INCLUDE_DIR: $DEST_INCLUDE_DIR" +echo "ZANO_DIR_PATH: $ZANO_DIR_PATH" + +echo "Cloning ios_toolchain from - $IOS_TOOLCHAIN_URL to - $IOS_TOOLCHAIN_DIR_PATH" +git clone $IOS_TOOLCHAIN_URL $IOS_TOOLCHAIN_DIR_PATH +cd $IOS_TOOLCHAIN_DIR_PATH +git checkout $IOS_TOOLCHAIN_VERSION +git submodule update --init --force +cd .. + +echo "Cloning zano from - $ZANO_URL to - $ZANO_DIR_PATH" +git clone $ZANO_URL $ZANO_DIR_PATH +cd $ZANO_DIR_PATH +git fetch origin +if [ $? -ne 0 ]; then + echo "Failed to perform command" + exit 1 +fi +git checkout $ZANO_VERSION +if [ $? -ne 0 ]; then + echo "Failed to perform command" + exit 1 +fi +git submodule update --init --force +if [ $? -ne 0 ]; then + echo "Failed to perform command" + exit 1 +fi +mkdir -p build +cd .. + + +export CMAKE_INCLUDE_PATH="${PREFIX}/include" +export CMAKE_LIBRARY_PATH="${PREFIX}/lib" + + +rm -rf ${ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64} > /dev/null +rm -rf ${ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64} > /dev/null + +echo "CMAKE_INCLUDE_PATH: $CMAKE_INCLUDE_PATH" +echo "CMAKE_LIBRARY_PATH: $CMAKE_LIBRARY_PATH" +echo "ROOT_DIR: $ROOT_DIR" + + +cmake -DCMAKE_BUILD_TYPE=$BUILD_TYPE \ + -DCMAKE_TOOLCHAIN_FILE="${IOS_TOOLCHAIN_DIR_PATH}/ios.toolchain.cmake" \ + -DPLATFORM=OS64 \ + -S"${ZANO_DIR_PATH}" \ + -B"${ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64}" \ + -GXcode \ + -DCAKEWALLET=TRUE \ + -DSKIP_BOOST_FATLIB_LIB=TRUE \ + -DCMAKE_SYSTEM_NAME=iOS \ + -DCMAKE_INSTALL_PREFIX="${ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64}" \ + -DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \ + -DCMAKE_CXX_FLAGS="-Wno-enum-constexpr-conversion" \ + -DDISABLE_TOR=TRUE + +# -DCMAKE_OSX_ARCHITECTURES="arm64" +# -DCMAKE_IOS_INSTALL_COMBINED=YES + +if [ $? -ne 0 ]; then + echo "Failed to perform command" + exit 1 +fi + +cmake --build "${ZANO_MOBILE_IOS_BUILD_FOLDER_ARM64}" --config $BUILD_TYPE --target install -- -j 4 +if [ $? -ne 0 ]; then + echo "Failed to perform command" + exit 1 +fi + +mkdir -p $DEST_LIB_DIR +mkdir -p $DEST_INCLUDE_DIR + +cp ${ZANO_MOBILE_IOS_INSTALL_FOLDER_ARM64}/lib/* $DEST_LIB_DIR +cp ${ZANO_DIR_PATH}/src/wallet/plain_wallet_api.h $DEST_INCLUDE_DIR diff --git a/scripts/ios/build_zano_all.sh b/scripts/ios/build_zano_all.sh new file mode 100755 index 000000000..2e5ef81d5 --- /dev/null +++ b/scripts/ios/build_zano_all.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +. ./config.sh +./install_missing_headers.sh +./build_openssl.sh +./build_boost.sh +./build_zano.sh diff --git a/scripts/ios/setup.sh b/scripts/ios/setup.sh index abe8435ae..b17b3718b 100755 --- a/scripts/ios/setup.sh +++ b/scripts/ios/setup.sh @@ -13,16 +13,21 @@ fi libtool -static -o libboost.a ./libboost_*.a libtool -static -o libhaven.a ./haven/*.a libtool -static -o libmonero.a ./monero/*.a +libtool -static -o libzano.a ./zano/*.a CW_HAVEN_EXTERNAL_LIB=../../../../../cw_haven/ios/External/ios/lib CW_HAVEN_EXTERNAL_INCLUDE=../../../../../cw_haven/ios/External/ios/include CW_MONERO_EXTERNAL_LIB=../../../../../cw_monero/ios/External/ios/lib CW_MONERO_EXTERNAL_INCLUDE=../../../../../cw_monero/ios/External/ios/include +CW_ZANO_EXTERNAL_LIB=../../../../../cw_zano/ios/External/ios/lib +CW_ZANO_EXTERNAL_INCLUDE=../../../../../cw_zano/ios/External/ios/include mkdir -p $CW_HAVEN_EXTERNAL_INCLUDE mkdir -p $CW_MONERO_EXTERNAL_INCLUDE +mkdir -p $CW_ZANO_EXTERNAL_INCLUDE mkdir -p $CW_HAVEN_EXTERNAL_LIB mkdir -p $CW_MONERO_EXTERNAL_LIB +mkdir -p $CW_ZANO_EXTERNAL_LIB ln ./libboost.a ${CW_HAVEN_EXTERNAL_LIB}/libboost.a ln ./libcrypto.a ${CW_HAVEN_EXTERNAL_LIB}/libcrypto.a @@ -37,4 +42,10 @@ ln ./libssl.a ${CW_MONERO_EXTERNAL_LIB}/libssl.a ln ./libsodium.a ${CW_MONERO_EXTERNAL_LIB}/libsodium.a ln ./libunbound.a ${CW_MONERO_EXTERNAL_LIB}/libunbound.a cp ./libmonero.a $CW_MONERO_EXTERNAL_LIB -cp ../include/monero/* $CW_MONERO_EXTERNAL_INCLUDE \ No newline at end of file +cp ../include/monero/* $CW_MONERO_EXTERNAL_INCLUDE + +ln ./libboost.a ${CW_ZANO_EXTERNAL_LIB}/libboost.a +ln ./libcrypto.a ${CW_ZANO_EXTERNAL_LIB}/libcrypto.a +ln ./libssl.a ${CW_ZANO_EXTERNAL_LIB}/libssl.a +cp ./libzano.a $CW_ZANO_EXTERNAL_LIB +cp ../include/zano/* $CW_ZANO_EXTERNAL_INCLUDE diff --git a/scripts/macos/app_config.sh b/scripts/macos/app_config.sh index 452205dd9..5089fe263 100755 --- a/scripts/macos/app_config.sh +++ b/scripts/macos/app_config.sh @@ -36,7 +36,7 @@ case $APP_MACOS_TYPE in $MONERO_COM) CONFIG_ARGS="--monero";; $CAKEWALLET) - CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero";; #--haven + CONFIG_ARGS="--monero --bitcoin --ethereum --polygon --nano --bitcoinCash --solana --tron --wownero --zano";; #--haven esac cp -rf pubspec_description.yaml pubspec.yaml diff --git a/tool/configure.dart b/tool/configure.dart index 6abd73d9e..c5a81d8c5 100644 --- a/tool/configure.dart +++ b/tool/configure.dart @@ -10,6 +10,7 @@ const polygonOutputPath = 'lib/polygon/polygon.dart'; const solanaOutputPath = 'lib/solana/solana.dart'; const tronOutputPath = 'lib/tron/tron.dart'; const wowneroOutputPath = 'lib/wownero/wownero.dart'; +const zanoOutputPath = 'lib/zano/zano.dart'; const walletTypesPath = 'lib/wallet_types.g.dart'; const secureStoragePath = 'lib/core/secure_storage.dart'; const pubspecDefaultPath = 'pubspec_default.yaml'; @@ -28,6 +29,7 @@ Future main(List args) async { final hasSolana = args.contains('${prefix}solana'); final hasTron = args.contains('${prefix}tron'); final hasWownero = args.contains('${prefix}wownero'); + final hasZano = args.contains('${prefix}zano'); final excludeFlutterSecureStorage = args.contains('${prefix}excludeFlutterSecureStorage'); await generateBitcoin(hasBitcoin); @@ -40,6 +42,7 @@ Future main(List args) async { await generateSolana(hasSolana); await generateTron(hasTron); await generateWownero(hasWownero); + await generateZano(hasZano); // await generateBanano(hasEthereum); await generatePubspec( @@ -55,6 +58,7 @@ Future main(List args) async { hasSolana: hasSolana, hasTron: hasTron, hasWownero: hasWownero, + hasZano: hasZano, ); await generateWalletTypes( hasMonero: hasMonero, @@ -68,6 +72,7 @@ Future main(List args) async { hasSolana: hasSolana, hasTron: hasTron, hasWownero: hasWownero, + hasZano: hasZano, ); await injectSecureStorage(!excludeFlutterSecureStorage); } @@ -1398,6 +1403,82 @@ abstract class Tron { await outputFile.writeAsString(output); } +Future generateZano(bool hasImplementation) async { + final outputFile = File(zanoOutputPath); + const zanoCommonHeaders = """ +import 'package:cake_wallet/utils/language_list.dart'; +import 'package:cake_wallet/view_model/send/output.dart'; +import 'package:collection/collection.dart'; +import 'package:cw_core/crypto_currency.dart'; +import 'package:cw_core/monero_transaction_priority.dart'; +import 'package:cw_core/output_info.dart'; +import 'package:cw_core/transaction_history.dart'; +import 'package:cw_core/transaction_info.dart'; +import 'package:cw_core/transaction_priority.dart'; +import 'package:cw_core/wallet_base.dart'; +import 'package:cw_core/wallet_credentials.dart'; +import 'package:cw_core/wallet_info.dart'; +import 'package:cw_core/wallet_service.dart'; +import 'package:hive/hive.dart'; +"""; + const zanoCWHeaders = """ +import 'package:cw_zano/mnemonics/english.dart'; +import 'package:cw_zano/model/zano_asset.dart'; +import 'package:cw_zano/model/zano_transaction_credentials.dart'; +import 'package:cw_zano/model/zano_transaction_info.dart'; +import 'package:cw_zano/zano_formatter.dart'; +import 'package:cw_zano/zano_wallet.dart'; +import 'package:cw_zano/zano_wallet_service.dart'; +"""; + const zanoCwPart = "part 'cw_zano.dart';"; + const zanoContent = """ +abstract class Zano { + TransactionPriority getDefaultTransactionPriority(); + TransactionPriority deserializeMoneroTransactionPriority({required int raw}); + List getTransactionPriorities(); + List getWordList(String language); + + WalletCredentials createZanoRestoreWalletFromKeysCredentials({ + required String name, + required String spendKey, + required String viewKey, + required String address, + required String password, + required String language, + required int height}); + WalletCredentials createZanoRestoreWalletFromSeedCredentials({required String name, required String password, required int height, required String mnemonic}); + WalletCredentials createZanoNewWalletCredentials({required String name, String password}); + Object createZanoTransactionCredentials({required List outputs, required TransactionPriority priority, required CryptoCurrency currency}); + double formatterIntAmountToDouble({required int amount, required CryptoCurrency currency, required bool forFee}); + int formatterParseAmount({required String amount, required CryptoCurrency currency}); + WalletService createZanoWalletService(Box walletInfoSource); + CryptoCurrency assetOfTransaction(WalletBase wallet, TransactionInfo tx); + List getZanoAssets(WalletBase wallet); + String getZanoAssetAddress(CryptoCurrency asset); + Future changeZanoAssetAvailability(WalletBase wallet, CryptoCurrency token); + Future addZanoAssetById(WalletBase wallet, String assetId); + Future deleteZanoAsset(WalletBase wallet, CryptoCurrency token); + Future getZanoAsset(WalletBase wallet, String contractAddress); + String getAddress(WalletBase wallet); +} +"""; + const zanoEmptyDefinition = 'Zano? zano;\n'; + const zanoCWDefinition = 'Zano? zano = CWZano();\n'; + + final output = '$zanoCommonHeaders\n' + + (hasImplementation ? '$zanoCWHeaders\n' : '\n') + + (hasImplementation ? '$zanoCwPart\n\n' : '\n') + + (hasImplementation ? zanoCWDefinition : zanoEmptyDefinition) + + '\n' + + zanoContent; + + if (outputFile.existsSync()) { + await outputFile.delete(); + } + + await outputFile.writeAsString(output); +} + Future generatePubspec({ required bool hasMonero, required bool hasBitcoin, @@ -1411,6 +1492,7 @@ Future generatePubspec({ required bool hasSolana, required bool hasTron, required bool hasWownero, + required bool hasZano, }) async { const cwCore = """ cw_core: @@ -1475,6 +1557,10 @@ Future generatePubspec({ cw_wownero: path: ./cw_wownero """; + const cwZano = """ + cw_zano: + path: ./cw_zano + """; final inputFile = File(pubspecOutputPath); final inputText = await inputFile.readAsString(); final inputLines = inputText.split('\n'); @@ -1536,6 +1622,10 @@ Future generatePubspec({ output += '\n$cwWownero'; } + if (hasZano) { + output += '\n$cwZano'; + } + final outputLines = output.split('\n'); inputLines.insertAll(dependenciesIndex + 1, outputLines); final outputContent = inputLines.join('\n'); @@ -1560,6 +1650,7 @@ Future generateWalletTypes({ required bool hasSolana, required bool hasTron, required bool hasWownero, + required bool hasZano, }) async { final walletTypesFile = File(walletTypesPath); @@ -1619,6 +1710,10 @@ Future generateWalletTypes({ outputContent += '\tWalletType.haven,\n'; } + if (hasZano) { + outputContent += '\tWalletType.zano,\n'; + } + outputContent += '];\n'; await walletTypesFile.writeAsString(outputContent); }