fix: all wallet flows to use ethers (#395)
* fix: all wallet flows to use only ethers libraries * feat: remove ethereumjs-wallet * fix: remove the buggy `/wallet` bee call and use provider
This commit is contained in:
Generated
+3
-369
@@ -23,7 +23,6 @@
|
||||
"buffer": "^6.0.3",
|
||||
"crypto": "npm:crypto-browserify",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"ethereumjs-wallet": "^1.0.2",
|
||||
"ethers": "^5.6.4",
|
||||
"file-saver": "^2.0.5",
|
||||
"formik": "2.2.9",
|
||||
@@ -4742,14 +4741,6 @@
|
||||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/bn.js": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz",
|
||||
"integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==",
|
||||
"dependencies": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@types/body-parser": {
|
||||
"version": "1.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
|
||||
@@ -4956,14 +4947,6 @@
|
||||
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
|
||||
"dev": true
|
||||
},
|
||||
"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/prettier": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.3.tgz",
|
||||
@@ -5102,14 +5085,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
|
||||
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
|
||||
},
|
||||
"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.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
|
||||
@@ -5820,11 +5795,6 @@
|
||||
"node": ">=8.9"
|
||||
}
|
||||
},
|
||||
"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/agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@@ -6544,14 +6514,6 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"node_modules/base-x": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
|
||||
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
@@ -6623,11 +6585,6 @@
|
||||
"node": ">=8"
|
||||
}
|
||||
},
|
||||
"node_modules/blakejs": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.1.tgz",
|
||||
"integrity": "sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg=="
|
||||
},
|
||||
"node_modules/bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
@@ -6864,24 +6821,6 @@
|
||||
"node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7"
|
||||
}
|
||||
},
|
||||
"node_modules/bs58": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
|
||||
"integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=",
|
||||
"dependencies": {
|
||||
"base-x": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"node_modules/bs58check": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz",
|
||||
"integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==",
|
||||
"dependencies": {
|
||||
"bs58": "^4.0.0",
|
||||
"create-hash": "^1.1.0",
|
||||
"safe-buffer": "^5.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/bser": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
|
||||
@@ -9770,63 +9709,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.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz",
|
||||
"integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==",
|
||||
"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/ethers": {
|
||||
"version": "5.6.4",
|
||||
"resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.4.tgz",
|
||||
@@ -13623,33 +13505,6 @@
|
||||
"set-immediate-shim": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"node_modules/keccak": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz",
|
||||
"integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.0",
|
||||
"readable-stream": "^3.6.0"
|
||||
},
|
||||
"engines": {
|
||||
"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/kind-of": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
@@ -14337,11 +14192,6 @@
|
||||
"integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/node-addon-api": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz",
|
||||
"integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA=="
|
||||
},
|
||||
"node_modules/node-fetch": {
|
||||
"version": "3.0.0-beta.9",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0-beta.9.tgz",
|
||||
@@ -17543,22 +17393,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/rollup": {
|
||||
"version": "2.75.6",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.6.tgz",
|
||||
@@ -17766,20 +17600,6 @@
|
||||
"node": ">=6.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/secp256k1": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz",
|
||||
"integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==",
|
||||
"hasInstallScript": true,
|
||||
"dependencies": {
|
||||
"elliptic": "^6.5.2",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=10.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/select-hose": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
|
||||
@@ -18003,11 +17823,6 @@
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
||||
},
|
||||
"node_modules/setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
@@ -19435,11 +19250,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.4",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz",
|
||||
@@ -19487,6 +19297,7 @@
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
@@ -23719,14 +23530,6 @@
|
||||
"@babel/types": "^7.3.0"
|
||||
}
|
||||
},
|
||||
"@types/bn.js": {
|
||||
"version": "5.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-5.1.0.tgz",
|
||||
"integrity": "sha512-QSSVYj7pYFN49kW77o2s9xTCwZ8F2xLbjLLSEVh8D2F4JUhZtPAGOFLTD+ffqksBx/u4cE/KImFjyhqCjn/LIA==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/body-parser": {
|
||||
"version": "1.19.2",
|
||||
"resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.2.tgz",
|
||||
@@ -23933,14 +23736,6 @@
|
||||
"integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==",
|
||||
"dev": true
|
||||
},
|
||||
"@types/pbkdf2": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/pbkdf2/-/pbkdf2-3.1.0.tgz",
|
||||
"integrity": "sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/prettier": {
|
||||
"version": "2.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/prettier/-/prettier-2.6.3.tgz",
|
||||
@@ -24081,14 +23876,6 @@
|
||||
"resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.2.tgz",
|
||||
"integrity": "sha512-hppQEBDmlwhFAXKJX2KnWLYu5yMfi91yazPb2l+lbJiwW+wdo1gNeRA+3RgNSO39WYX2euey41KEwnqesU2Jew=="
|
||||
},
|
||||
"@types/secp256k1": {
|
||||
"version": "4.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@types/secp256k1/-/secp256k1-4.0.3.tgz",
|
||||
"integrity": "sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==",
|
||||
"requires": {
|
||||
"@types/node": "*"
|
||||
}
|
||||
},
|
||||
"@types/semver": {
|
||||
"version": "7.3.9",
|
||||
"resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.3.9.tgz",
|
||||
@@ -24653,11 +24440,6 @@
|
||||
"regex-parser": "^2.2.11"
|
||||
}
|
||||
},
|
||||
"aes-js": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.1.2.tgz",
|
||||
"integrity": "sha512-e5pEa2kBnBOgR4Y/p20pskXI74UEz7de8ZGVo58asOtvSVG5YAbJeELPZxOmt+Bnz3rX753YKhfIn4X4l1PPRQ=="
|
||||
},
|
||||
"agent-base": {
|
||||
"version": "6.0.2",
|
||||
"resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz",
|
||||
@@ -25202,14 +24984,6 @@
|
||||
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
|
||||
"integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
|
||||
},
|
||||
"base-x": {
|
||||
"version": "3.0.9",
|
||||
"resolved": "https://registry.npmjs.org/base-x/-/base-x-3.0.9.tgz",
|
||||
"integrity": "sha512-H7JU6iBHTal1gp56aKoaa//YUxEaAOUiydvrV/pILqIHXTtqxSkATOnDA2u+jZ/61sD+L/412+7kzXRtWukhpQ==",
|
||||
"requires": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
}
|
||||
},
|
||||
"base64-js": {
|
||||
"version": "1.5.1",
|
||||
"resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz",
|
||||
@@ -25255,11 +25029,6 @@
|
||||
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==",
|
||||
"dev": true
|
||||
},
|
||||
"blakejs": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.1.tgz",
|
||||
"integrity": "sha512-bLG6PHOCZJKNshTjGRBvET0vTciwQE6zFKOKKXPDJfwFBd4Ac0yBfPZqcGvGJap50l7ktvlpFqc2jGVaUgbJgg=="
|
||||
},
|
||||
"bluebird": {
|
||||
"version": "3.7.2",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz",
|
||||
@@ -25460,24 +25229,6 @@
|
||||
"picocolors": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"bs58": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/bs58/-/bs58-4.0.1.tgz",
|
||||
"integrity": "sha1-vhYedsNU9veIrkBx9j806MTwpCo=",
|
||||
"requires": {
|
||||
"base-x": "^3.0.2"
|
||||
}
|
||||
},
|
||||
"bs58check": {
|
||||
"version": "2.1.2",
|
||||
"resolved": "https://registry.npmjs.org/bs58check/-/bs58check-2.1.2.tgz",
|
||||
"integrity": "sha512-0TS1jicxdU09dwJMNZtVAfzPi6Q6QeN0pM1Fkzrjn+XYHvzMKPU3pHVpva+769iNVSfIYWf7LJ6WR+BuuMf8cA==",
|
||||
"requires": {
|
||||
"bs58": "^4.0.0",
|
||||
"create-hash": "^1.1.0",
|
||||
"safe-buffer": "^5.1.2"
|
||||
}
|
||||
},
|
||||
"bser": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz",
|
||||
@@ -27650,62 +27401,6 @@
|
||||
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
|
||||
"dev": true
|
||||
},
|
||||
"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==",
|
||||
"requires": {
|
||||
"@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"
|
||||
}
|
||||
},
|
||||
"ethereumjs-util": {
|
||||
"version": "7.1.3",
|
||||
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-7.1.3.tgz",
|
||||
"integrity": "sha512-y+82tEbyASO0K0X1/SRhbJJoAlfcvq8JbrG4a5cjrOks7HS/36efU/0j2flxCPOUM++HFahk33kr/ZxyC4vNuw==",
|
||||
"requires": {
|
||||
"@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"
|
||||
},
|
||||
"dependencies": {
|
||||
"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=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"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==",
|
||||
"requires": {
|
||||
"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"
|
||||
}
|
||||
},
|
||||
"ethers": {
|
||||
"version": "5.6.4",
|
||||
"resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.4.tgz",
|
||||
@@ -30547,28 +30242,6 @@
|
||||
"set-immediate-shim": "~1.0.1"
|
||||
}
|
||||
},
|
||||
"keccak": {
|
||||
"version": "3.0.2",
|
||||
"resolved": "https://registry.npmjs.org/keccak/-/keccak-3.0.2.tgz",
|
||||
"integrity": "sha512-PyKKjkH53wDMLGrvmRGSNWgmSxZOUqbnXwKL9tmgbFYA1iAYqW21kfR7mZXV0MlESiefxQQE9X9fTa3X+2MPDQ==",
|
||||
"requires": {
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.0",
|
||||
"readable-stream": "^3.6.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"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==",
|
||||
"requires": {
|
||||
"inherits": "^2.0.3",
|
||||
"string_decoder": "^1.1.1",
|
||||
"util-deprecate": "^1.0.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"kind-of": {
|
||||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
@@ -31102,11 +30775,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node-addon-api": {
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-2.0.2.tgz",
|
||||
"integrity": "sha512-Ntyt4AIXyaLIuMHF6IOoTakB3K+RWxwtsHNRxllEoA6vPwP9o4866g6YWDLUdnucilZhmkxiHwHr11gAENw+QA=="
|
||||
},
|
||||
"node-fetch": {
|
||||
"version": "3.0.0-beta.9",
|
||||
"resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-3.0.0-beta.9.tgz",
|
||||
@@ -33322,21 +32990,6 @@
|
||||
"inherits": "^2.0.1"
|
||||
}
|
||||
},
|
||||
"rlp": {
|
||||
"version": "2.2.7",
|
||||
"resolved": "https://registry.npmjs.org/rlp/-/rlp-2.2.7.tgz",
|
||||
"integrity": "sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ==",
|
||||
"requires": {
|
||||
"bn.js": "^5.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"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=="
|
||||
}
|
||||
}
|
||||
},
|
||||
"rollup": {
|
||||
"version": "2.75.6",
|
||||
"resolved": "https://registry.npmjs.org/rollup/-/rollup-2.75.6.tgz",
|
||||
@@ -33473,16 +33126,6 @@
|
||||
"invariant": "2.2.4"
|
||||
}
|
||||
},
|
||||
"secp256k1": {
|
||||
"version": "4.0.2",
|
||||
"resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-4.0.2.tgz",
|
||||
"integrity": "sha512-UDar4sKvWAksIlfX3xIaQReADn+WFnHvbVujpcbr+9Sf/69odMwy2MUsz5CKLQgX9nsIyrjuxL2imVyoNHa3fg==",
|
||||
"requires": {
|
||||
"elliptic": "^6.5.2",
|
||||
"node-addon-api": "^2.0.0",
|
||||
"node-gyp-build": "^4.2.0"
|
||||
}
|
||||
},
|
||||
"select-hose": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz",
|
||||
@@ -33681,11 +33324,6 @@
|
||||
"resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz",
|
||||
"integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E="
|
||||
},
|
||||
"setimmediate": {
|
||||
"version": "1.0.5",
|
||||
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz",
|
||||
"integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU="
|
||||
},
|
||||
"setprototypeof": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
|
||||
@@ -34781,11 +34419,6 @@
|
||||
"node-gyp-build": "^4.3.0"
|
||||
}
|
||||
},
|
||||
"utf8": {
|
||||
"version": "3.0.0",
|
||||
"resolved": "https://registry.npmjs.org/utf8/-/utf8-3.0.0.tgz",
|
||||
"integrity": "sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ=="
|
||||
},
|
||||
"util": {
|
||||
"version": "0.12.4",
|
||||
"resolved": "https://registry.npmjs.org/util/-/util-0.12.4.tgz",
|
||||
@@ -34829,7 +34462,8 @@
|
||||
"uuid": {
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true
|
||||
},
|
||||
"v8-compile-cache": {
|
||||
"version": "2.3.0",
|
||||
|
||||
@@ -40,7 +40,6 @@
|
||||
"buffer": "^6.0.3",
|
||||
"crypto": "npm:crypto-browserify",
|
||||
"crypto-browserify": "^3.12.0",
|
||||
"ethereumjs-wallet": "^1.0.2",
|
||||
"ethers": "^5.6.4",
|
||||
"file-saver": "^2.0.5",
|
||||
"formik": "2.2.9",
|
||||
|
||||
+12
-12
@@ -58,12 +58,12 @@ const App = ({ beeApiUrl, beeDebugApiUrl, lockedApiSettings }: Props): ReactElem
|
||||
<div className="App">
|
||||
<ThemeProvider theme={theme}>
|
||||
<SettingsProvider beeApiUrl={beeApiUrl} beeDebugApiUrl={beeDebugApiUrl} lockedApiSettings={lockedApiSettings}>
|
||||
<BeeProvider>
|
||||
<StampsProvider>
|
||||
<FileProvider>
|
||||
<FeedsProvider>
|
||||
<PlatformProvider>
|
||||
<TopUpProvider>
|
||||
<TopUpProvider>
|
||||
<BeeProvider>
|
||||
<StampsProvider>
|
||||
<FileProvider>
|
||||
<FeedsProvider>
|
||||
<PlatformProvider>
|
||||
<SnackbarProvider>
|
||||
<Router>
|
||||
<>
|
||||
@@ -74,12 +74,12 @@ const App = ({ beeApiUrl, beeDebugApiUrl, lockedApiSettings }: Props): ReactElem
|
||||
</>
|
||||
</Router>
|
||||
</SnackbarProvider>
|
||||
</TopUpProvider>
|
||||
</PlatformProvider>
|
||||
</FeedsProvider>
|
||||
</FileProvider>
|
||||
</StampsProvider>
|
||||
</BeeProvider>
|
||||
</PlatformProvider>
|
||||
</FeedsProvider>
|
||||
</FileProvider>
|
||||
</StampsProvider>
|
||||
</BeeProvider>
|
||||
</TopUpProvider>
|
||||
</SettingsProvider>
|
||||
</ThemeProvider>
|
||||
</div>
|
||||
|
||||
@@ -13,16 +13,16 @@ import { AccountNavigation } from '../AccountNavigation'
|
||||
import { Header } from '../Header'
|
||||
|
||||
export function AccountWallet(): ReactElement {
|
||||
const { balance } = useContext(Context)
|
||||
const { balance, nodeAddresses } = useContext(Context)
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
if (!balance) {
|
||||
if (!balance || !nodeAddresses) {
|
||||
return <Loading />
|
||||
}
|
||||
|
||||
function onCheckTransactions() {
|
||||
window.open(`https://blockscout.com/xdai/mainnet/address/${balance?.address}/transactions`, '_blank')
|
||||
window.open(`https://blockscout.com/xdai/mainnet/address/${nodeAddresses?.ethereum}/transactions`, '_blank')
|
||||
}
|
||||
|
||||
function onInvite() {
|
||||
@@ -46,7 +46,7 @@ export function AccountWallet(): ReactElement {
|
||||
</Grid>
|
||||
</Box>
|
||||
<Box mb={0.25}>
|
||||
<ExpandableListItemKey label="Node wallet address" value={balance.address} expanded />
|
||||
<ExpandableListItemKey label="Node wallet address" value={nodeAddresses.ethereum} expanded />
|
||||
</Box>
|
||||
<Box mb={0.25}>
|
||||
<ExpandableListItem label="XDAI balance" value={`${balance.dai.toSignificantDigits(4)} XDAI`} />
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useSnackbar } from 'notistack'
|
||||
import { ReactElement, useContext, useEffect, useState } from 'react'
|
||||
import { Check, X } from 'react-feather'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { Wallet } from 'ethers'
|
||||
import ExpandableListItem from '../../components/ExpandableListItem'
|
||||
import ExpandableListItemActions from '../../components/ExpandableListItemActions'
|
||||
import ExpandableListItemKey from '../../components/ExpandableListItemKey'
|
||||
@@ -12,11 +13,10 @@ import { SwarmButton } from '../../components/SwarmButton'
|
||||
import { Context as BeeContext } from '../../providers/Bee'
|
||||
import { Context as TopUpContext } from '../../providers/TopUp'
|
||||
import { createGiftWallet } from '../../utils/desktop'
|
||||
import { generateWallet } from '../../utils/identity'
|
||||
import { ResolvedWallet } from '../../utils/wallet'
|
||||
|
||||
export default function Index(): ReactElement {
|
||||
const { giftWallets, addGiftWallet } = useContext(TopUpContext)
|
||||
const { giftWallets, addGiftWallet, provider } = useContext(TopUpContext)
|
||||
const { balance } = useContext(BeeContext)
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
@@ -26,13 +26,13 @@ export default function Index(): ReactElement {
|
||||
async function mapGiftWallets() {
|
||||
const results = []
|
||||
for (const giftWallet of giftWallets) {
|
||||
results.push(await ResolvedWallet.make(giftWallet))
|
||||
results.push(await ResolvedWallet.make(giftWallet, provider))
|
||||
}
|
||||
setBalances(results)
|
||||
}
|
||||
|
||||
mapGiftWallets()
|
||||
}, [giftWallets])
|
||||
}, [giftWallets, provider])
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
const navigate = useNavigate()
|
||||
@@ -41,9 +41,9 @@ export default function Index(): ReactElement {
|
||||
enqueueSnackbar('Sending funds to gift wallet...')
|
||||
setLoading(true)
|
||||
try {
|
||||
const wallet = generateWallet()
|
||||
const wallet = Wallet.createRandom()
|
||||
addGiftWallet(wallet)
|
||||
await createGiftWallet(wallet.getAddressString())
|
||||
await createGiftWallet(wallet.address)
|
||||
enqueueSnackbar('Succesfully funded gift wallet', { variant: 'success' })
|
||||
} catch (error) {
|
||||
enqueueSnackbar(`Failed to fund gift wallet: ${error}`, { variant: 'error' })
|
||||
|
||||
@@ -3,6 +3,7 @@ import { useSnackbar } from 'notistack'
|
||||
import { ReactElement, useContext, useState } from 'react'
|
||||
import { Check } from 'react-feather'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { providers } from 'ethers'
|
||||
import { HistoryHeader } from '../../components/HistoryHeader'
|
||||
import { SwarmButton } from '../../components/SwarmButton'
|
||||
import { SwarmTextInput } from '../../components/SwarmTextInput'
|
||||
@@ -11,18 +12,17 @@ import { ROUTES } from '../../routes'
|
||||
import { Rpc } from '../../utils/rpc'
|
||||
|
||||
export default function Index(): ReactElement {
|
||||
const { jsonRpcProvider, setJsonRpcProvider } = useContext(Context)
|
||||
|
||||
const [provider, setProvider] = useState(jsonRpcProvider)
|
||||
const { providerUrl, setProviderUrl } = useContext(Context)
|
||||
const [localProviderUrl, setLocalProviderUrl] = useState(providerUrl)
|
||||
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
const navigate = useNavigate()
|
||||
|
||||
async function onSubmit() {
|
||||
try {
|
||||
await Rpc.eth_getBlockByNumber(provider)
|
||||
await Rpc.eth_getBlockByNumber(new providers.JsonRpcProvider(localProviderUrl))
|
||||
enqueueSnackbar('Connected to RPC provider successfully.', { variant: 'success' })
|
||||
setJsonRpcProvider(provider)
|
||||
setProviderUrl(localProviderUrl)
|
||||
navigate(ROUTES.CONFIRMATION)
|
||||
} catch (error) {
|
||||
enqueueSnackbar('Could not connect to RPC provider.', { variant: 'error' })
|
||||
@@ -49,8 +49,8 @@ export default function Index(): ReactElement {
|
||||
<SwarmTextInput
|
||||
name="rpc-endpoint"
|
||||
label="RPC Endpoint"
|
||||
onChange={event => setProvider(event.target.value)}
|
||||
defaultValue={jsonRpcProvider}
|
||||
onChange={event => setLocalProviderUrl(event.target.value)}
|
||||
defaultValue={providerUrl}
|
||||
/>
|
||||
</Box>
|
||||
<SwarmButton iconType={Check} onClick={onSubmit}>
|
||||
|
||||
@@ -19,7 +19,7 @@ import { ResolvedWallet } from '../../utils/wallet'
|
||||
|
||||
export function GiftCardFund(): ReactElement {
|
||||
const { nodeAddresses, balance } = useContext(BeeContext)
|
||||
const { jsonRpcProvider } = useContext(TopUpContext)
|
||||
const { provider, providerUrl } = useContext(TopUpContext)
|
||||
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [wallet, setWallet] = useState<ResolvedWallet | null>(null)
|
||||
@@ -34,8 +34,8 @@ export function GiftCardFund(): ReactElement {
|
||||
return
|
||||
}
|
||||
|
||||
ResolvedWallet.make(privateKeyString).then(setWallet)
|
||||
}, [privateKeyString])
|
||||
ResolvedWallet.make(privateKeyString, provider).then(setWallet)
|
||||
}, [privateKeyString, provider])
|
||||
|
||||
if (!wallet || !balance) {
|
||||
return <Loading />
|
||||
@@ -49,10 +49,10 @@ export function GiftCardFund(): ReactElement {
|
||||
setLoading(true)
|
||||
|
||||
try {
|
||||
await wallet.transfer(nodeAddresses.ethereum)
|
||||
await wallet.transfer(nodeAddresses.ethereum, providerUrl)
|
||||
enqueueSnackbar('Successfully funded node, restarting...', { variant: 'success' })
|
||||
await sleepMs(5_000)
|
||||
await upgradeToLightNode(jsonRpcProvider)
|
||||
await upgradeToLightNode(providerUrl)
|
||||
await restartBeeNode()
|
||||
navigate(ROUTES.RESTART_LIGHT)
|
||||
} catch (error) {
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
import { Box, Typography } from '@material-ui/core'
|
||||
import { Wallet } from 'ethers'
|
||||
import { useSnackbar } from 'notistack'
|
||||
import { ReactElement, useState } from 'react'
|
||||
import { ReactElement, useContext, useState } from 'react'
|
||||
import { ArrowRight } from 'react-feather'
|
||||
import { useNavigate } from 'react-router'
|
||||
import { Context as TopUpContext } from '../../providers/TopUp'
|
||||
import { HistoryHeader } from '../../components/HistoryHeader'
|
||||
import { ProgressIndicator } from '../../components/ProgressIndicator'
|
||||
import { SwarmButton } from '../../components/SwarmButton'
|
||||
@@ -11,10 +13,10 @@ import { SwarmTextInput } from '../../components/SwarmTextInput'
|
||||
import { BzzToken } from '../../models/BzzToken'
|
||||
import { DaiToken } from '../../models/DaiToken'
|
||||
import { ROUTES } from '../../routes'
|
||||
import { getWalletFromPrivateKeyString } from '../../utils/identity'
|
||||
import { Rpc } from '../../utils/rpc'
|
||||
|
||||
export function GiftCardTopUpIndex(): ReactElement {
|
||||
const { provider } = useContext(TopUpContext)
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [giftCode, setGiftCode] = useState('')
|
||||
|
||||
@@ -24,9 +26,9 @@ export function GiftCardTopUpIndex(): ReactElement {
|
||||
async function onProceed() {
|
||||
setLoading(true)
|
||||
try {
|
||||
const wallet = getWalletFromPrivateKeyString(giftCode)
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(wallet.getAddressString()))
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(wallet.getAddressString()))
|
||||
const wallet = new Wallet(giftCode, provider)
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(wallet.address, provider))
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(wallet.address, provider))
|
||||
|
||||
if (dai.toDecimal.lt(0.001) || bzz.toDecimal.lt(0.001)) {
|
||||
throw Error('Gift wallet does not have enough funds')
|
||||
|
||||
@@ -28,13 +28,13 @@ export function Swap({ header }: Props): ReactElement {
|
||||
const [loading, setLoading] = useState(false)
|
||||
const [hasSwapped, setSwapped] = useState(false)
|
||||
|
||||
const { jsonRpcProvider } = useContext(TopUpContext)
|
||||
const { balance } = useContext(BeeContext)
|
||||
const { providerUrl } = useContext(TopUpContext)
|
||||
const { balance, nodeAddresses } = useContext(BeeContext)
|
||||
|
||||
const navigate = useNavigate()
|
||||
const { enqueueSnackbar } = useSnackbar()
|
||||
|
||||
if (!balance) {
|
||||
if (!balance || !nodeAddresses) {
|
||||
return <Loading />
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ export function Swap({ header }: Props): ReactElement {
|
||||
await performSwap(daiToSwap.toString)
|
||||
enqueueSnackbar('Successfully swapped, restarting...', { variant: 'success' })
|
||||
await sleepMs(5_000)
|
||||
await upgradeToLightNode(jsonRpcProvider)
|
||||
await upgradeToLightNode(providerUrl)
|
||||
await restartBeeNode()
|
||||
navigate(ROUTES.RESTART_LIGHT)
|
||||
enqueueSnackbar('Upgraded to light node', { variant: 'success' })
|
||||
@@ -98,7 +98,7 @@ export function Swap({ header }: Props): ReactElement {
|
||||
<ArrowDown size={24} color="#aaaaaa" />
|
||||
</Box>
|
||||
<Box mb={0.25}>
|
||||
<ExpandableListItemKey label="Funding wallet address" value={balance.address} expanded />
|
||||
<ExpandableListItemKey label="Funding wallet address" value={nodeAddresses.ethereum} expanded />
|
||||
</Box>
|
||||
<Box mb={0.25}>
|
||||
<ExpandableListItem
|
||||
|
||||
@@ -40,7 +40,7 @@ export default function Index({ header, title, p, next }: Props): ReactElement {
|
||||
<Box mb={4}>{p}</Box>
|
||||
<SwarmDivider mb={4} />
|
||||
<Box mb={0.25}>
|
||||
<ExpandableListItemKey label="Funding wallet address" value={balance.address} expanded />
|
||||
<ExpandableListItemKey label="Funding wallet address" value={nodeAddresses.ethereum} expanded />
|
||||
</Box>
|
||||
<Box mb={4}>
|
||||
<ExpandableListItem label="xDAI balance" value={balance.dai.toSignificantDigits(4)} />
|
||||
|
||||
@@ -17,6 +17,7 @@ import { Token } from '../models/Token'
|
||||
import type { Balance, ChequebookBalance, Settlements } from '../types'
|
||||
import { WalletAddress } from '../utils/wallet'
|
||||
import { Context as SettingsContext } from './Settings'
|
||||
import { Context as TopUpContext } from './TopUp'
|
||||
|
||||
export enum CheckState {
|
||||
OK = 'OK',
|
||||
@@ -184,6 +185,7 @@ function getStatus(
|
||||
|
||||
export function Provider({ children }: Props): ReactElement {
|
||||
const { beeApi, beeDebugApi } = useContext(SettingsContext)
|
||||
const { provider } = useContext(TopUpContext)
|
||||
const [apiHealth, setApiHealth] = useState<boolean>(false)
|
||||
const [debugApiHealth, setDebugApiHealth] = useState<Health | null>(null)
|
||||
const [nodeAddresses, setNodeAddresses] = useState<NodeAddresses | null>(null)
|
||||
@@ -238,9 +240,9 @@ export function Provider({ children }: Props): ReactElement {
|
||||
|
||||
useEffect(() => {
|
||||
if (nodeAddresses?.ethereum) {
|
||||
WalletAddress.make(nodeAddresses.ethereum).then(setWalletAddress)
|
||||
WalletAddress.make(nodeAddresses.ethereum, provider).then(setWalletAddress)
|
||||
}
|
||||
}, [nodeAddresses])
|
||||
}, [nodeAddresses, provider])
|
||||
|
||||
useEffect(() => {
|
||||
const interval = setInterval(() => walletAddress?.refresh().then(setWalletAddress), 30_000)
|
||||
|
||||
+21
-19
@@ -1,26 +1,27 @@
|
||||
import Wallet from 'ethereumjs-wallet'
|
||||
import { providers, Wallet } from 'ethers'
|
||||
import { createContext, ReactElement, useEffect, useState } from 'react'
|
||||
import { setJsonRpcInDesktop } from '../utils/desktop'
|
||||
import { getWalletFromPrivateKeyString } from '../utils/identity'
|
||||
|
||||
const LocalStorageKeys = {
|
||||
jsonRpcProvider: 'json-rpc-provider',
|
||||
providerUrl: 'json-rpc-provider',
|
||||
depositWallet: 'deposit-wallet',
|
||||
giftWallets: 'gift-wallets',
|
||||
invitation: 'invitation',
|
||||
}
|
||||
|
||||
interface ContextInterface {
|
||||
jsonRpcProvider: string
|
||||
providerUrl: string
|
||||
provider: providers.JsonRpcProvider
|
||||
giftWallets: Wallet[]
|
||||
setJsonRpcProvider: (jsonRpcProvider: string) => void
|
||||
setProviderUrl: (providerUrl: string) => void
|
||||
addGiftWallet: (wallet: Wallet) => void
|
||||
}
|
||||
|
||||
const initialValues: ContextInterface = {
|
||||
jsonRpcProvider: '',
|
||||
providerUrl: '',
|
||||
provider: new providers.JsonRpcProvider(),
|
||||
giftWallets: [],
|
||||
setJsonRpcProvider: () => {}, // eslint-disable-line
|
||||
setProviderUrl: () => {}, // eslint-disable-line
|
||||
addGiftWallet: () => {}, // eslint-disable-line
|
||||
}
|
||||
|
||||
@@ -32,38 +33,39 @@ interface Props {
|
||||
}
|
||||
|
||||
export function Provider({ children }: Props): ReactElement {
|
||||
const [jsonRpcProvider, setJsonRpcProvider] = useState(
|
||||
localStorage.getItem('json-rpc-provider') || initialValues.jsonRpcProvider,
|
||||
)
|
||||
const [providerUrl, setProviderUrl] = useState(localStorage.getItem('json-rpc-provider') || initialValues.providerUrl)
|
||||
const [provider, setProvider] = useState(new providers.JsonRpcProvider(providerUrl))
|
||||
const [giftWallets, setGiftWallets] = useState(initialValues.giftWallets)
|
||||
|
||||
useEffect(() => {
|
||||
const existingGiftWallets = localStorage.getItem(LocalStorageKeys.giftWallets)
|
||||
|
||||
if (existingGiftWallets) {
|
||||
setGiftWallets(JSON.parse(existingGiftWallets).map(getWalletFromPrivateKeyString))
|
||||
setGiftWallets(JSON.parse(existingGiftWallets).map((privateKey: string) => new Wallet(privateKey, provider)))
|
||||
}
|
||||
}, [])
|
||||
}, [provider])
|
||||
|
||||
function setAndPersistJsonRpcProvider(jsonRpcProvider: string) {
|
||||
localStorage.setItem(LocalStorageKeys.jsonRpcProvider, jsonRpcProvider)
|
||||
setJsonRpcProvider(jsonRpcProvider)
|
||||
function setAndPersistJsonRpcProvider(providerUrl: string) {
|
||||
localStorage.setItem(LocalStorageKeys.providerUrl, providerUrl)
|
||||
setProviderUrl(providerUrl)
|
||||
setProvider(new providers.JsonRpcProvider(providerUrl))
|
||||
// eslint-disable-next-line no-console
|
||||
setJsonRpcInDesktop(jsonRpcProvider).catch(console.error)
|
||||
setJsonRpcInDesktop(providerUrl).catch(console.error)
|
||||
}
|
||||
|
||||
function addGiftWallet(wallet: Wallet) {
|
||||
const newArray = [...giftWallets, wallet]
|
||||
localStorage.setItem(LocalStorageKeys.giftWallets, JSON.stringify(newArray.map(x => x.getPrivateKeyString())))
|
||||
localStorage.setItem(LocalStorageKeys.giftWallets, JSON.stringify(newArray.map(x => x.privateKey)))
|
||||
setGiftWallets(newArray)
|
||||
}
|
||||
|
||||
return (
|
||||
<Context.Provider
|
||||
value={{
|
||||
jsonRpcProvider,
|
||||
providerUrl,
|
||||
provider,
|
||||
giftWallets,
|
||||
setJsonRpcProvider: setAndPersistJsonRpcProvider,
|
||||
setProviderUrl: setAndPersistJsonRpcProvider,
|
||||
addGiftWallet,
|
||||
}}
|
||||
>
|
||||
|
||||
+9
-26
@@ -1,14 +1,10 @@
|
||||
import { BatchId, Bee, BeeDebug, Reference } from '@ethersphere/bee-js'
|
||||
import Wallet from 'ethereumjs-wallet'
|
||||
import { Wallet } from 'ethers'
|
||||
import { uuidV4, waitUntilStampUsable } from '.'
|
||||
import { Identity, IdentityType } from '../providers/Feeds'
|
||||
|
||||
export function generateWallet(): Wallet {
|
||||
const buffer = new Uint8Array(32)
|
||||
crypto.getRandomValues(buffer)
|
||||
const wallet = new Wallet(Buffer.from(buffer))
|
||||
|
||||
return wallet
|
||||
return Wallet.createRandom()
|
||||
}
|
||||
|
||||
export function persistIdentity(identities: Identity[], identity: Identity): void {
|
||||
@@ -35,14 +31,13 @@ export async function convertWalletToIdentity(
|
||||
throw Error('V3 passwords require password')
|
||||
}
|
||||
|
||||
const identityString =
|
||||
type === 'PRIVATE_KEY' ? identity.getPrivateKeyString() : await identity.toV3String(password as string)
|
||||
const identityString = type === 'PRIVATE_KEY' ? identity.privateKey : await identity.encrypt(password as string)
|
||||
|
||||
return {
|
||||
uuid: uuidV4(),
|
||||
name,
|
||||
type: password ? 'V3' : 'PRIVATE_KEY',
|
||||
address: identity.getAddressString(),
|
||||
address: identity.address,
|
||||
identity: identityString,
|
||||
}
|
||||
}
|
||||
@@ -56,14 +51,14 @@ export async function importIdentity(name: string, data: string): Promise<Identi
|
||||
name,
|
||||
type: 'PRIVATE_KEY',
|
||||
identity: data,
|
||||
address: wallet.getAddressString(),
|
||||
address: wallet.address,
|
||||
}
|
||||
}
|
||||
|
||||
if (data.length === 66 && data.toLowerCase().startsWith('0x')) {
|
||||
const wallet = await getWallet('PRIVATE_KEY', data.slice(2))
|
||||
|
||||
return { uuid: uuidV4(), name, type: 'PRIVATE_KEY', identity: data, address: wallet.getAddressString() }
|
||||
return { uuid: uuidV4(), name, type: 'PRIVATE_KEY', identity: data, address: wallet.address }
|
||||
}
|
||||
try {
|
||||
const { address } = JSON.parse(data)
|
||||
@@ -79,11 +74,7 @@ function getWalletFromIdentity(identity: Identity, password?: string): Promise<W
|
||||
}
|
||||
|
||||
async function getWallet(type: IdentityType, data: string, password?: string): Promise<Wallet> {
|
||||
return type === 'PRIVATE_KEY' ? getWalletFromPrivateKeyString(data) : await Wallet.fromV3(data, password as string)
|
||||
}
|
||||
|
||||
export function getWalletFromPrivateKeyString(privateKey: string): Wallet {
|
||||
return Wallet.fromPrivateKey(Buffer.from(trimHexString(privateKey), 'hex'))
|
||||
return type === 'PRIVATE_KEY' ? new Wallet(data) : await Wallet.fromEncryptedJson(data, password as string)
|
||||
}
|
||||
|
||||
export async function updateFeed(
|
||||
@@ -97,21 +88,13 @@ export async function updateFeed(
|
||||
const wallet = await getWalletFromIdentity(identity, password)
|
||||
|
||||
if (!identity.feedHash) {
|
||||
identity.feedHash = await beeApi.createFeedManifest(stamp, 'sequence', '00'.repeat(32), wallet.getAddressString())
|
||||
identity.feedHash = await beeApi.createFeedManifest(stamp, 'sequence', '00'.repeat(32), wallet.address)
|
||||
}
|
||||
|
||||
const writer = beeApi.makeFeedWriter('sequence', '00'.repeat(32), wallet.getPrivateKeyString())
|
||||
const writer = beeApi.makeFeedWriter('sequence', '00'.repeat(32), wallet.privateKey)
|
||||
|
||||
if (beeDebugApi) {
|
||||
await waitUntilStampUsable(stamp as BatchId, beeDebugApi)
|
||||
}
|
||||
await writer.upload(stamp, hash as Reference)
|
||||
}
|
||||
|
||||
function trimHexString(string: string): string {
|
||||
if (string.toLowerCase().startsWith('0x')) {
|
||||
return string.slice(2)
|
||||
}
|
||||
|
||||
return string
|
||||
}
|
||||
|
||||
+7
-33
@@ -1,45 +1,20 @@
|
||||
import { debounce } from '@material-ui/core'
|
||||
import axios from 'axios'
|
||||
import { Contract, providers, Wallet } from 'ethers'
|
||||
import { bzzContractInterface } from './bzz-contract-interface'
|
||||
|
||||
export const JSON_RPC_PROVIDER = 'https://gno.getblock.io/mainnet/?api_key=d7b92d96-9784-49a8-a800-b3edd1647fc7'
|
||||
|
||||
async function eth_getBalance(address: string): Promise<string> {
|
||||
async function eth_getBalance(address: string, provider: providers.JsonRpcProvider): Promise<string> {
|
||||
if (!address.startsWith('0x')) {
|
||||
address = `0x${address}`
|
||||
}
|
||||
const response = await axios(JSON_RPC_PROVIDER, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
data: {
|
||||
jsonrpc: '2.0',
|
||||
method: 'eth_getBalance',
|
||||
params: [address, 'latest'],
|
||||
id: 1,
|
||||
},
|
||||
})
|
||||
const balance = await provider.getBalance(address)
|
||||
|
||||
return response.data.result
|
||||
return balance.toString()
|
||||
}
|
||||
|
||||
async function eth_getBlockByNumber(provider = JSON_RPC_PROVIDER): Promise<string> {
|
||||
const response = await axios(provider, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json',
|
||||
},
|
||||
data: {
|
||||
jsonrpc: '2.0',
|
||||
method: 'eth_getBlockByNumber',
|
||||
params: ['latest', false],
|
||||
id: 1,
|
||||
},
|
||||
})
|
||||
async function eth_getBlockByNumber(provider: providers.JsonRpcProvider): Promise<string> {
|
||||
const blockNumber = await provider.getBlockNumber()
|
||||
|
||||
return response.data.result
|
||||
return blockNumber.toString()
|
||||
}
|
||||
|
||||
const partialERC20tokenABI = [
|
||||
@@ -63,10 +38,9 @@ const partialERC20tokenABI = [
|
||||
},
|
||||
]
|
||||
|
||||
const provider = new providers.JsonRpcProvider(JSON_RPC_PROVIDER)
|
||||
|
||||
async function eth_getBalanceERC20(
|
||||
address: string,
|
||||
provider: providers.JsonRpcProvider,
|
||||
tokenAddress = '0xdbf3ea6f5bee45c02255b2c26a16f300502f68da',
|
||||
): Promise<string> {
|
||||
if (!address.startsWith('0x')) {
|
||||
|
||||
+30
-24
@@ -1,23 +1,27 @@
|
||||
import Wallet from 'ethereumjs-wallet'
|
||||
import { providers, Wallet } from 'ethers'
|
||||
import { sleepMs } from '.'
|
||||
import { BzzToken } from '../models/BzzToken'
|
||||
import { DaiToken } from '../models/DaiToken'
|
||||
import { getWalletFromPrivateKeyString } from './identity'
|
||||
import { Rpc } from './rpc'
|
||||
|
||||
export class WalletAddress {
|
||||
private constructor(public address: string, public bzz: BzzToken, public dai: DaiToken) {}
|
||||
private constructor(
|
||||
public address: string,
|
||||
public bzz: BzzToken,
|
||||
public dai: DaiToken,
|
||||
public provider: providers.JsonRpcProvider,
|
||||
) {}
|
||||
|
||||
static async make(address: string): Promise<WalletAddress> {
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(address))
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(address))
|
||||
static async make(address: string, provider: providers.JsonRpcProvider): Promise<WalletAddress> {
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(address, provider))
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(address, provider))
|
||||
|
||||
return new WalletAddress(address, bzz, dai)
|
||||
return new WalletAddress(address, bzz, dai, provider)
|
||||
}
|
||||
|
||||
public async refresh(): Promise<WalletAddress> {
|
||||
this.bzz = new BzzToken(await Rpc._eth_getBalanceERC20(this.address))
|
||||
this.dai = new DaiToken(await Rpc._eth_getBalance(this.address))
|
||||
this.bzz = new BzzToken(await Rpc._eth_getBalanceERC20(this.address, this.provider))
|
||||
this.dai = new DaiToken(await Rpc._eth_getBalance(this.address, this.provider))
|
||||
|
||||
return this
|
||||
}
|
||||
@@ -27,32 +31,34 @@ export class ResolvedWallet {
|
||||
public address: string
|
||||
public privateKey: string
|
||||
|
||||
private constructor(public wallet: Wallet, public bzz: BzzToken, public dai: DaiToken) {
|
||||
this.address = wallet.getAddressString()
|
||||
this.privateKey = wallet.getPrivateKeyString()
|
||||
private constructor(
|
||||
public wallet: Wallet,
|
||||
public bzz: BzzToken,
|
||||
public dai: DaiToken,
|
||||
public provider: providers.JsonRpcProvider,
|
||||
) {
|
||||
this.address = wallet.address
|
||||
this.privateKey = wallet.privateKey
|
||||
}
|
||||
|
||||
static async make(privateKeyOrWallet: string | Wallet): Promise<ResolvedWallet> {
|
||||
static async make(privateKeyOrWallet: string | Wallet, provider: providers.JsonRpcProvider): Promise<ResolvedWallet> {
|
||||
const wallet =
|
||||
typeof privateKeyOrWallet === 'string' ? getWalletFromPrivateKeyString(privateKeyOrWallet) : privateKeyOrWallet
|
||||
const address = wallet.getAddressString()
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(address))
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(address))
|
||||
typeof privateKeyOrWallet === 'string' ? new Wallet(privateKeyOrWallet, provider) : privateKeyOrWallet
|
||||
const address = wallet.address
|
||||
const bzz = new BzzToken(await Rpc._eth_getBalanceERC20(address, provider))
|
||||
const dai = new DaiToken(await Rpc._eth_getBalance(address, provider))
|
||||
|
||||
return new ResolvedWallet(wallet, bzz, dai)
|
||||
return new ResolvedWallet(wallet, bzz, dai, provider)
|
||||
}
|
||||
|
||||
public async refresh(): Promise<ResolvedWallet> {
|
||||
this.bzz = new BzzToken(await Rpc._eth_getBalanceERC20(this.address))
|
||||
this.dai = new DaiToken(await Rpc._eth_getBalance(this.address))
|
||||
this.bzz = new BzzToken(await Rpc._eth_getBalanceERC20(this.address, this.provider))
|
||||
this.dai = new DaiToken(await Rpc._eth_getBalance(this.address, this.provider))
|
||||
|
||||
return this
|
||||
}
|
||||
|
||||
public async transfer(
|
||||
destination: string,
|
||||
jsonRpcProvider = 'https://gno.getblock.io/mainnet/?api_key=d7b92d96-9784-49a8-a800-b3edd1647fc7',
|
||||
): Promise<void> {
|
||||
public async transfer(destination: string, jsonRpcProvider: string): Promise<void> {
|
||||
const DUMMY_GAS_PRICE = '300000000000000'
|
||||
|
||||
if (this.bzz.toDecimal.gt(0.1)) {
|
||||
|
||||
Reference in New Issue
Block a user