diff --git a/.github/workflows/publish_npmjs.yaml b/.github/workflows/publish_npmjs.yaml index 3f62b903..a6b92047 100644 --- a/.github/workflows/publish_npmjs.yaml +++ b/.github/workflows/publish_npmjs.yaml @@ -9,8 +9,8 @@ jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v1 + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 with: node-version: 16 registry-url: 'https://registry.npmjs.org' diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index b32010d0..50d0bab7 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -22,12 +22,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -42,7 +42,7 @@ jobs: run: fdp-play start -d --fairos --fairos-image $FAIROS_IMAGE --bee-version $BEE_VERSION ## Try getting the node modules from cache, if failed npm ci - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache-npm with: path: node_modules @@ -70,12 +70,12 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 1 - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 + uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} @@ -90,7 +90,7 @@ jobs: run: fdp-play start -d --bee-version $BEE_VERSION ## Try getting the node modules from cache, if failed npm ci - - uses: actions/cache@v2 + - uses: actions/cache@v3 id: cache-npm with: path: node_modules diff --git a/README.md b/README.md index ca075013..687995cf 100644 --- a/README.md +++ b/README.md @@ -310,31 +310,6 @@ Checks whether the public key associated with the username in ENS is identical w await fdp.account.isPublicKeyEqual('username') ``` -### Migrate from v1 to v2 account - -Export old wallet with mnemonic - -```js -const wallet = await fdp.account.exportWallet('oldusername', 'oldpassword', { - mnemonic: 'one two three one two three one two three one two three' -}) -``` - -or with address - -```js -const wallet = await fdp.account.exportWallet('oldusername', 'oldpassword', { - address: '0x...' -}) -``` - -```js -// ask user to top up his account, then can be started the migration process -await fdp.account.migrate('oldusername', 'oldpassword', { - mnemonic: wallet.mnemonic.phrase -}) -``` - Using FDP instance with cache ```js diff --git a/package-lock.json b/package-lock.json index 98df323c..3524e8b6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,7 +12,7 @@ "@ethersphere/bee-js": "^6.2.0", "@fairdatasociety/fdp-contracts-js": "^3.8.0", "crypto-js": "^4.2.0", - "ethers": "^5.5.2", + "ethers": "^6.8.1", "js-sha3": "^0.9.2" }, "devDependencies": { @@ -80,6 +80,11 @@ "node": ">=0.10.0" } }, + "node_modules/@adraffy/ens-normalize": { + "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", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -2586,712 +2591,6 @@ "npm": ">=6.0.0" } }, - "node_modules/@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "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/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "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/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" - } - }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "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/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "node_modules/@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "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/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" - } - }, - "node_modules/@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "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/bytes": "^5.7.0" - } - }, - "node_modules/@ethersproject/basex": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", - "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "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/bytes": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "node_modules/@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "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/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" - } - }, - "node_modules/@ethersproject/bignumber/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/@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "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/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "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/bignumber": "^5.7.0" - } - }, - "node_modules/@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "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/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" - } - }, - "node_modules/@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "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/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "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/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "node_modules/@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "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/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" - } - }, - "node_modules/@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "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/bytes": "^5.7.0", - "js-sha3": "0.8.0" - } - }, - "node_modules/@ethersproject/keccak256/node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "node_modules/@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", - "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/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "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/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "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/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" - } - }, - "node_modules/@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "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/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/providers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", - "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "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/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/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0", - "bech32": "1.1.4", - "ws": "7.4.6" - } - }, - "node_modules/@ethersproject/providers/node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/@ethersproject/random": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", - "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "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/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "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/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/sha2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", - "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "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/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "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/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/signing-key/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/@ethersproject/solidity": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", - "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "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/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "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/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "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/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" - } - }, - "node_modules/@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "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/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "node_modules/@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "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/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^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/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "node_modules/@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "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/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "node_modules/@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "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/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, "node_modules/@fairdatasociety/fdp-contracts-js": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", @@ -4284,6 +3583,28 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "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/@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/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -5780,9 +5101,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/agent-base": { "version": "7.1.0", @@ -6254,11 +5575,6 @@ "node": ">=10.0.0" } }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, "node_modules/big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -7945,13 +7261,13 @@ } }, "node_modules/ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.8.1.tgz", + "integrity": "sha512-iEKm6zox5h1lDn6scuRWdIdFJUCGg3+/aQWu0F4K0GVyEZiktFkqrJbRjTn1FlYEPz7RKA707D6g5Kdk6j7Ljg==", "funding": [ { "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + "url": "https://github.com/sponsors/ethers-io/" }, { "type": "individual", @@ -7959,36 +7275,46 @@ } ], "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/@types/node": { + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" + }, + "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/events": { @@ -13674,11 +13000,6 @@ "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", "dev": true }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, "node_modules/semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", @@ -15361,6 +14682,11 @@ "integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA==", "dev": true }, + "@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + }, "@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -17137,406 +16463,6 @@ "multiformats": "^9.5.4" } }, - "@ethersproject/abi": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", - "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", - "requires": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/abstract-provider": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", - "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0" - } - }, - "@ethersproject/abstract-signer": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", - "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", - "requires": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "@ethersproject/address": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", - "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/rlp": "^5.7.0" - } - }, - "@ethersproject/base64": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", - "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", - "requires": { - "@ethersproject/bytes": "^5.7.0" - } - }, - "@ethersproject/basex": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", - "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/properties": "^5.7.0" - } - }, - "@ethersproject/bignumber": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", - "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "bn.js": "^5.2.1" - }, - "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==" - } - } - }, - "@ethersproject/bytes": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", - "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/constants": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", - "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", - "requires": { - "@ethersproject/bignumber": "^5.7.0" - } - }, - "@ethersproject/contracts": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", - "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", - "requires": { - "@ethersproject/abi": "^5.7.0", - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/transactions": "^5.7.0" - } - }, - "@ethersproject/hash": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", - "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/hdnode": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", - "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/basex": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "@ethersproject/json-wallets": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", - "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", - "requires": { - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hdnode": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/pbkdf2": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" - } - }, - "@ethersproject/keccak256": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", - "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "js-sha3": "0.8.0" - }, - "dependencies": { - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - } - } - }, - "@ethersproject/logger": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", - "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==" - }, - "@ethersproject/networks": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", - "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/pbkdf2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", - "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/sha2": "^5.7.0" - } - }, - "@ethersproject/properties": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", - "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", - "requires": { - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/providers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", - "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", - "requires": { - "@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/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/networks": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/web": "^5.7.0", - "bech32": "1.1.4", - "ws": "7.4.6" - }, - "dependencies": { - "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "requires": {} - } - } - }, - "@ethersproject/random": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", - "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/rlp": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", - "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/sha2": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", - "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "hash.js": "1.1.7" - } - }, - "@ethersproject/signing-key": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", - "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "bn.js": "^5.2.1", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - }, - "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==" - } - } - }, - "@ethersproject/solidity": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", - "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/sha2": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/strings": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", - "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/transactions": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", - "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", - "requires": { - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/keccak256": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/rlp": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0" - } - }, - "@ethersproject/units": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", - "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", - "requires": { - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/constants": "^5.7.0", - "@ethersproject/logger": "^5.7.0" - } - }, - "@ethersproject/wallet": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", - "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", - "requires": { - "@ethersproject/abstract-provider": "^5.7.0", - "@ethersproject/abstract-signer": "^5.7.0", - "@ethersproject/address": "^5.7.0", - "@ethersproject/bignumber": "^5.7.0", - "@ethersproject/bytes": "^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/properties": "^5.7.0", - "@ethersproject/random": "^5.7.0", - "@ethersproject/signing-key": "^5.7.0", - "@ethersproject/transactions": "^5.7.0", - "@ethersproject/wordlists": "^5.7.0" - } - }, - "@ethersproject/web": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", - "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", - "requires": { - "@ethersproject/base64": "^5.7.0", - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, - "@ethersproject/wordlists": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", - "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", - "requires": { - "@ethersproject/bytes": "^5.7.0", - "@ethersproject/hash": "^5.7.0", - "@ethersproject/logger": "^5.7.0", - "@ethersproject/properties": "^5.7.0", - "@ethersproject/strings": "^5.7.0" - } - }, "@fairdatasociety/fdp-contracts-js": { "version": "3.8.0", "resolved": "https://registry.npmjs.org/@fairdatasociety/fdp-contracts-js/-/fdp-contracts-js-3.8.0.tgz", @@ -18282,6 +17208,19 @@ "@jridgewell/sourcemap-codec": "^1.4.14" } }, + "@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "requires": { + "@noble/hashes": "1.3.2" + } + }, + "@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" + }, "@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -19465,9 +18404,9 @@ "dev": true }, "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==" }, "agent-base": { "version": "7.1.0", @@ -19822,11 +18761,6 @@ "integrity": "sha512-QHX8HLlncOLpy54mh+k/sWIFd0ThmRqwe9ZjELybGZK+tZ8rUb9VO0saKJUROTbE+KhzDUT7xziGpGrW8Kmd+g==", "dev": true }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, "big-integer": { "version": "1.6.51", "resolved": "https://registry.npmjs.org/big-integer/-/big-integer-1.6.51.tgz", @@ -20998,40 +19932,35 @@ "dev": true }, "ethers": { - "version": "5.7.2", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", - "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", - "requires": { - "@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" + "version": "6.8.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.8.1.tgz", + "integrity": "sha512-iEKm6zox5h1lDn6scuRWdIdFJUCGg3+/aQWu0F4K0GVyEZiktFkqrJbRjTn1FlYEPz7RKA707D6g5Kdk6j7Ljg==", + "requires": { + "@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" + }, + "dependencies": { + "@types/node": { + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" + }, + "tslib": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" + }, + "ws": { + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "requires": {} + } } }, "events": { @@ -25189,11 +24118,6 @@ } } }, - "scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, "semver": { "version": "6.3.1", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", diff --git a/package.json b/package.json index 2bd0fcc4..34a79b9f 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@ethersphere/bee-js": "^6.2.0", "@fairdatasociety/fdp-contracts-js": "^3.8.0", "crypto-js": "^4.2.0", - "ethers": "^5.5.2", + "ethers": "^6.8.1", "js-sha3": "^0.9.2" }, "devDependencies": { diff --git a/src/account/account-data.ts b/src/account/account-data.ts index 5a104ff2..a02ed505 100644 --- a/src/account/account-data.ts +++ b/src/account/account-data.ts @@ -1,10 +1,8 @@ -import { utils, Wallet } from 'ethers' -import { assertAccount, assertMnemonic, assertPassword, assertUsername, HD_PATH, removeZeroFromHex } from './utils' -import { getEncryptedMnemonic } from './mnemonic' -import { decryptText } from '../utils/encryption' -import { downloadPortableAccount, uploadPortableAccount, UserAccountWithMnemonic } from './account' +import { computeAddress, HDNodeWallet, SigningKey, Wallet } from 'ethers' +import { assertAccount, assertPassword, assertUsername, HD_PATH, removeZeroFromHex } from './utils' +import { downloadPortableAccount, uploadPortableAccount } from './account' import { Connection } from '../connection/connection' -import { AddressOptions, isAddressOptions, isMnemonicOptions, MnemonicOptions, RegistrationRequest } from './types' +import { RegistrationRequest } from './types' import { ENS, PublicKey } from '@fairdatasociety/fdp-contracts-js' import { Reference, Utils } from '@ethersphere/bee-js' import CryptoJS from 'crypto-js' @@ -16,7 +14,7 @@ export class AccountData { /** * Active FDP account wallet */ - public wallet?: utils.HDNode + public wallet?: HDNodeWallet /** * Active FDP account's seed for entity creation @@ -38,7 +36,7 @@ export class AccountData { */ private connectWalletWithENS(seed: Uint8Array) { this.seed = seed - this.wallet = utils.HDNode.fromSeed(seed).derivePath(HD_PATH) + this.wallet = HDNodeWallet.fromSeed(seed).derivePath(HD_PATH) this.ens.connect(new Wallet(this.wallet!.privateKey).connect(this.ens.provider)) } @@ -48,8 +46,8 @@ export class AccountData { * @param seed data extracted from mnemonic phrase or from uploaded account */ setAccountFromSeed(seed: Uint8Array): void { - const hdNode = utils.HDNode.fromSeed(seed).derivePath(HD_PATH) - this.publicKey = new utils.SigningKey(hdNode.privateKey).publicKey + const hdNode = HDNodeWallet.fromSeed(seed).derivePath(HD_PATH) + this.publicKey = new SigningKey(hdNode.privateKey).publicKey this.connectWalletWithENS(seed) } @@ -59,79 +57,24 @@ export class AccountData { * @param mnemonic phrase from BIP-039/BIP-044 wallet */ setAccountFromMnemonic(mnemonic: string): void { - this.publicKey = Wallet.fromMnemonic(mnemonic).publicKey + this.publicKey = Wallet.fromPhrase(mnemonic).publicKey this.connectWalletWithENS(mnemonicToSeed(mnemonic)) } /** * Creates a new FDP account wallet */ - createWallet(): Wallet { + createWallet(): HDNodeWallet { if (this.wallet) { throw new Error('Wallet already created') } const wallet = Wallet.createRandom() - this.setAccountFromMnemonic(wallet.mnemonic.phrase) + this.setAccountFromMnemonic(wallet.mnemonic!.phrase) return wallet } - /** - * Exports wallet from version 1 account - * - * Account and postage batch id are not required - * - * @deprecated the method will be removed after an accounts' migration process is completed - * - * @param username username from version 1 account - * @param password password from version 1 account - * @param options migration options with address or mnemonic from version 1 account - */ - async exportWallet( - username: string, - password: string, - options: AddressOptions | MnemonicOptions, - ): Promise { - assertUsername(username) - assertPassword(password) - - let mnemonic = isMnemonicOptions(options) ? options.mnemonic : undefined - - if (isAddressOptions(options)) { - const address = prepareEthAddress(options.address) - const encryptedMnemonic = await getEncryptedMnemonic(this.connection.bee, username, address) - mnemonic = decryptText(password, encryptedMnemonic) - } - - assertMnemonic(mnemonic) - - const wallet = Wallet.fromMnemonic(mnemonic) - - return { wallet, mnemonic } - } - - /** - * Migrates from FDP account without ENS to account with ENS - * - * Account and postage batch id are not required - * - * @deprecated the method will be removed after an accounts' migration process is completed - * - * @param username username from version 1 account - * @param password password from version 1 account - * @param options migration options with address or mnemonic from version 1 account - */ - async migrate(username: string, password: string, options: AddressOptions | MnemonicOptions): Promise { - assertUsername(username) - assertPassword(password) - - const exported = await this.exportWallet(username, password, options) - this.setAccountFromMnemonic(exported.mnemonic) - - return this.register(this.createRegistrationRequest(username, password)) - } - /** * Logs in with the FDP credentials and gives back ethers wallet * @@ -152,7 +95,7 @@ export class AccountData { const publicKey = await this.ens.getPublicKey(username) try { - const address = prepareEthAddress(utils.computeAddress(publicKey)) + const address = prepareEthAddress(computeAddress(publicKey)) const account = await downloadPortableAccount(this.connection.bee, address, username, password) this.setAccountFromSeed(account.seed) diff --git a/src/account/account.ts b/src/account/account.ts index 2e73e67d..1211f330 100644 --- a/src/account/account.ts +++ b/src/account/account.ts @@ -1,39 +1,11 @@ import { Bee, PrivateKeyBytes, Reference, Utils } from '@ethersphere/bee-js' -import { utils, Wallet } from 'ethers' -import { encryptText, IV_LENGTH, decryptBytes, encryptBytes } from '../utils/encryption' -import { uploadEncryptedMnemonic } from './mnemonic' -import { - assertChunkSizeLength, - assertMnemonic, - assertPassword, - CHUNK_SIZE, - SEED_SIZE, - createCredentialsTopic, - HD_PATH, -} from './utils' +import { HDNodeWallet, Wallet } from 'ethers' +import { IV_LENGTH, decryptBytes, encryptBytes } from '../utils/encryption' +import { assertChunkSizeLength, CHUNK_SIZE, SEED_SIZE, createCredentialsTopic, HD_PATH } from './utils' import { Connection } from '../connection/connection' import CryptoJS from 'crypto-js' import { wordArrayToBytes } from '../utils/bytes' -/** - * Created and encrypted user account to upload to the network - * @deprecated interface for v1 accounts - */ -interface UserAccount { - wallet: Wallet - mnemonic: string - encryptedMnemonic: string -} - -/** - * Account and mnemonic phrase - * @deprecated interface for v1 accounts - */ -export interface UserAccountWithMnemonic { - wallet: Wallet - mnemonic: string -} - /** * User account with seed phrase */ @@ -42,62 +14,6 @@ export interface UserAccountWithSeed { seed: Uint8Array } -/** - * Encrypted account uploaded to the network - */ -export interface UserAccountWithReference extends UserAccount { - reference: Reference -} - -/** - * Creates a new user account based on the passed mnemonic phrase or without it, encrypted with a password - * - * @deprecated method for v1 accounts - * - * @param password FDP password - * @param mnemonic mnemonic phrase - */ -async function createUserAccount(password: string, mnemonic?: string): Promise { - assertPassword(password) - - if (mnemonic) { - assertMnemonic(mnemonic) - } else { - mnemonic = Wallet.createRandom().mnemonic.phrase - } - - const wallet = Wallet.fromMnemonic(mnemonic) - const encryptedMnemonic = encryptText(password, mnemonic) - - return { - wallet, - mnemonic, - encryptedMnemonic, - } -} - -/** - * Creates a new user (version 1) and uploads the encrypted account to the network - * - * @deprecated use `createUser` method instead to create the latest version of an account - * - * @param connection connection information for data uploading - * @param username FDP username - * @param password FDP password - * @param mnemonic mnemonic phrase - */ -export async function createUserV1( - connection: Connection, - username: string, - password: string, - mnemonic?: string, -): Promise { - const account = await createUserAccount(password, mnemonic) - const reference = await uploadEncryptedMnemonic(connection, account.wallet, username, account.encryptedMnemonic) - - return { ...account, reference } -} - /** * Uploads portable account (version 2) * @@ -146,7 +62,7 @@ export async function downloadPortableAccount( const socReader = bee.makeSOCReader(address) const encryptedData = (await socReader.download(topic)).payload() const seed = decryptBytes(password, encryptedData).slice(0, SEED_SIZE) - const node = utils.HDNode.fromSeed(seed).derivePath(HD_PATH) + const node = HDNodeWallet.fromSeed(seed).derivePath(HD_PATH) const wallet = new Wallet(node.privateKey) return { wallet, seed } diff --git a/src/account/mnemonic.ts b/src/account/mnemonic.ts deleted file mode 100644 index c453f290..00000000 --- a/src/account/mnemonic.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { Bee, Reference, Utils } from '@ethersphere/bee-js' -import { assertBase64UrlData, assertUsername } from './utils' -import { Wallet } from 'ethers' -import { getFeedData, writeFeedDataRaw } from '../feed/api' -import { Connection } from '../connection/connection' -import { stringToBytes } from '../utils/bytes' - -/** - * Downloads encrypted mnemonic phrase from swarm chunk for version 1 account - * - * @deprecated use methods for v2 account instead - * - * @param bee Bee client - * @param username FDP account username - * @param address FDP account address - * - * @returns encrypted mnemonic phrase in Base64url format - */ -export async function getEncryptedMnemonic(bee: Bee, username: string, address: Utils.EthAddress): Promise { - assertUsername(username) - - return (await getFeedData(bee, username, address)).data.chunkContent().text() -} - -/** - * Uploads encrypted mnemonic from account version 1 to swarm chunk - * - * @deprecated use methods for v2 account instead - * - * @param connection connection information for data uploading - * @param wallet FDP account Ethereum wallet - * @param username FDP username - * @param encryptedMnemonic encrypted mnemonic phrase in Base64url format - */ -export async function uploadEncryptedMnemonic( - connection: Connection, - wallet: Wallet, - username: string, - encryptedMnemonic: string, -): Promise { - assertUsername(username) - assertBase64UrlData(encryptedMnemonic) - - return writeFeedDataRaw(connection, username, stringToBytes(encryptedMnemonic), wallet) -} diff --git a/src/account/types.ts b/src/account/types.ts index 908f9458..221ca819 100644 --- a/src/account/types.ts +++ b/src/account/types.ts @@ -1,23 +1,6 @@ -import { Utils } from '@ethersphere/bee-js' -import { isEthAddress, isObject } from '../utils/type' -import { isValidMnemonic } from 'ethers/lib/utils' import { ServiceRequest } from '@fairdatasociety/fdp-contracts-js/build/types/model/service-request.model' import { RegisterUsernameRequestData } from '@fairdatasociety/fdp-contracts-js' -/** - * Migrate options with possibility to migrate with an address - */ -export interface AddressOptions { - address: Utils.EthAddress -} - -/** - * Migrate options with possibility to migrate with a mnemonic - */ -export interface MnemonicOptions { - mnemonic: string -} - /** * This objects encapsulates state of registration process. */ @@ -28,20 +11,6 @@ export interface RegistrationRequest { ensRequest?: ServiceRequest } -/** - * Checks that value is an AddressOptions - */ -export function isAddressOptions(options: unknown): options is AddressOptions { - return isObject(options) && isEthAddress((options as AddressOptions).address) -} - -/** - * Checks that value is an MnemonicOptions - */ -export function isMnemonicOptions(options: unknown): options is MnemonicOptions { - return isObject(options) && isValidMnemonic((options as MnemonicOptions).mnemonic) -} - /** * Assert account options */ diff --git a/src/account/utils.ts b/src/account/utils.ts index 24989126..4623f772 100644 --- a/src/account/utils.ts +++ b/src/account/utils.ts @@ -2,13 +2,10 @@ import { Data, Utils } from '@ethersphere/bee-js' import { bmtHash } from '../chunk/bmt' import { makeSpan, stringToBytes, wrapBytesWithHelpers } from '../utils/bytes' import { AccountData } from './account-data' -import { isValidMnemonic } from 'ethers/lib/utils' -import CryptoJS from 'crypto-js' -import { assertBatchId, replaceAll } from '../utils/string' +import { assertBatchId } from '../utils/string' import { assertString } from '../utils/type' import { AssertAccountOptions } from './types' -export const MNEMONIC_LENGTH = 12 export const MAX_CHUNK_LENGTH = 4096 export const AUTH_VERSION = 'FDP-login-v1.0' export const CHUNK_SIZE = 4096 @@ -17,34 +14,6 @@ export const HD_PATH = `m/44'/60'/0'/0/0` export const ERROR_CHUNK_ALREADY_EXISTS = 'chunk already exists' export const ERROR_INSUFFICIENT_FUNDS = 'insufficient funds for gas * price + value' -/** - * Encode input data to Base64Url with Go lang compatible paddings - * - * @param data input data to encode - */ -export function encodeBase64Url(data: CryptoJS.lib.WordArray): string { - const base64url = data.toString(CryptoJS.enc.Base64url) - const paddingNumber = base64url.length % 4 - let padding = '' - - if (paddingNumber === 2) { - padding = '==' - } else if (paddingNumber === 3) { - padding = '=' - } - - return base64url + padding -} - -/** - * Decode input Base64Url data to string - * - * @param data Base64Url data - */ -export function decodeBase64Url(data: string): CryptoJS.lib.WordArray { - return CryptoJS.enc.Base64url.parse(replaceAll(data, '=', '')) -} - /** * Extracts only content from chunk data * @@ -114,20 +83,6 @@ export function assertPassword(value: unknown): asserts value is string { } } -/** - * Asserts whether a valid mnemonic phrase has been passed - * - * @param value mnemonic phrase - */ -export function assertMnemonic(value: unknown): asserts value is string { - assertString(value) - const words = value.split(' ') - - if (!(words.length === MNEMONIC_LENGTH && isValidMnemonic(value))) { - throw new Error('Incorrect mnemonic') - } -} - /** * Asserts whether an account is defined * diff --git a/src/content-items/handler.ts b/src/content-items/handler.ts index 4cc4776c..2a4470b8 100644 --- a/src/content-items/handler.ts +++ b/src/content-items/handler.ts @@ -1,5 +1,5 @@ import { Connection } from '../connection/connection' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { Reference, BeeRequestOptions } from '@ethersphere/bee-js' import { getUnixTimestamp } from '../utils/time' import { writeFeedData } from '../feed/api' @@ -37,7 +37,7 @@ export const DEFAULT_UPLOAD_OPTIONS: DataUploadOptions = { */ export async function addEntryToDirectory( connection: Connection, - wallet: utils.HDNode, + wallet: HDNodeWallet, podPassword: PodPasswordBytes, parentPath: string, entryPath: string, @@ -94,7 +94,7 @@ export async function addEntryToDirectory( export async function deleteItem( connection: Connection, itemMetaPath: string, - wallet: utils.HDNode, + wallet: HDNodeWallet, podPassword: PodPasswordBytes, ): Promise { let pathInfo @@ -137,7 +137,7 @@ export async function deleteItem( */ export async function removeEntryFromDirectory( connection: Connection, - wallet: utils.HDNode, + wallet: HDNodeWallet, podPassword: PodPasswordBytes, parentPath: string, entryPath: string, diff --git a/src/content-items/utils.ts b/src/content-items/utils.ts index 915a81f3..942114b5 100644 --- a/src/content-items/utils.ts +++ b/src/content-items/utils.ts @@ -8,7 +8,7 @@ import { decryptJson, PodPasswordBytes } from '../utils/encryption' import CryptoJS from 'crypto-js' import { isObject } from '../utils/type' import { Connection } from '../connection/connection' -import { utils, Wallet } from 'ethers' +import { HDNodeWallet } from 'ethers' import { Epoch } from '../feed/lookup/epoch' import { stringToBytes } from '../utils/bytes' @@ -46,48 +46,6 @@ export async function getRawMetadata( } } -/** - * Checks if file or directory exists at the specified path - * - * @param bee Bee instance - * @param fullPath full path to the item - * @param address uploader address - * @param requestOptions options for downloading - */ -export async function isItemExists( - bee: Bee, - fullPath: string, - address: EthAddress, - requestOptions: BeeRequestOptions | undefined, -): Promise { - try { - return (await getFeedData(bee, fullPath, address, requestOptions)).data.text() === DELETE_FEED_MAGIC_WORD - } catch (e) { - return false - } -} - -/** - * Asserts whether item is not exists - * - * @param contentType human readable content type explanation - * @param bee Bee instance - * @param fullPath full path to the item - * @param address uploader address - * @param downloadOptions options for downloading - */ -export async function assertItemIsNotExists( - contentType: string, - bee: Bee, - fullPath: string, - address: EthAddress, - downloadOptions: BeeRequestOptions | undefined, -): Promise { - if (await isItemExists(bee, fullPath, address, downloadOptions)) { - throw new Error(`${contentType} "${fullPath}" already uploaded to the network`) - } -} - /** * Converts FairOS directory metadata to a `DirectoryItem` * @@ -179,7 +137,7 @@ export async function getCreationPathInfo( export async function deleteFeedData( connection: Connection, topic: string, - wallet: utils.HDNode | Wallet, + wallet: HDNodeWallet, podPassword: PodPasswordBytes, epoch?: Epoch, ): Promise { diff --git a/src/directory/handler.ts b/src/directory/handler.ts index dc9aa152..bd85f9b7 100644 --- a/src/directory/handler.ts +++ b/src/directory/handler.ts @@ -15,7 +15,7 @@ import { DIRECTORY_TOKEN, FILE_TOKEN } from '../file/handler' import { getUnixTimestamp } from '../utils/time' import { createRawDirectoryMetadata, META_VERSION } from '../pod/utils' import { Connection } from '../connection/connection' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { addEntryToDirectory, DEFAULT_UPLOAD_OPTIONS } from '../content-items/handler' import { rawDirectoryMetadataToDirectoryItem, @@ -122,7 +122,7 @@ async function createDirectoryInfo( path: string, name: string, podPassword: PodPasswordBytes, - wallet: utils.HDNode, + wallet: HDNodeWallet, epoch?: Epoch, ): Promise { const now = getUnixTimestamp() @@ -141,7 +141,7 @@ async function createDirectoryInfo( export async function createRootDirectory( connection: Connection, podPassword: PodPasswordBytes, - wallet: utils.HDNode, + wallet: HDNodeWallet, ): Promise { return createDirectoryInfo(connection, '', '/', podPassword, wallet) } @@ -158,7 +158,7 @@ export async function createRootDirectory( export async function createDirectory( connection: Connection, fullPath: string, - podWallet: utils.HDNode, + podWallet: HDNodeWallet, podPassword: PodPasswordBytes, downloadOptions?: BeeRequestOptions, ): Promise { diff --git a/src/feed/api.ts b/src/feed/api.ts index c4b54e7d..49742fbe 100644 --- a/src/feed/api.ts +++ b/src/feed/api.ts @@ -8,7 +8,7 @@ import { getUnixTimestamp } from '../utils/time' import { LookupAnswer } from './types' import { Connection } from '../connection/connection' import { encryptBytes, PodPasswordBytes } from '../utils/encryption' -import { utils, Wallet } from 'ethers' +import { HDNodeWallet } from 'ethers' /** * Magic word for replacing content after deletion @@ -53,36 +53,14 @@ export async function writeFeedData( connection: Connection, topic: string, data: Uint8Array, - wallet: utils.HDNode | Wallet, + wallet: HDNodeWallet, podPassword: PodPasswordBytes, epoch?: Epoch, -): Promise { - data = encryptBytes(podPassword, data) - - return writeFeedDataRaw(connection, topic, data, wallet, epoch) -} - -/** - * Writes data without encryption to feed using `topic` and `epoch` as a key and signed data with `privateKey` as a value - * - * @deprecated required for deprecated methods - * - * @param connection connection information for data uploading - * @param topic key for data - * @param data data to upload - * @param wallet feed owner's wallet - * @param epoch feed epoch - */ -export async function writeFeedDataRaw( - connection: Connection, - topic: string, - data: Uint8Array, - wallet: utils.HDNode | Wallet, - epoch?: Epoch, ): Promise { if (!epoch) { epoch = new Epoch(HIGHEST_LEVEL, getUnixTimestamp()) } + data = encryptBytes(podPassword, data) const topicHash = bmtHashString(topic) const id = getId(topicHash, epoch.time, epoch.level) diff --git a/src/pod/api.ts b/src/pod/api.ts index b9e380ae..afdf6349 100644 --- a/src/pod/api.ts +++ b/src/pod/api.ts @@ -3,7 +3,7 @@ import { getFeedData } from '../feed/api' import { POD_TOPIC } from './personal-storage' import { ExtendedPodInfo, extractPods, PodsInfo } from './utils' import { prepareEthAddress, privateKeyToBytes } from '../utils/wallet' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { DownloadOptions } from '../content-items/types' import { getWalletByIndex } from '../utils/cache/wallet' import { getPodsList as getPodsListCached } from './cache/api' @@ -17,7 +17,7 @@ import { getPodsList as getPodsListCached } from './cache/api' */ export async function getPodsList( bee: Bee, - userWallet: utils.HDNode, + userWallet: HDNodeWallet, downloadOptions?: DownloadOptions, ): Promise { let lookupAnswer @@ -55,7 +55,7 @@ export async function getPodsList( export async function getExtendedPodsList( bee: Bee, podName: string, - userWallet: utils.HDNode, + userWallet: HDNodeWallet, seed: Uint8Array, downloadOptions?: DownloadOptions, ): Promise { diff --git a/src/pod/cache/api.ts b/src/pod/cache/api.ts index a136d1c9..9ff456fc 100644 --- a/src/pod/cache/api.ts +++ b/src/pod/cache/api.ts @@ -1,5 +1,5 @@ import { Bee } from '@ethersphere/bee-js' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { DownloadOptions } from '../../content-items/types' import { jsonToPodsList, podListToJSON, PodsInfo } from '../utils' import { CacheEpochData } from '../../cache/types' @@ -15,7 +15,7 @@ import { getPodsList as getPodsNoCache } from '../api' */ export async function getPodsList( bee: Bee, - userWallet: utils.HDNode, + userWallet: HDNodeWallet, downloadOptions?: DownloadOptions, ): Promise { return processCacheData({ diff --git a/src/pod/utils.ts b/src/pod/utils.ts index 252fc947..8f29819f 100644 --- a/src/pod/utils.ts +++ b/src/pod/utils.ts @@ -18,7 +18,7 @@ import { stringToBytes, wordArrayToBytes, } from '../utils/bytes' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { getRawDirectoryMetadataBytes } from '../directory/adapter' import { assertArray, @@ -68,7 +68,7 @@ export interface PodsInfo { */ export interface ExtendedPodInfo { pod: PodPrepared - podWallet: utils.HDNode + podWallet: HDNodeWallet podAddress: Utils.EthAddress epoch: Epoch } @@ -389,7 +389,7 @@ export function getRandomPodPassword(): PodPasswordBytes { export async function createPod( bee: Bee, connection: Connection, - userWallet: utils.HDNode, + userWallet: HDNodeWallet, seed: Uint8Array, pod: PodName | SharedPodPrepared, ): Promise { diff --git a/src/shim/utils.ts b/src/shim/utils.ts index 1ecf5825..41bddcd5 100644 --- a/src/shim/utils.ts +++ b/src/shim/utils.ts @@ -2,7 +2,7 @@ * Detects current environment is node or not */ export function isNode(): boolean { - // `process.versions.node` is defined for NodeJS + // `process.versions.node` is defined for Node.js // most of js frameworks have no `process.versions` property, but in some there is an empty object in `process.versions` return typeof process !== 'undefined' && Boolean(process?.versions?.node) } diff --git a/src/utils/cache/wallet.ts b/src/utils/cache/wallet.ts index be89c963..7bcc2016 100644 --- a/src/utils/cache/wallet.ts +++ b/src/utils/cache/wallet.ts @@ -1,9 +1,19 @@ import { CacheInfo } from '../../cache/types' -import { utils } from 'ethers' +import { HDNodeWallet } from 'ethers' import { getCacheKey, processCacheData } from '../../cache/utils' import { bytesToHex } from '../hex' import { getWalletByIndex as getWallet } from '../wallet' +/** + * Asserts that value is HDNodeWallet + * @param value value to check + */ +export function assertHDNodeWallet(value: unknown): asserts value is HDNodeWallet { + if (!(value instanceof HDNodeWallet)) { + throw new Error('Expected an HDNodeWallet') + } +} + /** * Get Hierarchical Deterministic Wallet from seed by index with caching * @@ -11,7 +21,7 @@ import { getWalletByIndex as getWallet } from '../wallet' * @param index wallet index * @param cacheInfo cache info */ -export async function getWalletByIndex(seed: Uint8Array, index: number, cacheInfo?: CacheInfo): Promise { +export async function getWalletByIndex(seed: Uint8Array, index: number, cacheInfo?: CacheInfo): Promise { return processCacheData({ key: getCacheKey(bytesToHex(seed), index.toString()), onGetData: async () => ({ data: getWallet(seed, index).extendedKey }), @@ -20,7 +30,10 @@ export async function getWalletByIndex(seed: Uint8Array, index: number, cacheInf throw new Error(`Incorrect recovered cache data for the wallet by index ${index}`) } - return utils.HDNode.fromExtendedKey(data.data) + const wallet = HDNodeWallet.fromExtendedKey(data.data) + assertHDNodeWallet(wallet) + + return wallet }, cacheInfo, }) diff --git a/src/utils/encryption.ts b/src/utils/encryption.ts index 29587003..00128273 100644 --- a/src/utils/encryption.ts +++ b/src/utils/encryption.ts @@ -1,5 +1,4 @@ import CryptoJS from 'crypto-js' -import { decodeBase64Url, encodeBase64Url } from '../account/utils' import { PrivateKeyBytes, Utils } from '@ethersphere/bee-js' import { bytesToHex } from './hex' import { bytesToString, bytesToWordArray, wordArrayToBytes } from './bytes' @@ -13,18 +12,6 @@ export const POD_PASSWORD_LENGTH = 32 */ export declare type PodPasswordBytes = Utils.Bytes<32> -/** - * Decrypts text with password - * - * @deprecated method for v1 accounts - * - * @param password string to decrypt text - * @param text text to be decrypted - */ -export function decryptText(password: string, text: string): string { - return decrypt(password, decodeBase64Url(text)).toString(CryptoJS.enc.Utf8) -} - /** * Decrypts WordsArray with password * @@ -47,19 +34,6 @@ export function decrypt(password: string, data: CryptoJS.lib.WordArray): CryptoJ }) } -/** - * Encrypts text with password - * - * @deprecated method for v1 accounts - * - * @param password string to encrypt text - * @param text text to be encrypted - * @param customIv initial vector for AES. In case of absence, a random vector will be created - */ -export function encryptText(password: string, text: string, customIv?: CryptoJS.lib.WordArray): string { - return encodeBase64Url(encrypt(password, text, customIv)) -} - /** * Encrypt WordArray with password * diff --git a/src/utils/type.ts b/src/utils/type.ts index 962a170d..ff1b7754 100644 --- a/src/utils/type.ts +++ b/src/utils/type.ts @@ -1,6 +1,6 @@ import { Utils } from '@ethersphere/bee-js' import { POD_PASSWORD_LENGTH, PodPasswordBytes } from './encryption' -import { utils, Wallet } from 'ethers' +import { HDNodeWallet } from 'ethers' export type { PublicKey } from '@fairdatasociety/fdp-contracts-js' export const ETH_ADDR_HEX_LENGTH = 40 @@ -97,7 +97,7 @@ export function isArrayBufferView(value: unknown): value is ArrayBufferView { /** * Asserts that the given value is a wallet */ -export function assertWallet(value: unknown): asserts value is utils.HDNode | Wallet { +export function assertWallet(value: unknown): asserts value is HDNodeWallet { if (!value) { throw new Error('Empty wallet') } diff --git a/src/utils/wallet.ts b/src/utils/wallet.ts index 65eb45b6..e5edef3c 100644 --- a/src/utils/wallet.ts +++ b/src/utils/wallet.ts @@ -1,4 +1,4 @@ -import { utils } from 'ethers' +import { HDNodeWallet, Mnemonic } from 'ethers' import { PrivateKeyBytes, Utils } from '@ethersphere/bee-js' import { removeZeroFromHex } from '../account/utils' @@ -8,8 +8,8 @@ import { removeZeroFromHex } from '../account/utils' * @param seed data for wallet creation * @param index wallet index */ -export function getWalletByIndex(seed: Uint8Array, index: number): utils.HDNode { - const node = utils.HDNode.fromSeed(seed) +export function getWalletByIndex(seed: Uint8Array, index: number): HDNodeWallet { + const node = HDNodeWallet.fromSeed(seed) return node.derivePath(`m/44'/60'/0'/0/${index}`) } @@ -29,7 +29,7 @@ export function privateKeyToBytes(privateKey: string): PrivateKeyBytes { * @param mnemonic mnemonic phrase */ export function mnemonicToSeed(mnemonic: string): Uint8Array { - return Utils.hexToBytes(removeZeroFromHex(utils.mnemonicToSeed(mnemonic))) + return Utils.hexToBytes(removeZeroFromHex(Mnemonic.fromPhrase(mnemonic).computeSeed())) } /** diff --git a/test/integration/browser/fdp-class.browser.spec.ts b/test/integration/browser/fdp-class.browser.spec.ts index 967770ed..2ff077f4 100644 --- a/test/integration/browser/fdp-class.browser.spec.ts +++ b/test/integration/browser/fdp-class.browser.spec.ts @@ -3,7 +3,6 @@ import { batchId, beeUrl, createFdp, fdpOptions, generateRandomHexString, genera import '../../../src' import '../../index' import { FdpStorage, MAX_POD_NAME_LENGTH } from '../../../src' -import { createUserV1 } from '../../../src/account/account' import { Pod, PodShareInfo, RawFileMetadata } from '../../../src/pod/types' import { FileShareInfo } from '../../../src/file/types' import { BatchId, Reference } from '@ethersphere/bee-js' @@ -162,41 +161,6 @@ describe('Fair Data Protocol class - in browser', () => { ) }, JSON.stringify(generateUser())) }) - - it('should migrate v1 user to v2', async () => { - const fdp = createFdp() - const user = generateUser() - const user2 = generateUser() - await createUserV1(fdp.connection, user.username, user.password, user.mnemonic) - - const result = await page.evaluate( - async (user, user2) => { - user = JSON.parse(user) - user2 = JSON.parse(user2) - const fdp = eval(await window.initFdp()) as FdpStorage - const fdp2 = eval(await window.initFdp()) as FdpStorage - fdp.account.setAccountFromMnemonic(user.mnemonic) - fdp2.account.setAccountFromMnemonic(user2.mnemonic) - await window.topUpAddress(fdp) - await window.topUpAddress(fdp2) - - await fdp.account.migrate(user.username, user.password, { - mnemonic: user.mnemonic, - }) - const loggedWallet = await fdp.account.login(user.username, user.password) - await window.shouldFail( - fdp2.account.register(fdp.account.createRegistrationRequest(user.username, user.password)), - `ENS: Username ${user.username} is not available`, - ) - - return { address: loggedWallet.address } - }, - JSON.stringify(user), - JSON.stringify(user2), - ) - - expect(result.address).toEqual(user.address) - }) }) describe('Login', () => { @@ -379,7 +343,7 @@ describe('Fair Data Protocol class - in browser', () => { return { list: (await fdp.personalStorage.list()).pods, - mnemonic: wallet.mnemonic.phrase, + mnemonic: wallet.mnemonic!.phrase, } }, podName, diff --git a/test/integration/fairos/fdp-class.fairos.spec.ts b/test/integration/fairos/fdp-class.fairos.spec.ts index 93581175..1a31aa6c 100644 --- a/test/integration/fairos/fdp-class.fairos.spec.ts +++ b/test/integration/fairos/fdp-class.fairos.spec.ts @@ -1,6 +1,6 @@ import { createFdp, generateRandomHexString, generateUser, topUpAddress, topUpFdp, waitFairOS } from '../../utils' import { Directories, FairOSApi, PodsList } from '../../utils/fairos-api' -import { Wallet, utils } from 'ethers' +import { namehash, Wallet } from 'ethers' import { wrapBytesWithHelpers } from '../../../src/utils/bytes' import { getExtendedPodsListByAccountData } from '../../../src/pod/utils' import { getRawMetadata } from '../../../src/content-items/utils' @@ -20,8 +20,8 @@ describe('Fair Data Protocol with FairOS-dfs', () => { const fdp = createFdp() const user = generateUser(fdp) await topUpFdp(fdp) - const nameHash = utils.namehash(`${user.username}.fds`) - const publicKey = Wallet.fromMnemonic(user.mnemonic).publicKey.replace('0x', '') + const nameHash = namehash(`${user.username}.fds`) + const publicKey = Wallet.fromPhrase(user.mnemonic).publicKey.replace('0x', '') await fdp.account.register(fdp.account.createRegistrationRequest(user.username, user.password)) const response = await fairos.login(user.username, user.password) expect(response.status).toEqual(200) @@ -36,8 +36,8 @@ describe('Fair Data Protocol with FairOS-dfs', () => { const fairos = new FairOSApi() const fdp = createFdp() const user = generateUser() - const nameHash = utils.namehash(`${user.username}.fds`) - const publicKey = Wallet.fromMnemonic(user.mnemonic).publicKey.replace('0x', '') + const nameHash = namehash(`${user.username}.fds`) + const publicKey = Wallet.fromPhrase(user.mnemonic).publicKey.replace('0x', '') await topUpAddress(user.address) const response = await fairos.register(user.username, user.password, user.mnemonic) diff --git a/test/integration/node/fdp-class.spec.ts b/test/integration/node/fdp-class.spec.ts index a8500c17..1df683a8 100644 --- a/test/integration/node/fdp-class.spec.ts +++ b/test/integration/node/fdp-class.spec.ts @@ -1,4 +1,4 @@ -import { DirectoryItem, FdpContracts, FdpStorage } from '../../../src' +import { DirectoryItem, FdpContracts, FdpStorage, MAX_POD_NAME_LENGTH } from '../../../src' import { batchId, createFdp, @@ -8,8 +8,6 @@ import { getBee, topUpFdp, } from '../../utils' -import { MAX_POD_NAME_LENGTH } from '../../../src/pod/utils' -import { createUserV1 } from '../../../src/account/account' import { PodShareInfo, RawFileMetadata } from '../../../src/pod/types' import { FileShareInfo } from '../../../src/file/types' import { getFeedData } from '../../../src/feed/api' @@ -50,7 +48,7 @@ describe('Fair Data Protocol class', () => { const fdp = createFdp() const wallet = fdp.account.createWallet() - expect(wallet.mnemonic.phrase).toBeDefined() + expect(wallet.mnemonic!.phrase).toBeDefined() expect(wallet.address).toBeDefined() expect(wallet.privateKey).toBeDefined() @@ -95,26 +93,6 @@ describe('Fair Data Protocol class', () => { fdp.account.register(fdp.account.createRegistrationRequest(user.username, user.password)), ).rejects.toThrow(`ENS: Username ${user.username} is not available`) }) - - it('should migrate v1 user to v2', async () => { - const fdp = createFdp() - const fdp2 = createFdp() - - const user = generateUser(fdp) - generateUser(fdp2) - await topUpFdp(fdp) - await topUpFdp(fdp2) - await createUserV1(fdp.connection, user.username, user.password, user.mnemonic) - await fdp.account.migrate(user.username, user.password, { - mnemonic: user.mnemonic, - }) - const loggedWallet = await fdp.account.login(user.username, user.password) - expect(loggedWallet.address).toEqual(user.address) - - await expect( - fdp2.account.register(fdp.account.createRegistrationRequest(user.username, user.password)), - ).rejects.toThrow(`ENS: Username ${user.username} is not available`) - }) }) describe('Login', () => { @@ -742,7 +720,7 @@ describe('Fair Data Protocol class', () => { const filenameSmall = generateRandomHexString() + '.txt' const fullFilenameSmallPath = '/' + filenameSmall - const privateKey = removeZeroFromHex(Wallet.fromMnemonic(user.mnemonic).privateKey) + const privateKey = removeZeroFromHex(Wallet.fromPhrase(user.mnemonic).privateKey) const seed = mnemonicToSeed(user.mnemonic) // check pod metadata @@ -970,7 +948,7 @@ describe('Fair Data Protocol class', () => { isUseCache: true, }) fdpRecovered.cache.object = JSON.parse(cache) - fdpRecovered.account.setAccountFromMnemonic(wallet.mnemonic.phrase) + fdpRecovered.account.setAccountFromMnemonic(wallet.mnemonic!.phrase) const pods = await fdpRecovered.personalStorage.list() expect(pods.pods).toHaveLength(1) expect(pods.pods[0].name).toEqual(pod2) diff --git a/test/unit/encryption.spec.ts b/test/unit/encryption.spec.ts deleted file mode 100644 index 4f58ce4b..00000000 --- a/test/unit/encryption.spec.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { decryptText, encryptText } from '../../src/utils/encryption' -import CryptoJS from 'crypto-js' -import { generateRandomHexString } from '../utils' - -describe('encryption', () => { - describe('FairOS-dfs compatibility', () => { - const examples = [ - { - data: '7uQRkTQ2G8dzh-tFeGLQ-KIeeVHmdWnek1VsqfKj7gLcEWM4EQxY7QTXwBlaC6IQLYSfkQpCj0PqcAINRTaz0nyOuZKckJ4opVqZ9h4YPNAXQynkwl-GYnYsvKqkRW8tFf0XXQ==', - password: 'zaqzaq', - expected: 'wrestle tomato logic broom plastic little fault awesome ketchup brisk junior endorse', - iv: 'eee4119134361bc77387eb457862d0f8', - }, - { - data: '0XpncZw1cBd9oh6MXyxYaFPiG_tMt9S-iY69RBPiKBjxKmpe9PpsGylqSTMMjRSu-eBhPUW4i8xuMlnT3HTLmd1ljK4lupMVXzfVO_SRYbFlD3Un-CjGfH7zXQQ=', - password: 'bbb', - expected: 'situate zone steel fog used improve reason lesson company green large target', - iv: 'd17a67719c3570177da21e8c5f2c5868', - }, - { - data: 'GAEHnSA9-UhNsUeC2Mk-l9nEYXxGGTn7s3FQNPMBVFO7oK4XmpEPMMFGajmFck1cpEtpaU684ljDWdOtFCNRJ3i2KBHxPOjfGAqRwTM7JJNhbjv6KII1e144J5ei', - password: 'helloworld', - expected: 'kid pond elbow remove switch reveal hello letter vintage gadget police motion', - iv: '1801079d203df9484db14782d8c93e97', - }, - ] - - it('decryptText', () => { - for (const item of examples) { - const decrypted = decryptText(item.password, item.data) - expect(decrypted).toEqual(item.expected) - } - }) - - it('encryptText', () => { - for (const item of examples) { - const encrypted = encryptText(item.password, item.expected, CryptoJS.enc.Hex.parse(item.iv)) - expect(encrypted).toEqual(item.data) - } - }) - - it('encryptText and decryptText', () => { - const examples: { text: string; password: string }[] = [] - - // examples with content length from 1 to 200 and password in range 3-10 - for (let i = 1; i <= 200; i++) { - for (let j = 1; j <= 20; j++) { - examples.push({ - text: generateRandomHexString(i), - password: generateRandomHexString(j), - }) - } - } - - for (const item of examples) { - const encrypted = encryptText(item.password, item.text) - const decrypted = decryptText(item.password, encrypted) - expect(decrypted).toEqual(item.text) - } - }) - }) -}) diff --git a/test/utils.ts b/test/utils.ts index 89e50803..e391d63e 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,7 +1,7 @@ import crypto from 'crypto' import { BATCH_ID_HEX_LENGTH, BatchId, Bee, BeeDebug, Utils } from '@ethersphere/bee-js' import { FdpStorage, Options } from '../src' -import { utils, Wallet } from 'ethers' +import { parseEther, toBeHex, Wallet } from 'ethers' import { Environments, getEnsEnvironmentConfig } from '@fairdatasociety/fdp-contracts-js' import axios from 'axios' import { CacheOptions } from '../src/cache/types' @@ -69,7 +69,7 @@ export function generateUser(fdp?: FdpStorage): TestUser { return { username: crypto.randomBytes(USERNAME_LENGTH).toString('hex'), password: crypto.randomBytes(PASSWORD_LENGTH).toString('hex'), - mnemonic: wallet.mnemonic.phrase, + mnemonic: wallet.mnemonic!.phrase, address: wallet.address, } } @@ -270,7 +270,7 @@ export async function topUpAddress(address: string, amountInEther = '0.01'): Pro { from: account, to: address, - value: utils.hexlify(utils.parseEther(amountInEther)), + value: toBeHex(parseEther(amountInEther)), }, ])