From 28fa28adcdf573ceff4d28081a582d3be42b4009 Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Tue, 9 Jan 2024 19:48:02 -0300 Subject: [PATCH 1/6] Upgrade ethers - Use new ethers api - Change BigNumber for js native BigInt - Remove unnecesary libs - Fix send screen issues --- android/app/build.gradle | 6 + babel.config.js | 11 +- ethetsInitializer.ts | 22 ++ index.js => index.ts | 4 +- package-lock.json | 512 ++++++++++++++------------- package.json | 33 +- shim.js | 27 -- src/components/Calculator.tsx | 23 +- src/components/EstimatedTxFee.tsx | 14 +- src/components/TokenActivityItem.tsx | 3 +- src/components/TokenItem.tsx | 3 +- src/hooks/useBalances.ts | 6 +- src/hooks/useBlockchainData.ts | 4 +- src/hooks/useNews.tsx | 8 +- src/hooks/useTokenConversions.ts | 15 +- src/hooks/useTx.ts | 4 +- src/locale/en.json | 1 + src/locale/es.json | 1 + src/screens/main/SendScreen.tsx | 22 +- src/screens/main/TokenScreen.tsx | 13 +- src/screens/main/TxScreen.tsx | 10 +- src/utils/formatter.ts | 9 +- src/utils/number.ts | 17 +- src/web3/providers.ts | 6 +- src/web3/tokens.ts | 4 +- src/web3/tx/erc20.tx.ts | 95 +++-- src/web3/tx/tron.tx.ts | 23 +- src/web3/tx/types.ts | 20 +- src/web3/wallet/wallet.erc20.ts | 6 +- src/web3/wallet/wallet.tron.ts | 8 +- 30 files changed, 462 insertions(+), 468 deletions(-) create mode 100644 ethetsInitializer.ts rename index.js => index.ts (69%) delete mode 100644 shim.js diff --git a/android/app/build.gradle b/android/app/build.gradle index c95cb40..9445565 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -109,6 +109,12 @@ android { proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" } } + packagingOptions { + pickFirst 'lib/x86/libcrypto.so' + pickFirst 'lib/x86_64/libcrypto.so' + pickFirst 'lib/armeabi-v7a/libcrypto.so' + pickFirst 'lib/arm64-v8a/libcrypto.so' + } } dependencies { diff --git a/babel.config.js b/babel.config.js index 69ecbe1..ca6b531 100644 --- a/babel.config.js +++ b/babel.config.js @@ -17,10 +17,15 @@ module.exports = function (api) { '@utils': './src/utils', '@http': './src/http', '@assets': './assets', + 'crypto': 'react-native-quick-crypto', + 'stream': 'stream-browserify', + 'buffer': '@craftzdog/react-native-buffer', + 'http': '@tradle/react-native-http', + 'https': 'https-browserify', '@ledgerhq/domain-service': '@ledgerhq/domain-service/lib', // Fix @ledgerhq/hw-app-eth - '@ledgerhq/evm-tools': '@ledgerhq/evm-tools/lib', // Fix @ledgerhq/hw-app-eth - '@ledgerhq/cryptoassets': '@ledgerhq/cryptoassets/lib', // Fix @ledgerhq/hw-app-eth - '@ledgerhq/live-network': '@ledgerhq/live-network/lib', // Fix @ledgerhq/hw-app-eth + '@ledgerhq/evm-tools': '@ledgerhq/evm-tools/lib', + '@ledgerhq/cryptoassets': '@ledgerhq/cryptoassets/lib', + '@ledgerhq/live-network': '@ledgerhq/live-network/lib', }, extensions: [ '.ios.ts', diff --git a/ethetsInitializer.ts b/ethetsInitializer.ts new file mode 100644 index 0000000..77f99f7 --- /dev/null +++ b/ethetsInitializer.ts @@ -0,0 +1,22 @@ +import { ethers } from 'ethers'; +import crypto from 'react-native-quick-crypto'; + +ethers.randomBytes.register((length) => { + return new Uint8Array(crypto.randomBytes(length)); +}); + +ethers.computeHmac.register((algo, key, data) => { + return crypto.createHmac(algo, key).update(data).digest(); +}); + +ethers.pbkdf2.register((passwd, salt, iter, keylen, algo) => { + return crypto.pbkdf2Sync(passwd, salt, iter, keylen, algo); +}); + +ethers.sha256.register((data) => { + return crypto.createHash('sha256').update(data).digest(); +}); + +ethers.sha512.register((data) => { + return crypto.createHash('sha512').update(data).digest(); +}); diff --git a/index.js b/index.ts similarity index 69% rename from index.js rename to index.ts index 5d228ba..631af59 100644 --- a/index.js +++ b/index.ts @@ -1,8 +1,6 @@ import 'react-native-reanimated'; -import 'react-native-get-random-values'; -import '@ethersproject/shims'; -import './shim'; +import './ethetsInitializer'; import { AppRegistry } from 'react-native'; diff --git a/package-lock.json b/package-lock.json index 4453e17..4457a51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,6 @@ "hasInstallScript": true, "dependencies": { "@ethereumjs/util": "^8.0.3", - "@ethersproject/shims": "^5.7.0", "@ledgerhq/hw-app-eth": "^6.35.1", "@ledgerhq/hw-app-trx": "^6.28.1", "@ledgerhq/react-native-hid": "^6.31.1", @@ -33,7 +32,7 @@ "domain-browser": "^1.2.0", "ethereumjs-units": "^0.2.0", "ethereumjs-wallet": "^1.0.2", - "ethers": "^5.7.2", + "ethers": "^6.9.2", "events": "^1.1.1", "https-browserify": "^0.0.1", "i18next": "^22.4.9", @@ -60,6 +59,8 @@ "react-native-get-random-values": "^1.8.0", "react-native-keychain": "^8.1.1", "react-native-qrcode-svg": "^6.2.0", + "react-native-quick-base64": "^2.0.8", + "react-native-quick-crypto": "^0.6.1", "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^3.6.1", "react-native-safe-area-context": "^4.8.2", @@ -112,7 +113,6 @@ "react-native-dotenv": "^3.4.7", "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", - "rn-nodeify": "^10.3.0", "typescript": "5.0.4" }, "engines": { @@ -129,9 +129,9 @@ } }, "node_modules/@adraffy/ens-normalize": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, "node_modules/@ampproject/remapping": { "version": "2.2.0", @@ -2135,6 +2135,29 @@ "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", "dev": true }, + "node_modules/@craftzdog/react-native-buffer": { + "version": "6.0.5", + "resolved": "https://registry.npmjs.org/@craftzdog/react-native-buffer/-/react-native-buffer-6.0.5.tgz", + "integrity": "sha512-Av+YqfwA9e7jhgI9GFE/gTpwl/H+dRRLmZyJPOpKTy107j9Oj7oXlm3/YiMNz+C/CEGqcKAOqnXDLs4OL6AAFw==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "dependencies": { + "ieee754": "^1.2.1", + "react-native-quick-base64": "^2.0.5" + } + }, "node_modules/@egjs/hammerjs": { "version": "2.0.17", "resolved": "https://registry.npmjs.org/@egjs/hammerjs/-/hammerjs-2.0.17.tgz", @@ -2612,6 +2635,11 @@ "scrypt-js": "3.0.1" } }, + "node_modules/@ethersproject/json-wallets/node_modules/aes-js": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + }, "node_modules/@ethersproject/keccak256": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", @@ -2816,21 +2844,6 @@ "hash.js": "1.1.7" } }, - "node_modules/@ethersproject/shims": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/shims/-/shims-5.7.0.tgz", - "integrity": "sha512-WeDptc6oAprov5CCN2LJ/6/+dC9gTonnkdAtLepm/7P5Z+3PRxS5NpfVWmOMs1yE4Vitl2cU8bOPWC0GvGSbVg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] - }, "node_modules/@ethersproject/signing-key": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", @@ -3927,6 +3940,53 @@ "ethers": "5.7.2" } }, + "node_modules/@ledgerhq/evm-tools/node_modules/ethers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" + } + }, "node_modules/@ledgerhq/hw-app-eth": { "version": "6.35.1", "resolved": "https://registry.npmjs.org/@ledgerhq/hw-app-eth/-/hw-app-eth-6.35.1.tgz", @@ -6720,9 +6780,9 @@ } }, "node_modules/aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" }, "node_modules/ajv": { "version": "6.12.6", @@ -8448,6 +8508,27 @@ "node": ">= 8" } }, + "node_modules/crypto-browserify": { + "version": "3.12.0", + "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", + "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", + "dependencies": { + "browserify-cipher": "^1.0.0", + "browserify-sign": "^4.0.0", + "create-ecdh": "^4.0.0", + "create-hash": "^1.1.0", + "create-hmac": "^1.1.0", + "diffie-hellman": "^5.0.0", + "inherits": "^2.0.1", + "pbkdf2": "^3.0.3", + "public-encrypt": "^4.0.0", + "randombytes": "^2.0.0", + "randomfill": "^1.0.3" + }, + "engines": { + "node": "*" + } + }, "node_modules/crypto-js": { "version": "4.2.0", "resolved": "https://registry.npmjs.org/crypto-js/-/crypto-js-4.2.0.tgz", @@ -9894,13 +9975,13 @@ "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" }, "node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "version": "6.9.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.9.2.tgz", + "integrity": "sha512-YpkrtILnMQz5jSEsJQRTpduaGT/CXuLnUIuOYzHA0v/7c8IX91m2J48wSKjzGL5L9J/Us3tLoUdb+OwE3U+FFQ==", "funding": [ { "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + "url": "https://github.com/sponsors/ethers-io/" }, { "type": "individual", @@ -9908,36 +9989,63 @@ } ], "dependencies": { - "@ethersproject/abi": "5.7.0", - "@ethersproject/abstract-provider": "5.7.0", - "@ethersproject/abstract-signer": "5.7.0", - "@ethersproject/address": "5.7.0", - "@ethersproject/base64": "5.7.0", - "@ethersproject/basex": "5.7.0", - "@ethersproject/bignumber": "5.7.0", - "@ethersproject/bytes": "5.7.0", - "@ethersproject/constants": "5.7.0", - "@ethersproject/contracts": "5.7.0", - "@ethersproject/hash": "5.7.0", - "@ethersproject/hdnode": "5.7.0", - "@ethersproject/json-wallets": "5.7.0", - "@ethersproject/keccak256": "5.7.0", - "@ethersproject/logger": "5.7.0", - "@ethersproject/networks": "5.7.1", - "@ethersproject/pbkdf2": "5.7.0", - "@ethersproject/properties": "5.7.0", - "@ethersproject/providers": "5.7.2", - "@ethersproject/random": "5.7.0", - "@ethersproject/rlp": "5.7.0", - "@ethersproject/sha2": "5.7.0", - "@ethersproject/signing-key": "5.7.0", - "@ethersproject/solidity": "5.7.0", - "@ethersproject/strings": "5.7.0", - "@ethersproject/transactions": "5.7.0", - "@ethersproject/units": "5.7.0", - "@ethersproject/wallet": "5.7.0", - "@ethersproject/web": "5.7.1", - "@ethersproject/wordlists": "5.7.0" + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/ethers/node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/ethers/node_modules/tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "node_modules/ethers/node_modules/ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": "^5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } } }, "node_modules/event-target-shim": { @@ -10306,12 +10414,6 @@ "micromatch": "^4.0.2" } }, - "node_modules/findit": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/findit/-/findit-2.0.0.tgz", - "integrity": "sha512-ENZS237/Hr8bjczn5eKuBohLgaD0JyUd0arxretR1f9RO46vZHA1b2y0VorgGV3WaOT3c+78P8h7v4JGJ1i/rg==", - "dev": true - }, "node_modules/flat-cache": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-3.0.4.tgz", @@ -11046,22 +11148,6 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" }, - "node_modules/is-arguments": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", - "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-array-buffer": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", @@ -14489,22 +14575,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", @@ -14588,18 +14658,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha512-tqa/UMy/CCoYmj+H5qc07qvSL9dqcs/WZENZ1JbtWBlATP+iVOe778gE6MSijnyCnORzDuX6hU+LA4SZ09YjFQ==", - "dev": true, - "dependencies": { - "isobject": "^3.0.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/object.values": { "version": "1.1.6", "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.1.6.tgz", @@ -15903,6 +15961,98 @@ "react-native-svg": "^13.2.0" } }, + "node_modules/react-native-quick-base64": { + "version": "2.0.8", + "resolved": "https://registry.npmjs.org/react-native-quick-base64/-/react-native-quick-base64-2.0.8.tgz", + "integrity": "sha512-2kMlnLSy0qz4NA0KXMGugd3qNB5EAizxZ6ghEVNGIxAOlc9CGvC8miv35wgpFbSKeiaBRfcPfkdTM/5Erb/6SQ==", + "dependencies": { + "base64-js": "^1.5.1" + }, + "peerDependencies": { + "react": "*", + "react-native": "*" + } + }, + "node_modules/react-native-quick-crypto": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/react-native-quick-crypto/-/react-native-quick-crypto-0.6.1.tgz", + "integrity": "sha512-s6uFo7tcI3syo8/y5j+t6Rf+KVSuRKDp6tH04A0vjaHptJC6Iu7DVgkNYO7aqtfrYn8ZUgQ/Kqaq+m4i9TxgIQ==", + "dependencies": { + "@craftzdog/react-native-buffer": "^6.0.5", + "@types/node": "^17.0.31", + "crypto-browserify": "^3.12.0", + "events": "^3.3.0", + "react-native-quick-base64": "^2.0.5", + "stream-browserify": "^3.0.0", + "string_decoder": "^1.3.0" + }, + "peerDependencies": { + "react": "*", + "react-native": ">=0.71.0" + } + }, + "node_modules/react-native-quick-crypto/node_modules/@types/node": { + "version": "17.0.45", + "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", + "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" + }, + "node_modules/react-native-quick-crypto/node_modules/events": { + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", + "engines": { + "node": ">=0.8.x" + } + }, + "node_modules/react-native-quick-crypto/node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/react-native-quick-crypto/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] + }, + "node_modules/react-native-quick-crypto/node_modules/stream-browserify": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", + "dependencies": { + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" + } + }, + "node_modules/react-native-quick-crypto/node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, "node_modules/react-native-randombytes": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/react-native-randombytes/-/react-native-randombytes-3.6.1.tgz", @@ -16471,84 +16621,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, - "node_modules/rn-nodeify": { - "version": "10.3.0", - "resolved": "https://registry.npmjs.org/rn-nodeify/-/rn-nodeify-10.3.0.tgz", - "integrity": "sha512-EZB3M4M5i8yySCWF7AAZ31xU7cpdLuIKMlVxXji9t0aY8Ojy3BAyRt1sTp0OwBgy1ejShmlIu2L4f8mToJ+uvg==", - "dev": true, - "dependencies": { - "@yarnpkg/lockfile": "^1.0.0", - "deep-equal": "^1.0.0", - "findit": "^2.0.0", - "fs-extra": "^0.22.1", - "minimist": "^1.1.2", - "object.pick": "^1.1.1", - "run-parallel": "^1.1.2", - "semver": "^5.0.1", - "xtend": "^4.0.0" - }, - "bin": { - "rn-nodeify": "cmd.js" - } - }, - "node_modules/rn-nodeify/node_modules/deep-equal": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.1.1.tgz", - "integrity": "sha512-yd9c5AdiqVcR+JjcwUQb9DkhJc8ngNr0MahEBGvDiJw8puWab2yZlh+nkasOnZP+EGTAP6rRp2JzJhJZzvNF8g==", - "dev": true, - "dependencies": { - "is-arguments": "^1.0.4", - "is-date-object": "^1.0.1", - "is-regex": "^1.0.4", - "object-is": "^1.0.1", - "object-keys": "^1.1.1", - "regexp.prototype.flags": "^1.2.0" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/rn-nodeify/node_modules/fs-extra": { - "version": "0.22.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-0.22.1.tgz", - "integrity": "sha512-M7CuxS2f9k/5il8ufmLiCtT7B2O2JLoTZi83ZtyEJMG67cTn87fNULYWtno5Vm31TxmSRE0nkA9GxaRR+y3XTA==", - "dev": true, - "dependencies": { - "graceful-fs": "^4.1.2", - "jsonfile": "^2.1.0", - "rimraf": "^2.2.8" - } - }, - "node_modules/rn-nodeify/node_modules/jsonfile": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-2.4.0.tgz", - "integrity": "sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw==", - "dev": true, - "optionalDependencies": { - "graceful-fs": "^4.1.6" - } - }, - "node_modules/rn-nodeify/node_modules/rimraf": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.7.1.tgz", - "integrity": "sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==", - "dev": true, - "dependencies": { - "glob": "^7.1.3" - }, - "bin": { - "rimraf": "bin.js" - } - }, - "node_modules/rn-nodeify/node_modules/semver": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", - "integrity": "sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -17499,11 +17571,6 @@ "url": "https://paulmillr.com/funding/" } }, - "node_modules/tronweb/node_modules/aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" - }, "node_modules/tronweb/node_modules/axios": { "version": "0.26.1", "resolved": "https://registry.npmjs.org/axios/-/axios-0.26.1.tgz", @@ -17531,44 +17598,6 @@ "@scure/bip39": "1.2.1" } }, - "node_modules/tronweb/node_modules/ethers": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.7.1.tgz", - "integrity": "sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/ethers-io/" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@adraffy/ens-normalize": "1.9.2", - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.7.1", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - }, - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tronweb/node_modules/ethers/node_modules/@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, "node_modules/tronweb/node_modules/semver": { "version": "5.7.2", "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.2.tgz", @@ -17577,31 +17606,6 @@ "semver": "bin/semver" } }, - "node_modules/tronweb/node_modules/tslib": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", - "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" - }, - "node_modules/tronweb/node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", - "engines": { - "node": ">=10.0.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, "node_modules/tsconfig-paths": { "version": "3.14.2", "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.14.2.tgz", diff --git a/package.json b/package.json index a92c6e6..2553067 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,7 @@ "version": "1.5.1", "private": true, "scripts": { - "postinstall": "./node_modules/.bin/rn-nodeify --hack --install 'crypto,buffer,stream,http,https' --hack && patch-package", + "postinstall": "patch-package", "android": "react-native run-android", "ios": "react-native run-ios", "lint": "eslint --quiet --no-error-on-unmatched-pattern . --ext .ts,.tsx --cache", @@ -19,7 +19,6 @@ }, "dependencies": { "@ethereumjs/util": "^8.0.3", - "@ethersproject/shims": "^5.7.0", "@ledgerhq/hw-app-eth": "^6.35.1", "@ledgerhq/hw-app-trx": "^6.28.1", "@ledgerhq/react-native-hid": "^6.31.1", @@ -42,7 +41,7 @@ "domain-browser": "^1.2.0", "ethereumjs-units": "^0.2.0", "ethereumjs-wallet": "^1.0.2", - "ethers": "^5.7.2", + "ethers": "^6.9.2", "events": "^1.1.1", "https-browserify": "^0.0.1", "i18next": "^22.4.9", @@ -66,9 +65,10 @@ "react-native-device-info": "^10.9.0", "react-native-encrypted-storage": "^4.0.3", "react-native-gesture-handler": "^2.14.0", - "react-native-get-random-values": "^1.8.0", "react-native-keychain": "^8.1.1", "react-native-qrcode-svg": "^6.2.0", + "react-native-quick-base64": "^2.0.8", + "react-native-quick-crypto": "^0.6.1", "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^3.6.1", "react-native-safe-area-context": "^4.8.2", @@ -91,7 +91,6 @@ }, "devDependencies": { "@babel/core": "^7.23.7", - "@tsconfig/react-native": "^3.0.2", "@babel/plugin-transform-flow-strip-types": "^7.23.3", "@babel/preset-env": "^7.23.7", "@babel/runtime": "^7.23.7", @@ -99,6 +98,7 @@ "@react-native/eslint-config": "^0.73.1", "@react-native/metro-config": "^0.73.2", "@react-native/typescript-config": "^0.73.1", + "@tsconfig/react-native": "^3.0.2", "@types/bip39": "^2.4.2", "@types/jest": "^29.2.1", "@types/lodash": "^4.14.191", @@ -121,32 +121,9 @@ "react-native-dotenv": "^3.4.7", "react-native-svg-transformer": "^1.3.0", "react-test-renderer": "18.2.0", - "rn-nodeify": "^10.3.0", "typescript": "5.0.4" }, "engines": { "node": ">=18" - }, - "react-native": { - "_stream_transform": "readable-stream/transform", - "_stream_readable": "readable-stream/readable", - "_stream_writable": "readable-stream/writable", - "_stream_duplex": "readable-stream/duplex", - "_stream_passthrough": "readable-stream/passthrough", - "stream": "stream-browserify", - "crypto": "react-native-crypto", - "http": "@tradle/react-native-http", - "https": "https-browserify" - }, - "browser": { - "_stream_transform": "readable-stream/transform", - "_stream_readable": "readable-stream/readable", - "_stream_writable": "readable-stream/writable", - "_stream_duplex": "readable-stream/duplex", - "_stream_passthrough": "readable-stream/passthrough", - "stream": "stream-browserify", - "crypto": "react-native-crypto", - "http": "@tradle/react-native-http", - "https": "https-browserify" } } diff --git a/shim.js b/shim.js deleted file mode 100644 index d509704..0000000 --- a/shim.js +++ /dev/null @@ -1,27 +0,0 @@ -if (typeof __dirname === 'undefined') global.__dirname = '/'; -if (typeof __filename === 'undefined') global.__filename = ''; -if (typeof process === 'undefined') { - global.process = require('process'); -} else { - const bProcess = require('process'); - for (const p in bProcess) { - if (!(p in process)) { - process[p] = bProcess[p]; - } - } -} - -process.browser = false; -if (typeof Buffer === 'undefined') global.Buffer = require('buffer').Buffer; - -// global.location = global.location || { port: 80 } -const isDev = typeof __DEV__ === 'boolean' && __DEV__; -Object.assign(process.env, { NODE_ENV: isDev ? 'development' : 'production' }); -if (typeof localStorage !== 'undefined') { - // eslint-disable-next-line no-undef - localStorage.debug = isDev ? '*' : ''; -} - -// If using the crypto shim, uncomment the following line to ensure -// crypto is loaded first, so it can populate global.crypto -require('crypto'); diff --git a/src/components/Calculator.tsx b/src/components/Calculator.tsx index cd7c7fc..beab2d2 100644 --- a/src/components/Calculator.tsx +++ b/src/components/Calculator.tsx @@ -1,6 +1,6 @@ import React, { useEffect, useMemo, useRef, useState } from 'react'; -import { BigNumber, utils } from 'ethers'; +import { parseUnits } from 'ethers'; import { useTranslation } from 'react-i18next'; import styled from 'styled-components/native'; @@ -14,6 +14,7 @@ import BottomSheet from '@containers/Bottomsheet'; import useBalances from '@hooks/useBalances'; import useBlockchainData from '@hooks/useBlockchainData'; import { INPUT_NUMBER, localizeNumber, numberToFormattedString } from '@utils/formatter'; +import { isZero } from '@utils/number'; import type { TokenSymbol } from '@web3/tokens'; type CalculatorProps = { @@ -23,7 +24,7 @@ type CalculatorProps = { loading?: boolean; disabled?: boolean; tokenSymbol?: TokenSymbol; - transactionFee?: BigNumber; + transactionFee?: bigint; }; const ANIMATION_DURATION = 1000; @@ -99,7 +100,7 @@ const Calculator = ({ loading = false, visible = false, disabled = false, - transactionFee = BigNumber.from(0), + transactionFee = 0n, }: CalculatorProps) => { const { t } = useTranslation(); @@ -126,11 +127,11 @@ const Calculator = ({ const maxAmount = useMemo(() => { const balance = token ? tokenBalances?.[token.symbol] : null; - if (token?.symbol !== blockchainBaseToken.symbol) return balance || BigNumber.from(0); + if (token?.symbol !== blockchainBaseToken.symbol) return balance || 0n; - const max = balance?.sub(transactionFee) || BigNumber.from(0); + const max = (balance || 0n) - transactionFee; - return max.isNegative() ? BigNumber.from(0) : max; + return max < 0n ? 0n : max; }, [tokenBalances, token, transactionFee]); const resetState = () => { @@ -145,8 +146,8 @@ const Calculator = ({ useEffect(() => { if (!token || !tokenBalances) return; - const amountBN = utils.parseUnits(amount, token.decimals); - setBalanceExceeded(amountBN.gt(maxAmount)); + const amountBN = parseUnits(amount, token.decimals); + setBalanceExceeded(amountBN > maxAmount); }, [amount, tokenBalances, token]); const onKeyPress = (key: string) => setAmount((prevAmount) => { @@ -178,9 +179,9 @@ const Calculator = ({ }; const onPressPill = (percentage: number) => { - if (!token || !tokenBalances || maxAmount.isZero()) return; + if (!token || !tokenBalances || isZero(maxAmount)) return; - const newAmount = maxAmount.mul(percentage).div(100); + const newAmount = (maxAmount * BigInt(percentage)) / 100n; setAmount(numberToFormattedString(newAmount, { decimals: token.decimals, localize: false, @@ -252,7 +253,7 @@ const Calculator = ({ noI18n /> {balanceExceeded && } - {!transactionFee.isZero() && ( + {!isZero(transactionFee) && ( - - {isErc20Fee && ( + {!!isErc20Fee && ( <> - {txFee.bandwithFee.isZero() && } + {isZero(txFee.bandwithFee) && } {!!txFee.energyNeeded && ( @@ -123,10 +123,10 @@ const EstimatedTxFee = ({ energy: numberToFormattedString(txFee.energyNeeded), }} /> - {txFee.energyFee.isZero() && } + {isZero(txFee.energyFee) && } )} - {!txFee.activationFee.isZero() && ( + {!isZero(txFee.activationFee) && ( )} - {!txFee?.totalFee.isZero() && ( + {!isZero(txFee?.totalFee) && ( <> & { - balance?: BigNumber; + balance?: bigint; balanceLoading?: boolean; withoutMargin?: boolean; fullName?: boolean; diff --git a/src/hooks/useBalances.ts b/src/hooks/useBalances.ts index 6e931f0..c25de7a 100644 --- a/src/hooks/useBalances.ts +++ b/src/hooks/useBalances.ts @@ -1,17 +1,17 @@ import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'; -import { BigNumber } from 'ethers'; import useBlockchainData from './useBlockchainData'; import useNotifications from './useNotifications'; import useWalletPublicValues from './useWalletPublicValues'; import { ReactQueryKeys } from '@utils/constants'; +import { isZero } from '@utils/number'; import { Blockchains } from '@web3/constants'; import type { TokensBalance, TokenSymbol } from '@web3/tokens'; import { getWalletBalance } from '@web3/wallet'; export type TokensBalanceArrayItem = { symbol: TokenSymbol; - balance: BigNumber; + balance: bigint; }; type UseBalancesReturn = { @@ -73,7 +73,7 @@ const useBalances = (options: UseBalancesProps = {}): UseBalancesReturn => { symbol, balance, }; - if (balance.isZero()) { + if (isZero(balance)) { acc.zeroBalances.push(item as TokensBalanceArrayItem); } else { acc.balances.push(item as TokensBalanceArrayItem); diff --git a/src/hooks/useBlockchainData.ts b/src/hooks/useBlockchainData.ts index edf0a99..3756968 100644 --- a/src/hooks/useBlockchainData.ts +++ b/src/hooks/useBlockchainData.ts @@ -2,7 +2,7 @@ import { useMemo } from 'react'; import { useAsyncStorage } from '@react-native-async-storage/async-storage'; import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query'; -import { providers } from 'ethers'; +import { Provider } from 'ethers'; import { zipObject } from 'lodash'; import StorageKeys from '@system/storageKeys'; @@ -29,7 +29,7 @@ type UseBlockchainDataReturn = { [blockchain in Blockchains]: TokenSymbol; }; blockchain: Blockchains; - blockchainProvider: providers.Provider | typeof tronProvider; + blockchainProvider: Provider | typeof tronProvider; tokens: TokensStruct; blockchainBaseToken: TokenType; }; diff --git a/src/hooks/useNews.tsx b/src/hooks/useNews.tsx index 76f38e4..ea857a7 100644 --- a/src/hooks/useNews.tsx +++ b/src/hooks/useNews.tsx @@ -1,5 +1,4 @@ import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'; -import { BigNumber } from 'ethers'; import { useTranslation } from 'react-i18next'; import useNotifications from './useNotifications'; @@ -8,11 +7,6 @@ import { ArticleResponse, getLatestNews } from '@http/news'; import { ReactQueryKeys } from '@utils/constants'; import type { TokenSymbol, TokenType } from '@web3/tokens'; -export type TokensBalanceArrayItem = { - symbol: TokenSymbol; - balance: BigNumber; -}; - type UseNewsReturn = { news?: ArticleResponse[] | null; newsLoading: boolean; @@ -77,4 +71,4 @@ const useNews = ({ }; }; -export default useNews; \ No newline at end of file +export default useNews; diff --git a/src/hooks/useTokenConversions.ts b/src/hooks/useTokenConversions.ts index 3adaf18..76f0811 100644 --- a/src/hooks/useTokenConversions.ts +++ b/src/hooks/useTokenConversions.ts @@ -1,11 +1,12 @@ import { useQuery, useQueryClient, UseQueryOptions } from '@tanstack/react-query'; -import { BigNumber, utils } from 'ethers'; +import { parseUnits } from 'ethers'; import useConsolidatedCurrency from './useConsolidatedCurrency'; import useNotifications from './useNotifications'; import { getTokenConversions, TokenConversionsEndpointResponse } from '@http/tokens'; import { ReactQueryKeys } from '@utils/constants'; import { numberToFormattedString } from '@utils/formatter'; +import { isZero, toBigInt } from '@utils/number'; import type { TokenType } from '@web3/tokens'; type TokenConversion = TokenConversionsEndpointResponse['data']; @@ -13,7 +14,7 @@ type TokenConversion = TokenConversionsEndpointResponse['data']; type UseTokenConversionssReturn = { tokenConversions?: TokenConversion | null; tokenConversionsLoading: boolean; - convert: (balance: number | BigNumber, from: Omit) => number; + convert: (balance: number | bigint, from: Omit) => number; refetchTokenConversions: () => Promise; }; @@ -46,16 +47,16 @@ const useTokenConversions = (options: UseTokenConversionsProps = {}): UseTokenCo }; const convert: UseTokenConversionssReturn['convert'] = (balance, from) => { - const balanceToConvert = BigNumber.isBigNumber(balance) ? balance : BigNumber.from(balance); + const balanceToConvert = toBigInt(balance); - if (!tokenConversions || balanceToConvert.isZero()) return 0; + if (!tokenConversions || isZero(balanceToConvert)) return 0; - const to = tokenConversions[from.symbol]?.[consolidatedCurrency!] || 0; + const to = tokenConversions[from .symbol]?.[consolidatedCurrency!] || 0; const toDecimals = to.toString().split('.')?.[1]?.length || 0; const convertedBalance = balanceToConvert - .mul(utils.parseUnits(to.toString(), toDecimals)) // add extra decimals for multiplication - .div(BigNumber.from(`1${new Array(toDecimals).fill(0).join('')}`)); // remove extra decimals + * (parseUnits(to.toString(), toDecimals)) // add extra decimals for multiplication + / (BigInt(`1${new Array(toDecimals).fill(0).join('')}`)); // remove extra decimals return Number(numberToFormattedString(convertedBalance, { decimals: from.decimals, diff --git a/src/hooks/useTx.ts b/src/hooks/useTx.ts index 00efd34..16e16c3 100644 --- a/src/hooks/useTx.ts +++ b/src/hooks/useTx.ts @@ -1,7 +1,5 @@ import { useState } from 'react'; -import { BigNumber } from 'ethers'; - import useBlockchainData from './useBlockchainData'; import usePrivateKey from './usePrivateKey'; import useWalletPublicValues from './useWalletPublicValues'; @@ -21,7 +19,7 @@ type UseTxReturn = { estimatedTxFeesLoading: boolean; estimatedTxFeesError: boolean; fetchEstimateTxFees: (toAddress: string, token: TokenType) => void; - sendToken: (toAddress: string, token: TokenType, amount: BigNumber | number | string, encryptionKey?: string) => void; + sendToken: (toAddress: string, token: TokenType, amount: bigint | number | string, encryptionKey?: string) => void; sendTokenLoading: boolean; sendTokenError: boolean; }; diff --git a/src/locale/en.json b/src/locale/en.json index 744212c..d2a04bd 100644 --- a/src/locale/en.json +++ b/src/locale/en.json @@ -111,6 +111,7 @@ }, "send": { "title": "Send cryptos", + "successNotification": "Transaction completed", "notFoundsForFeeNotification": "You do not have funds to pay shipping fee", "feeDescription": { "ETHEREUM": "The **gas** is the toll that is used to carry out operations on the **blockchain**.", diff --git a/src/locale/es.json b/src/locale/es.json index 838048c..20b2911 100644 --- a/src/locale/es.json +++ b/src/locale/es.json @@ -111,6 +111,7 @@ }, "send": { "title": "Enviar cryptos", + "successNotification": "Transacción finalizada", "notFoundsForFeeNotification": "No posee fondos para pagar las comisiones de envió", "feeDescription": { "ETHEREUM": "El **gas** es el peaje que se utiliza para realizar operaciones en la **blockchain**.", diff --git a/src/screens/main/SendScreen.tsx b/src/screens/main/SendScreen.tsx index 33e5267..f1da1e4 100644 --- a/src/screens/main/SendScreen.tsx +++ b/src/screens/main/SendScreen.tsx @@ -30,6 +30,7 @@ import useWalletPublicValues from '@hooks/useWalletPublicValues'; import type { WalletTx } from '@http/tx/types'; import { ScreenName } from '@navigation/constants'; import { MainNavigatorType } from '@navigation/MainNavigator'; +import { isZero } from '@utils/number'; import { TokenSymbol, TokenType } from '@web3/tokens'; import { isValidAddressToSend } from '@web3/tx'; import { SenndTxReturn } from '@web3/tx/types'; @@ -97,11 +98,14 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { tokens.find(({ symbol }) => (symbol === route.params?.tokenToSendSymbol)) || null, ); - const goToHome = useCallback(() => navigation.navigate(ScreenName.home), []); + const goToHomeAfterSendTx = useCallback(() => { + dispatchNotification('main.send.successNotification', 'success'); + navigation.navigate(ScreenName.home); + }, []); const onAddSuccess = useCallback((txData: WalletTx) => { if (!tokenToSend || !txData) { - goToHome(); + goToHomeAfterSendTx(); return; } @@ -118,7 +122,7 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { txs, txsLoading, } = useMiningPendingTxs({ - onAddError: goToHome, + onAddError: goToHomeAfterSendTx, onAddSuccess, }); @@ -155,7 +159,7 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { ), [blockchainBaseToken, tokenBalances]); const hasNotBalanceForFee = useMemo(() => ( - estimatedTxFees?.totalFee.gt(blockchainBaseTokenBalance) || false + (estimatedTxFees?.totalFee || 0n) > blockchainBaseTokenBalance || false ), [estimatedTxFees, tokenBalances]); const allDataSetted = !addressToSendError && !!addressToSend && !!tokenToSend?.symbol; @@ -208,7 +212,7 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { } closeCalculator(); - if (estimatedTxFees?.totalFee.gt(blockchainBaseTokenBalance)) { + if ((estimatedTxFees?.totalFee || 0n) > blockchainBaseTokenBalance) { dispatchNotification('main.send.notFoundsForFeeNotification', 'error'); return; } @@ -233,12 +237,12 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { if (qrError) { dispatchNotification('main.send.invalidQr', 'error'); setAddressToSend(''); + setAddressToSendError(false); closeQrScanner(); return; } - setAddressToSendError(false); - setAddressToSend(address); + onAddressChange(address); closeQrScanner(); }; @@ -260,7 +264,7 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { data: token, label: token.name, leftComponent: , - disabled: !tokenBalances || tokenBalances?.[token.symbol].isZero(), + disabled: !tokenBalances || isZero(tokenBalances?.[token.symbol]), }; }); }, [tokenBalances]); @@ -302,7 +306,7 @@ const SendScreen = ({ navigation, route }: SendScreenProps) => { withoutMargin withBorders={selected} borderColor={theme.colors.success} - disabled={tokenBalances?.[option.data.symbol].isZero()} + disabled={isZero(tokenBalances?.[option.data.symbol])} balanceLoading={tokenBalancesLoading} balance={tokenBalances?.[option.data.symbol]} {...option.data} diff --git a/src/screens/main/TokenScreen.tsx b/src/screens/main/TokenScreen.tsx index 155cc39..7c249aa 100644 --- a/src/screens/main/TokenScreen.tsx +++ b/src/screens/main/TokenScreen.tsx @@ -2,7 +2,6 @@ import React, { useMemo, useState } from 'react'; import Clipboard from '@react-native-clipboard/clipboard'; import { NativeStackScreenProps } from '@react-navigation/native-stack'; -import { BigNumber } from 'ethers'; import styled from 'styled-components/native'; import Button from '@components/Button'; @@ -30,6 +29,7 @@ import useWalletPublicValues from '@hooks/useWalletPublicValues'; import { ScreenName } from '@navigation/constants'; import { MainNavigatorType } from '@navigation/MainNavigator'; import { numberToFiatBalance, numberToFormattedString } from '@utils/formatter'; +import { isZero } from '@utils/number'; const TokenBaseInfo = styled.View` flex-direction: row; @@ -120,16 +120,13 @@ const TokenScreen = ({ navigation, route }: TokenScreenProps) => { } = useMiningPendingTxs(); const tokenBalance = useMemo(() => { - const zero = BigNumber.from(0); - if (!token) return zero; + if (!token) return 0n; - return tokenBalances?.[token.symbol] || zero; + return tokenBalances?.[token.symbol] || 0n; }, [tokenSymbol]); const tokenBalanceConverted = useMemo(() => { - const zero = BigNumber.from(0); - - if (!token) return zero; + if (!token) return 0n; return convert(tokenBalance, token); }, [tokenBalance, tokenConversions]); @@ -221,7 +218,7 @@ const TokenScreen = ({ navigation, route }: TokenScreenProps) => { bigTitle > - {!tokenBalance.isZero() && ( + {!isZero(tokenBalance) && ( BigNumber.from(tx.gasPrice || '0').mul(tx.gasUsed || 0), [tx]); + const txGasTotal = useMemo(() => BigInt(tx.gasPrice || '0') * (BigInt(tx.gasUsed || 0) || 0n), [tx]); const status = txStatus(tx); const isSending = isSendTx(tx, address); const txIcon = isSending ? 'arrow-right' : 'arrow-left'; const txIconColor = isSending ? theme.colors.error : theme.colors.success; const txAddress = isSending ? tx.to : tx.from; - const balance = BigNumber.from(tx.value); + const balance = BigInt(tx.value); const balanceFormatted = numberToFormattedString(balance || 0, { decimals: token.decimals }); const balanceConverted = numberToFiatBalance(convert(balance || 0, token), consolidatedCurrency); @@ -189,7 +189,7 @@ const TxScreen = ({ - {!txGasTotal.isZero() && ( + {!isZero(txGasTotal) && ( @@ -219,4 +219,4 @@ const TxScreen = ({ ); }; -export default TxScreen; \ No newline at end of file +export default TxScreen; diff --git a/src/utils/formatter.ts b/src/utils/formatter.ts index eae86b1..c620e88 100644 --- a/src/utils/formatter.ts +++ b/src/utils/formatter.ts @@ -1,7 +1,8 @@ -import { BigNumber, utils } from 'ethers'; +import { formatUnits } from 'ethers'; import { t } from 'i18next'; import { FIAT_DECIMALS } from './constants'; +import { toBigInt } from './number'; export const PASSWORD_REGEX = /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)[a-zA-Z\d]{8,}$/; export const INPUT_NUMBER = /^(\d)*.?(\d)*$/; @@ -28,7 +29,7 @@ export const localizeNumber = (number: string): string => { }; export const numberToFormattedString = ( - number: BigNumber | number | string, + number: bigint | number | string, { decimals = 0, localize = true, @@ -36,7 +37,7 @@ export const numberToFormattedString = ( }: NumberToFormattedStringOptions = {}, ): string => { const baseFormattedNumber = decimals - ? utils.formatUnits(number, decimals) + ? formatUnits(toBigInt(number), decimals) : number.toString(); const splittedNumber = baseFormattedNumber.split('.'); @@ -54,7 +55,7 @@ export const numberToFormattedString = ( }; export const numberToFiatBalance = ( - number: BigNumber | number, + number: bigint | number, symbol?: string, ): string => ( `≈ ${numberToFormattedString(number, { fixedDecimals: FIAT_DECIMALS })}${symbol ? ` ${symbol}` : ''}` diff --git a/src/utils/number.ts b/src/utils/number.ts index c520e59..76e0a34 100644 --- a/src/utils/number.ts +++ b/src/utils/number.ts @@ -1,12 +1,9 @@ -import { BigNumber, utils } from 'ethers'; +export const isBigInt = (value: any) => typeof value === 'bigint'; -export const bigNumberMulNumber = (number: BigNumber, mul: number, decimals: number): number => { - try { - return number.mul(mul).toNumber(); +export const toBigInt = (number: bigint | number | string = 0) => ( + isBigInt(number) + ? number as bigint + : BigInt(number) +); - } catch (error) { - const balanceNormalNumber = Number(utils.formatUnits(number, decimals)); - - return balanceNormalNumber * mul; - } -}; +export const isZero = (number: bigint | number | string = 0) => toBigInt(number) === 0n; diff --git a/src/web3/providers.ts b/src/web3/providers.ts index c95993b..c0b89b9 100644 --- a/src/web3/providers.ts +++ b/src/web3/providers.ts @@ -18,9 +18,9 @@ const ETHEREUM_NETWORK_MAIN = 'mainnet'; const ETHEREUM_NETWORK = isDev() ? ETHEREUM_NETWORK_DEV : ETHEREUM_NETWORK_MAIN; const TRON_PROVIDER = isDev() ? WEB3_TRON_TESTNET_PROVIDER_VENDOR : WEB3_TRON_PROVIDER_VENDOR; -export const ethereumProvider = new ethers.providers.InfuraProvider(ETHEREUM_NETWORK, WEB3_ETH_PROVIDER_VENDOR); -export const polygonProvider = new ethers.providers.JsonRpcProvider(WEB3_POLYGON_PROVIDER_VENDOR); -export const bscProvider = new ethers.providers.JsonRpcProvider(WEB3_BSC_PROVIDER_VENDOR); +export const ethereumProvider = new ethers.InfuraProvider(ETHEREUM_NETWORK, WEB3_ETH_PROVIDER_VENDOR); +export const polygonProvider = new ethers.JsonRpcProvider(WEB3_POLYGON_PROVIDER_VENDOR); +export const bscProvider = new ethers.JsonRpcProvider(WEB3_BSC_PROVIDER_VENDOR); export const tronProvider = new TronWeb({ fullHost: TRON_PROVIDER, headers: { 'TRON-PRO-API-KEY': WEB3_TRON_PROVIDER_VENDOR_KEY }, diff --git a/src/web3/tokens.ts b/src/web3/tokens.ts index 68e6f21..4c1a800 100644 --- a/src/web3/tokens.ts +++ b/src/web3/tokens.ts @@ -1,5 +1,3 @@ -import type { BigNumber } from 'ethers'; - import { Blockchains, DEFAULT_BLOCKCHAIN } from './constants'; import { isDev } from '@utils/config'; @@ -30,7 +28,7 @@ export type TokensStruct = { }; export type TokensBalance = { - [token in TokenSymbol]: BigNumber; + [token in TokenSymbol]: bigint; }; const TOKENS_ETH_MAINNET: TokensStruct = { diff --git a/src/web3/tx/erc20.tx.ts b/src/web3/tx/erc20.tx.ts index a860d6d..4034b7e 100644 --- a/src/web3/tx/erc20.tx.ts +++ b/src/web3/tx/erc20.tx.ts @@ -1,9 +1,20 @@ -import type { SignatureLike } from '@ethersproject/bytes'; import AppEth, { ledgerService } from '@ledgerhq/hw-app-eth'; -import { BigNumber, Contract, VoidSigner, Wallet, providers, utils } from 'ethers'; +import { + Contract, + VoidSigner, + Wallet, + Provider, + TransactionRequest, + parseUnits, + resolveProperties, + Transaction, + isAddress, + SignatureLike, +} from 'ethers'; import { ERC20TxFees, EstimateFees, NO_TX_TO_SIGN_ERROR, ProcessTxToSave, SendTx } from './types'; import { ERC20WalletTx } from '@http/tx/types'; +import { isBigInt } from '@utils/number'; import { BLOCKCHAINS_CONFIG, Blockchains } from '@web3/constants'; import getProvider from '@web3/providers'; import { BASE_TOKENS_TRANSFER_ABI } from '@web3/smartContracts'; @@ -13,17 +24,17 @@ import { BASE_ADDRESS_INDEX, connectHw, getDerivationPath } from '@web3/wallet'; export type TxInfo = { chainId: number; - maxFeePerGas: BigNumber; - maxPriorityFeePerGas: BigNumber; - gasPrice: BigNumber; - gasUnits: BigNumber; - totalFee: BigNumber; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + gasPrice: bigint; + gasUnits: bigint; + totalFee: bigint; }; const estimateErc20TxInfo: EstimateFees = async ( blockchain, @@ -31,7 +42,7 @@ const estimateErc20TxInfo: EstimateFees => { - const provider = getProvider(blockchain) as providers.Provider; + const provider = getProvider(blockchain) as Provider; const blockchainConfig = BLOCKCHAINS_CONFIG[blockchain]; const [ @@ -44,7 +55,7 @@ const estimateErc20TxInfo: EstimateFees = { + const tx: TransactionRequest = { from: fromAddress, to: toAddress, gasLimit: 0, @@ -66,28 +77,28 @@ const estimateErc20TxInfo: EstimateFees = async ( privateKey: '', }, ) => { - const provider = getProvider(blockchain) as providers.Provider; + const provider = getProvider(blockchain) as Provider; const blockchainConfig = BLOCKCHAINS_CONFIG[blockchain]; @@ -171,10 +182,10 @@ export const erc20send: SendTx = async ( provider.getTransactionCount(fromAddress, 'pending'), ]); - const gasLimit = txEstimations.gasUnits.toNumber(); - const amount = BigNumber.isBigNumber(quantity) + const gasLimit = Number(txEstimations.gasUnits); + const amount = isBigInt(quantity) ? quantity - : utils.parseUnits(quantity.toString(), token.decimals); + : parseUnits(quantity.toString(), token.decimals); const txFees = blockchainConfig.hasMaxFeePerGas ? { maxFeePerGas: txEstimations.maxFeePerGas, @@ -184,8 +195,9 @@ export const erc20send: SendTx = async ( gasPrice: txEstimations.gasPrice, }; - const tx: Omit, 'nonce'> & { + const tx: Omit & { nonce: number; + to: string; } = { from: fromAddress, to: toAddress, @@ -204,15 +216,20 @@ export const erc20send: SendTx = async ( } if (isHw) { const { from, ...txToResolveProperties } = tx; - const txToSerialize = await utils.resolveProperties(txToResolveProperties); - const unsignedTx = utils.serializeTransaction(txToSerialize).substring(2); + const txToSerialize = await resolveProperties(txToResolveProperties); + const unsignedTx = Transaction.from(txToSerialize).serialized.substring(2); const sig = await erc20SignTxWithLedger(blockchain, { bluetoothConnection: hwBluetooth, tx: unsignedTx, }); - const { hash } = await provider.sendTransaction(utils.serializeTransaction(txToSerialize, sig)); + const serializedTx = Transaction.from({ + ...txToSerialize, + signature: sig, + }).serialized; + + const { hash } = await provider.broadcastTransaction(serializedTx); return { hash }; } @@ -223,24 +240,26 @@ export const erc20send: SendTx = async ( }; export const erc20ProcessTxToSave: ProcessTxToSave = async ({ hash, blockchain }) => { - const provider = getProvider(blockchain) as providers.Provider; + const provider = getProvider(blockchain) as Provider; const txData = await provider.getTransaction(hash); if (!txData) return null; + const confirmations = await txData.confirmations(); + const walletTx = { blockchain, - confirmations: txData.confirmations, + confirmations, contractAddress: BASE_TOKEN_ADDRESS, from: txData.from, to: txData.to || '', - gasPrice: (txData.gasPrice || txData.maxFeePerGas || BigNumber.from(0)).toString(), + gasPrice: (txData.gasPrice || txData.maxFeePerGas || 0n).toString(), hash: txData.hash, isError: false, timeStamp: (new Date()).getTime().toString(), value: (txData.value).toString(), - gasUsed: txData.gasLimit.toNumber(), + gasUsed: Number(txData.gasLimit), }; const voidData = '0x'; @@ -248,7 +267,7 @@ export const erc20ProcessTxToSave: ProcessTxToSave = async ({ has const txContract = new Contract(txData.to || '', BASE_TOKENS_TRANSFER_ABI); const decodedTxData = txContract.interface - .decodeFunctionData('transferFrom', txData.data) as [string, string, BigNumber]; + .decodeFunctionData('transferFrom', txData.data) as unknown as [string, string, BigInt]; walletTx.value = decodedTxData[2].toString(); walletTx.to = decodedTxData[1]; @@ -258,4 +277,4 @@ export const erc20ProcessTxToSave: ProcessTxToSave = async ({ has return walletTx; }; -export const erc20IsValidAddressToSend = (address: string) => utils.isAddress(address); +export const erc20IsValidAddressToSend = (address: string) => isAddress(address); diff --git a/src/web3/tx/tron.tx.ts b/src/web3/tx/tron.tx.ts index f5d6356..9b2f43d 100644 --- a/src/web3/tx/tron.tx.ts +++ b/src/web3/tx/tron.tx.ts @@ -1,9 +1,10 @@ import AppTrx from '@ledgerhq/hw-app-trx'; -import { BigNumber, utils } from 'ethers'; +import { parseUnits } from 'ethers'; import { EstimateFees, NO_TX_TO_SIGN_ERROR, ProcessTxToSave, SendTx, TronTxFees } from './types'; import { getTronTxConfirmations } from '@http/tx/tron.tx'; import { TronWalletTx } from '@http/tx/types'; +import { isBigInt } from '@utils/number'; import { Blockchains } from '@web3/constants'; import { tronProvider } from '@web3/providers'; import { BASE_TOKEN_ADDRESS, TOKENS_TRON, TokenType } from '@web3/tokens'; @@ -53,11 +54,11 @@ export const estimateTronFees: EstimateFees = async ( const accountResources = await tronProvider.trx.getAccountResources(fromAddress); - const amount = BigNumber.isBigNumber(quantity) + const amount = isBigInt(quantity) ? quantity - : utils.parseUnits(quantity.toString(), token.decimals); + : parseUnits(quantity.toString(), token.decimals); - let activationFee = BigNumber.from(0); + let activationFee = 0n; let unsignedTx = null; let energyNeeded = 0; if (isMainToken) { @@ -71,7 +72,7 @@ export const estimateTronFees: EstimateFees = async ( unsignedTx = newUnsignedTx; const needsDestinationAccountActivation = !Object.keys(toResources).length; if (needsDestinationAccountActivation) { - activationFee = utils.parseUnits((ACTIVATION_FEE).toString(), TOKENS_TRON.TRX?.decimals); + activationFee = parseUnits((ACTIVATION_FEE).toString(), TOKENS_TRON.TRX?.decimals); } } else { const functionSelector = 'transfer(address,uint256)'; @@ -112,10 +113,10 @@ export const estimateTronFees: EstimateFees = async ( ? Math.abs(accountEnergy - energyNeeded) : 0; - const bandwithFee = utils.parseUnits((bandwithMissing * BANDWITH_PRICE).toString(), 0); - const energyFee = utils.parseUnits((energyMissing * ENERGY_PRICE).toString(), 0); + const bandwithFee = parseUnits((bandwithMissing * BANDWITH_PRICE).toString(), 0); + const energyFee = parseUnits((energyMissing * ENERGY_PRICE).toString(), 0); - const totalFee = bandwithFee.add(energyFee).add(activationFee); + const totalFee = bandwithFee + energyFee + activationFee; return { bandwithNeeded, @@ -173,9 +174,9 @@ export const tronSend: SendTx = async ( privateKey: '', }, ) => { - const amount = BigNumber.isBigNumber(quantity) + const amount = isBigInt(quantity) ? quantity - : utils.parseUnits(quantity.toString(), token.decimals); + : parseUnits(quantity.toString(), token.decimals); let unsignedTx = null; if (token.address === BASE_TOKEN_ADDRESS) { @@ -188,7 +189,7 @@ export const tronSend: SendTx = async ( ]; const estimatedContractEnergy = await estimateTrc20TokenTxEnergyRequired(token, toAddress); - + const contractOptions = { feeLimit: estimatedContractEnergy * ENERGY_PRICE, }; diff --git a/src/web3/tx/types.ts b/src/web3/tx/types.ts index f9dd8b0..3743b22 100644 --- a/src/web3/tx/types.ts +++ b/src/web3/tx/types.ts @@ -1,5 +1,3 @@ -import { BigNumber } from 'ethers'; - import { WalletTx } from '@http/tx/types'; import { Blockchains } from '@web3/constants'; import { TokenType } from '@web3/tokens'; @@ -20,14 +18,14 @@ export type SendTx = ( fromAddress: string, toAddress: string, token: TokenType, - quantity: BigNumber | number | string, + quantity: bigint | number | string, signOptions: SignOptions, ) => Promise>; export type ERC20TxFees = { - gasPrice: BigNumber; - gasUnits: BigNumber; - totalFee: BigNumber; + gasPrice: bigint; + gasUnits: bigint; + totalFee: bigint; bandwithNeeded?: null; energyNeeded?: null; accountEnergy?: null; @@ -46,10 +44,10 @@ export type TronTxFees = { accountBandwidth: number; bandwithPrice: number; energyPrice: number; - bandwithFee: BigNumber; - energyFee: BigNumber; - activationFee: BigNumber; - totalFee: BigNumber; + bandwithFee: bigint; + energyFee: bigint; + activationFee: bigint; + totalFee: bigint; gasPrice?: null; gasUnits?: null; }; @@ -61,7 +59,7 @@ export type EstimateFees = ( fromAddress: string, toAddress: string, token: TokenType, - quantity?: BigNumber | number | string, + quantity?: bigint | number | string, ) => Promise; export type ProcessTxToSave = (config: { diff --git a/src/web3/wallet/wallet.erc20.ts b/src/web3/wallet/wallet.erc20.ts index 6ecd82c..713cbf5 100644 --- a/src/web3/wallet/wallet.erc20.ts +++ b/src/web3/wallet/wallet.erc20.ts @@ -1,4 +1,4 @@ -import { BigNumber, Contract, providers } from 'ethers'; +import { Contract, Provider } from 'ethers'; import { zipObject } from 'lodash'; import { GetBalance } from './types'; @@ -20,12 +20,12 @@ export const getERC20WalletBalance: GetBalance = async ( const balanceChecker = new Contract( BALANCE_CHECKER_ADDRESS[blockchain as keyof typeof BALANCE_CHECKER_ADDRESS], BALANCE_CHECKER_ABI, - provider as providers.Provider, + provider as Provider, ); const walletBalances = await balanceChecker.balances([walletAddress], tokenAddresses); return zipObject( Object.keys(tokens), - walletBalances.map((balance: BigNumber) => balance), + walletBalances.map((balance: bigint) => balance), ) as TokensBalance; }; diff --git a/src/web3/wallet/wallet.tron.ts b/src/web3/wallet/wallet.tron.ts index 7785004..89119d9 100644 --- a/src/web3/wallet/wallet.tron.ts +++ b/src/web3/wallet/wallet.tron.ts @@ -1,4 +1,4 @@ -import { BigNumber, utils } from 'ethers'; +import { parseUnits } from 'ethers'; import { zipObject } from 'lodash'; import { GetBalance } from './types'; @@ -17,7 +17,7 @@ export const getTronWalletBalance: GetBalance = async ( const tokenAddresses = Object.values(tokens).map(({ address }) => address); const trxBalanceResponse = await tronProvider.trx.getBalance(walletAddress); - const trxBalance = utils.parseUnits(trxBalanceResponse.toString(), 0); + const trxBalance = parseUnits(trxBalanceResponse.toString(), 0); const otherTokensAddresses = tokenAddresses.filter((address) => address !== BASE_TOKEN_ADDRESS); @@ -27,13 +27,13 @@ export const getTronWalletBalance: GetBalance = async ( const contract = tronProvider.contract(abi.entrys, tAddress); const balance = await contract.balanceOf(walletAddress).call(); - return utils.parseUnits(balance.toString(), 0); + return parseUnits(balance.toString(), 0); }), ); return zipObject( Object.keys(tokens), - [trxBalance, ...otherBalances].map((balance: BigNumber) => balance), + [trxBalance, ...otherBalances].map((balance: bigint) => balance), ) as TokensBalance; }; From ecb4f03a6bf6d28a1e4f849cb89d2632081b2adc Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Tue, 9 Jan 2024 23:42:04 -0300 Subject: [PATCH 2/6] update react native and remove unnecesary libs --- .../java/com/RungeCoin/MainApplication.kt | 10 +- package-lock.json | 910 ++++-------------- package.json | 42 +- patches/bip39+3.0.4.patch | 77 -- patches/bip39+3.1.0.patch | 64 ++ src/@types/ethereumjs-units.d.tsx | 6 - 6 files changed, 289 insertions(+), 820 deletions(-) delete mode 100644 patches/bip39+3.0.4.patch create mode 100644 patches/bip39+3.1.0.patch delete mode 100644 src/@types/ethereumjs-units.d.tsx diff --git a/android/app/src/main/java/com/RungeCoin/MainApplication.kt b/android/app/src/main/java/com/RungeCoin/MainApplication.kt index 98cd572..4feeb40 100644 --- a/android/app/src/main/java/com/RungeCoin/MainApplication.kt +++ b/android/app/src/main/java/com/RungeCoin/MainApplication.kt @@ -16,11 +16,11 @@ class MainApplication : Application(), ReactApplication { override val reactNativeHost: ReactNativeHost = object : DefaultReactNativeHost(this) { - override fun getPackages(): List { - // Packages that cannot be autolinked yet can be added manually here, for example: - // packages.add(new MyReactNativePackage()); - return PackageList(this).packages - } + override fun getPackages(): List = + PackageList(this).packages.apply { + // Packages that cannot be autolinked yet can be added manually here, for example: + // add(MyReactNativePackage()) + } override fun getJSMainModuleName(): String = "index" diff --git a/package-lock.json b/package-lock.json index 4457a51..27fdb62 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,7 +9,6 @@ "version": "1.5.1", "hasInstallScript": true, "dependencies": { - "@ethereumjs/util": "^8.0.3", "@ledgerhq/hw-app-eth": "^6.35.1", "@ledgerhq/hw-app-trx": "^6.28.1", "@ledgerhq/react-native-hid": "^6.31.1", @@ -20,48 +19,33 @@ "@react-navigation/native-stack": "^6.9.13", "@tanstack/react-query": "^4.24.4", "@tradle/react-native-http": "^2.0.1", - "assert": "^1.5.0", + "assert": "^2.1.0", "axios": "^1.6.5", - "bip39": "^3.0.4", - "browserify-zlib": "^0.1.4", - "buffer": "^4.9.2", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", + "bip39": "^3.1.0", "date-fns": "^2.29.3", - "dns.js": "^1.0.1", - "domain-browser": "^1.2.0", - "ethereumjs-units": "^0.2.0", "ethereumjs-wallet": "^1.0.2", "ethers": "^6.9.2", - "events": "^1.1.1", + "events": "^3.3.0", "https-browserify": "^0.0.1", "i18next": "^22.4.9", "intl-pluralrules": "^1.3.1", "jsc-android": "^250231.0.0", "lodash": "^4.17.21", - "path-browserify": "^0.0.0", - "pbkdf2": "^3.1.2", - "process": "^0.11.10", - "punycode": "^1.4.1", - "querystring-es3": "^0.2.1", "react": "18.2.0", "react-content-loader": "^6.2.0", "react-i18next": "^12.1.5", - "react-native": "0.73.1", + "react-native": "0.73.2", "react-native-aes-crypto": "^2.1.1", "react-native-ble-manager": "^10.1.2", "react-native-ble-plx": "^2.0.3", "react-native-camera-kit": "^13.0.0", - "react-native-crypto": "^2.2.0", "react-native-device-info": "^10.9.0", "react-native-encrypted-storage": "^4.0.3", "react-native-gesture-handler": "^2.14.0", - "react-native-get-random-values": "^1.8.0", "react-native-keychain": "^8.1.1", "react-native-qrcode-svg": "^6.2.0", "react-native-quick-base64": "^2.0.8", "react-native-quick-crypto": "^0.6.1", - "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^3.6.1", "react-native-safe-area-context": "^4.8.2", "react-native-screens": "^3.29.0", @@ -69,29 +53,22 @@ "react-native-svg": "^13.8.0", "react-native-vector-icons": "^9.2.0", "react-native-webview": "^13.6.4", - "readable-stream": "^1.0.33", "rxjs": "^7.8.0", - "stream-browserify": "^1.0.0", - "string_decoder": "^0.10.31", + "stream-browserify": "^3.0.0", "styled-components": "^5.3.6", - "timers-browserify": "^1.4.2", "tronweb": "^5.3.1", - "tty-browserify": "^0.0.0", - "url": "^0.10.3", - "util": "^0.10.4", - "vm-browserify": "^0.0.4" + "url": "^0.11.3" }, "devDependencies": { "@babel/core": "^7.23.7", "@babel/plugin-transform-flow-strip-types": "^7.23.3", "@babel/preset-env": "^7.23.7", "@babel/runtime": "^7.23.7", - "@react-native/babel-preset": "^0.73.18", - "@react-native/eslint-config": "^0.73.1", - "@react-native/metro-config": "^0.73.2", - "@react-native/typescript-config": "^0.73.1", + "@react-native/babel-preset": "0.73.19", + "@react-native/eslint-config": "0.73.2", + "@react-native/metro-config": "0.73.3", + "@react-native/typescript-config": "0.73.1", "@tsconfig/react-native": "^3.0.2", - "@types/bip39": "^2.4.2", "@types/jest": "^29.2.1", "@types/lodash": "^4.14.191", "@types/react": "^18.2.6", @@ -2296,41 +2273,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/@ethereumjs/rlp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/@ethereumjs/rlp/-/rlp-4.0.0.tgz", - "integrity": "sha512-LM4jS5n33bJN60fM5EC8VeyhUgga6/DjCPBV2vWjnfVtobqtOiNC4SQ1MRFqyBSmJGGdB533JZWewyvlcdJtkQ==", - "bin": { - "rlp": "bin/rlp" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@ethereumjs/util": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/@ethereumjs/util/-/util-8.0.3.tgz", - "integrity": "sha512-0apCbwc8xAaie6W7q6QyogfyRS2BMU816a8KwpnpRw9Qrc6Bws+l7J3LfCLMt2iL6Wi8CYb0B29AeIr2N4vHnw==", - "dependencies": { - "@ethereumjs/rlp": "^4.0.0-beta.2", - "async": "^3.2.4", - "ethereum-cryptography": "^1.1.2" - }, - "engines": { - "node": ">=14" - } - }, - "node_modules/@ethereumjs/util/node_modules/ethereum-cryptography": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-1.2.0.tgz", - "integrity": "sha512-6yFQC9b5ug6/17CQpCyE3k9eKBMdhyVjzUy1WkiuY/E4vj/SXDBbCw8QEIaXqf0Mf2SnY6RmpDcwlUmBSS0EJw==", - "dependencies": { - "@noble/hashes": "1.2.0", - "@noble/secp256k1": "1.7.1", - "@scure/bip32": "1.1.5", - "@scure/bip39": "1.1.1" - } - }, "node_modules/@ethersproject/abi": { "version": "5.7.0", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", @@ -4043,14 +3985,6 @@ "rxjs": "^7.8.1" } }, - "node_modules/@ledgerhq/hw-transport/node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "engines": { - "node": ">=0.8.x" - } - }, "node_modules/@ledgerhq/live-env": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@ledgerhq/live-env/-/live-env-0.8.0.tgz", @@ -4201,26 +4135,15 @@ } }, "node_modules/@noble/hashes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.2.0.tgz", - "integrity": "sha512-FZfhjEDbT5GRswV3C6uvLPHMiVD6lQBmpoX5+eSiPaMTXte/IKqI5dykDxzZB/WBeK/CDuQRBWarPdi3FNY2zQ==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -5282,17 +5205,20 @@ } }, "node_modules/@react-native/babel-plugin-codegen": { - "version": "0.71.3", - "resolved": "https://registry.npmjs.org/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.71.3.tgz", - "integrity": "sha512-udPH9oWVTO0q7OJL672k7pmBzMA7Ei83hQwk/dxUlveTwjHz1ChHwMXhDJBhG/dNFijl9wcHrD1aXrI8WchZQg==", + "version": "0.73.2", + "resolved": "https://registry.npmjs.org/@react-native/babel-plugin-codegen/-/babel-plugin-codegen-0.73.2.tgz", + "integrity": "sha512-PadyFZWVaWXIBP7Q5dgEL7eAd7tnsgsLjoHJB1hIRZZuVUg1Zqe3nULwC7RFAqOtr5Qx7KXChkFFcKQ3WnZzGw==", "dependencies": { - "react-native-codegen": "0.71.6" + "@react-native/codegen": "0.73.2" + }, + "engines": { + "node": ">=18" } }, "node_modules/@react-native/babel-preset": { - "version": "0.73.18", - "resolved": "https://registry.npmjs.org/@react-native/babel-preset/-/babel-preset-0.73.18.tgz", - "integrity": "sha512-FzPasmazoX9WZnmwotk6SK9ydiExdqS4Xt5VaukPoY9u8u3AUUODzqjTsWSOxjFD9eRF3Knyg5H8JMDe6pj5wQ==", + "version": "0.73.19", + "resolved": "https://registry.npmjs.org/@react-native/babel-preset/-/babel-preset-0.73.19.tgz", + "integrity": "sha512-ujon01uMOREZecIltQxPDmJ6xlVqAUFGI/JCSpeVYdxyXBoBH5dBb0ihj7h6LKH1q1jsnO9z4MxfddtypKkIbg==", "dependencies": { "@babel/core": "^7.20.0", "@babel/plugin-proposal-async-generator-functions": "^7.0.0", @@ -5333,7 +5259,7 @@ "@babel/plugin-transform-typescript": "^7.5.0", "@babel/plugin-transform-unicode-regex": "^7.0.0", "@babel/template": "^7.0.0", - "@react-native/babel-plugin-codegen": "*", + "@react-native/babel-plugin-codegen": "0.73.2", "babel-plugin-transform-flow-enums": "^0.0.2", "react-refresh": "^0.14.0" }, @@ -5373,19 +5299,19 @@ } }, "node_modules/@react-native/community-cli-plugin": { - "version": "0.73.11", - "resolved": "https://registry.npmjs.org/@react-native/community-cli-plugin/-/community-cli-plugin-0.73.11.tgz", - "integrity": "sha512-s0bprwljKS1Al8wOKathDDmRyF+70CcNE2G/aqZ7+L0NoOE0Uxxx/5P2BxlM2Mfht7O33B4SeMNiPdE/FqIubQ==", + "version": "0.73.12", + "resolved": "https://registry.npmjs.org/@react-native/community-cli-plugin/-/community-cli-plugin-0.73.12.tgz", + "integrity": "sha512-xWU06OkC1cX++Duh/cD/Wv+oZ0oSY3yqbtxAqQA2H3Q+MQltNNJM6MqIHt1VOZSabRf/LVlR1JL6U9TXJirkaw==", "dependencies": { "@react-native-community/cli-server-api": "12.3.0", "@react-native-community/cli-tools": "12.3.0", - "@react-native/dev-middleware": "^0.73.6", - "@react-native/metro-babel-transformer": "^0.73.12", + "@react-native/dev-middleware": "0.73.7", + "@react-native/metro-babel-transformer": "0.73.13", "chalk": "^4.0.0", "execa": "^5.1.1", - "metro": "^0.80.0", - "metro-config": "^0.80.0", - "metro-core": "^0.80.0", + "metro": "^0.80.3", + "metro-config": "^0.80.3", + "metro-core": "^0.80.3", "node-fetch": "^2.2.0", "readline": "^1.3.0" }, @@ -5466,12 +5392,12 @@ } }, "node_modules/@react-native/dev-middleware": { - "version": "0.73.6", - "resolved": "https://registry.npmjs.org/@react-native/dev-middleware/-/dev-middleware-0.73.6.tgz", - "integrity": "sha512-9SD7gIso+hO1Jy1Y/Glbd+JWQwyH7Xjnwebtkxdm5TMB51LQPjaGtMcwEigbIZyAtvoaDGmhWmudwbKpDlS+gA==", + "version": "0.73.7", + "resolved": "https://registry.npmjs.org/@react-native/dev-middleware/-/dev-middleware-0.73.7.tgz", + "integrity": "sha512-BZXpn+qKp/dNdr4+TkZxXDttfx8YobDh8MFHsMk9usouLm22pKgFIPkGBV0X8Do4LBkFNPGtrnsKkWk/yuUXKg==", "dependencies": { "@isaacs/ttlcache": "^1.4.1", - "@react-native/debugger-frontend": "^0.73.3", + "@react-native/debugger-frontend": "0.73.3", "chrome-launcher": "^0.15.2", "chromium-edge-launcher": "^1.0.0", "connect": "^3.6.5", @@ -5499,14 +5425,14 @@ "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, "node_modules/@react-native/eslint-config": { - "version": "0.73.1", - "resolved": "https://registry.npmjs.org/@react-native/eslint-config/-/eslint-config-0.73.1.tgz", - "integrity": "sha512-Dgxk5JTfZqHvKL63iyMZanWqH/+P+GI3m7r7PtUEJgQbm+2XYbJnbAgJwebmDE7BzBFEcmxavjemHBkgs/eH3Q==", + "version": "0.73.2", + "resolved": "https://registry.npmjs.org/@react-native/eslint-config/-/eslint-config-0.73.2.tgz", + "integrity": "sha512-YzMfes19loTfbrkbYNAfHBDXX4oRBzc5wnvHs4h2GIHUj6YKs5ZK5lldqSrBJCdZAI3nuaO9Qj+t5JRwou571w==", "dev": true, "dependencies": { "@babel/core": "^7.20.0", "@babel/eslint-parser": "^7.20.0", - "@react-native/eslint-plugin": "^0.73.1", + "@react-native/eslint-plugin": "0.73.1", "@typescript-eslint/eslint-plugin": "^5.57.1", "@typescript-eslint/parser": "^5.57.1", "eslint-config-prettier": "^8.5.0", @@ -5552,13 +5478,12 @@ } }, "node_modules/@react-native/metro-babel-transformer": { - "version": "0.73.12", - "resolved": "https://registry.npmjs.org/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.73.12.tgz", - "integrity": "sha512-VmxN5aaoOprzDzUR+8c3XYhG0FoMOO6n0ToylCW6EeZCuf5RTY7HWVOhacabGoB1mHrWzJ0wWEsqX+eD4iFxoA==", + "version": "0.73.13", + "resolved": "https://registry.npmjs.org/@react-native/metro-babel-transformer/-/metro-babel-transformer-0.73.13.tgz", + "integrity": "sha512-k9AQifogQfgUXPlqQSoMtX2KUhniw4XvJl+nZ4hphCH7qiMDAwuP8OmkJbz5E/N+Ro9OFuLE7ax4GlwxaTsAWg==", "dependencies": { "@babel/core": "^7.20.0", - "@react-native/babel-preset": "*", - "babel-preset-fbjs": "^3.4.0", + "@react-native/babel-preset": "0.73.19", "hermes-parser": "0.15.0", "nullthrows": "^1.1.1" }, @@ -5570,15 +5495,15 @@ } }, "node_modules/@react-native/metro-config": { - "version": "0.73.2", - "resolved": "https://registry.npmjs.org/@react-native/metro-config/-/metro-config-0.73.2.tgz", - "integrity": "sha512-sYBtFigV3L5Kc/D0xjgxAS3dVUg9UlCIT9D7qHhk6SMCh73YS5W9ZBmJAhXW9I8I4NPvCkol2iIvrfVszqEu7w==", + "version": "0.73.3", + "resolved": "https://registry.npmjs.org/@react-native/metro-config/-/metro-config-0.73.3.tgz", + "integrity": "sha512-aIVh+lM52n7/RFDXLDiIp1vI21jc9thm2VxdkP7KwxMut7VvW+2tO38zKt74/2ker2ca0205tbf3pyCYBvV6Ww==", "dev": true, "dependencies": { - "@react-native/js-polyfills": "^0.73.1", - "@react-native/metro-babel-transformer": "^0.73.12", - "metro-config": "^0.80.0", - "metro-runtime": "^0.80.0" + "@react-native/js-polyfills": "0.73.1", + "@react-native/metro-babel-transformer": "0.73.13", + "metro-config": "^0.80.3", + "metro-runtime": "^0.80.3" }, "engines": { "node": ">=18" @@ -5714,37 +5639,6 @@ } ] }, - "node_modules/@scure/bip32": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.1.5.tgz", - "integrity": "sha512-XyNh1rB0SkEqd3tXcXMi+Xe1fvg+kUIcoRIEujP1Jgv7DqW2r9lg3Ah0NkFaCs9sTkQAQA8kw7xiRXzENi9Rtw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "~1.2.0", - "@noble/secp256k1": "~1.7.0", - "@scure/base": "~1.1.0" - } - }, - "node_modules/@scure/bip39": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.1.1.tgz", - "integrity": "sha512-t+wDck2rVkh65Hmv280fYdVdY25J9YeEUIgn2LG1WM6gxFkGzcksoDiUkWVpVp3Oex9xGC68JU2dSbUfwZ2jPg==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "@noble/hashes": "~1.2.0", - "@scure/base": "~1.1.0" - } - }, "node_modules/@sideway/address": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.4.tgz", @@ -6223,15 +6117,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/bip39": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/@types/bip39/-/bip39-2.4.2.tgz", - "integrity": "sha512-Vo9lqOIRq8uoIzEVrV87ZvcIM0PN9t0K3oYZ/CS61fIYKCBdOIM7mlWzXuRvSXrDtVa1uUO2w1cdfufxTC0bzg==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/bn.js": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", @@ -7048,25 +6933,15 @@ } }, "node_modules/assert": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.5.0.tgz", - "integrity": "sha512-EDsgawzwoun2CZkCgtxJbv392v4nbk9XDD06zI+kQYoBM/3RBWLlEyJARDOmhAAosBjWACEkKL6S+lIZtcAubA==", - "dependencies": { - "object-assign": "^4.1.1", - "util": "0.10.3" - } - }, - "node_modules/assert/node_modules/inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha512-8nWq2nLTAwd02jTqJExUYFSD/fKq6VH9Y/oG2accc/kdI0V98Bag8d5a4gi3XHz73rDWa2PvTtvcWYquKqSENA==" - }, - "node_modules/assert/node_modules/util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha512-5KiHfsmkqacuKjkRkdV7SsfDJ2EGiPsK92s2MhNSY0craxjTdKTtqKsJaCWp4LW33ZZ0OPUv1WO/TFvNQRiQxQ==", + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", + "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", "dependencies": { - "inherits": "2.0.1" + "call-bind": "^1.0.2", + "is-nan": "^1.3.2", + "object-is": "^1.1.5", + "object.assign": "^4.1.4", + "util": "^0.12.5" } }, "node_modules/ast-types": { @@ -7094,11 +6969,6 @@ "node": ">=4" } }, - "node_modules/async": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.4.tgz", - "integrity": "sha512-iAB+JbDEGXhyIUavoDl9WP/Jj106Kz9DEn1DPgYw5ruDn0e3Wgi3sKFm55sASdGBNOQB8F59d9qQ7deqrHA8wQ==" - }, "node_modules/async-limiter": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/async-limiter/-/async-limiter-1.0.1.tgz", @@ -7122,7 +6992,6 @@ "version": "1.0.5", "resolved": "https://registry.npmjs.org/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz", "integrity": "sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -7400,11 +7269,6 @@ "resolved": "https://registry.npmjs.org/babel-plugin-syntax-jsx/-/babel-plugin-syntax-jsx-6.18.0.tgz", "integrity": "sha512-qrPaCSo9c8RHNRHIotaufGbuOBN8rtdC4QrrFFc43vyWCCz7Kl7GL1PGaXtMGQZUXrkCjNEgxDfmAuAabr/rlw==" }, - "node_modules/babel-plugin-syntax-trailing-function-commas": { - "version": "7.0.0-beta.0", - "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-7.0.0-beta.0.tgz", - "integrity": "sha512-Xj9XuRuz3nTSbaTXWv3itLOcxyF4oPD8douBBmj7U9BBC6nEBYfyOJYQMf/8PJAFotC62UY5dFfIGEPr7WswzQ==" - }, "node_modules/babel-plugin-transform-flow-enums": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/babel-plugin-transform-flow-enums/-/babel-plugin-transform-flow-enums-0.0.2.tgz", @@ -7442,43 +7306,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/babel-preset-fbjs": { - "version": "3.4.0", - "resolved": "https://registry.npmjs.org/babel-preset-fbjs/-/babel-preset-fbjs-3.4.0.tgz", - "integrity": "sha512-9ywCsCvo1ojrw0b+XYk7aFvTH6D9064t0RIL1rtMf3nsa02Xw41MS7sZw216Im35xj/UY0PDBQsa1brUDDF1Ow==", - "dependencies": { - "@babel/plugin-proposal-class-properties": "^7.0.0", - "@babel/plugin-proposal-object-rest-spread": "^7.0.0", - "@babel/plugin-syntax-class-properties": "^7.0.0", - "@babel/plugin-syntax-flow": "^7.0.0", - "@babel/plugin-syntax-jsx": "^7.0.0", - "@babel/plugin-syntax-object-rest-spread": "^7.0.0", - "@babel/plugin-transform-arrow-functions": "^7.0.0", - "@babel/plugin-transform-block-scoped-functions": "^7.0.0", - "@babel/plugin-transform-block-scoping": "^7.0.0", - "@babel/plugin-transform-classes": "^7.0.0", - "@babel/plugin-transform-computed-properties": "^7.0.0", - "@babel/plugin-transform-destructuring": "^7.0.0", - "@babel/plugin-transform-flow-strip-types": "^7.0.0", - "@babel/plugin-transform-for-of": "^7.0.0", - "@babel/plugin-transform-function-name": "^7.0.0", - "@babel/plugin-transform-literals": "^7.0.0", - "@babel/plugin-transform-member-expression-literals": "^7.0.0", - "@babel/plugin-transform-modules-commonjs": "^7.0.0", - "@babel/plugin-transform-object-super": "^7.0.0", - "@babel/plugin-transform-parameters": "^7.0.0", - "@babel/plugin-transform-property-literals": "^7.0.0", - "@babel/plugin-transform-react-display-name": "^7.0.0", - "@babel/plugin-transform-react-jsx": "^7.0.0", - "@babel/plugin-transform-shorthand-properties": "^7.0.0", - "@babel/plugin-transform-spread": "^7.0.0", - "@babel/plugin-transform-template-literals": "^7.0.0", - "babel-plugin-syntax-trailing-function-commas": "^7.0.0-beta.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0" - } - }, "node_modules/babel-preset-jest": { "version": "29.6.3", "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", @@ -7537,30 +7364,14 @@ "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" }, - "node_modules/bignumber.js": { - "version": "2.4.0", - "resolved": "https://registry.npmjs.org/bignumber.js/-/bignumber.js-2.4.0.tgz", - "integrity": "sha512-uw4ra6Cv483Op/ebM0GBKKfxZlSmn6NgFRby5L3yGTlunLj53KQgndDlqy2WVFOwgvurocApYkSud0aO+mvrpQ==", - "engines": { - "node": "*" - } - }, "node_modules/bip39": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.4.tgz", - "integrity": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.1.0.tgz", + "integrity": "sha512-c9kiwdk45Do5GL0vJMe7tS95VjCii65mYAH7DfWl3uW8AVzXKQVUm64i3hzVybBDMp9r7j9iNxR85+ul8MdN/A==", "dependencies": { - "@types/node": "11.11.6", - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1" + "@noble/hashes": "^1.2.0" } }, - "node_modules/bip39/node_modules/@types/node": { - "version": "11.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", - "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" - }, "node_modules/bl": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/bl/-/bl-4.1.0.tgz", @@ -7594,46 +7405,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/bl/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/bl/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bl/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/blakejs": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", @@ -7746,19 +7517,6 @@ "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" }, - "node_modules/browserify-sign/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/browserify-sign/node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -7778,22 +7536,6 @@ } ] }, - "node_modules/browserify-sign/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/browserify-zlib": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.1.4.tgz", - "integrity": "sha512-19OEpq7vWgsH6WkvkBJQDFvJS1uPcbFOQ4v9CU839dO+ZZXUZO6XpE6hNCqvlIIj+4fZvRiJ6DsAQ382GwiyTQ==", - "dependencies": { - "pako": "~0.2.0" - } - }, "node_modules/browserslist": { "version": "4.22.2", "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", @@ -7851,16 +7593,6 @@ "node-int64": "^0.4.0" } }, - "node_modules/buffer": { - "version": "4.9.2", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.2.tgz", - "integrity": "sha512-xq+q3SRMOxGivLhBNaUdC64hDTQwejJ+H0T/NB1XMtTVEwNTrfFF3gAxiyW0Bu/xWEGhjVKgUcMhCrUy2+uCWg==", - "dependencies": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" - } - }, "node_modules/buffer-from": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", @@ -7897,7 +7629,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.2.tgz", "integrity": "sha512-7O+FbCihrB5WGbFYesctwmTKae6rOiIzmz1icreWJ+0aA7LJfuqhEso2T9ncpcFtzMQtzXf2QGGueWJGTYsqrA==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "get-intrinsic": "^1.0.2" @@ -8292,16 +8023,6 @@ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", "integrity": "sha512-Tpp60P6IUJDTuOq/5Z8cdskzJujfwqfOTkrwIwj7IRISpnkJnT6SyJ4PCPnGMoFjC9ddhal5KVIYtAt97ix05A==" }, - "node_modules/console-browserify": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz", - "integrity": "sha512-ZMkYO/LkF17QvCPqM0gxw8yUzigAOZOSWSHg91FH6orS7vcEj5dVZTidN2fQ14yBSdg97RqhSNwLUXInd52OTA==" - }, - "node_modules/constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha512-xFxOwqIzR/e1k1gLiWEophSCMqXcwVHIH7akf7b/vxcUeGunlj3hvZaaqxwHsTgn+IndtkQJgSztIDWeumWJDQ==" - }, "node_modules/convert-source-map": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", @@ -8727,7 +8448,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", - "dev": true, "dependencies": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" @@ -8845,11 +8565,6 @@ "node": ">=8" } }, - "node_modules/dns.js": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/dns.js/-/dns.js-1.0.1.tgz", - "integrity": "sha512-taQ05oSLPD0xY/zeOn21TfiinTrk2GjGyJC9q0WIohi7UiOWo9v8Io2kiNU1hpf1HyqX/SihAyDXkIW0cUt2ug==" - }, "node_modules/doctrine": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-3.0.0.tgz", @@ -8875,15 +8590,6 @@ "url": "https://github.com/cheeriojs/dom-serializer?sponsor=1" } }, - "node_modules/domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "engines": { - "node": ">=0.4", - "npm": ">=1.2" - } - }, "node_modules/domelementtype": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-2.3.0.tgz", @@ -9926,14 +9632,6 @@ "setimmediate": "^1.0.5" } }, - "node_modules/ethereumjs-units": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/ethereumjs-units/-/ethereumjs-units-0.2.0.tgz", - "integrity": "sha512-jHUdVlmaK/mx6YETiNSRnjeJA7TQepqUjDL4md3njnSnl0kIOv07tqC2VddRmmuQdpPqnvPfltcfwjknVc8DoA==", - "dependencies": { - "bignumber.js": "^2.3.0" - } - }, "node_modules/ethereumjs-util": { "version": "7.1.5", "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", @@ -10062,11 +9760,11 @@ "integrity": "sha512-tvtQIeLVHjDkJYnzf2dgVMxfuSGJeM/7UCG17TT4EumTfNtF+0nebF/4zWOIkCreAbtNqhGEboB6BWrwqNaw4Q==" }, "node_modules/events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha512-kEcvvCBByWXGnZy6JUlgAp2gBIUjfCAV6P6TgT1/aaQKcmuAEC4OZTV1I4EWQLz2gxZw76atuVyvHhTxvi0Flw==", + "version": "3.3.0", + "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", + "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", "engines": { - "node": ">=0.4.x" + "node": ">=0.8.x" } }, "node_modules/evp_bytestokey": { @@ -10125,11 +9823,6 @@ "node": "^14.15.0 || ^16.10.0 || >=18.0.0" } }, - "node_modules/fast-base64-decode": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fast-base64-decode/-/fast-base64-decode-1.0.0.tgz", - "integrity": "sha512-qwaScUgUGBYeDNRnbc/KyllVU88Jk1pRHPStuF/lO7B0/RTRLj7U0lkdTAutlBblY08rwZDff6tNU9cjv6j//Q==" - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -10469,7 +10162,6 @@ "version": "0.3.3", "resolved": "https://registry.npmjs.org/for-each/-/for-each-0.3.3.tgz", "integrity": "sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==", - "dev": true, "dependencies": { "is-callable": "^1.1.3" } @@ -10580,7 +10272,6 @@ "version": "1.2.1", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", - "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", @@ -10705,7 +10396,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", "integrity": "sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==", - "dev": true, "dependencies": { "get-intrinsic": "^1.1.3" }, @@ -10762,7 +10452,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", - "dev": true, "dependencies": { "get-intrinsic": "^1.1.1" }, @@ -10774,7 +10463,6 @@ "version": "1.0.1", "resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz", "integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -10786,7 +10474,6 @@ "version": "1.0.3", "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz", "integrity": "sha512-l3LCuF6MgDNwTDKkdYGEihYjt5pRPbEg46rtlmnSPlUbgmB8LOIrKJbYYFBSbnPaJexMKtiPO8hmeRjRz2Td+A==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -10798,7 +10485,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.0.tgz", "integrity": "sha512-kFjcSNhnlGV1kyoGk7OXKSawH5JOb/LzUc5w9B02hOTO0dfFRjbHQKvg1d6cf3HbeUmtU9VbbV3qzZ2Teh97WQ==", - "dev": true, "dependencies": { "has-symbols": "^1.0.2" }, @@ -10822,19 +10508,6 @@ "node": ">=4" } }, - "node_modules/hash-base/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, "node_modules/hash-base/node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -10854,14 +10527,6 @@ } ] }, - "node_modules/hash-base/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/hash.js": { "version": "1.1.7", "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", @@ -11092,11 +10757,6 @@ "node": ">=0.8.19" } }, - "node_modules/indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha512-i0G7hLJ1z0DE8dsqJa2rycj9dBmNKgXBvotXtZYXakU9oivfB9Uj2ZBC27qqef2U58/ZLwalxa1X/RDCdkHtVg==" - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -11148,6 +10808,21 @@ "resolved": "https://registry.npmjs.org/ip/-/ip-1.1.8.tgz", "integrity": "sha512-PuExPYUiu6qMBQb4l06ecm6T6ujzhmh+MeJcW9wa89PoAz5pvd4zPgN5WJV104mb6S2T1AwNIAaB70JNrLQWhg==" }, + "node_modules/is-arguments": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/is-arguments/-/is-arguments-1.1.1.tgz", + "integrity": "sha512-8Q7EARjzEnKpt/PCD7e1cgUS0a6X8u5tdSiMqXhojOdoV9TsMsiO+9VLC5vAmO8N7/GmXn7yjR8qnA6bVAEzfA==", + "dependencies": { + "call-bind": "^1.0.2", + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-array-buffer": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/is-array-buffer/-/is-array-buffer-3.0.2.tgz", @@ -11199,7 +10874,6 @@ "version": "1.2.7", "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.2.7.tgz", "integrity": "sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==", - "dev": true, "engines": { "node": ">= 0.4" }, @@ -11299,6 +10973,20 @@ "node": ">=6" } }, + "node_modules/is-generator-function": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", + "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", + "dependencies": { + "has-tostringtag": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -11319,6 +11007,21 @@ "node": ">=8" } }, + "node_modules/is-nan": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", + "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", + "dependencies": { + "call-bind": "^1.0.0", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -11455,7 +11158,6 @@ "version": "1.1.10", "resolved": "https://registry.npmjs.org/is-typed-array/-/is-typed-array-1.1.10.tgz", "integrity": "sha512-PJqgEHiWZvMpaFZ3uTc8kHPM4+4ADTlDniuQL7cU/UDA0Ql7F70yGfHph3cLNe+c9toaigv+DFzTJKhc2CtO6A==", - "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", @@ -13402,46 +13104,6 @@ "node": ">=10.0.0" } }, - "node_modules/keccak/node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/keccak/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/keccak/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, "node_modules/kind-of": { "version": "6.0.3", "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz", @@ -14570,7 +14232,21 @@ "version": "1.12.3", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.12.3.tgz", "integrity": "sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==", - "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/object-is": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", + "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", + "dependencies": { + "call-bind": "^1.0.2", + "define-properties": "^1.1.3" + }, + "engines": { + "node": ">= 0.4" + }, "funding": { "url": "https://github.com/sponsors/ljharb" } @@ -14579,7 +14255,6 @@ "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "dev": true, "engines": { "node": ">= 0.4" } @@ -14588,7 +14263,6 @@ "version": "4.1.4", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", - "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", @@ -14890,11 +14564,6 @@ "node": ">=6" } }, - "node_modules/pako": { - "version": "0.2.9", - "resolved": "https://registry.npmjs.org/pako/-/pako-0.2.9.tgz", - "integrity": "sha512-NUcwaKxUxWrZLpDG+z/xZaCgQITkA/Dv4V/T6bw7VON6l1Xz/VnrBqrYjZQ12TamKHzITTfOEIYUj48y2KXImA==" - }, "node_modules/parent-module": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", @@ -15132,11 +14801,6 @@ "which": "bin/which" } }, - "node_modules/path-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", - "integrity": "sha512-WA3pxi1olUQcsl82W576vkqhUSGp0uBtr/381pxx5WXLp3NC+AB99hUG3aGW7H0Kg9PFr1D8wv1iJeICe+9Mhw==" - }, "node_modules/path-dirname": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", @@ -15387,14 +15051,6 @@ "url": "https://github.com/chalk/ansi-styles?sponsor=1" } }, - "node_modules/process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", - "engines": { - "node": ">= 0.6.0" - } - }, "node_modules/process-nextick-args": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", @@ -15582,6 +15238,20 @@ "node": ">=6" } }, + "node_modules/qs": { + "version": "6.11.2", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.11.2.tgz", + "integrity": "sha512-tDNIz22aBzCDxLtVH++VnTfzxlfeK5CbqohpSqpJgj1Wg/cQbStNAz3NuqCs5vV+pjBsK4x4pN9HlVh7rcYRiA==", + "dependencies": { + "side-channel": "^1.0.4" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/query-string": { "version": "7.1.3", "resolved": "https://registry.npmjs.org/query-string/-/query-string-7.1.3.tgz", @@ -15599,15 +15269,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha512-X/xY82scca2tau62i9mDyU9K+I+djTMUsvwf7xnUX5GLvVzgJybOJf4Y6o9Zx3oJK/LSXg5tTZBjwzqVPaPO2g==", - "deprecated": "The querystring API is considered Legacy. new code should use the URLSearchParams API instead.", - "engines": { - "node": ">=0.4.x" - } - }, "node_modules/querystring-es3": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", @@ -15750,21 +15411,21 @@ "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==" }, "node_modules/react-native": { - "version": "0.73.1", - "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.73.1.tgz", - "integrity": "sha512-nLl9O2yKRh1nMXwsk4SUiD0ddd19RqlKgNU9AU8bTK/zD2xwnVOG56YK1/22SN67niWyoeG83vVg1eTk+S6ReA==", + "version": "0.73.2", + "resolved": "https://registry.npmjs.org/react-native/-/react-native-0.73.2.tgz", + "integrity": "sha512-7zj9tcUYpJUBdOdXY6cM8RcXYWkyql4kMyGZflW99E5EuFPoC7Ti+ZQSl7LP9ZPzGD0vMfslwyDW0I4tPWUCFw==", "dependencies": { "@jest/create-cache-key-function": "^29.6.3", "@react-native-community/cli": "12.3.0", "@react-native-community/cli-platform-android": "12.3.0", "@react-native-community/cli-platform-ios": "12.3.0", - "@react-native/assets-registry": "^0.73.1", - "@react-native/codegen": "^0.73.2", - "@react-native/community-cli-plugin": "0.73.11", - "@react-native/gradle-plugin": "^0.73.4", - "@react-native/js-polyfills": "^0.73.1", - "@react-native/normalize-colors": "^0.73.2", - "@react-native/virtualized-lists": "^0.73.4", + "@react-native/assets-registry": "0.73.1", + "@react-native/codegen": "0.73.2", + "@react-native/community-cli-plugin": "0.73.12", + "@react-native/gradle-plugin": "0.73.4", + "@react-native/js-polyfills": "0.73.1", + "@react-native/normalize-colors": "0.73.2", + "@react-native/virtualized-lists": "0.73.4", "abort-controller": "^3.0.0", "anser": "^1.4.9", "ansi-regex": "^5.0.0", @@ -15776,8 +15437,8 @@ "jest-environment-node": "^29.6.3", "jsc-android": "^250231.0.0", "memoize-one": "^5.0.0", - "metro-runtime": "^0.80.0", - "metro-source-map": "^0.80.0", + "metro-runtime": "^0.80.3", + "metro-source-map": "^0.80.3", "mkdirp": "^0.5.1", "nullthrows": "^1.1.1", "pretty-format": "^26.5.2", @@ -15832,59 +15493,6 @@ "react-native": "*" } }, - "node_modules/react-native-codegen": { - "version": "0.71.6", - "resolved": "https://registry.npmjs.org/react-native-codegen/-/react-native-codegen-0.71.6.tgz", - "integrity": "sha512-e5pR4VldIhEaFctfSAEgxbng0uG4gjBQxAHes3EKLdosH/Av90pQfSe9IDVdFIngvNPzt8Y14pNjrtqov/yNIg==", - "dependencies": { - "@babel/parser": "^7.14.0", - "flow-parser": "^0.185.0", - "jscodeshift": "^0.14.0", - "nullthrows": "^1.1.1" - } - }, - "node_modules/react-native-codegen/node_modules/flow-parser": { - "version": "0.185.2", - "resolved": "https://registry.npmjs.org/flow-parser/-/flow-parser-0.185.2.tgz", - "integrity": "sha512-2hJ5ACYeJCzNtiVULov6pljKOLygy0zddoqSI1fFetM+XRPpRshFdGEijtqlamA1XwyZ+7rhryI6FQFzvtLWUQ==", - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/react-native-crypto": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/react-native-crypto/-/react-native-crypto-2.2.0.tgz", - "integrity": "sha512-eZu9Y8pa8BN9FU2pIex7MLRAi+Cd1Y6bsxfiufKh7sfraAACJvjQTeW7/zcQAT93WMfM+D0OVk+bubvkrbrUkw==", - "dependencies": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.4", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "3.0.8", - "public-encrypt": "^4.0.0", - "randomfill": "^1.0.3" - }, - "engines": { - "node": "*" - }, - "peerDependencies": { - "react-native-randombytes": ">=2.0.0 <4.0.0" - } - }, - "node_modules/react-native-crypto/node_modules/pbkdf2": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.8.tgz", - "integrity": "sha512-Bf7yBd61ChnMqPqf+PxHm34Iiq9M9Bkd/+JqzosPOqwG6FiTixtkpCs4PNd38+6/VYRvAxGe/GgPb4Q4GktFzg==", - "dependencies": { - "create-hmac": "^1.1.2" - }, - "engines": { - "node": ">=0.12" - } - }, "node_modules/react-native-device-info": { "version": "10.9.0", "resolved": "https://registry.npmjs.org/react-native-device-info/-/react-native-device-info-10.9.0.tgz", @@ -15931,17 +15539,6 @@ "react-native": "*" } }, - "node_modules/react-native-get-random-values": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/react-native-get-random-values/-/react-native-get-random-values-1.8.0.tgz", - "integrity": "sha512-H/zghhun0T+UIJLmig3+ZuBCvF66rdbiWUfRSNS6kv5oDSpa1ZiVyvRWtuPesQpT8dXj+Bv7WJRQOUP+5TB1sA==", - "dependencies": { - "fast-base64-decode": "^1.0.0" - }, - "peerDependencies": { - "react-native": ">=0.56" - } - }, "node_modules/react-native-keychain": { "version": "8.1.1", "resolved": "https://registry.npmjs.org/react-native-keychain/-/react-native-keychain-8.1.1.tgz", @@ -15996,72 +15593,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.45.tgz", "integrity": "sha512-w+tIMs3rq2afQdsPJlODhoUEKzFP1ayaoyl1CcnwtIlsVe7K7bA1NGm4s3PraqTLlXnbIN84zuBlxBWo1u9BLw==" }, - "node_modules/react-native-quick-crypto/node_modules/events": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz", - "integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==", - "engines": { - "node": ">=0.8.x" - } - }, - "node_modules/react-native-quick-crypto/node_modules/readable-stream": { - "version": "3.6.2", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", - "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/react-native-quick-crypto/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/react-native-quick-crypto/node_modules/stream-browserify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", - "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", - "dependencies": { - "inherits": "~2.0.4", - "readable-stream": "^3.5.0" - } - }, - "node_modules/react-native-quick-crypto/node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/react-native-randombytes": { - "version": "3.6.1", - "resolved": "https://registry.npmjs.org/react-native-randombytes/-/react-native-randombytes-3.6.1.tgz", - "integrity": "sha512-qxkwMbOZ0Hff1V7VqpaWrR6ItkA+oF6bnI79Qp9F3Tk8WBsdKDi6m1mi3dEdFWePoRLrhJ2L03rU0yabst1tVw==", - "dependencies": { - "buffer": "^4.9.1", - "sjcl": "^1.0.3" - } - }, "node_modules/react-native-reanimated": { "version": "3.6.1", "resolved": "https://registry.npmjs.org/react-native-reanimated/-/react-native-reanimated-3.6.1.tgz", @@ -16368,21 +15899,18 @@ } }, "node_modules/readable-stream": { - "version": "1.0.33", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.33.tgz", - "integrity": "sha512-72KxhcKi8bAvHP/cyyWSP+ODS5ef0DIRs0OzrhGXw31q41f19aoELCbvd42FjhpyEDxQMRiiC5rq9rfE5PzTqg==", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "0.0.1", - "string_decoder": "~0.10.x" + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" } }, - "node_modules/readable-stream/node_modules/isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha512-D2S+3GLxWH+uhrNEcoh/fnmYeP8E8/zHl644d/jdA0g2uyXvy3sb0qxotE+ne0LtccHknQzWwZEzhak7oJ0COQ==" - }, "node_modules/readline": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz", @@ -16902,7 +16430,6 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.0.4.tgz", "integrity": "sha512-q5XPytqFEIKHkGdiMIrY10mvLRvnQh42/+GoBlFW3b2LXLE2xxJpZFdm94we0BaoV3RwJyGqg5wS7epxTv0Zvw==", - "dev": true, "dependencies": { "call-bind": "^1.0.0", "get-intrinsic": "^1.0.2", @@ -16922,14 +16449,6 @@ "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==" }, - "node_modules/sjcl": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/sjcl/-/sjcl-1.0.8.tgz", - "integrity": "sha512-LzIjEQ0S0DpIgnxMEayM1rq9aGwGRG4OnZhCdjx7glTaJtf4zRfpg87ImfjSJjoW9vKpagd82McDOwbRT5kQKQ==", - "engines": { - "node": "*" - } - }, "node_modules/slash": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", @@ -17053,12 +16572,12 @@ } }, "node_modules/stream-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-1.0.0.tgz", - "integrity": "sha512-e+V5xc4LlkOiRr64kZTUdb11exsbpSnwb9uwmXaHeDXCpfHg7vaefMJOxi21Pe74ZOqjZ87blBcqqpNAM4Ku0g==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-3.0.0.tgz", + "integrity": "sha512-H73RAHsVBapbim0tU2JwwOiXUj+fikfiaoYAKHF3VJfA0pe2BCzkhAHBlLG6REzE+2WNZcxOXjK7lkso+9euLA==", "dependencies": { - "inherits": "~2.0.1", - "readable-stream": "^1.0.27-1" + "inherits": "~2.0.4", + "readable-stream": "^3.5.0" } }, "node_modules/strict-uri-encode": { @@ -17070,9 +16589,31 @@ } }, "node_modules/string_decoder": { - "version": "0.10.31", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "integrity": "sha512-ev2QzSzWPYmy9GuqfIVildA4OdcGLeFZQrq5ys6RtiuF+RQQiZWr8TZNyAcuVXyQRYfEO+MsoB/1BuQVhOJuoQ==" + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string_decoder/node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ] }, "node_modules/string-length": { "version": "4.0.2", @@ -17455,17 +16996,6 @@ "safe-buffer": "~5.1.0" } }, - "node_modules/timers-browserify": { - "version": "1.4.2", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-1.4.2.tgz", - "integrity": "sha512-PIxwAupJZiYU4JmVZYwXp9FKsHMXb5h0ZEFyuXTAn8WLHOlcij+FEcbrvDsom1o5dr1YggEtFbECvGCW2sT53Q==", - "dependencies": { - "process": "~0.11.0" - }, - "engines": { - "node": ">=0.6.0" - } - }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -17665,11 +17195,6 @@ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", "dev": true }, - "node_modules/tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha512-JVa5ijo+j/sOoHGjw0sxw734b1LhBkQ3bvUGNdxnVXDCX81Yx7TFgnZygxrIIWn23hbfTaMYLwRmAxFyDuFmIw==" - }, "node_modules/type-check": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.4.0.tgz", @@ -17896,19 +17421,14 @@ } }, "node_modules/url": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/url/-/url-0.10.3.tgz", - "integrity": "sha512-hzSUW2q06EqL1gKM/a+obYHLIO6ct2hwPuviqTTOcfFVc61UbfJ2Q32+uGL/HCPxKqrdGB5QUwIe7UqlDgwsOQ==", + "version": "0.11.3", + "resolved": "https://registry.npmjs.org/url/-/url-0.11.3.tgz", + "integrity": "sha512-6hxOLGfZASQK/cijlZnZJTq8OXAkt/3YGfQX45vvMYXpZoo8NdWZcY73K108Jf759lS1Bv/8wXnHDTSz17dSRw==", "dependencies": { - "punycode": "1.3.2", - "querystring": "0.2.0" + "punycode": "^1.4.1", + "qs": "^6.11.2" } }, - "node_modules/url/node_modules/punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha512-RofWgt/7fL5wP1Y7fxE7/EmTLzQVnB0ycyibJ0OOHIlJqTNzglYFxVwETOcIoJqJmpDXJ9xImDv+Fq34F/d4Dw==" - }, "node_modules/use-latest-callback": { "version": "0.1.6", "resolved": "https://registry.npmjs.org/use-latest-callback/-/use-latest-callback-0.1.6.tgz", @@ -17945,11 +17465,15 @@ "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" }, "node_modules/util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", + "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==", "dependencies": { - "inherits": "2.0.3" + "inherits": "^2.0.3", + "is-arguments": "^1.0.4", + "is-generator-function": "^1.0.7", + "is-typed-array": "^1.1.3", + "which-typed-array": "^1.1.2" } }, "node_modules/util-deprecate": { @@ -17957,11 +17481,6 @@ "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" }, - "node_modules/util/node_modules/inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" - }, "node_modules/utility-types": { "version": "3.10.0", "resolved": "https://registry.npmjs.org/utility-types/-/utility-types-3.10.0.tgz", @@ -18021,14 +17540,6 @@ "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz", "integrity": "sha512-gQpnTgkubC6hQgdIcRdYGDSDc+SaujOdyesZQMv6JlfQee/9Mp0Qhnys6WxDWvQnL5WZdT7o2Ul187aSt0Rq+w==" }, - "node_modules/vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha512-NyZNR3WDah+NPkjh/YmhuWSsT4a0mF0BJYgUmvrJ70zxjTXh5Y2Asobxlh0Nfs0PCFB5FVpRJft7NozAWFMwLQ==", - "dependencies": { - "indexof": "0.0.1" - } - }, "node_modules/void-elements": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/void-elements/-/void-elements-3.1.0.tgz", @@ -18116,7 +17627,6 @@ "version": "1.1.11", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.11.tgz", "integrity": "sha512-qe9UWWpkeG5yzZ0tNYxDmd7vo58HDBc39mZ0xWWpolAGADdFOzkfamWLDxkOWcvHQKVmdTyQdLD4NOfjLWTKew==", - "dev": true, "dependencies": { "available-typed-arrays": "^1.0.5", "call-bind": "^1.0.2", diff --git a/package.json b/package.json index 2553067..4abacec 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "distribute-production-flow": "eval $(./scripts/parsedEnv.sh) && ./scripts/upload-build-production-flow.sh" }, "dependencies": { - "@ethereumjs/util": "^8.0.3", "@ledgerhq/hw-app-eth": "^6.35.1", "@ledgerhq/hw-app-trx": "^6.28.1", "@ledgerhq/react-native-hid": "^6.31.1", @@ -29,39 +28,26 @@ "@react-navigation/native-stack": "^6.9.13", "@tanstack/react-query": "^4.24.4", "@tradle/react-native-http": "^2.0.1", - "assert": "^1.5.0", + "assert": "^2.1.0", "axios": "^1.6.5", - "bip39": "^3.0.4", - "browserify-zlib": "^0.1.4", - "buffer": "^4.9.2", - "console-browserify": "^1.2.0", - "constants-browserify": "^1.0.0", + "bip39": "^3.1.0", "date-fns": "^2.29.3", - "dns.js": "^1.0.1", - "domain-browser": "^1.2.0", - "ethereumjs-units": "^0.2.0", "ethereumjs-wallet": "^1.0.2", "ethers": "^6.9.2", - "events": "^1.1.1", + "events": "^3.3.0", "https-browserify": "^0.0.1", "i18next": "^22.4.9", "intl-pluralrules": "^1.3.1", "jsc-android": "^250231.0.0", "lodash": "^4.17.21", - "path-browserify": "^0.0.0", - "pbkdf2": "^3.1.2", - "process": "^0.11.10", - "punycode": "^1.4.1", - "querystring-es3": "^0.2.1", "react": "18.2.0", "react-content-loader": "^6.2.0", "react-i18next": "^12.1.5", - "react-native": "0.73.1", + "react-native": "0.73.2", "react-native-aes-crypto": "^2.1.1", "react-native-ble-manager": "^10.1.2", "react-native-ble-plx": "^2.0.3", "react-native-camera-kit": "^13.0.0", - "react-native-crypto": "^2.2.0", "react-native-device-info": "^10.9.0", "react-native-encrypted-storage": "^4.0.3", "react-native-gesture-handler": "^2.14.0", @@ -69,7 +55,6 @@ "react-native-qrcode-svg": "^6.2.0", "react-native-quick-base64": "^2.0.8", "react-native-quick-crypto": "^0.6.1", - "react-native-randombytes": "^3.6.1", "react-native-reanimated": "^3.6.1", "react-native-safe-area-context": "^4.8.2", "react-native-screens": "^3.29.0", @@ -77,29 +62,22 @@ "react-native-svg": "^13.8.0", "react-native-vector-icons": "^9.2.0", "react-native-webview": "^13.6.4", - "readable-stream": "^1.0.33", "rxjs": "^7.8.0", - "stream-browserify": "^1.0.0", - "string_decoder": "^0.10.31", + "stream-browserify": "^3.0.0", "styled-components": "^5.3.6", - "timers-browserify": "^1.4.2", "tronweb": "^5.3.1", - "tty-browserify": "^0.0.0", - "url": "^0.10.3", - "util": "^0.10.4", - "vm-browserify": "^0.0.4" + "url": "^0.11.3" }, "devDependencies": { "@babel/core": "^7.23.7", "@babel/plugin-transform-flow-strip-types": "^7.23.3", "@babel/preset-env": "^7.23.7", "@babel/runtime": "^7.23.7", - "@react-native/babel-preset": "^0.73.18", - "@react-native/eslint-config": "^0.73.1", - "@react-native/metro-config": "^0.73.2", - "@react-native/typescript-config": "^0.73.1", + "@react-native/babel-preset": "0.73.19", + "@react-native/eslint-config": "0.73.2", + "@react-native/metro-config": "0.73.3", + "@react-native/typescript-config": "0.73.1", "@tsconfig/react-native": "^3.0.2", - "@types/bip39": "^2.4.2", "@types/jest": "^29.2.1", "@types/lodash": "^4.14.191", "@types/react": "^18.2.6", diff --git a/patches/bip39+3.0.4.patch b/patches/bip39+3.0.4.patch deleted file mode 100644 index 39b48c0..0000000 --- a/patches/bip39+3.0.4.patch +++ /dev/null @@ -1,77 +0,0 @@ -diff --git a/node_modules/bip39/src/index.js b/node_modules/bip39/src/index.js -index 91d1a72..49c3e82 100644 ---- a/node_modules/bip39/src/index.js -+++ b/node_modules/bip39/src/index.js -@@ -1,8 +1,9 @@ - "use strict"; - Object.defineProperty(exports, "__esModule", { value: true }); --const createHash = require("create-hash"); --const pbkdf2_1 = require("pbkdf2"); --const randomBytes = require("randombytes"); -+global.Buffer = global.Buffer || require('buffer').Buffer -+const { NativeModules } = require('react-native') -+const Aes = NativeModules.Aes -+const { randomBytes, createHash, pbkdf2Sync } = require('react-native-crypto') - const _wordlists_1 = require("./_wordlists"); - let DEFAULT_WORDLIST = _wordlists_1._default; - const INVALID_MNEMONIC = 'Invalid mnemonic'; -@@ -10,18 +11,11 @@ const INVALID_ENTROPY = 'Invalid entropy'; - const INVALID_CHECKSUM = 'Invalid mnemonic checksum'; - const WORDLIST_REQUIRED = 'A wordlist is required but a default could not be found.\n' + - 'Please pass a 2048 word array explicitly.'; --function pbkdf2Promise(password, saltMixin, iterations, keylen, digest) { -- return Promise.resolve().then(() => new Promise((resolve, reject) => { -- const callback = (err, derivedKey) => { -- if (err) { -- return reject(err); -- } -- else { -- return resolve(derivedKey); -- } -- }; -- pbkdf2_1.pbkdf2(password, saltMixin, iterations, keylen, digest, callback); -- })); -+function pbkdf2Promise(password, saltMixin, iterations, keylen) { -+ return Promise.resolve().then(() => new Promise((resolve, reject) => Aes.pbkdf2(password.toString('utf8'), saltMixin.toString('utf8'), iterations, keylen) -+ .then((seed) => resolve(global.Buffer.from(seed, "hex"))) -+ .catch(reject) -+ )); - } - function normalize(str) { - return (str || '').normalize('NFKD'); -@@ -52,14 +46,14 @@ function salt(password) { - function mnemonicToSeedSync(mnemonic, password) { - const mnemonicBuffer = Buffer.from(normalize(mnemonic), 'utf8'); - const saltBuffer = Buffer.from(salt(normalize(password)), 'utf8'); -- return pbkdf2_1.pbkdf2Sync(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512'); -+ return pbkdf2Sync(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512'); - } - exports.mnemonicToSeedSync = mnemonicToSeedSync; - function mnemonicToSeed(mnemonic, password) { - return Promise.resolve().then(() => { - const mnemonicBuffer = Buffer.from(normalize(mnemonic), 'utf8'); - const saltBuffer = Buffer.from(salt(normalize(password)), 'utf8'); -- return pbkdf2Promise(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512'); -+ return pbkdf2Promise(mnemonicBuffer, saltBuffer, 2048, 512); - }); - } - exports.mnemonicToSeed = mnemonicToSeed; -@@ -75,12 +69,12 @@ function mnemonicToEntropy(mnemonic, wordlist) { - // convert word indices to 11 bit binary strings - const bits = words - .map((word) => { -- const index = wordlist.indexOf(word); -- if (index === -1) { -- throw new Error(INVALID_MNEMONIC); -- } -- return lpad(index.toString(2), '0', 11); -- }) -+ const index = wordlist.indexOf(word); -+ if (index === -1) { -+ throw new Error(INVALID_MNEMONIC); -+ } -+ return lpad(index.toString(2), '0', 11); -+ }) - .join(''); - // split the binary string into ENT/CS - const dividerIndex = Math.floor(bits.length / 33) * 32; \ No newline at end of file diff --git a/patches/bip39+3.1.0.patch b/patches/bip39+3.1.0.patch new file mode 100644 index 0000000..ccc49d2 --- /dev/null +++ b/patches/bip39+3.1.0.patch @@ -0,0 +1,64 @@ +diff --git a/node_modules/bip39/src/index.js b/node_modules/bip39/src/index.js +index 91d1a72..49c3e82 100644 +--- a/node_modules/bip39/src/index.js ++++ b/node_modules/bip39/src/index.js +@@ -1,9 +1,8 @@ + "use strict"; + Object.defineProperty(exports, "__esModule", { value: true }); +-const sha256_1 = require("@noble/hashes/sha256"); +-const sha512_1 = require("@noble/hashes/sha512"); +-const pbkdf2_1 = require("@noble/hashes/pbkdf2"); +-const utils_1 = require("@noble/hashes/utils"); ++ ++const { pbkdf2, randomBytes, pbkdf2Sync, createHash } = require('crypto'); ++ + const _wordlists_1 = require("./_wordlists"); + let DEFAULT_WORDLIST = _wordlists_1._default; + const INVALID_MNEMONIC = 'Invalid mnemonic'; +@@ -29,7 +28,7 @@ function bytesToBinary(bytes) { + function deriveChecksumBits(entropyBuffer) { + const ENT = entropyBuffer.length * 8; + const CS = ENT / 32; +- const hash = sha256_1.sha256(Uint8Array.from(entropyBuffer)); ++ const hash = createHash('sha256').update(entropyBuffer).digest(); + return bytesToBinary(Array.from(hash)).slice(0, CS); + } + function salt(password) { +@@ -38,20 +37,19 @@ function salt(password) { + function mnemonicToSeedSync(mnemonic, password) { + const mnemonicBuffer = Uint8Array.from(Buffer.from(normalize(mnemonic), 'utf8')); + const saltBuffer = Uint8Array.from(Buffer.from(salt(normalize(password)), 'utf8')); +- const res = pbkdf2_1.pbkdf2(sha512_1.sha512, mnemonicBuffer, saltBuffer, { +- c: 2048, +- dkLen: 64, +- }); +- return Buffer.from(res); ++ return res = pbkdf2Sync(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512'); + } + exports.mnemonicToSeedSync = mnemonicToSeedSync; + function mnemonicToSeed(mnemonic, password) { + const mnemonicBuffer = Uint8Array.from(Buffer.from(normalize(mnemonic), 'utf8')); + const saltBuffer = Uint8Array.from(Buffer.from(salt(normalize(password)), 'utf8')); +- return pbkdf2_1.pbkdf2Async(sha512_1.sha512, mnemonicBuffer, saltBuffer, { +- c: 2048, +- dkLen: 64, +- }).then((res) => Buffer.from(res)); ++ return new Promise((resolve, reject) => { ++ const callback = (err, res) => { ++ if (err) return reject(err); ++ return resolve(res); ++ }; ++ pbkdf2(mnemonicBuffer, saltBuffer, 2048, 64, 'sha512', callback); ++ }); + } + exports.mnemonicToSeed = mnemonicToSeed; + function mnemonicToEntropy(mnemonic, wordlist) { +@@ -132,7 +130,7 @@ function generateMnemonic(strength, rng, wordlist) { + if (strength % 32 !== 0) { + throw new TypeError(INVALID_ENTROPY); + } +- rng = rng || ((size) => Buffer.from(utils_1.randomBytes(size))); ++ rng = rng || ((size) => Buffer.from(randomBytes(size))); + return entropyToMnemonic(rng(strength / 8), wordlist); + } + exports.generateMnemonic = generateMnemonic; diff --git a/src/@types/ethereumjs-units.d.tsx b/src/@types/ethereumjs-units.d.tsx deleted file mode 100644 index 27fcc83..0000000 --- a/src/@types/ethereumjs-units.d.tsx +++ /dev/null @@ -1,6 +0,0 @@ -type Converter = (amount: string, from: string, to: string) => string; - -declare module 'ethereumjs-units' { - export const convert: Converter; - export const lazyConvert: Converter; -} From 57bb4c10f2a40b48b2a796789c7967265205fbcd Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Wed, 10 Jan 2024 00:05:43 -0300 Subject: [PATCH 3/6] remove ethereumjs-wallet --- package-lock.json | 191 +---------------------- package.json | 6 +- src/screens/start/ObtainAccessScreen.tsx | 6 +- src/web3/wallet/wallet.ts | 8 +- 4 files changed, 15 insertions(+), 196 deletions(-) diff --git a/package-lock.json b/package-lock.json index 27fdb62..3d6bce3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -19,13 +19,10 @@ "@react-navigation/native-stack": "^6.9.13", "@tanstack/react-query": "^4.24.4", "@tradle/react-native-http": "^2.0.1", - "assert": "^2.1.0", "axios": "^1.6.5", "bip39": "^3.1.0", "date-fns": "^2.29.3", - "ethereumjs-wallet": "^1.0.2", "ethers": "^6.9.2", - "events": "^3.3.0", "https-browserify": "^0.0.1", "i18next": "^22.4.9", "intl-pluralrules": "^1.3.1", @@ -57,7 +54,8 @@ "stream-browserify": "^3.0.0", "styled-components": "^5.3.6", "tronweb": "^5.3.1", - "url": "^0.11.3" + "url": "^0.11.3", + "util": "^0.12.5" }, "devDependencies": { "@babel/core": "^7.23.7", @@ -6117,14 +6115,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/bn.js": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.1.tgz", - "integrity": "sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/graceful-fs": { "version": "4.1.9", "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", @@ -6203,14 +6193,6 @@ "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" }, - "node_modules/@types/pbkdf2": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz", - "integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/prop-types": { "version": "15.7.5", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.5.tgz", @@ -6262,14 +6244,6 @@ "integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew==", "dev": true }, - "node_modules/@types/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==", - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/semver": { "version": "7.3.13", "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.13.tgz", @@ -6932,18 +6906,6 @@ "safer-buffer": "^2.1.0" } }, - "node_modules/assert": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/assert/-/assert-2.1.0.tgz", - "integrity": "sha512-eLHpSK/Y4nhMJ07gDaAzoX/XAKS8PSaojml3M0DM4JpV1LAi5JOJ/p6H/XWrl8L+DzVEvVCW1z3vWAaB9oTsQw==", - "dependencies": { - "call-bind": "^1.0.2", - "is-nan": "^1.3.2", - "object-is": "^1.1.5", - "object.assign": "^4.1.4", - "util": "^0.12.5" - } - }, "node_modules/ast-types": { "version": "0.15.2", "resolved": "https://registry.npmjs.org/ast-types/-/ast-types-0.15.2.tgz", @@ -7405,11 +7367,6 @@ "ieee754": "^1.1.13" } }, - "node_modules/blakejs": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.2.1.tgz", - "integrity": "sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ==" - }, "node_modules/bn.js": { "version": "4.12.0", "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", @@ -8448,6 +8405,7 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", + "dev": true, "dependencies": { "has-property-descriptors": "^1.0.0", "object-keys": "^1.1.1" @@ -9610,68 +9568,6 @@ "node": ">= 0.6" } }, - "node_modules/ethereum-cryptography": { - "version": "0.1.3", - "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz", - "integrity": "sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ==", - "dependencies": { - "@types/pbkdf2": "^3.0.0", - "@types/secp256k1": "^4.0.1", - "blakejs": "^1.1.0", - "browserify-aes": "^1.2.0", - "bs58check": "^2.1.2", - "create-hash": "^1.2.0", - "create-hmac": "^1.1.7", - "hash.js": "^1.1.7", - "keccak": "^3.0.0", - "pbkdf2": "^3.0.17", - "randombytes": "^2.1.0", - "safe-buffer": "^5.1.2", - "scrypt-js": "^3.0.0", - "secp256k1": "^4.0.1", - "setimmediate": "^1.0.5" - } - }, - "node_modules/ethereumjs-util": { - "version": "7.1.5", - "resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz", - "integrity": "sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg==", - "dependencies": { - "@types/bn.js": "^5.1.0", - "bn.js": "^5.1.2", - "create-hash": "^1.1.2", - "ethereum-cryptography": "^0.1.3", - "rlp": "^2.2.4" - }, - "engines": { - "node": ">=10.0.0" - } - }, - "node_modules/ethereumjs-util/node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, - "node_modules/ethereumjs-wallet": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/ethereumjs-wallet/-/ethereumjs-wallet-1.0.2.tgz", - "integrity": "sha512-CCWV4RESJgRdHIvFciVQFnCHfqyhXWchTPlkfp28Qc53ufs+doi5I/cV2+xeK9+qEo25XCWfP9MiL+WEPAZfdA==", - "dependencies": { - "aes-js": "^3.1.2", - "bs58check": "^2.1.2", - "ethereum-cryptography": "^0.1.3", - "ethereumjs-util": "^7.1.2", - "randombytes": "^2.1.0", - "scrypt-js": "^3.0.1", - "utf8": "^3.0.0", - "uuid": "^8.3.2" - } - }, - "node_modules/ethereumjs-wallet/node_modules/aes-js": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz", - "integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ==" - }, "node_modules/ethers": { "version": "6.9.2", "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.9.2.tgz", @@ -10452,6 +10348,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/has-property-descriptors/-/has-property-descriptors-1.0.0.tgz", "integrity": "sha512-62DVLZGoiEBDHQyqG4w9xCuZ7eJEwNmJRWw2VY84Oedb7WFcA27fiEVe8oUQx9hAUJ4ekurquucTGwsyO1XGdQ==", + "dev": true, "dependencies": { "get-intrinsic": "^1.1.1" }, @@ -11007,21 +10904,6 @@ "node": ">=8" } }, - "node_modules/is-nan": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/is-nan/-/is-nan-1.3.2.tgz", - "integrity": "sha512-E+zBKpQ2t6MEo1VsonYmluk9NxGrbzpeeLC2xIViuO2EjU2xsXsBPwTr3Ykv9l08UYEVEdWeRZNouaZqF6RN0w==", - "dependencies": { - "call-bind": "^1.0.0", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -14236,25 +14118,11 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object-is": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/object-is/-/object-is-1.1.5.tgz", - "integrity": "sha512-3cyDsyHgtmi7I7DfSSI2LDp6SK2lwvtbg0p0R1e0RvTqF5ceGx+K2dfSjm1bKDMVCFEDAQvy+o8c6a7VujOddw==", - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/object-keys": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", + "dev": true, "engines": { "node": ">= 0.4" } @@ -14263,6 +14131,7 @@ "version": "4.1.4", "resolved": "https://registry.npmjs.org/object.assign/-/object.assign-4.1.4.tgz", "integrity": "sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ==", + "dev": true, "dependencies": { "call-bind": "^1.0.2", "define-properties": "^1.1.4", @@ -16133,22 +16002,6 @@ "inherits": "^2.0.1" } }, - "node_modules/rlp": { - "version": "2.2.7", - "resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz", - "integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==", - "dependencies": { - "bn.js": "^5.2.0" - }, - "bin": { - "rlp": "bin/rlp" - } - }, - "node_modules/rlp/node_modules/bn.js": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", - "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -16241,20 +16094,6 @@ "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" }, - "node_modules/secp256k1": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.3.tgz", - "integrity": "sha512-NLZVf+ROMxwtEj3Xa562qgv2BK5e2WNmXPiOdVIPLgs6lyTzMvBq0aWTYMI5XCP9jZMVKOcqZLw/Wc4vDkuxhA==", - "hasInstallScript": true, - "dependencies": { - "elliptic": "^6.5.4", - "node-addon-api": "^2.0.0", - "node-gyp-build": "^4.2.0" - }, - "engines": { - "node": ">=10.0.0" - } - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -16361,11 +16200,6 @@ "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", "integrity": "sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==" }, - "node_modules/setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha512-MATJdZp8sLqDl/68LfQmbP8zKPLQNV6BIZoIgrscFDQ+RsvK/BxeDQOgyxKKoh0y/8h3BqVFnCqQ/gd+reiIXA==" - }, "node_modules/setprototypeof": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", @@ -17459,11 +17293,6 @@ "node": ">=6.14.2" } }, - "node_modules/utf8": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz", - "integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==" - }, "node_modules/util": { "version": "0.12.5", "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz", @@ -17497,14 +17326,6 @@ "node": ">= 0.4.0" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "bin": { - "uuid": "dist/bin/uuid" - } - }, "node_modules/v8-to-istanbul": { "version": "9.2.0", "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", diff --git a/package.json b/package.json index 4abacec..f8cdec2 100644 --- a/package.json +++ b/package.json @@ -28,13 +28,10 @@ "@react-navigation/native-stack": "^6.9.13", "@tanstack/react-query": "^4.24.4", "@tradle/react-native-http": "^2.0.1", - "assert": "^2.1.0", "axios": "^1.6.5", "bip39": "^3.1.0", "date-fns": "^2.29.3", - "ethereumjs-wallet": "^1.0.2", "ethers": "^6.9.2", - "events": "^3.3.0", "https-browserify": "^0.0.1", "i18next": "^22.4.9", "intl-pluralrules": "^1.3.1", @@ -66,7 +63,8 @@ "stream-browserify": "^3.0.0", "styled-components": "^5.3.6", "tronweb": "^5.3.1", - "url": "^0.11.3" + "url": "^0.11.3", + "util": "^0.12.5" }, "devDependencies": { "@babel/core": "^7.23.7", diff --git a/src/screens/start/ObtainAccessScreen.tsx b/src/screens/start/ObtainAccessScreen.tsx index 4721a93..812df90 100644 --- a/src/screens/start/ObtainAccessScreen.tsx +++ b/src/screens/start/ObtainAccessScreen.tsx @@ -84,15 +84,15 @@ const ObtainAccessScreen = ({ navigation, route }: ObtainAccessScreenProps) => { const obtainAccess = async () => { const wallets = await createWalletFromSeedPhrase(seedPhrase); - const tronWalletPrivateKey = wallets.tronWallet.getPrivateKeyString().replace('0x', ''); + const tronWalletPrivateKey = wallets.tronWallet.privateKey.replace('0x', ''); await Promise.all([ - setPrivateKey(Blockchains.ETHEREUM, wallets.erc20Wallet.getPrivateKeyString()), + setPrivateKey(Blockchains.ETHEREUM, wallets.erc20Wallet.privateKey), setPrivateKey(Blockchains.TRON, tronWalletPrivateKey), storePassword(password), ]); setWalletPublicValues({ - erc20Address: wallets.erc20Wallet.getAddressString(), + erc20Address: wallets.erc20Wallet.address, tronAddress: getTronAddressFromPrivateKey(tronWalletPrivateKey), }); }; diff --git a/src/web3/wallet/wallet.ts b/src/web3/wallet/wallet.ts index 228f3e6..c64d817 100644 --- a/src/web3/wallet/wallet.ts +++ b/src/web3/wallet/wallet.ts @@ -9,7 +9,7 @@ import { mnemonicToSeed, validateMnemonic, } from 'bip39'; -import { hdkey } from 'ethereumjs-wallet'; +import { HDNodeWallet } from 'ethers'; import { t } from 'i18next'; import { Observable } from 'rxjs'; @@ -68,9 +68,9 @@ export const createWalletFromSeedPhrase = async (mnemonic: string, index: number const walletIndex = index > 0 ? index : 0; const seed = await mnemonicToSeed(mnemonic); - const root = hdkey.fromMasterSeed(seed); - const erc20Wallet = root.derivePath(`${ETH_DERIVATION_PATH}/${walletIndex}`).getWallet(); - const tronWallet = root.derivePath(`${TRON_DERIVATION_PATH}/${walletIndex}`).getWallet(); + const root = HDNodeWallet.fromSeed(seed); + const erc20Wallet = root.derivePath(`${ETH_DERIVATION_PATH}/${walletIndex}`); + const tronWallet = root.derivePath(`${TRON_DERIVATION_PATH}/${walletIndex}`); return { erc20Wallet, From 80c924402d86f5412ce83cccfddd8c4c2786a613 Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Wed, 10 Jan 2024 01:20:37 -0300 Subject: [PATCH 4/6] change cypher methods --- package-lock.json | 6 ----- package.json | 1 - src/hooks/usePrivateKey.ts | 6 ++--- src/utils/pin.ts | 4 +-- src/utils/security.ts | 54 +++++++++++++++++++------------------- 5 files changed, 31 insertions(+), 40 deletions(-) diff --git a/package-lock.json b/package-lock.json index 3d6bce3..8f63018 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32,7 +32,6 @@ "react-content-loader": "^6.2.0", "react-i18next": "^12.1.5", "react-native": "0.73.2", - "react-native-aes-crypto": "^2.1.1", "react-native-ble-manager": "^10.1.2", "react-native-ble-plx": "^2.0.3", "react-native-camera-kit": "^13.0.0", @@ -15332,11 +15331,6 @@ "react": "18.2.0" } }, - "node_modules/react-native-aes-crypto": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/react-native-aes-crypto/-/react-native-aes-crypto-2.1.1.tgz", - "integrity": "sha512-huAt7k43myFiY0bPnvoaCP0oBjTMw4VsL2mjkmCPzzDA56Sm3ps5xXIejPo5Z9qfnei9iijHzATV8eRNMEPtbQ==" - }, "node_modules/react-native-ble-manager": { "version": "10.1.2", "resolved": "https://registry.npmjs.org/react-native-ble-manager/-/react-native-ble-manager-10.1.2.tgz", diff --git a/package.json b/package.json index f8cdec2..2636a23 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,6 @@ "react-content-loader": "^6.2.0", "react-i18next": "^12.1.5", "react-native": "0.73.2", - "react-native-aes-crypto": "^2.1.1", "react-native-ble-manager": "^10.1.2", "react-native-ble-plx": "^2.0.3", "react-native-camera-kit": "^13.0.0", diff --git a/src/hooks/usePrivateKey.ts b/src/hooks/usePrivateKey.ts index f054f2e..f01e61b 100644 --- a/src/hooks/usePrivateKey.ts +++ b/src/hooks/usePrivateKey.ts @@ -40,7 +40,7 @@ const usePrivateKey = (): UsePrivateKeyReturn => { const setPrivateKey: UsePrivateKeyReturn['setPrivateKey'] = async (blockchain, newPrivateKey, encryptionKey) => { if (hasDoubleEncryption) { - const encryptedData = await encrypt(newPrivateKey, encryptionKey); + const encryptedData = encrypt(newPrivateKey, encryptionKey); EncryptedStorage.setItem(PRIVATE_KEYS_CONFIG[blockchain], JSON.stringify(encryptedData)); return; } @@ -55,9 +55,7 @@ const usePrivateKey = (): UsePrivateKeyReturn => { blockchains.map((blockchain) => getPrivateKey(blockchain)), ); - const encryptedPrivateKeys = await Promise.all( - privateKeys.map((currentPrivateKey) => encrypt(currentPrivateKey || '', encryptionKey)), - ); + const encryptedPrivateKeys = privateKeys.map((currentPrivateKey) => encrypt(currentPrivateKey || '', encryptionKey)); await Promise.all( encryptedPrivateKeys.map((currentEncryptedData, index) => ( diff --git a/src/utils/pin.ts b/src/utils/pin.ts index b844148..920d16a 100644 --- a/src/utils/pin.ts +++ b/src/utils/pin.ts @@ -5,7 +5,7 @@ import StorageKeys from '@system/storageKeys'; export const storagePinFlagValue = async (pin: string) => { const storedPassword = await getStoredPassword(); - const encryptedStoredPassword = await encrypt(storedPassword || '', pin); + const encryptedStoredPassword = encrypt(storedPassword || '', pin); await EncryptedStorage.setItem(StorageKeys.PIN_FLAG_VALUE, JSON.stringify(encryptedStoredPassword)); }; @@ -23,7 +23,7 @@ export const checkPin = async (pin: string) => { const encryptedHash: EncryptedData = JSON.parse(storedPinValue); try { - const decryptedHash = await decrypt(encryptedHash.cipher, encryptedHash.iv, pin); + const decryptedHash = decrypt(encryptedHash.cipher, encryptedHash.iv, pin); return currentHash === decryptedHash; } catch (error) { diff --git a/src/utils/security.ts b/src/utils/security.ts index 9e35472..5dc1917 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -1,5 +1,7 @@ +import { Buffer } from 'buffer'; +import { createHash, randomBytes, createCipheriv, createDecipheriv } from 'crypto'; + import { HASH_SALT } from '@env'; -import Aes from 'react-native-aes-crypto'; import EncryptedStorage from 'react-native-encrypted-storage'; import { getSupportedBiometryType, @@ -22,28 +24,36 @@ export type EncryptedData = { iv: string; }; -export const hashFrom = (toHash: string, useSalt: boolean = true) => { - const valueToHash = useSalt ? `${HASH_SALT}${toHash}${HASH_SALT}` : toHash; - return Aes.sha256(valueToHash); +export const hashFrom = (toHash: string, algorithm = 'sha256') => { + const valueToHash = `${HASH_SALT}${toHash}${HASH_SALT}`; + + return createHash(algorithm).update(valueToHash).digest(); }; -export const encrypt = async (value: string, key: string = ''): Promise => { +export const encrypt = (value: string, key: string = ''): EncryptedData => { if (!key) return { cipher: value, iv: '' }; - const hashedKey = await hashFrom(key); - const iv = await Aes.randomKey(16); - const cipher = await Aes.encrypt(value, hashedKey, iv, ENCRYPTION_ALGORITHM); + const hashedKey = hashFrom(key); + const iv = Buffer.from(randomBytes(16)); + const encryptor = createCipheriv(ENCRYPTION_ALGORITHM, hashedKey, iv); - return { cipher, iv }; + encryptor.write(value); + encryptor.end(); + + const cipher = encryptor.read().toString('base64'); + return { cipher, iv: iv.toString('base64') }; }; -export const decrypt = async (value: string, iv: string = '', key: string = '') => { +export const decrypt = (value: string, iv: string = '', key: string = '') => { if (!key || !iv) return value; - const hashedKey = await hashFrom(key); - const decryptedValue = await Aes.decrypt(value, hashedKey, iv, ENCRYPTION_ALGORITHM); + const hashedKey = hashFrom(key); + const decrypter = createDecipheriv(ENCRYPTION_ALGORITHM, hashedKey, Buffer.from(iv, 'base64')); + + decrypter.write(Buffer.from(value, 'base64')); + decrypter.end(); - return decryptedValue; + return decrypter.read().toString('utf8'); }; export const deviceHasBiometrics = async () => { @@ -83,25 +93,15 @@ export const obtainBiometrics = (title?: string | null, cancel?: string | null) export const getStoredPassword = () => EncryptedStorage.getItem(StorageKeys.PASSWORD); export const storePassword = async (password: string) => { - const hashedPassword = await hashFrom(password); + const hashedPassword = hashFrom(password, 'sha512').toString('base64'); - EncryptedStorage.setItem(StorageKeys.PASSWORD, hashedPassword); + await EncryptedStorage.setItem(StorageKeys.PASSWORD, hashedPassword); }; export const comparePassword = async (password: string) => { const storedPassword = await getStoredPassword(); - const hashedPassword = await hashFrom(password); - - if (storedPassword === hashedPassword) return true; - - const oldVersionHashedPassword = await hashFrom(password, false); - - if (storedPassword === oldVersionHashedPassword) { - // Update the stored password if it comes from old app versions - await EncryptedStorage.setItem(StorageKeys.PASSWORD, hashedPassword); - return true; - } + const hashedPassword = hashFrom(password, 'sha512').toString('base64'); - return false; + return storedPassword === hashedPassword; }; From 455cb86ac851a12e404bdf95f1a478c52405ee15 Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Wed, 10 Jan 2024 11:00:45 -0300 Subject: [PATCH 5/6] change encoding cipher algorithms --- src/utils/security.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/utils/security.ts b/src/utils/security.ts index 5dc1917..16332d9 100644 --- a/src/utils/security.ts +++ b/src/utils/security.ts @@ -41,14 +41,14 @@ export const encrypt = (value: string, key: string = ''): EncryptedData => { encryptor.end(); const cipher = encryptor.read().toString('base64'); - return { cipher, iv: iv.toString('base64') }; + return { cipher, iv: iv.toString('hex') }; }; export const decrypt = (value: string, iv: string = '', key: string = '') => { if (!key || !iv) return value; const hashedKey = hashFrom(key); - const decrypter = createDecipheriv(ENCRYPTION_ALGORITHM, hashedKey, Buffer.from(iv, 'base64')); + const decrypter = createDecipheriv(ENCRYPTION_ALGORITHM, hashedKey, Buffer.from(iv, 'hex')); decrypter.write(Buffer.from(value, 'base64')); decrypter.end(); @@ -93,7 +93,7 @@ export const obtainBiometrics = (title?: string | null, cancel?: string | null) export const getStoredPassword = () => EncryptedStorage.getItem(StorageKeys.PASSWORD); export const storePassword = async (password: string) => { - const hashedPassword = hashFrom(password, 'sha512').toString('base64'); + const hashedPassword = hashFrom(password).toString('hex'); await EncryptedStorage.setItem(StorageKeys.PASSWORD, hashedPassword); }; @@ -101,7 +101,7 @@ export const storePassword = async (password: string) => { export const comparePassword = async (password: string) => { const storedPassword = await getStoredPassword(); - const hashedPassword = hashFrom(password, 'sha512').toString('base64'); + const hashedPassword = hashFrom(password).toString('hex'); return storedPassword === hashedPassword; }; From 8bccd434bdfe66f3fee912076ad52a892baa4b7e Mon Sep 17 00:00:00 2001 From: nicolas-meilan Date: Wed, 10 Jan 2024 20:01:40 -0300 Subject: [PATCH 6/6] fix ledger on send token --- src/web3/tx/erc20.tx.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web3/tx/erc20.tx.ts b/src/web3/tx/erc20.tx.ts index 4034b7e..e76b2e4 100644 --- a/src/web3/tx/erc20.tx.ts +++ b/src/web3/tx/erc20.tx.ts @@ -217,7 +217,7 @@ export const erc20send: SendTx = async ( if (isHw) { const { from, ...txToResolveProperties } = tx; const txToSerialize = await resolveProperties(txToResolveProperties); - const unsignedTx = Transaction.from(txToSerialize).serialized.substring(2); + const unsignedTx = Transaction.from(txToSerialize).unsignedSerialized.substring(2); const sig = await erc20SignTxWithLedger(blockchain, { bluetoothConnection: hwBluetooth,