From 739eaa5638b52ef88fe11aaabcf810891b5914a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Tue, 24 Sep 2024 16:04:15 -0300 Subject: [PATCH 1/9] wip ethers v6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- package.json | 9 +- src/index.ts | 3 +- src/lib/provider.ts | 23 +- src/lib/signer.ts | 5 +- src/lib/wallet.ts | 33 +- src/tasks.ts | 2 +- src/type-extensions.ts | 6 +- test/environment.test.ts | 4 +- yarn.lock | 1003 +++++++++++--------------------------- 9 files changed, 342 insertions(+), 746 deletions(-) diff --git a/package.json b/package.json index b5228f2..b3bf6e1 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "README.md" ], "devDependencies": { + "@nomicfoundation/hardhat-ethers": "^3.0.0", "@nomiclabs/hardhat-ethers": "^2.1.1", "@types/chai": "^4.1.7", "@types/chai-as-promised": "^7.1.5", @@ -42,8 +43,8 @@ "@types/prompt-sync": "^4.1.1", "chai": "^4.2.0", "chai-as-promised": "^7.1.1", - "ethers": "^5.0.0", - "hardhat": "^2.0.0", + "ethers": "^6.13.0", + "hardhat": "^2.22.0", "mocha": "^7.1.2", "prettier": "2.0.5", "ts-node": "^8.1.0", @@ -54,8 +55,8 @@ }, "peerDependencies": { "@nomiclabs/hardhat-ethers": "^2.1.1", - "ethers": "^5.0.0", - "hardhat": "^2.0.0" + "ethers": "^6.13.0", + "hardhat": "^2.22.0" }, "dependencies": { "debug": "^4.3.4", diff --git a/src/index.ts b/src/index.ts index b7324d9..6bfba0a 100644 --- a/src/index.ts +++ b/src/index.ts @@ -8,8 +8,7 @@ import { HardhatConfig, HardhatUserConfig, Network } from 'hardhat/types' import { getWallet, getWallets } from './lib/wallet' import { getSigner, getSigners } from './lib/signer' import { getProvider } from './lib/provider' -import { logDebug, logError } from './helpers/logger' -import { isRepl } from './lib/ask' +import { logDebug } from './helpers/logger' import './type-extensions' import './tasks' diff --git a/src/lib/provider.ts b/src/lib/provider.ts index 6980a5b..606a7a6 100644 --- a/src/lib/provider.ts +++ b/src/lib/provider.ts @@ -1,8 +1,8 @@ import cloneDeep from 'lodash.clonedeep' import { EthersProviderWrapper } from '@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper' -import { Mnemonic } from 'ethers/lib/utils' import { createProvider } from 'hardhat/internal/core/providers/construction' import { + HardhatConfig, HardhatNetworkAccountsConfig, HardhatNetworkHDAccountsConfig, HttpNetworkAccountsConfig, @@ -18,24 +18,29 @@ import { import { logDebug } from '../helpers/logger' import { getWallet } from './wallet' +import { Mnemonic } from 'ethers' export async function getProvider( + config: HardhatConfig, _network: Network, accountsDir: string, name?: string, password?: string, ): Promise { const wallet = await getWallet(accountsDir, name, password) - const network = setNetworkMnemonic(_network, wallet.mnemonic) - return createProviderWrapper(network) + if (wallet.mnemonic === null || wallet.path === null) { + throw new Error('Wallet is not an HDNodeWallet') + } + const network = setNetworkMnemonic(_network, wallet.mnemonic, wallet.path) + return createProviderWrapper(config, network) } -function createProviderWrapper(network: Network) { - const ethereumProvider = createProvider(network.name, network.config) +async function createProviderWrapper(config: HardhatConfig, network: Network) { + const ethereumProvider = await createProvider(config, network.name) return new EthersProviderWrapper(ethereumProvider) } -function setNetworkMnemonic(_network: Network, mnemonic: Mnemonic): Network { +function setNetworkMnemonic(_network: Network, mnemonic: Mnemonic, path: string): Network { logDebug(`Cloning network config for ${_network.name} provider`) const networkConfig = cloneDeep(_network.config) @@ -48,15 +53,15 @@ function setNetworkMnemonic(_network: Network, mnemonic: Mnemonic): Network { ) { logDebug('Target network already uses HD accounts, overriding mnemonic') networkAccounts.mnemonic = mnemonic.phrase - networkAccounts.path = removeIndexFromHDPath(mnemonic.path) + // networkAccounts.path = removeIndexFromHDPath(mnemonic.path) } else { logDebug('Target network not using HD accounts, setting mnemonic') networkConfig.accounts = { mnemonic: mnemonic.phrase, initialIndex: DEFAULT_HD_INITIAL_INDEX, count: DEFAULT_HD_COUNT, - path: removeIndexFromHDPath(mnemonic.path), - passphrase: DEFAULT_HD_PASSPHRASE, + path: removeIndexFromHDPath(path), + passphrase: mnemonic.password || DEFAULT_HD_PASSPHRASE, } } diff --git a/src/lib/signer.ts b/src/lib/signer.ts index 80e15aa..15f5fef 100644 --- a/src/lib/signer.ts +++ b/src/lib/signer.ts @@ -1,16 +1,17 @@ -import { Network } from 'hardhat/types' +import { HardhatConfig, Network } from 'hardhat/types' import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers' import { logDebug } from '../helpers/logger' import { getProvider } from './provider' export async function getSigner( + config: HardhatConfig, network: Network, accountsDir: string, name?: string, password?: string, ): Promise { - const provider = await getProvider(network, accountsDir, name, password) + const provider = await getProvider(config, network, accountsDir, name, password) const signer = provider.getSigner() const signerWithAddress = await SignerWithAddress.create(signer) diff --git a/src/lib/wallet.ts b/src/lib/wallet.ts index 6bb269f..722286a 100644 --- a/src/lib/wallet.ts +++ b/src/lib/wallet.ts @@ -1,4 +1,4 @@ -import { Wallet } from 'ethers' +import { HDNodeWallet, Wallet } from 'ethers' import { derivePrivateKeys } from 'hardhat/internal/core/providers/util' import { SecureAccountPluginError } from '../helpers/error' @@ -13,7 +13,7 @@ export async function getWallet( accountsDir: string, name?: string, _password?: string, -): Promise { +): Promise { const account = await getAccountOrAsk(name, accountsDir) const password = await getPasswordOrAsk(_password) @@ -21,7 +21,11 @@ export async function getWallet( const wallet = await Wallet.fromEncryptedJson(account.json, password) logDebug(`Account unlocked: ${wallet.address}`) - return wallet + if (isHDNodeWallet(wallet)) { + return wallet + } else { + throw new SecureAccountPluginError('Wallet is not an HDNodeWallet') + } } catch (error) { throw new SecureAccountPluginError(error as Error) } @@ -31,26 +35,25 @@ export async function getWallets( accountsDir: string, name?: string, password?: string, -): Promise { +): Promise { const wallet = await getWallet(accountsDir, name, password) + if (wallet.mnemonic === null) { + throw new SecureAccountPluginError('Wallet is not an HDNodeWallet') + } + logDebug(`Deriving private keys from mnemonic`) - const privateKeys = derivePrivateKeys( - wallet.mnemonic.phrase, - removeIndexFromHDPath(wallet.mnemonic.path), - DEFAULT_HD_INITIAL_INDEX, - DEFAULT_HD_COUNT, - DEFAULT_HD_PASSPHRASE, - ) - - return privateKeys.map((privateKey) => new Wallet(privateKey)) + return Array.from(Array(DEFAULT_HD_COUNT).keys()).map((i) => wallet.deriveChild(i)) } - -export function removeIndexFromHDPath (hdpath: string): string { +export function removeIndexFromHDPath(hdpath: string): string { if (hdpath.endsWith('/')) { return hdpath } else { return hdpath.substring(0, hdpath.lastIndexOf('/') + 1) } } + +function isHDNodeWallet(wallet: Wallet | HDNodeWallet): wallet is HDNodeWallet { + return (wallet as HDNodeWallet).mnemonic !== undefined +} diff --git a/src/tasks.ts b/src/tasks.ts index db48ca5..5aa56e0 100644 --- a/src/tasks.ts +++ b/src/tasks.ts @@ -51,7 +51,7 @@ subtask(TASK_ACCOUNTS_ADD, 'Add a new account via mnemonic.') // Get account mnemonic const mnemonic = await getStringOrAsk('mnemonic', 'Enter mnemonic (leave empty to create a random mnemonic)', taskArgs.mnemonic) - const wallet = mnemonic.length === 0 ? hre.ethers.Wallet.createRandom() : hre.ethers.Wallet.fromMnemonic(mnemonic) + const wallet = mnemonic.length === 0 ? hre.ethers.Wallet.createRandom() : hre.ethers.Wallet.fromPhrase(mnemonic) // Get account password and ecrypt wallet const password = await getPasswordOrAsk(taskArgs.password) diff --git a/src/type-extensions.ts b/src/type-extensions.ts index 6c2a66f..d4404d5 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -1,6 +1,6 @@ import "hardhat/types/config"; import "hardhat/types/runtime"; -import { Wallet } from 'ethers' +import { HDNodeWallet } from 'ethers' import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; import { EthersProviderWrapper } from "@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper"; import { Network } from "hardhat/types/runtime"; @@ -16,8 +16,8 @@ declare module "hardhat/types/config" { } export interface AccountsRuntimeEnvironment { - getWallet(name?: string, password?: string): Promise - getWallets(name?: string, password?: string): Promise + getWallet(name?: string, password?: string): Promise + getWallets(name?: string, password?: string): Promise getSigner(network?: Network, name?: string, password?: string): Promise getSigners(network?: Network, name?: string, password?: string): Promise getProvider(network?: Network, name?: string, password?: string): Promise diff --git a/test/environment.test.ts b/test/environment.test.ts index 2fde91a..c68d2cc 100644 --- a/test/environment.test.ts +++ b/test/environment.test.ts @@ -24,11 +24,11 @@ describe('Extended environment usage > project using private keys', function () }) function runTests() { - it('should unlock account and return a single wallet', async function () { + it.only('should unlock account and return a single wallet', async function () { const wallet = await this.hre.accounts.getWallet(TEST_NAME, TEST_PASSWORD) expect(wallet.address).to.equal(TEST_ADDRESSES[0]) - expect(wallet.mnemonic.phrase).to.equal(TEST_MNEMONIC) + expect(wallet?.mnemonic?.phrase).to.equal(TEST_MNEMONIC) expect(wallet.provider).to.be.null expect(wallet.signMessage('test')).to.eventually.equal(TEST_SIGNED_MESSAGE) }) diff --git a/yarn.lock b/yarn.lock index 2f258c1..22ae80c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,6 +2,11 @@ # yarn lockfile v1 +"@adraffy/ens-normalize@1.10.1": + version "1.10.1" + resolved "https://registry.yarnpkg.com/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz#63430d04bd8c5e74f8d7d049338f1cd9d4f02069" + integrity sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw== + "@babel/code-frame@^7.0.0": version "7.18.6" resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.18.6.tgz#3b25d38c89600baa2dcc219edfa88a74eb2c427a" @@ -23,76 +28,7 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@ethereumjs/block@^3.5.0", "@ethereumjs/block@^3.6.2", "@ethereumjs/block@^3.6.3": - version "3.6.3" - resolved "https://registry.yarnpkg.com/@ethereumjs/block/-/block-3.6.3.tgz#d96cbd7af38b92ebb3424223dbf773f5ccd27f84" - integrity sha512-CegDeryc2DVKnDkg5COQrE0bJfw/p0v3GBk2W5/Dj5dOVfEmb50Ux0GLnSPypooLnfqjwFaorGuT9FokWB3GRg== - dependencies: - "@ethereumjs/common" "^2.6.5" - "@ethereumjs/tx" "^3.5.2" - ethereumjs-util "^7.1.5" - merkle-patricia-tree "^4.2.4" - -"@ethereumjs/blockchain@^5.5.2", "@ethereumjs/blockchain@^5.5.3": - version "5.5.3" - resolved "https://registry.yarnpkg.com/@ethereumjs/blockchain/-/blockchain-5.5.3.tgz#aa49a6a04789da6b66b5bcbb0d0b98efc369f640" - integrity sha512-bi0wuNJ1gw4ByNCV56H0Z4Q7D+SxUbwyG12Wxzbvqc89PXLRNR20LBcSUZRKpN0+YCPo6m0XZL/JLio3B52LTw== - dependencies: - "@ethereumjs/block" "^3.6.2" - "@ethereumjs/common" "^2.6.4" - "@ethereumjs/ethash" "^1.1.0" - debug "^4.3.3" - ethereumjs-util "^7.1.5" - level-mem "^5.0.1" - lru-cache "^5.1.1" - semaphore-async-await "^1.5.1" - -"@ethereumjs/common@^2.6.4", "@ethereumjs/common@^2.6.5": - version "2.6.5" - resolved "https://registry.yarnpkg.com/@ethereumjs/common/-/common-2.6.5.tgz#0a75a22a046272579d91919cb12d84f2756e8d30" - integrity sha512-lRyVQOeCDaIVtgfbowla32pzeDv2Obr8oR8Put5RdUBNRGr1VGPGQNGP6elWIpgK3YdpzqTOh4GyUGOureVeeA== - dependencies: - crc-32 "^1.2.0" - ethereumjs-util "^7.1.5" - -"@ethereumjs/ethash@^1.1.0": - version "1.1.0" - resolved "https://registry.yarnpkg.com/@ethereumjs/ethash/-/ethash-1.1.0.tgz#7c5918ffcaa9cb9c1dc7d12f77ef038c11fb83fb" - integrity sha512-/U7UOKW6BzpA+Vt+kISAoeDie1vAvY4Zy2KF5JJb+So7+1yKmJeJEHOGSnQIj330e9Zyl3L5Nae6VZyh2TJnAA== - dependencies: - "@ethereumjs/block" "^3.5.0" - "@types/levelup" "^4.3.0" - buffer-xor "^2.0.1" - ethereumjs-util "^7.1.1" - miller-rabin "^4.0.0" - -"@ethereumjs/tx@^3.5.1", "@ethereumjs/tx@^3.5.2": - version "3.5.2" - resolved "https://registry.yarnpkg.com/@ethereumjs/tx/-/tx-3.5.2.tgz#197b9b6299582ad84f9527ca961466fce2296c1c" - integrity sha512-gQDNJWKrSDGu2w7w0PzVXVBNMzb7wwdDOmOqczmhNjqFxFuIbhVJDwiGEnxFNC2/b8ifcZzY7MLcluizohRzNw== - dependencies: - "@ethereumjs/common" "^2.6.4" - ethereumjs-util "^7.1.5" - -"@ethereumjs/vm@^5.9.0": - version "5.9.3" - resolved "https://registry.yarnpkg.com/@ethereumjs/vm/-/vm-5.9.3.tgz#6d69202e4c132a4a1e1628ac246e92062e230823" - integrity sha512-Ha04TeF8goEglr8eL7hkkYyjhzdZS0PsoRURzYlTF6I0VVId5KjKb0N7MrA8GMgheN+UeTncfTgYx52D/WhEmg== - dependencies: - "@ethereumjs/block" "^3.6.3" - "@ethereumjs/blockchain" "^5.5.3" - "@ethereumjs/common" "^2.6.5" - "@ethereumjs/tx" "^3.5.2" - async-eventemitter "^0.2.4" - core-js-pure "^3.0.1" - debug "^4.3.3" - ethereumjs-util "^7.1.5" - functional-red-black-tree "^1.0.1" - mcl-wasm "^0.7.1" - merkle-patricia-tree "^4.2.4" - rustbn.js "~0.2.0" - -"@ethersproject/abi@5.6.4", "@ethersproject/abi@^5.1.2", "@ethersproject/abi@^5.6.3": +"@ethersproject/abi@^5.1.2": version "5.6.4" resolved "https://registry.yarnpkg.com/@ethersproject/abi/-/abi-5.6.4.tgz#f6e01b6ed391a505932698ecc0d9e7a99ee60362" integrity sha512-TTeZUlCeIHG6527/2goZA6gW5F8Emoc7MrZDC7hhP84aRGvW3TEdTnZR08Ls88YXM1m2SuK42Osw/jSi3uO8gg== @@ -107,7 +43,7 @@ "@ethersproject/properties" "^5.6.0" "@ethersproject/strings" "^5.6.1" -"@ethersproject/abstract-provider@5.6.1", "@ethersproject/abstract-provider@^5.6.1": +"@ethersproject/abstract-provider@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-provider/-/abstract-provider-5.6.1.tgz#02ddce150785caf0c77fe036a0ebfcee61878c59" integrity sha512-BxlIgogYJtp1FS8Muvj8YfdClk3unZH0vRMVX791Z9INBNT/kuACZ9GzaY1Y4yFq+YSy6/w4gzj3HCRKrK9hsQ== @@ -120,7 +56,7 @@ "@ethersproject/transactions" "^5.6.2" "@ethersproject/web" "^5.6.1" -"@ethersproject/abstract-signer@5.6.2", "@ethersproject/abstract-signer@^5.6.2": +"@ethersproject/abstract-signer@^5.6.2": version "5.6.2" resolved "https://registry.yarnpkg.com/@ethersproject/abstract-signer/-/abstract-signer-5.6.2.tgz#491f07fc2cbd5da258f46ec539664713950b0b33" integrity sha512-n1r6lttFBG0t2vNiI3HoWaS/KdOt8xyDjzlP2cuevlWLG6EX0OwcKLyG/Kp/cuwNxdy/ous+R/DEMdTUwWQIjQ== @@ -131,7 +67,7 @@ "@ethersproject/logger" "^5.6.0" "@ethersproject/properties" "^5.6.0" -"@ethersproject/address@5.6.1", "@ethersproject/address@^5.6.1": +"@ethersproject/address@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/address/-/address-5.6.1.tgz#ab57818d9aefee919c5721d28cd31fd95eff413d" integrity sha512-uOgF0kS5MJv9ZvCz7x6T2EXJSzotiybApn4XlOgoTX0xdtyVIJ7pF+6cGPxiEq/dpBiTfMiw7Yc81JcwhSYA0Q== @@ -142,22 +78,14 @@ "@ethersproject/logger" "^5.6.0" "@ethersproject/rlp" "^5.6.1" -"@ethersproject/base64@5.6.1", "@ethersproject/base64@^5.6.1": +"@ethersproject/base64@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/base64/-/base64-5.6.1.tgz#2c40d8a0310c9d1606c2c37ae3092634b41d87cb" integrity sha512-qB76rjop6a0RIYYMiB4Eh/8n+Hxu2NIZm8S/Q7kNo5pmZfXhHGHmS4MinUainiBC54SCyRnwzL+KZjj8zbsSsw== dependencies: "@ethersproject/bytes" "^5.6.1" -"@ethersproject/basex@5.6.1", "@ethersproject/basex@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/basex/-/basex-5.6.1.tgz#badbb2f1d4a6f52ce41c9064f01eab19cc4c5305" - integrity sha512-a52MkVz4vuBXR06nvflPMotld1FJWSj2QT0985v7P/emPZO00PucFAkbcmq2vpVU7Ts7umKiSI6SppiLykVWsA== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - -"@ethersproject/bignumber@5.6.2", "@ethersproject/bignumber@^5.6.2": +"@ethersproject/bignumber@^5.6.2": version "5.6.2" resolved "https://registry.yarnpkg.com/@ethersproject/bignumber/-/bignumber-5.6.2.tgz#72a0717d6163fab44c47bcc82e0c550ac0315d66" integrity sha512-v7+EEUbhGqT3XJ9LMPsKvXYHFc8eHxTowFCG/HgJErmq4XHJ2WR7aeyICg3uTOAQ7Icn0GFHAohXEhxQHq4Ubw== @@ -166,37 +94,21 @@ "@ethersproject/logger" "^5.6.0" bn.js "^5.2.1" -"@ethersproject/bytes@5.6.1", "@ethersproject/bytes@^5.6.1": +"@ethersproject/bytes@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/bytes/-/bytes-5.6.1.tgz#24f916e411f82a8a60412344bf4a813b917eefe7" integrity sha512-NwQt7cKn5+ZE4uDn+X5RAXLp46E1chXoaMmrxAyA0rblpxz8t58lVkrHXoRIn0lz1joQElQ8410GqhTqMOwc6g== dependencies: "@ethersproject/logger" "^5.6.0" -"@ethersproject/constants@5.6.1", "@ethersproject/constants@^5.6.1": +"@ethersproject/constants@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/constants/-/constants-5.6.1.tgz#e2e974cac160dd101cf79fdf879d7d18e8cb1370" integrity sha512-QSq9WVnZbxXYFftrjSjZDUshp6/eKp6qrtdBtUCm0QxCV5z1fG/w3kdlcsjMCQuQHUnAclKoK7XpXMezhRDOLg== dependencies: "@ethersproject/bignumber" "^5.6.2" -"@ethersproject/contracts@5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/contracts/-/contracts-5.6.2.tgz#20b52e69ebc1b74274ff8e3d4e508de971c287bc" - integrity sha512-hguUA57BIKi6WY0kHvZp6PwPlWF87MCeB4B7Z7AbUpTxfFXFdn/3b0GmjZPagIHS+3yhcBJDnuEfU4Xz+Ks/8g== - dependencies: - "@ethersproject/abi" "^5.6.3" - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/transactions" "^5.6.2" - -"@ethersproject/hash@5.6.1", "@ethersproject/hash@^5.6.1": +"@ethersproject/hash@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/hash/-/hash-5.6.1.tgz#224572ea4de257f05b4abf8ae58b03a67e99b0f4" integrity sha512-L1xAHurbaxG8VVul4ankNX5HgQ8PNCTrnVXEiFnE9xoRnaUcgfD12tZINtDinSllxPLCtGwguQxJ5E6keE84pA== @@ -210,44 +122,7 @@ "@ethersproject/properties" "^5.6.0" "@ethersproject/strings" "^5.6.1" -"@ethersproject/hdnode@5.6.2", "@ethersproject/hdnode@^5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/hdnode/-/hdnode-5.6.2.tgz#26f3c83a3e8f1b7985c15d1db50dc2903418b2d2" - integrity sha512-tERxW8Ccf9CxW2db3WsN01Qao3wFeRsfYY9TCuhmG0xNpl2IO8wgXU3HtWIZ49gUWPggRy4Yg5axU0ACaEKf1Q== - dependencies: - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/basex" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/pbkdf2" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/signing-key" "^5.6.2" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/wordlists" "^5.6.1" - -"@ethersproject/json-wallets@5.6.1", "@ethersproject/json-wallets@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/json-wallets/-/json-wallets-5.6.1.tgz#3f06ba555c9c0d7da46756a12ac53483fe18dd91" - integrity sha512-KfyJ6Zwz3kGeX25nLihPwZYlDqamO6pfGKNnVMWWfEVVp42lTfCZVXXy5Ie8IZTN0HKwAngpIPi7gk4IJzgmqQ== - dependencies: - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hdnode" "^5.6.2" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/pbkdf2" "^5.6.1" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - aes-js "3.0.0" - scrypt-js "3.0.1" - -"@ethersproject/keccak256@5.6.1", "@ethersproject/keccak256@^5.6.1": +"@ethersproject/keccak256@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/keccak256/-/keccak256-5.6.1.tgz#b867167c9b50ba1b1a92bccdd4f2d6bd168a91cc" integrity sha512-bB7DQHCTRDooZZdL3lk9wpL0+XuG3XLGHLh3cePnybsO3V0rdCAOQGpn/0R3aODmnTOOkCATJiD2hnL+5bwthA== @@ -255,68 +130,26 @@ "@ethersproject/bytes" "^5.6.1" js-sha3 "0.8.0" -"@ethersproject/logger@5.6.0", "@ethersproject/logger@^5.6.0": +"@ethersproject/logger@^5.6.0": version "5.6.0" resolved "https://registry.yarnpkg.com/@ethersproject/logger/-/logger-5.6.0.tgz#d7db1bfcc22fd2e4ab574cba0bb6ad779a9a3e7a" integrity sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg== -"@ethersproject/networks@5.6.4", "@ethersproject/networks@^5.6.3": +"@ethersproject/networks@^5.6.3": version "5.6.4" resolved "https://registry.yarnpkg.com/@ethersproject/networks/-/networks-5.6.4.tgz#51296d8fec59e9627554f5a8a9c7791248c8dc07" integrity sha512-KShHeHPahHI2UlWdtDMn2lJETcbtaJge4k7XSjDR9h79QTd6yQJmv6Cp2ZA4JdqWnhszAOLSuJEd9C0PRw7hSQ== dependencies: "@ethersproject/logger" "^5.6.0" -"@ethersproject/pbkdf2@5.6.1", "@ethersproject/pbkdf2@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/pbkdf2/-/pbkdf2-5.6.1.tgz#f462fe320b22c0d6b1d72a9920a3963b09eb82d1" - integrity sha512-k4gRQ+D93zDRPNUfmduNKq065uadC2YjMP/CqwwX5qG6R05f47boq6pLZtV/RnC4NZAYOPH1Cyo54q0c9sshRQ== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/sha2" "^5.6.1" - -"@ethersproject/properties@5.6.0", "@ethersproject/properties@^5.6.0": +"@ethersproject/properties@^5.6.0": version "5.6.0" resolved "https://registry.yarnpkg.com/@ethersproject/properties/-/properties-5.6.0.tgz#38904651713bc6bdd5bdd1b0a4287ecda920fa04" integrity sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg== dependencies: "@ethersproject/logger" "^5.6.0" -"@ethersproject/providers@5.6.8": - version "5.6.8" - resolved "https://registry.yarnpkg.com/@ethersproject/providers/-/providers-5.6.8.tgz#22e6c57be215ba5545d3a46cf759d265bb4e879d" - integrity sha512-Wf+CseT/iOJjrGtAOf3ck9zS7AgPmr2fZ3N97r4+YXN3mBePTG2/bJ8DApl9mVwYL+RpYbNxMEkEp4mPGdwG/w== - dependencies: - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/base64" "^5.6.1" - "@ethersproject/basex" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/networks" "^5.6.3" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/rlp" "^5.6.1" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/web" "^5.6.1" - bech32 "1.1.4" - ws "7.4.6" - -"@ethersproject/random@5.6.1", "@ethersproject/random@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/random/-/random-5.6.1.tgz#66915943981bcd3e11bbd43733f5c3ba5a790255" - integrity sha512-/wtPNHwbmng+5yi3fkipA8YBT59DdkGRoC2vWk09Dci/q5DlgnMkhIycjHlavrvrjJBkFjO/ueLyT+aUDfc4lA== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/rlp@5.6.1", "@ethersproject/rlp@^5.6.1": +"@ethersproject/rlp@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/rlp/-/rlp-5.6.1.tgz#df8311e6f9f24dcb03d59a2bac457a28a4fe2bd8" integrity sha512-uYjmcZx+DKlFUk7a5/W9aQVaoEC7+1MOBgNtvNg13+RnuUwT4F0zTovC0tmay5SmRslb29V1B7Y5KCri46WhuQ== @@ -324,16 +157,7 @@ "@ethersproject/bytes" "^5.6.1" "@ethersproject/logger" "^5.6.0" -"@ethersproject/sha2@5.6.1", "@ethersproject/sha2@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/sha2/-/sha2-5.6.1.tgz#211f14d3f5da5301c8972a8827770b6fd3e51656" - integrity sha512-5K2GyqcW7G4Yo3uenHegbXRPDgARpWUiXc6RiF7b6i/HXUoWlb7uCARh7BAHg7/qT/Q5ydofNwiZcim9qpjB6g== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - hash.js "1.1.7" - -"@ethersproject/signing-key@5.6.2", "@ethersproject/signing-key@^5.6.2": +"@ethersproject/signing-key@^5.6.2": version "5.6.2" resolved "https://registry.yarnpkg.com/@ethersproject/signing-key/-/signing-key-5.6.2.tgz#8a51b111e4d62e5a62aee1da1e088d12de0614a3" integrity sha512-jVbu0RuP7EFpw82vHcL+GP35+KaNruVAZM90GxgQnGqB6crhBqW/ozBfFvdeImtmb4qPko0uxXjn8l9jpn0cwQ== @@ -345,19 +169,7 @@ elliptic "6.5.4" hash.js "1.1.7" -"@ethersproject/solidity@5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/solidity/-/solidity-5.6.1.tgz#5845e71182c66d32e6ec5eefd041fca091a473e2" - integrity sha512-KWqVLkUUoLBfL1iwdzUVlkNqAUIFMpbbeH0rgCfKmJp0vFtY4AsaN91gHKo9ZZLkC4UOm3cI3BmMV4N53BOq4g== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/sha2" "^5.6.1" - "@ethersproject/strings" "^5.6.1" - -"@ethersproject/strings@5.6.1", "@ethersproject/strings@^5.6.1": +"@ethersproject/strings@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/strings/-/strings-5.6.1.tgz#dbc1b7f901db822b5cafd4ebf01ca93c373f8952" integrity sha512-2X1Lgk6Jyfg26MUnsHiT456U9ijxKUybz8IM1Vih+NJxYtXhmvKBcHOmvGqpFSVJ0nQ4ZCoIViR8XlRw1v/+Cw== @@ -366,7 +178,7 @@ "@ethersproject/constants" "^5.6.1" "@ethersproject/logger" "^5.6.0" -"@ethersproject/transactions@5.6.2", "@ethersproject/transactions@^5.6.2": +"@ethersproject/transactions@^5.6.2": version "5.6.2" resolved "https://registry.yarnpkg.com/@ethersproject/transactions/-/transactions-5.6.2.tgz#793a774c01ced9fe7073985bb95a4b4e57a6370b" integrity sha512-BuV63IRPHmJvthNkkt9G70Ullx6AcM+SDc+a8Aw/8Yew6YwT51TcBKEp1P4oOQ/bP25I18JJr7rcFRgFtU9B2Q== @@ -381,37 +193,7 @@ "@ethersproject/rlp" "^5.6.1" "@ethersproject/signing-key" "^5.6.2" -"@ethersproject/units@5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/units/-/units-5.6.1.tgz#ecc590d16d37c8f9ef4e89e2005bda7ddc6a4e6f" - integrity sha512-rEfSEvMQ7obcx3KWD5EWWx77gqv54K6BKiZzKxkQJqtpriVsICrktIQmKl8ReNToPeIYPnFHpXvKpi068YFZXw== - dependencies: - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/constants" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - -"@ethersproject/wallet@5.6.2": - version "5.6.2" - resolved "https://registry.yarnpkg.com/@ethersproject/wallet/-/wallet-5.6.2.tgz#cd61429d1e934681e413f4bc847a5f2f87e3a03c" - integrity sha512-lrgh0FDQPuOnHcF80Q3gHYsSUODp6aJLAdDmDV0xKCN/T7D99ta1jGVhulg3PY8wiXEngD0DfM0I2XKXlrqJfg== - dependencies: - "@ethersproject/abstract-provider" "^5.6.1" - "@ethersproject/abstract-signer" "^5.6.2" - "@ethersproject/address" "^5.6.1" - "@ethersproject/bignumber" "^5.6.2" - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/hdnode" "^5.6.2" - "@ethersproject/json-wallets" "^5.6.1" - "@ethersproject/keccak256" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/random" "^5.6.1" - "@ethersproject/signing-key" "^5.6.2" - "@ethersproject/transactions" "^5.6.2" - "@ethersproject/wordlists" "^5.6.1" - -"@ethersproject/web@5.6.1", "@ethersproject/web@^5.6.1": +"@ethersproject/web@^5.6.1": version "5.6.1" resolved "https://registry.yarnpkg.com/@ethersproject/web/-/web-5.6.1.tgz#6e2bd3ebadd033e6fe57d072db2b69ad2c9bdf5d" integrity sha512-/vSyzaQlNXkO1WV+RneYKqCJwualcUdx/Z3gseVovZP0wIlOFcCE1hkRhKBH8ImKbGQbMl9EAAyJFrJu7V0aqA== @@ -422,16 +204,10 @@ "@ethersproject/properties" "^5.6.0" "@ethersproject/strings" "^5.6.1" -"@ethersproject/wordlists@5.6.1", "@ethersproject/wordlists@^5.6.1": - version "5.6.1" - resolved "https://registry.yarnpkg.com/@ethersproject/wordlists/-/wordlists-5.6.1.tgz#1e78e2740a8a21e9e99947e47979d72e130aeda1" - integrity sha512-wiPRgBpNbNwCQFoCr8bcWO8o5I810cqO6mkdtKfLKFlLxeCWcnzDi4Alu8iyNzlhYuS9npCwivMbRWF19dyblw== - dependencies: - "@ethersproject/bytes" "^5.6.1" - "@ethersproject/hash" "^5.6.1" - "@ethersproject/logger" "^5.6.0" - "@ethersproject/properties" "^5.6.0" - "@ethersproject/strings" "^5.6.1" +"@fastify/busboy@^2.0.0": + version "2.1.1" + resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d" + integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA== "@metamask/eth-sig-util@^4.0.0": version "4.0.1" @@ -444,16 +220,162 @@ tweetnacl "^1.0.3" tweetnacl-util "^0.15.1" +"@noble/curves@1.2.0": + version "1.2.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" + integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== + dependencies: + "@noble/hashes" "1.3.2" + "@noble/hashes@1.1.2", "@noble/hashes@~1.1.1": version "1.1.2" resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.1.2.tgz#e9e035b9b166ca0af657a7848eb2718f0f22f183" integrity sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA== +"@noble/hashes@1.3.2": + version "1.3.2" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" + integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== + "@noble/secp256k1@1.6.3", "@noble/secp256k1@~1.6.0": version "1.6.3" resolved "https://registry.yarnpkg.com/@noble/secp256k1/-/secp256k1-1.6.3.tgz#7eed12d9f4404b416999d0c87686836c4c5c9b94" integrity sha512-T04e4iTurVy7I8Sw4+c5OSN9/RkPlo1uKxAomtxQNLq8j1uPAqnsqG1bqvY3Jv7c13gyr6dui0zmh/I3+f/JaQ== +"@nomicfoundation/edr-darwin-arm64@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-arm64/-/edr-darwin-arm64-0.5.2.tgz#72f7a826c9f0f2c91308edca562de3b9484ac079" + integrity sha512-Gm4wOPKhbDjGTIRyFA2QUAPfCXA1AHxYOKt3yLSGJkQkdy9a5WW+qtqKeEKHc/+4wpJSLtsGQfpzyIzggFfo/A== + +"@nomicfoundation/edr-darwin-x64@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-darwin-x64/-/edr-darwin-x64-0.5.2.tgz#6d0fedb219d664631c6feddc596ab8c3bbc36fa8" + integrity sha512-ClyABq2dFCsrYEED3/UIO0c7p4H1/4vvlswFlqUyBpOkJccr75qIYvahOSJRM62WgUFRhbSS0OJXFRwc/PwmVg== + +"@nomicfoundation/edr-linux-arm64-gnu@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-gnu/-/edr-linux-arm64-gnu-0.5.2.tgz#60e4d52d963141bc2bb4a02639dc590a7fbdda2f" + integrity sha512-HWMTVk1iOabfvU2RvrKLDgtFjJZTC42CpHiw2h6rfpsgRqMahvIlx2jdjWYzFNy1jZKPTN1AStQ/91MRrg5KnA== + +"@nomicfoundation/edr-linux-arm64-musl@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-arm64-musl/-/edr-linux-arm64-musl-0.5.2.tgz#6676a09eab57c435a16ffc144658c896acca9baa" + integrity sha512-CwsQ10xFx/QAD5y3/g5alm9+jFVuhc7uYMhrZAu9UVF+KtVjeCvafj0PaVsZ8qyijjqVuVsJ8hD1x5ob7SMcGg== + +"@nomicfoundation/edr-linux-x64-gnu@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-gnu/-/edr-linux-x64-gnu-0.5.2.tgz#f558d9697ce961410e7a7468f9ab8c8a601b9df6" + integrity sha512-CWVCEdhWJ3fmUpzWHCRnC0/VLBDbqtqTGTR6yyY1Ep3S3BOrHEAvt7h5gx85r2vLcztisu2vlDq51auie4IU1A== + +"@nomicfoundation/edr-linux-x64-musl@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-linux-x64-musl/-/edr-linux-x64-musl-0.5.2.tgz#c9c9cbb2997499f75c1d022be724b0551d44569f" + integrity sha512-+aJDfwhkddy2pP5u1ISg3IZVAm0dO836tRlDTFWtvvSMQ5hRGqPcWwlsbobhDQsIxhPJyT7phL0orCg5W3WMeA== + +"@nomicfoundation/edr-win32-x64-msvc@0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr-win32-x64-msvc/-/edr-win32-x64-msvc-0.5.2.tgz#f16db88bf4fe09a996af0a25096e09deecb72bfa" + integrity sha512-CcvvuA3sAv7liFNPsIR/68YlH6rrybKzYttLlMr80d4GKJjwJ5OKb3YgE6FdZZnOfP19HEHhsLcE0DPLtY3r0w== + +"@nomicfoundation/edr@^0.5.2": + version "0.5.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/edr/-/edr-0.5.2.tgz#e8c7b3d3dd4a312432ab3930dec60f76dc5c4926" + integrity sha512-hW/iLvUQZNTVjFyX/I40rtKvvDOqUEyIi96T28YaLfmPL+3LW2lxmYLUXEJ6MI14HzqxDqrLyhf6IbjAa2r3Dw== + dependencies: + "@nomicfoundation/edr-darwin-arm64" "0.5.2" + "@nomicfoundation/edr-darwin-x64" "0.5.2" + "@nomicfoundation/edr-linux-arm64-gnu" "0.5.2" + "@nomicfoundation/edr-linux-arm64-musl" "0.5.2" + "@nomicfoundation/edr-linux-x64-gnu" "0.5.2" + "@nomicfoundation/edr-linux-x64-musl" "0.5.2" + "@nomicfoundation/edr-win32-x64-msvc" "0.5.2" + +"@nomicfoundation/ethereumjs-common@4.0.4": + version "4.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-common/-/ethereumjs-common-4.0.4.tgz#9901f513af2d4802da87c66d6f255b510bef5acb" + integrity sha512-9Rgb658lcWsjiicr5GzNCjI1llow/7r0k50dLL95OJ+6iZJcVbi15r3Y0xh2cIO+zgX0WIHcbzIu6FeQf9KPrg== + dependencies: + "@nomicfoundation/ethereumjs-util" "9.0.4" + +"@nomicfoundation/ethereumjs-rlp@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-rlp/-/ethereumjs-rlp-5.0.4.tgz#66c95256fc3c909f6fb18f6a586475fc9762fa30" + integrity sha512-8H1S3s8F6QueOc/X92SdrA4RDenpiAEqMg5vJH99kcQaCy/a3Q6fgseo75mgWlbanGJXSlAPtnCeG9jvfTYXlw== + +"@nomicfoundation/ethereumjs-tx@5.0.4": + version "5.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-tx/-/ethereumjs-tx-5.0.4.tgz#b0ceb58c98cc34367d40a30d255d6315b2f456da" + integrity sha512-Xjv8wAKJGMrP1f0n2PeyfFCCojHd7iS3s/Ab7qzF1S64kxZ8Z22LCMynArYsVqiFx6rzYy548HNVEyI+AYN/kw== + dependencies: + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-rlp" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" + ethereum-cryptography "0.1.3" + +"@nomicfoundation/ethereumjs-util@9.0.4": + version "9.0.4" + resolved "https://registry.yarnpkg.com/@nomicfoundation/ethereumjs-util/-/ethereumjs-util-9.0.4.tgz#84c5274e82018b154244c877b76bc049a4ed7b38" + integrity sha512-sLOzjnSrlx9Bb9EFNtHzK/FJFsfg2re6bsGqinFinH1gCqVfz9YYlXiMWwDM4C/L4ywuHFCYwfKTVr/QHQcU0Q== + dependencies: + "@nomicfoundation/ethereumjs-rlp" "5.0.4" + ethereum-cryptography "0.1.3" + +"@nomicfoundation/hardhat-ethers@^3.0.0": + version "3.0.8" + resolved "https://registry.yarnpkg.com/@nomicfoundation/hardhat-ethers/-/hardhat-ethers-3.0.8.tgz#af078f566373abeb77e11cbe69fe3dd47f8bfc27" + integrity sha512-zhOZ4hdRORls31DTOqg+GmEZM0ujly8GGIuRY7t7szEk2zW/arY1qDug/py8AEktT00v5K+b6RvbVog+va51IA== + dependencies: + debug "^4.1.1" + lodash.isequal "^4.5.0" + +"@nomicfoundation/solidity-analyzer-darwin-arm64@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-arm64/-/solidity-analyzer-darwin-arm64-0.1.2.tgz#3a9c3b20d51360b20affb8f753e756d553d49557" + integrity sha512-JaqcWPDZENCvm++lFFGjrDd8mxtf+CtLd2MiXvMNTBD33dContTZ9TWETwNFwg7JTJT5Q9HEecH7FA+HTSsIUw== + +"@nomicfoundation/solidity-analyzer-darwin-x64@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-darwin-x64/-/solidity-analyzer-darwin-x64-0.1.2.tgz#74dcfabeb4ca373d95bd0d13692f44fcef133c28" + integrity sha512-fZNmVztrSXC03e9RONBT+CiksSeYcxI1wlzqyr0L7hsQlK1fzV+f04g2JtQ1c/Fe74ZwdV6aQBdd6Uwl1052sw== + +"@nomicfoundation/solidity-analyzer-linux-arm64-gnu@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-gnu/-/solidity-analyzer-linux-arm64-gnu-0.1.2.tgz#4af5849a89e5a8f511acc04f28eb5d4460ba2b6a" + integrity sha512-3d54oc+9ZVBuB6nbp8wHylk4xh0N0Gc+bk+/uJae+rUgbOBwQSfuGIbAZt1wBXs5REkSmynEGcqx6DutoK0tPA== + +"@nomicfoundation/solidity-analyzer-linux-arm64-musl@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-arm64-musl/-/solidity-analyzer-linux-arm64-musl-0.1.2.tgz#54036808a9a327b2ff84446c130a6687ee702a8e" + integrity sha512-iDJfR2qf55vgsg7BtJa7iPiFAsYf2d0Tv/0B+vhtnI16+wfQeTbP7teookbGvAo0eJo7aLLm0xfS/GTkvHIucA== + +"@nomicfoundation/solidity-analyzer-linux-x64-gnu@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-gnu/-/solidity-analyzer-linux-x64-gnu-0.1.2.tgz#466cda0d6e43691986c944b909fc6dbb8cfc594e" + integrity sha512-9dlHMAt5/2cpWyuJ9fQNOUXFB/vgSFORg1jpjX1Mh9hJ/MfZXlDdHQ+DpFCs32Zk5pxRBb07yGvSHk9/fezL+g== + +"@nomicfoundation/solidity-analyzer-linux-x64-musl@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-linux-x64-musl/-/solidity-analyzer-linux-x64-musl-0.1.2.tgz#2b35826987a6e94444140ac92310baa088ee7f94" + integrity sha512-GzzVeeJob3lfrSlDKQw2bRJ8rBf6mEYaWY+gW0JnTDHINA0s2gPR4km5RLIj1xeZZOYz4zRw+AEeYgLRqB2NXg== + +"@nomicfoundation/solidity-analyzer-win32-x64-msvc@0.1.2": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer-win32-x64-msvc/-/solidity-analyzer-win32-x64-msvc-0.1.2.tgz#e6363d13b8709ca66f330562337dbc01ce8bbbd9" + integrity sha512-Fdjli4DCcFHb4Zgsz0uEJXZ2K7VEO+w5KVv7HmT7WO10iODdU9csC2az4jrhEsRtiR9Gfd74FlG0NYlw1BMdyA== + +"@nomicfoundation/solidity-analyzer@^0.1.0": + version "0.1.2" + resolved "https://registry.yarnpkg.com/@nomicfoundation/solidity-analyzer/-/solidity-analyzer-0.1.2.tgz#8bcea7d300157bf3a770a851d9f5c5e2db34ac55" + integrity sha512-q4n32/FNKIhQ3zQGGw5CvPF6GTvDCpYwIf7bEY/dZTZbgfDsHyjJwURxUJf3VQuuJj+fDIFl4+KkBVbw4Ef6jA== + optionalDependencies: + "@nomicfoundation/solidity-analyzer-darwin-arm64" "0.1.2" + "@nomicfoundation/solidity-analyzer-darwin-x64" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-arm64-gnu" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-arm64-musl" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-x64-gnu" "0.1.2" + "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" + "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" + "@nomiclabs/hardhat-ethers@^2.1.1": version "2.1.1" resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.1.1.tgz#3f1d1ab49813d1bae4c035cc1adec224711e528b" @@ -549,18 +471,6 @@ "@sentry/types" "5.30.0" tslib "^1.9.3" -"@solidity-parser/parser@^0.14.2": - version "0.14.3" - resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.3.tgz#0d627427b35a40d8521aaa933cc3df7d07bfa36f" - integrity sha512-29g2SZ29HtsqA58pLCtopI1P/cPy5/UAzlcAXO6T/CNJimG6yA8kx4NaseMyJULiC+TEs02Y9/yeHzClqoA0hw== - dependencies: - antlr4ts "^0.5.0-alpha.4" - -"@types/abstract-leveldown@*": - version "7.2.0" - resolved "https://registry.yarnpkg.com/@types/abstract-leveldown/-/abstract-leveldown-7.2.0.tgz#f055979a99f7654e84d6b8e6267419e9c4cfff87" - integrity sha512-q5veSX6zjUy/DlDhR4Y4cU0k2Ar+DT2LUraP00T19WLmTO6Se1djepCCaqU6nQrwcJ5Hyo/CWqxTzrrFg8eqbQ== - "@types/bn.js@^4.11.3": version "4.11.6" resolved "https://registry.yarnpkg.com/@types/bn.js/-/bn.js-4.11.6.tgz#c306c70d9358aaea33cd4eda092a742b9505967c" @@ -601,20 +511,6 @@ dependencies: "@types/node" "*" -"@types/level-errors@*": - version "3.0.0" - resolved "https://registry.yarnpkg.com/@types/level-errors/-/level-errors-3.0.0.tgz#15c1f4915a5ef763b51651b15e90f6dc081b96a8" - integrity sha512-/lMtoq/Cf/2DVOm6zE6ORyOM+3ZVm/BvzEZVxUhf6bgh8ZHglXlBqxbxSlJeVp8FCbD3IVvk/VbsaNmDjrQvqQ== - -"@types/levelup@^4.3.0": - version "4.3.3" - resolved "https://registry.yarnpkg.com/@types/levelup/-/levelup-4.3.3.tgz#4dc2b77db079b1cf855562ad52321aa4241b8ef4" - integrity sha512-K+OTIjJcZHVlZQN1HmU64VtrC0jC3dXWQozuEIR9zVvltIk90zaGPM2AgT+fIkChpzHhFE3YnvFLCbLtzAmexA== - dependencies: - "@types/abstract-leveldown" "*" - "@types/level-errors" "*" - "@types/node" "*" - "@types/lodash.clonedeep@^4.5.7": version "4.5.7" resolved "https://registry.yarnpkg.com/@types/lodash.clonedeep/-/lodash.clonedeep-4.5.7.tgz#0e119f582ed6f9e6b373c04a644651763214f197" @@ -647,6 +543,11 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.6.tgz#31743bc5772b6ac223845e18c3fc26f042713c83" integrity sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A== +"@types/node@18.15.13": + version "18.15.13" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.15.13.tgz#f64277c341150c979e42b00e4ac289290c9df469" + integrity sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q== + "@types/node@^8.10.38": version "8.10.66" resolved "https://registry.yarnpkg.com/@types/node/-/node-8.10.66.tgz#dd035d409df322acc83dff62a602f12a5783bbb3" @@ -676,44 +577,15 @@ resolved "https://registry.yarnpkg.com/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz#aa58042711d6e3275dd37dc597e5d31e8c290a44" integrity sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q== -abort-controller@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/abort-controller/-/abort-controller-3.0.0.tgz#eaf54d53b62bae4138e809ca225c8439a6efb392" - integrity sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg== - dependencies: - event-target-shim "^5.0.0" - -abstract-leveldown@^6.2.1: - version "6.3.0" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.3.0.tgz#d25221d1e6612f820c35963ba4bd739928f6026a" - integrity sha512-TU5nlYgta8YrBMNpc9FwQzRbiXsj49gsALsXadbGHt9CROPzX5fB0rWDR5mtdpOOKa5XqRFpbj1QroPAoPzVjQ== - dependencies: - buffer "^5.5.0" - immediate "^3.2.3" - level-concat-iterator "~2.0.0" - level-supports "~1.0.0" - xtend "~4.0.0" - -abstract-leveldown@~6.2.1: - version "6.2.3" - resolved "https://registry.yarnpkg.com/abstract-leveldown/-/abstract-leveldown-6.2.3.tgz#036543d87e3710f2528e47040bc3261b77a9a8eb" - integrity sha512-BsLm5vFMRUrrLeCcRc+G0t2qOaTzpoJQLOubq2XM72eNpjF5UdU5o/5NvlNhx95XHcAvcl8OMXr4mlg/fRgUXQ== - dependencies: - buffer "^5.5.0" - immediate "^3.2.3" - level-concat-iterator "~2.0.0" - level-supports "~1.0.0" - xtend "~4.0.0" - adm-zip@^0.4.16: version "0.4.16" resolved "https://registry.yarnpkg.com/adm-zip/-/adm-zip-0.4.16.tgz#cf4c508fdffab02c269cbc7f471a875f05570365" integrity sha512-TFi4HBKSGfIKsK5YCkKaaFG2m4PEDyViZmEwof3MTIgzimHLto6muaHVpbrljdIvIrFZzEq/p4nafOeLcYegrg== -aes-js@3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-3.0.0.tgz#e21df10ad6c2053295bcbb8dab40b09dbea87e4d" - integrity sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw== +aes-js@4.0.0-beta.5: + version "4.0.0-beta.5" + resolved "https://registry.yarnpkg.com/aes-js/-/aes-js-4.0.0-beta.5.tgz#8d2452c52adedebc3a3e28465d858c11ca315873" + integrity sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q== agent-base@6: version "6.0.2" @@ -730,6 +602,13 @@ aggregate-error@^3.0.0: clean-stack "^2.0.0" indent-string "^4.0.0" +ansi-align@^3.0.0: + version "3.0.1" + resolved "https://registry.yarnpkg.com/ansi-align/-/ansi-align-3.0.1.tgz#0cdf12e111ace773a86e9a1fad1225c43cb19a59" + integrity sha512-IOfwwBF5iczOjp/WeY4YxyjqAFMQoZufdQWDd19SEExbVLNXqvpzSJ/M7Za4/sCPmQ0+GRquoA7bGcINcxew6w== + dependencies: + string-width "^4.1.0" + ansi-colors@3.2.3: version "3.2.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.3.tgz#57d35b8686e851e2cc04c403f1c00203976a1813" @@ -781,11 +660,6 @@ ansi-styles@^4.0.0, ansi-styles@^4.1.0: dependencies: color-convert "^2.0.1" -antlr4ts@^0.5.0-alpha.4: - version "0.5.0-alpha.4" - resolved "https://registry.yarnpkg.com/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz#71702865a87478ed0b40c0709f422cf14d51652a" - integrity sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ== - anymatch@~3.1.1, anymatch@~3.1.2: version "3.1.2" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.2.tgz#c0557c096af32f106198f4f4e2a383537e378716" @@ -827,20 +701,6 @@ assertion-error@^1.1.0: resolved "https://registry.yarnpkg.com/assertion-error/-/assertion-error-1.1.0.tgz#e60b6b0e8f301bd97e5375215bda406c85118c0b" integrity sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw== -async-eventemitter@^0.2.4: - version "0.2.4" - resolved "https://registry.yarnpkg.com/async-eventemitter/-/async-eventemitter-0.2.4.tgz#f5e7c8ca7d3e46aab9ec40a292baf686a0bafaca" - integrity sha512-pd20BwL7Yt1zwDFy+8MX8F1+WCT8aQeKj0kQnTrH9WaeRETlRamVhD0JtRPmrV4GfOJ2F9CvdQkZeZhnh2TuHw== - dependencies: - async "^2.4.0" - -async@^2.4.0: - version "2.6.4" - resolved "https://registry.yarnpkg.com/async/-/async-2.6.4.tgz#706b7ff6084664cd7eae713f6f965433b5504221" - integrity sha512-mzo5dfJYwAn29PeiJ0zvwTo04zj8HDJj0Mn8TD7sno7q12prdbnasKJHhkm2c1LgrhlJ0teaea8860oxi51mGA== - dependencies: - lodash "^4.17.14" - balanced-match@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" @@ -853,16 +713,6 @@ base-x@^3.0.2: dependencies: safe-buffer "^5.0.1" -base64-js@^1.3.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" - integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== - -bech32@1.1.4: - version "1.1.4" - resolved "https://registry.yarnpkg.com/bech32/-/bech32-1.1.4.tgz#e38c9f37bf179b8eb16ae3a772b40c356d4832e9" - integrity sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ== - binary-extensions@^2.0.0: version "2.2.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.2.0.tgz#75f502eeaf9ffde42fc98829645be4ea76bd9e2d" @@ -873,16 +723,30 @@ blakejs@^1.1.0: resolved "https://registry.yarnpkg.com/blakejs/-/blakejs-1.2.1.tgz#5057e4206eadb4a97f7c0b6e197a505042fc3814" integrity sha512-QXUSXI3QVc/gJME0dBpXrag1kbzOqCjCX8/b54ntNyW6sjtoqxqRk3LTmXzaJoh71zMsDCjM+47jS7XiwN/+fQ== -bn.js@^4.0.0, bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: +bn.js@^4.11.0, bn.js@^4.11.8, bn.js@^4.11.9: version "4.12.0" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-4.12.0.tgz#775b3f278efbb9718eec7361f483fb36fbbfea88" integrity sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA== -bn.js@^5.1.2, bn.js@^5.2.0, bn.js@^5.2.1: +bn.js@^5.2.0, bn.js@^5.2.1: version "5.2.1" resolved "https://registry.yarnpkg.com/bn.js/-/bn.js-5.2.1.tgz#0bc527a6a0d18d0aa8d5b0538ce4a77dccfa7b70" integrity sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ== +boxen@^5.1.2: + version "5.1.2" + resolved "https://registry.yarnpkg.com/boxen/-/boxen-5.1.2.tgz#788cb686fc83c1f486dfa8a40c68fc2b831d2b50" + integrity sha512-9gYgQKXx+1nP8mP7CzFyaUARhg7D3n1dF/FnErWmu9l6JvGpNUN278h0aSb+QjoiKSWG+iZ3uHrcqk0qrY9RQQ== + dependencies: + ansi-align "^3.0.0" + camelcase "^6.2.0" + chalk "^4.1.0" + cli-boxes "^2.2.1" + string-width "^4.2.2" + type-fest "^0.20.2" + widest-line "^3.1.0" + wrap-ansi "^7.0.0" + brace-expansion@^1.1.7: version "1.1.11" resolved "https://registry.yarnpkg.com/brace-expansion/-/brace-expansion-1.1.11.tgz#3c7fcbf529d87226f3d2f52b966ff5271eb441dd" @@ -905,7 +769,7 @@ braces@~3.0.2: dependencies: fill-range "^7.0.1" -brorand@^1.0.1, brorand@^1.1.0: +brorand@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/brorand/-/brorand-1.1.0.tgz#12c25efe40a45e3c323eb8675a0a0ce57b22371f" integrity sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w== @@ -953,21 +817,6 @@ buffer-xor@^1.0.3: resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-1.0.3.tgz#26e61ed1422fb70dd42e6e36729ed51d855fe8d9" integrity sha512-571s0T7nZWK6vB67HI5dyUF7wXiNcfaPPPTl6zYCNApANjIvYJTg7hlud/+cJpdAhS7dVzqMLmfhfHR3rAcOjQ== -buffer-xor@^2.0.1: - version "2.0.2" - resolved "https://registry.yarnpkg.com/buffer-xor/-/buffer-xor-2.0.2.tgz#34f7c64f04c777a1f8aac5e661273bb9dd320289" - integrity sha512-eHslX0bin3GB+Lx2p7lEYRShRewuNZL3fUl4qlVJGGiwoPGftmt8JQgk2Y9Ji5/01TnVDo33E5b5O3vUB1HdqQ== - dependencies: - safe-buffer "^5.1.1" - -buffer@^5.5.0, buffer@^5.6.0: - version "5.7.1" - resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" - integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== - dependencies: - base64-js "^1.3.1" - ieee754 "^1.1.13" - builtin-modules@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-1.1.1.tgz#270f076c5a72c02f5b65a47df94c5fe3a278892f" @@ -991,7 +840,7 @@ camelcase@^5.0.0: resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-5.3.1.tgz#e3c9b31569e106811df242f715725a1f4c494320" integrity sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg== -camelcase@^6.0.0: +camelcase@^6.0.0, camelcase@^6.2.0: version "6.3.0" resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-6.3.0.tgz#5685b95eb209ac9c0c177467778c9c84df58ba9a" integrity sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA== @@ -1086,6 +935,11 @@ clean-stack@^2.0.0: resolved "https://registry.yarnpkg.com/clean-stack/-/clean-stack-2.2.0.tgz#ee8472dbb129e727b31e8a10a427dee9dfe4008b" integrity sha512-4diC9HaTE+KRAMWhDhrGOECgWZxoevMc5TlkObMqNSsVU62PYzXZ/SMTjzyGAFF1YusgxGcSWTEXBhp0CPwQ1A== +cli-boxes@^2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/cli-boxes/-/cli-boxes-2.2.1.tgz#ddd5035d25094fce220e9cab40a45840a440318f" + integrity sha512-y4coMcylgSCdVinjiDBuR8PCC2bLjyGTwEmPb9NHR/QaNU6EUOXcTY/s6VjGMD6ENSEaeQYHCY0GNGS5jfMwPw== + cliui@^5.0.0: version "5.0.0" resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5" @@ -1133,16 +987,16 @@ command-exists@^1.2.8: resolved "https://registry.yarnpkg.com/command-exists/-/command-exists-1.2.9.tgz#c50725af3808c8ab0260fd60b01fbfa25b954f69" integrity sha512-LTQ/SGc+s0Xc0Fu5WaKnR0YiygZkm9eKFvyS+fRsU7/ZWFF8ykFM6Pc9aCVf1+xasOOZpO3BAVgVrKvsqKHV7w== -commander@3.0.2: - version "3.0.2" - resolved "https://registry.yarnpkg.com/commander/-/commander-3.0.2.tgz#6837c3fb677ad9933d1cfba42dd14d5117d6b39e" - integrity sha512-Gar0ASD4BDyKC4hl4DwHqDrmvjoxWKZigVnAbn5H1owvm4CxCPdb0HQDehwNYMJpla5+M2tPmPARzhtYuwpHow== - commander@^2.12.1: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" integrity sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ== +commander@^8.1.0: + version "8.3.0" + resolved "https://registry.yarnpkg.com/commander/-/commander-8.3.0.tgz#4837ea1b2da67b9c616a67afbb0fafee567bca66" + integrity sha512-OkTL9umf+He2DZkUq8f8J9of7yL6RJKI24dVITBmNfZBmri9zYZQrKkuXiKhyfPSu8tUhnVBB1iKXevvnlR4Ww== + concat-map@0.0.1: version "0.0.1" resolved "https://registry.yarnpkg.com/concat-map/-/concat-map-0.0.1.tgz#d8a96bd77fd68df7793a73036a3ba0d5405d477b" @@ -1153,16 +1007,6 @@ cookie@^0.4.1: resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.4.2.tgz#0e41f24de5ecf317947c82fc789e06a884824432" integrity sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA== -core-js-pure@^3.0.1: - version "3.24.1" - resolved "https://registry.yarnpkg.com/core-js-pure/-/core-js-pure-3.24.1.tgz#8839dde5da545521bf282feb7dc6d0b425f39fd3" - integrity sha512-r1nJk41QLLPyozHUUPmILCEMtMw24NG4oWK6RbsDdjzQgg9ZvrUsPBj1MnG0wXXp1DCDU6j+wUvEmBSrtRbLXg== - -crc-32@^1.2.0: - version "1.2.2" - resolved "https://registry.yarnpkg.com/crc-32/-/crc-32-1.2.2.tgz#3cad35a934b8bf71f25ca524b6da51fb7eace2ff" - integrity sha512-ROmzCKrTnOwybPcJApAA6WBWij23HVfGVNKqqrZpuyZOHqK2CwHSvpGuyt/UNNvaIjEd8X5IFGp4Mh+Ie1IHJQ== - create-hash@^1.1.0, create-hash@^1.1.2, create-hash@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/create-hash/-/create-hash-1.2.0.tgz#889078af11a63756bcfb59bd221996be3a9ef196" @@ -1193,7 +1037,7 @@ debug@3.2.6: dependencies: ms "^2.1.1" -debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.3, debug@^4.3.4: +debug@4, debug@4.3.4, debug@^4.1.1, debug@^4.3.4: version "4.3.4" resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865" integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ== @@ -1217,14 +1061,6 @@ deep-eql@^3.0.1: dependencies: type-detect "^4.0.0" -deferred-leveldown@~5.3.0: - version "5.3.0" - resolved "https://registry.yarnpkg.com/deferred-leveldown/-/deferred-leveldown-5.3.0.tgz#27a997ad95408b61161aa69bd489b86c71b78058" - integrity sha512-a59VOT+oDy7vtAbLRCZwWgxu2BaCfd5Hk7wxJd48ei7I+nsg8Orlb9CLG0PMZienk9BSUKgeAqkO2+Lw+1+Ukw== - dependencies: - abstract-leveldown "~6.2.1" - inherits "^2.0.3" - define-properties@^1.1.2, define-properties@^1.1.3, define-properties@^1.1.4: version "1.1.4" resolved "https://registry.yarnpkg.com/define-properties/-/define-properties-1.1.4.tgz#0b14d7bd7fbeb2f3572c3a7eda80ea5d57fb05b1" @@ -1276,16 +1112,6 @@ emoji-regex@^8.0.0: resolved "https://registry.yarnpkg.com/emoji-regex/-/emoji-regex-8.0.0.tgz#e818fd69ce5ccfcb404594f842963bf53164cc37" integrity sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A== -encoding-down@^6.3.0: - version "6.3.0" - resolved "https://registry.yarnpkg.com/encoding-down/-/encoding-down-6.3.0.tgz#b1c4eb0e1728c146ecaef8e32963c549e76d082b" - integrity sha512-QKrV0iKR6MZVJV08QY0wp1e7vF6QbhnbQhb07bwpEyuz4uZiZgPlEGdkCROuFkUwdxlFaiPIhjyarH1ee/3vhw== - dependencies: - abstract-leveldown "^6.2.1" - inherits "^2.0.3" - level-codec "^9.0.0" - level-errors "^2.0.0" - enquirer@^2.3.0, enquirer@^2.3.6: version "2.3.6" resolved "https://registry.yarnpkg.com/enquirer/-/enquirer-2.3.6.tgz#2a7fe5dd634a1e4125a975ec994ff5456dc3734d" @@ -1298,13 +1124,6 @@ env-paths@^2.2.0: resolved "https://registry.yarnpkg.com/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2" integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A== -errno@~0.1.1: - version "0.1.8" - resolved "https://registry.yarnpkg.com/errno/-/errno-0.1.8.tgz#8bb3e9c7d463be4976ff888f76b4809ebc2e811f" - integrity sha512-dJ6oBr5SQ1VSd9qkk7ByRgb/1SH4JZjCHSW/mr63/QcXO9zLVxvJ6Oy13nio03rxpSnVDDjFor75SjVeZWPW/A== - dependencies: - prr "~1.0.1" - es-abstract@^1.19.0, es-abstract@^1.19.2, es-abstract@^1.19.5, es-abstract@^1.20.1: version "1.20.1" resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.20.1.tgz#027292cd6ef44bd12b1913b828116f54787d1814" @@ -1376,7 +1195,7 @@ esprima@^4.0.0: resolved "https://registry.yarnpkg.com/esprima/-/esprima-4.0.1.tgz#13b04cdb3e6c5d19df91ab6987a8695619b0aa71" integrity sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A== -ethereum-cryptography@^0.1.3: +ethereum-cryptography@0.1.3, ethereum-cryptography@^0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/ethereum-cryptography/-/ethereum-cryptography-0.1.3.tgz#8d6143cfc3d74bf79bbd8edecdf29e4ae20dd191" integrity sha512-w8/4x1SGGzc+tO97TASLja6SLd3fRIK2tLVcV2Gx4IB21hE19atll5Cq9o3d0ZmAYC/8aw0ipieTSiekAea4SQ== @@ -1428,52 +1247,18 @@ ethereumjs-util@^6.0.0, ethereumjs-util@^6.2.1: ethjs-util "0.1.6" rlp "^2.2.3" -ethereumjs-util@^7.1.1, ethereumjs-util@^7.1.4, ethereumjs-util@^7.1.5: - version "7.1.5" - resolved "https://registry.yarnpkg.com/ethereumjs-util/-/ethereumjs-util-7.1.5.tgz#9ecf04861e4fbbeed7465ece5f23317ad1129181" - integrity sha512-SDl5kKrQAudFBUe5OJM9Ac6WmMyYmXX/6sTmLZ3ffG2eY6ZIGBes3pEDxNN6V72WyOw4CPD5RomKdsa8DAAwLg== +ethers@^6.13.0: + version "6.13.2" + resolved "https://registry.yarnpkg.com/ethers/-/ethers-6.13.2.tgz#4b67d4b49e69b59893931a032560999e5e4419fe" + integrity sha512-9VkriTTed+/27BGuY1s0hf441kqwHJ1wtN2edksEtiRvXx+soxRX3iSXTfFqq2+YwrOqbDoTHjIhQnjJRlzKmg== 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" - -ethers@^5.0.0: - version "5.6.9" - resolved "https://registry.yarnpkg.com/ethers/-/ethers-5.6.9.tgz#4e12f8dfcb67b88ae7a78a9519b384c23c576a4d" - integrity sha512-lMGC2zv9HC5EC+8r429WaWu3uWJUCgUCt8xxKCFqkrFuBDZXDYIdzDUECxzjf2BMF8IVBByY1EBoGSL3RTm8RA== - dependencies: - "@ethersproject/abi" "5.6.4" - "@ethersproject/abstract-provider" "5.6.1" - "@ethersproject/abstract-signer" "5.6.2" - "@ethersproject/address" "5.6.1" - "@ethersproject/base64" "5.6.1" - "@ethersproject/basex" "5.6.1" - "@ethersproject/bignumber" "5.6.2" - "@ethersproject/bytes" "5.6.1" - "@ethersproject/constants" "5.6.1" - "@ethersproject/contracts" "5.6.2" - "@ethersproject/hash" "5.6.1" - "@ethersproject/hdnode" "5.6.2" - "@ethersproject/json-wallets" "5.6.1" - "@ethersproject/keccak256" "5.6.1" - "@ethersproject/logger" "5.6.0" - "@ethersproject/networks" "5.6.4" - "@ethersproject/pbkdf2" "5.6.1" - "@ethersproject/properties" "5.6.0" - "@ethersproject/providers" "5.6.8" - "@ethersproject/random" "5.6.1" - "@ethersproject/rlp" "5.6.1" - "@ethersproject/sha2" "5.6.1" - "@ethersproject/signing-key" "5.6.2" - "@ethersproject/solidity" "5.6.1" - "@ethersproject/strings" "5.6.1" - "@ethersproject/transactions" "5.6.2" - "@ethersproject/units" "5.6.1" - "@ethersproject/wallet" "5.6.2" - "@ethersproject/web" "5.6.1" - "@ethersproject/wordlists" "5.6.1" + "@adraffy/ens-normalize" "1.10.1" + "@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.17.1" ethjs-util@0.1.6, ethjs-util@^0.1.6: version "0.1.6" @@ -1483,11 +1268,6 @@ ethjs-util@0.1.6, ethjs-util@^0.1.6: is-hex-prefixed "1.0.0" strip-hex-prefix "1.0.0" -event-target-shim@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/event-target-shim/-/event-target-shim-5.0.1.tgz#5d4d3ebdf9583d63a5333ce2deb7480ab2b05789" - integrity sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ== - evp_bytestokey@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz#7fcbdb198dc71959432efe13842684e0525acb02" @@ -1557,17 +1337,6 @@ fp-ts@^1.0.0: resolved "https://registry.yarnpkg.com/fp-ts/-/fp-ts-1.19.5.tgz#3da865e585dfa1fdfd51785417357ac50afc520a" integrity sha512-wDNqTimnzs8QqpldiId9OavWK2NptormjXnRJTQecNjzwfyp6P/8s/zG8e4h3ja3oqkKaY72UlTjQYt/1yXf9A== -fs-extra@^0.30.0: - version "0.30.0" - resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-0.30.0.tgz#f233ffcc08d4da7d432daa449776989db1df93f0" - integrity sha512-UvSPKyhMn6LEd/WpUaV9C9t3zATuqoqfWc3QdPhPLb58prN9tqYPlPWi8Krxi44loBoUzlobqZ3+8tGpxxSzwA== - dependencies: - graceful-fs "^4.1.2" - jsonfile "^2.1.0" - klaw "^1.0.0" - path-is-absolute "^1.0.0" - rimraf "^2.2.8" - fs-extra@^7.0.1: version "7.0.1" resolved "https://registry.yarnpkg.com/fs-extra/-/fs-extra-7.0.1.tgz#4f189c44aa123b895f722804f55ea23eadc348e9" @@ -1607,11 +1376,6 @@ function.prototype.name@^1.1.5: es-abstract "^1.19.0" functions-have-names "^1.2.2" -functional-red-black-tree@^1.0.1, functional-red-black-tree@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327" - integrity sha512-dsKNQNdj6xA3T+QlADDA7mOSlX0qiMINjn0cgr+eGHGsbSHzTabcIogz2+p/iqP1Xs6EP/sS2SbqH+brGTbq0g== - functions-have-names@^1.2.2: version "1.2.3" resolved "https://registry.yarnpkg.com/functions-have-names/-/functions-have-names-1.2.3.tgz#0404fe4ee2ba2f607f0e0ec3c80bae994133b834" @@ -1675,7 +1439,7 @@ glob@7.2.0: once "^1.3.0" path-is-absolute "^1.0.0" -glob@^7.1.1, glob@^7.1.3: +glob@^7.1.1: version "7.2.3" resolved "https://registry.yarnpkg.com/glob/-/glob-7.2.3.tgz#b8df0fb802bbfa8e89bd1d938b4e16578ed44f2b" integrity sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q== @@ -1687,7 +1451,7 @@ glob@^7.1.1, glob@^7.1.3: once "^1.3.0" path-is-absolute "^1.0.0" -graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9: +graceful-fs@^4.1.2, graceful-fs@^4.1.6: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" integrity sha512-9ByhssR2fPVsNZj478qUUbKfmL0+t5BDVyjShtyZZLiK7ZDAArFFfopyOTj0M05wE2tJPisA4iTnnXl2YoPvOA== @@ -1697,26 +1461,25 @@ growl@1.10.5: resolved "https://registry.yarnpkg.com/growl/-/growl-1.10.5.tgz#f2735dc2283674fa67478b10181059355c369e5e" integrity sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA== -hardhat@^2.0.0: - version "2.10.2" - resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.10.2.tgz#ff94ee4cb144a9c114641581ff5e4d7bea5f93a9" - integrity sha512-L/KvDDT/MA6332uAtYTqdcHoSABljw4pPjHQe5SHdIJ+xKfaSc6vDKw03CmrQ5Xup0gHs8XnVSBpZo1AbbIW7g== +hardhat@^2.22.0: + version "2.22.10" + resolved "https://registry.yarnpkg.com/hardhat/-/hardhat-2.22.10.tgz#826ab56e47af98406e6dd105ba6d2dbb148013d9" + integrity sha512-JRUDdiystjniAvBGFmJRsiIZSOP2/6s++8xRDe3TzLeQXlWWHsXBrd9wd3JWFyKXvgMqMeLL5Sz/oNxXKYw9vg== dependencies: - "@ethereumjs/block" "^3.6.2" - "@ethereumjs/blockchain" "^5.5.2" - "@ethereumjs/common" "^2.6.4" - "@ethereumjs/tx" "^3.5.1" - "@ethereumjs/vm" "^5.9.0" "@ethersproject/abi" "^5.1.2" "@metamask/eth-sig-util" "^4.0.0" + "@nomicfoundation/edr" "^0.5.2" + "@nomicfoundation/ethereumjs-common" "4.0.4" + "@nomicfoundation/ethereumjs-tx" "5.0.4" + "@nomicfoundation/ethereumjs-util" "9.0.4" + "@nomicfoundation/solidity-analyzer" "^0.1.0" "@sentry/node" "^5.18.1" - "@solidity-parser/parser" "^0.14.2" "@types/bn.js" "^5.1.0" "@types/lru-cache" "^5.1.0" - abort-controller "^3.0.0" adm-zip "^0.4.16" aggregate-error "^3.0.0" ansi-escapes "^4.3.0" + boxen "^5.1.2" chalk "^2.4.2" chokidar "^3.4.0" ci-info "^2.0.0" @@ -1725,29 +1488,25 @@ hardhat@^2.0.0: env-paths "^2.2.0" ethereum-cryptography "^1.0.3" ethereumjs-abi "^0.6.8" - ethereumjs-util "^7.1.4" find-up "^2.1.0" fp-ts "1.19.3" fs-extra "^7.0.1" glob "7.2.0" immutable "^4.0.0-rc.12" io-ts "1.10.4" + keccak "^3.0.2" lodash "^4.17.11" - merkle-patricia-tree "^4.2.4" mnemonist "^0.38.0" mocha "^10.0.0" p-map "^4.0.0" - qs "^6.7.0" raw-body "^2.4.1" resolve "1.17.0" semver "^6.3.0" - slash "^3.0.0" - solc "0.7.3" + solc "0.8.26" source-map-support "^0.5.13" stacktrace-parser "^0.1.10" - "true-case-path" "^2.2.1" tsort "0.0.1" - undici "^5.4.0" + undici "^5.14.0" uuid "^8.3.2" ws "^7.4.6" @@ -1849,21 +1608,6 @@ iconv-lite@0.4.24: dependencies: safer-buffer ">= 2.1.2 < 3" -ieee754@^1.1.13: - version "1.2.1" - resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" - integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== - -immediate@^3.2.3: - version "3.3.0" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.3.0.tgz#1aef225517836bcdf7f2a2de2600c79ff0269266" - integrity sha512-HR7EVodfFUdQCTIeySw+WDRFJlPcLOJbXfwwZ7Oom6tjsvZ3bOkCDJHehQC3nxJrv7+f9XecwazynjU8e4Vw3Q== - -immediate@~3.2.3: - version "3.2.3" - resolved "https://registry.yarnpkg.com/immediate/-/immediate-3.2.3.tgz#d140fa8f614659bd6541233097ddaac25cdd991c" - integrity sha512-RrGCXRm/fRVqMIhqXrGEX9rRADavPiDFSoMb/k64i9XMk8uH4r/Omi5Ctierj6XzNecwDbO4WuFbDD1zmpl3Tg== - immutable@^4.0.0-rc.12: version "4.1.0" resolved "https://registry.yarnpkg.com/immutable/-/immutable-4.1.0.tgz#f795787f0db780183307b9eb2091fcac1f6fafef" @@ -1882,7 +1626,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4, inherits@~2.0.1: +inherits@2, inherits@2.0.4, inherits@^2.0.1, inherits@^2.0.3, inherits@^2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -2082,13 +1826,6 @@ js-yaml@^3.13.1: argparse "^1.0.7" esprima "^4.0.0" -jsonfile@^2.1.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-2.4.0.tgz#3736a2b428b87bbda0cc83b53fa3d633a35c2ae8" - integrity sha512-PKllAqbgLgxHaj8TElYymKCAgrASebJrWpTnEkOaTowt23VKXXN0sUeriJ+eh7y6ufb/CC5ap11pz71/cM0hUw== - optionalDependencies: - graceful-fs "^4.1.6" - jsonfile@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-4.0.0.tgz#8771aae0799b64076b76640fca058f9c10e33ecb" @@ -2105,83 +1842,14 @@ keccak@^3.0.0: node-gyp-build "^4.2.0" readable-stream "^3.6.0" -klaw@^1.0.0: - version "1.3.1" - resolved "https://registry.yarnpkg.com/klaw/-/klaw-1.3.1.tgz#4088433b46b3b1ba259d78785d8e96f73ba02439" - integrity sha512-TED5xi9gGQjGpNnvRWknrwAB1eL5GciPfVFOt3Vk1OJCVDQbzuSfrF3hkUQKlsgKrG1F+0t5W0m+Fje1jIt8rw== - optionalDependencies: - graceful-fs "^4.1.9" - -level-codec@^9.0.0: - version "9.0.2" - resolved "https://registry.yarnpkg.com/level-codec/-/level-codec-9.0.2.tgz#fd60df8c64786a80d44e63423096ffead63d8cbc" - integrity sha512-UyIwNb1lJBChJnGfjmO0OR+ezh2iVu1Kas3nvBS/BzGnx79dv6g7unpKIDNPMhfdTEGoc7mC8uAu51XEtX+FHQ== - dependencies: - buffer "^5.6.0" - -level-concat-iterator@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/level-concat-iterator/-/level-concat-iterator-2.0.1.tgz#1d1009cf108340252cb38c51f9727311193e6263" - integrity sha512-OTKKOqeav2QWcERMJR7IS9CUo1sHnke2C0gkSmcR7QuEtFNLLzHQAvnMw8ykvEcv0Qtkg0p7FOwP1v9e5Smdcw== - -level-errors@^2.0.0, level-errors@~2.0.0: - version "2.0.1" - resolved "https://registry.yarnpkg.com/level-errors/-/level-errors-2.0.1.tgz#2132a677bf4e679ce029f517c2f17432800c05c8" - integrity sha512-UVprBJXite4gPS+3VznfgDSU8PTRuVX0NXwoWW50KLxd2yw4Y1t2JUR5In1itQnudZqRMT9DlAM3Q//9NCjCFw== - dependencies: - errno "~0.1.1" - -level-iterator-stream@~4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/level-iterator-stream/-/level-iterator-stream-4.0.2.tgz#7ceba69b713b0d7e22fcc0d1f128ccdc8a24f79c" - integrity sha512-ZSthfEqzGSOMWoUGhTXdX9jv26d32XJuHz/5YnuHZzH6wldfWMOVwI9TBtKcya4BKTyTt3XVA0A3cF3q5CY30Q== - dependencies: - inherits "^2.0.4" - readable-stream "^3.4.0" - xtend "^4.0.2" - -level-mem@^5.0.1: - version "5.0.1" - resolved "https://registry.yarnpkg.com/level-mem/-/level-mem-5.0.1.tgz#c345126b74f5b8aa376dc77d36813a177ef8251d" - integrity sha512-qd+qUJHXsGSFoHTziptAKXoLX87QjR7v2KMbqncDXPxQuCdsQlzmyX+gwrEHhlzn08vkf8TyipYyMmiC6Gobzg== - dependencies: - level-packager "^5.0.3" - memdown "^5.0.0" - -level-packager@^5.0.3: - version "5.1.1" - resolved "https://registry.yarnpkg.com/level-packager/-/level-packager-5.1.1.tgz#323ec842d6babe7336f70299c14df2e329c18939" - integrity sha512-HMwMaQPlTC1IlcwT3+swhqf/NUO+ZhXVz6TY1zZIIZlIR0YSn8GtAAWmIvKjNY16ZkEg/JcpAuQskxsXqC0yOQ== - dependencies: - encoding-down "^6.3.0" - levelup "^4.3.2" - -level-supports@~1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/level-supports/-/level-supports-1.0.1.tgz#2f530a596834c7301622521988e2c36bb77d122d" - integrity sha512-rXM7GYnW8gsl1vedTJIbzOrRv85c/2uCMpiiCzO2fndd06U/kUXEEU9evYn4zFggBOg36IsBW8LzqIpETwwQzg== - dependencies: - xtend "^4.0.2" - -level-ws@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/level-ws/-/level-ws-2.0.0.tgz#207a07bcd0164a0ec5d62c304b4615c54436d339" - integrity sha512-1iv7VXx0G9ec1isqQZ7y5LmoZo/ewAsyDHNA8EFDW5hqH2Kqovm33nSFkSdnLLAK+I5FlT+lo5Cw9itGe+CpQA== - dependencies: - inherits "^2.0.3" - readable-stream "^3.1.0" - xtend "^4.0.1" - -levelup@^4.3.2: - version "4.4.0" - resolved "https://registry.yarnpkg.com/levelup/-/levelup-4.4.0.tgz#f89da3a228c38deb49c48f88a70fb71f01cafed6" - integrity sha512-94++VFO3qN95cM/d6eBXvd894oJE0w3cInq9USsyQzzoJxmiYzPAocNcuGCPGGjoXqDVJcr3C1jzt1TSjyaiLQ== +keccak@^3.0.2: + version "3.0.4" + resolved "https://registry.yarnpkg.com/keccak/-/keccak-3.0.4.tgz#edc09b89e633c0549da444432ecf062ffadee86d" + integrity sha512-3vKuW0jV8J3XNTzvfyicFR5qvxrSAGl7KIhvgOu5cmWwM7tZRj3fMbj/pfIf4be7aznbc+prBWGjywox/g2Y6Q== dependencies: - deferred-leveldown "~5.3.0" - level-errors "~2.0.0" - level-iterator-stream "~4.0.0" - level-supports "~1.0.0" - xtend "~4.0.0" + node-addon-api "^2.0.0" + node-gyp-build "^4.2.0" + readable-stream "^3.6.0" lines-and-columns@^1.1.6: version "1.2.4" @@ -2216,7 +1884,12 @@ lodash.clonedeep@^4.5.0: resolved "https://registry.yarnpkg.com/lodash.clonedeep/-/lodash.clonedeep-4.5.0.tgz#e23f3f9c4f8fbdde872529c1071857a086e5ccef" integrity sha512-H5ZhCF25riFd9uB5UCkVKo61m3S/xZk1x4wA6yp/L3RFP6Z/eHH1ymQcGLo7J3GMPfm0V/7m1tryHuGVxpqEBQ== -lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15: +lodash.isequal@^4.5.0: + version "4.5.0" + resolved "https://registry.yarnpkg.com/lodash.isequal/-/lodash.isequal-4.5.0.tgz#415c4478f2bcc30120c22ce10ed3226f7d3e18e0" + integrity sha512-pDo3lu8Jhfjqls6GkMgpahsF9kCyayhgykjyLMNFTKWrpVdAQtYyB4muAMWozBB4ig/dtWAmsMxLEI8wuz+DYQ== + +lodash@^4.17.11, lodash@^4.17.15: version "4.17.21" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== @@ -2243,33 +1916,16 @@ loupe@^2.3.1: dependencies: get-func-name "^2.0.0" -lru-cache@^5.1.1: - version "5.1.1" - resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-5.1.1.tgz#1da27e6710271947695daf6848e847f01d84b920" - integrity sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w== - dependencies: - yallist "^3.0.2" - lru_map@^0.3.3: version "0.3.3" resolved "https://registry.yarnpkg.com/lru_map/-/lru_map-0.3.3.tgz#b5c8351b9464cbd750335a79650a0ec0e56118dd" integrity sha512-Pn9cox5CsMYngeDbmChANltQl+5pi6XmTrraMSzhPmMBbmgcxmqWry0U3PGapCU1yB4/LqCcom7qhHZiF/jGfQ== -ltgt@~2.2.0: - version "2.2.1" - resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" - integrity sha512-AI2r85+4MquTw9ZYqabu4nMwy9Oftlfa/e/52t9IjtfG+mGBbTNdAoZ3RQKLHR6r0wQnwZnPIEh/Ya6XTWAKNA== - make-error@^1.1.1: version "1.3.6" resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== -mcl-wasm@^0.7.1: - version "0.7.9" - resolved "https://registry.yarnpkg.com/mcl-wasm/-/mcl-wasm-0.7.9.tgz#c1588ce90042a8700c3b60e40efb339fc07ab87f" - integrity sha512-iJIUcQWA88IJB/5L15GnJVnSQJmf/YaxxV6zRavv83HILHaJQb6y0iFyDMdDO0gN8X37tdxmAOrH/P8B6RB8sQ== - md5.js@^1.3.4: version "1.3.5" resolved "https://registry.yarnpkg.com/md5.js/-/md5.js-1.3.5.tgz#b5d07b8e3216e3e27cd728d72f70d1e6a342005f" @@ -2279,43 +1935,11 @@ md5.js@^1.3.4: inherits "^2.0.1" safe-buffer "^5.1.2" -memdown@^5.0.0: - version "5.1.0" - resolved "https://registry.yarnpkg.com/memdown/-/memdown-5.1.0.tgz#608e91a9f10f37f5b5fe767667a8674129a833cb" - integrity sha512-B3J+UizMRAlEArDjWHTMmadet+UKwHd3UjMgGBkZcKAxAYVPS9o0Yeiha4qvz7iGiL2Sb3igUft6p7nbFWctpw== - dependencies: - abstract-leveldown "~6.2.1" - functional-red-black-tree "~1.0.1" - immediate "~3.2.3" - inherits "~2.0.1" - ltgt "~2.2.0" - safe-buffer "~5.2.0" - memorystream@^0.3.1: version "0.3.1" resolved "https://registry.yarnpkg.com/memorystream/-/memorystream-0.3.1.tgz#86d7090b30ce455d63fbae12dda51a47ddcaf9b2" integrity sha512-S3UwM3yj5mtUSEfP41UZmt/0SCoVYUcU1rkXv+BQ5Ig8ndL4sPoJNBUJERafdPb5jjHJGuMgytgKvKIf58XNBw== -merkle-patricia-tree@^4.2.4: - version "4.2.4" - resolved "https://registry.yarnpkg.com/merkle-patricia-tree/-/merkle-patricia-tree-4.2.4.tgz#ff988d045e2bf3dfa2239f7fabe2d59618d57413" - integrity sha512-eHbf/BG6eGNsqqfbLED9rIqbsF4+sykEaBn6OLNs71tjclbMcMOk1tEPmJKcNcNCLkvbpY/lwyOlizWsqPNo8w== - dependencies: - "@types/levelup" "^4.3.0" - ethereumjs-util "^7.1.4" - level-mem "^5.0.1" - level-ws "^2.0.0" - readable-stream "^3.6.0" - semaphore-async-await "^1.5.1" - -miller-rabin@^4.0.0: - version "4.0.1" - resolved "https://registry.yarnpkg.com/miller-rabin/-/miller-rabin-4.0.1.tgz#f080351c865b0dc562a8462966daa53543c78a4d" - integrity sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA== - dependencies: - bn.js "^4.0.0" - brorand "^1.0.1" - minimalistic-assert@^1.0.0, minimalistic-assert@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz#2e194de044626d4a10e7f7fbc00ce73e83e4d5c7" @@ -2643,18 +2267,6 @@ prompt-sync@^4.2.0: dependencies: strip-ansi "^5.0.0" -prr@~1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" - integrity sha512-yPw4Sng1gWghHQWj0B3ZggWUm4qVbPwPFcRG8KyxiU7J2OHFSoEHKS+EZ3fv5l1t9CyCiop6l/ZYeWbrgoQejw== - -qs@^6.7.0: - version "6.11.0" - resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" - integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== - dependencies: - side-channel "^1.0.4" - randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" @@ -2672,7 +2284,7 @@ raw-body@^2.4.1: iconv-lite "0.4.24" unpipe "1.0.0" -readable-stream@^3.1.0, readable-stream@^3.4.0, readable-stream@^3.6.0: +readable-stream@^3.6.0: version "3.6.0" resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.0.tgz#337bbda3adc0706bd3e024426a286d4b4b2c9198" integrity sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA== @@ -2709,11 +2321,6 @@ require-directory@^2.1.1: resolved "https://registry.yarnpkg.com/require-directory/-/require-directory-2.1.1.tgz#8c64ad5fd30dab1c976e2344ffe7f792a6a6df42" integrity sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q== -require-from-string@^2.0.0: - version "2.0.2" - resolved "https://registry.yarnpkg.com/require-from-string/-/require-from-string-2.0.2.tgz#89a7fdd938261267318eafe14f9c32e598c36909" - integrity sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw== - require-main-filename@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/require-main-filename/-/require-main-filename-2.0.0.tgz#d0b329ecc7cc0f61649f62215be69af54aa8989b" @@ -2735,13 +2342,6 @@ resolve@^1.3.2: path-parse "^1.0.7" supports-preserve-symlinks-flag "^1.0.0" -rimraf@^2.2.8: - version "2.7.1" - resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" - integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w== - dependencies: - glob "^7.1.3" - ripemd160@^2.0.0, ripemd160@^2.0.1: version "2.0.2" resolved "https://registry.yarnpkg.com/ripemd160/-/ripemd160-2.0.2.tgz#a1c1a6f624751577ba5d07914cbc92850585890c" @@ -2750,18 +2350,13 @@ ripemd160@^2.0.0, ripemd160@^2.0.1: hash-base "^3.0.0" inherits "^2.0.1" -rlp@^2.2.3, rlp@^2.2.4: +rlp@^2.2.3: version "2.2.7" resolved "https://registry.yarnpkg.com/rlp/-/rlp-2.2.7.tgz#33f31c4afac81124ac4b283e2bd4d9720b30beaf" integrity sha512-d5gdPmgQ0Z+AklL2NVXr/IoSjNZFfTVvQWzL/AM2AOcSzYP2xjlb0AC8YyCLc41MSNf6P6QVtjgPdmVtzb+4lQ== dependencies: bn.js "^5.2.0" -rustbn.js@~0.2.0: - version "0.2.0" - resolved "https://registry.yarnpkg.com/rustbn.js/-/rustbn.js-0.2.0.tgz#8082cb886e707155fd1cb6f23bd591ab8d55d0ca" - integrity sha512-4VlvkRUuCJvr2J6Y0ImW7NvTCriMi7ErOAqWk1y69vAdoNIzCF3yPmgeNzx+RQTLEDFq5sHfscn1MwHxP9hNfA== - safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, safe-buffer@^5.2.0, safe-buffer@~5.2.0: version "5.2.1" resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6" @@ -2772,7 +2367,7 @@ safe-buffer@^5.0.1, safe-buffer@^5.1.0, safe-buffer@^5.1.1, safe-buffer@^5.1.2, resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== -scrypt-js@3.0.1, scrypt-js@^3.0.0: +scrypt-js@^3.0.0: version "3.0.1" resolved "https://registry.yarnpkg.com/scrypt-js/-/scrypt-js-3.0.1.tgz#d314a57c2aef69d1ad98a138a21fe9eafa9ee312" integrity sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA== @@ -2786,11 +2381,6 @@ secp256k1@^4.0.1: node-addon-api "^2.0.0" node-gyp-build "^4.2.0" -semaphore-async-await@^1.5.1: - version "1.5.1" - resolved "https://registry.yarnpkg.com/semaphore-async-await/-/semaphore-async-await-1.5.1.tgz#857bef5e3644601ca4b9570b87e9df5ca12974fa" - integrity sha512-b/ptP11hETwYWpeilHXXQiV5UJNJl7ZWWooKRE5eBIYWoom6dZ0SluCIdCtKycsMtZgKWE01/qAw6jblw1YVhg== - semver@^5.3.0, semver@^5.5.0, semver@^5.7.0: version "5.7.1" resolved "https://registry.yarnpkg.com/semver/-/semver-5.7.1.tgz#a954f931aeba508d307bbf069eff0c01c96116f7" @@ -2840,23 +2430,16 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" -slash@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/slash/-/slash-3.0.0.tgz#6539be870c165adbd5240220dbe361f1bc4d4634" - integrity sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q== - -solc@0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/solc/-/solc-0.7.3.tgz#04646961bd867a744f63d2b4e3c0701ffdc7d78a" - integrity sha512-GAsWNAjGzIDg7VxzP6mPjdurby3IkGCjQcM8GFYZT6RyaoUZKmMU6Y7YwG+tFGhv7dwZ8rmR4iwFDrrD99JwqA== +solc@0.8.26: + version "0.8.26" + resolved "https://registry.yarnpkg.com/solc/-/solc-0.8.26.tgz#afc78078953f6ab3e727c338a2fefcd80dd5b01a" + integrity sha512-yiPQNVf5rBFHwN6SIf3TUUvVAFKcQqmSUFeq+fb6pNRCo0ZCgpYOZDi3BVoezCPIAcKrVYd/qXlBLUP9wVrZ9g== dependencies: command-exists "^1.2.8" - commander "3.0.2" + commander "^8.1.0" follow-redirects "^1.12.1" - fs-extra "^0.30.0" js-sha3 "0.8.0" memorystream "^0.3.1" - require-from-string "^2.0.0" semver "^5.5.0" tmp "0.0.33" @@ -2907,7 +2490,7 @@ string-width@^3.0.0, string-width@^3.1.0: is-fullwidth-code-point "^2.0.0" strip-ansi "^5.1.0" -string-width@^4.1.0, string-width@^4.2.0: +string-width@^4.0.0, string-width@^4.1.0, string-width@^4.2.0, string-width@^4.2.2: version "4.2.3" resolved "https://registry.yarnpkg.com/string-width/-/string-width-4.2.3.tgz#269c7117d27b05ad2e536830a8ec895ef9c6d010" integrity sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g== @@ -3031,11 +2614,6 @@ toidentifier@1.0.1: resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== -"true-case-path@^2.2.1": - version "2.2.1" - resolved "https://registry.yarnpkg.com/true-case-path/-/true-case-path-2.2.1.tgz#c5bf04a5bbec3fd118be4084461b3a27c4d796bf" - integrity sha512-0z3j8R7MCjy10kc/g+qg7Ln3alJTodw9aDuVWZa3uiWqfuBMKeAeP2ocWcxoyM3D73yz3Jt/Pu4qPr4wHSdB/Q== - ts-node@^8.1.0: version "8.10.2" resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.10.2.tgz#eee03764633b1234ddd37f8db9ec10b75ec7fb8d" @@ -3047,6 +2625,11 @@ ts-node@^8.1.0: source-map-support "^0.5.17" yn "3.1.1" +tslib@2.4.0: + version "2.4.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.4.0.tgz#7cecaa7f073ce680a05847aa77be941098f36dc3" + integrity sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ== + tslib@^1.7.1, tslib@^1.8.0, tslib@^1.8.1, tslib@^1.9.3: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" @@ -3112,6 +2695,11 @@ type-detect@^4.0.0, type-detect@^4.0.5: resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c" integrity sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g== +type-fest@^0.20.2: + version "0.20.2" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.20.2.tgz#1bf207f4b28f91583666cb5fbd327887301cd5f4" + integrity sha512-Ne+eE4r0/iWnpAxD852z3A+N0Bt5RN//NjJwRd2VFHEmrywxf5vsZlh4R6lixl6B+wz/8d+maTSAkN1FIkI3LQ== + type-fest@^0.21.3: version "0.21.3" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.21.3.tgz#d260a24b0198436e133fa26a524a6d65fa3b2e37" @@ -3137,10 +2725,12 @@ unbox-primitive@^1.0.2: has-symbols "^1.0.3" which-boxed-primitive "^1.0.2" -undici@^5.4.0: - version "5.9.1" - resolved "https://registry.yarnpkg.com/undici/-/undici-5.9.1.tgz#fc9fd85dd488f965f153314a63d9426a11f3360b" - integrity sha512-6fB3a+SNnWEm4CJbgo0/CWR8RGcOCQP68SF4X0mxtYTq2VNN8T88NYrWVBAeSX+zb7bny2dx2iYhP3XHi00omg== +undici@^5.14.0: + version "5.28.4" + resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068" + integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g== + dependencies: + "@fastify/busboy" "^2.0.0" universalify@^0.1.0: version "0.1.2" @@ -3192,6 +2782,13 @@ wide-align@1.1.3: dependencies: string-width "^1.0.2 || 2" +widest-line@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/widest-line/-/widest-line-3.1.0.tgz#8292333bbf66cb45ff0de1603b136b7ae1496eca" + integrity sha512-NsmoXalsWVDMGupxZ5R08ka9flZjjiLvHVAWYOKtiKM8ujtZWr9cRffak+uSE48+Ob8ObalXpwyeUiyDD6QFgg== + dependencies: + string-width "^4.0.0" + workerpool@6.2.1: version "6.2.1" resolved "https://registry.yarnpkg.com/workerpool/-/workerpool-6.2.1.tgz#46fc150c17d826b86a008e5a4508656777e9c343" @@ -3220,21 +2817,16 @@ wrappy@1: resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@7.4.6: - version "7.4.6" - resolved "https://registry.yarnpkg.com/ws/-/ws-7.4.6.tgz#5654ca8ecdeee47c33a9a4bf6d28e2be2980377c" - integrity sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A== +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== ws@^7.4.6: version "7.5.9" resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.9.tgz#54fa7db29f4c7cec68b1ddd3a89de099942bb591" integrity sha512-F+P9Jil7UiSKSkppIiD94dN07AwvFixvLIj1Og1Rl9GGMuNipJnV9JzjD6XuqmAeiswGvUmNLjr5cFuXwNS77Q== -xtend@^4.0.1, xtend@^4.0.2, xtend@~4.0.0: - version "4.0.2" - resolved "https://registry.yarnpkg.com/xtend/-/xtend-4.0.2.tgz#bb72779f5fa465186b1f438f674fa347fdb5db54" - integrity sha512-LKYU1iAXJXUgAXn9URjiu+MWhyUXHsvfp7mcuYm9dSUKK0/CjtrUwFAxD82/mCWbtLsGjFIad0wIsod4zrTAEQ== - y18n@^4.0.0: version "4.0.3" resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.3.tgz#b5f259c82cd6e336921efd7bfd8bf560de9eeedf" @@ -3245,11 +2837,6 @@ y18n@^5.0.5: resolved "https://registry.yarnpkg.com/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== -yallist@^3.0.2: - version "3.1.1" - resolved "https://registry.yarnpkg.com/yallist/-/yallist-3.1.1.tgz#dbb7daf9bfd8bac9ab45ebf602b8cbad0d5d08fd" - integrity sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g== - yargs-parser@13.1.2, yargs-parser@^13.1.2: version "13.1.2" resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-13.1.2.tgz#130f09702ebaeef2650d54ce6e3e5706f7a4fb38" From 749567e99042f4194d8a1aa8892acd0017d34405 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Fri, 27 Sep 2024 16:47:54 -0300 Subject: [PATCH 2/9] feat: refactor for ethers v6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- package.json | 7 +- src/{lib => helpers}/ask.ts | 10 +- src/helpers/error.ts | 6 +- src/index.ts | 72 +++++++---- src/lib/account.ts | 77 ++++++++++-- src/lib/provider.ts | 91 +++----------- src/lib/signer.ts | 48 +++---- src/lib/wallet.ts | 59 --------- src/tasks.ts | 119 +++++++----------- src/type-extensions.ts | 67 +++++++--- test/environment.test.ts | 75 +++++------ .../.accounts/test-account.json | 28 +++++ .../.accounts/test.json | 1 + .../hardhat-project-config/hardhat.config.ts | 27 ++++ .../hardhat-project-pkeys/hardhat.config.ts | 2 +- .../hardhat-project/hardhat.config.ts | 3 - test/mnemonics.ts | 22 ++++ yarn.lock | 13 +- 18 files changed, 364 insertions(+), 363 deletions(-) rename src/{lib => helpers}/ask.ts (93%) delete mode 100644 src/lib/wallet.ts create mode 100644 test/fixture-projects/hardhat-project-config/.accounts/test-account.json create mode 100644 test/fixture-projects/hardhat-project-config/.accounts/test.json create mode 100644 test/fixture-projects/hardhat-project-config/hardhat.config.ts diff --git a/package.json b/package.json index b3bf6e1..b2b5915 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardhat-secure-accounts", - "version": "0.0.6", + "version": "1.0.0", "description": "Account management plugin for Hardhat", "repository": "github:edgeandnode/hardhat-secure-accounts", "author": "Edge & Node", @@ -32,7 +32,6 @@ ], "devDependencies": { "@nomicfoundation/hardhat-ethers": "^3.0.0", - "@nomiclabs/hardhat-ethers": "^2.1.1", "@types/chai": "^4.1.7", "@types/chai-as-promised": "^7.1.5", "@types/debug": "^4.1.7", @@ -51,10 +50,10 @@ "tslint": "^5.16.0", "tslint-config-prettier": "^1.18.0", "tslint-plugin-prettier": "^2.0.1", - "typescript": "^4.0.3" + "typescript": "^5.6.2" }, "peerDependencies": { - "@nomiclabs/hardhat-ethers": "^2.1.1", + "@nomicfoundation/hardhat-ethers": "^3.0.0", "ethers": "^6.13.0", "hardhat": "^2.22.0" }, diff --git a/src/lib/ask.ts b/src/helpers/ask.ts similarity index 93% rename from src/lib/ask.ts rename to src/helpers/ask.ts index 89903b2..0b30f79 100644 --- a/src/lib/ask.ts +++ b/src/helpers/ask.ts @@ -1,9 +1,9 @@ import Enquirer from 'enquirer' import Prompt from 'prompt-sync' -import { getSecureAccount, getSecureAccounts, SecureAccount } from './account' -import { logDebug, logWarn } from '../helpers/logger' -import { SecureAccountPluginError } from '../helpers/error' +import { getSecureAccount, getSecureAccounts, SecureAccount } from '../lib/account' +import { logDebug, logWarn } from './logger' +import { SecureAccountsPluginError } from './error' export const isRepl = () => !!require('repl').repl @@ -22,7 +22,7 @@ export async function getAccountOrAsk( const account = getSecureAccount(accountsDir, name) if (account === undefined) { - throw new SecureAccountPluginError('Account not found!') + throw new SecureAccountsPluginError('Account not found!') } logDebug(`Found account ${account.name} at ${account.filename}`) @@ -39,7 +39,7 @@ export async function getPasswordOrAsk(_password: string | undefined): Promise) => { - const userPath = userConfig.paths?.accounts + const userPath = userConfig.paths?.secureAccounts let accounts: string if (userPath === undefined) { @@ -28,25 +27,48 @@ extendConfig((config: HardhatConfig, userConfig: Readonly) => } logDebug(`Using accounts directory: ${accounts}`) - config.paths.accounts = accounts + config.paths.secureAccounts = accounts }) extendEnvironment((hre) => { - hre.accounts = { - getWallet: lazyFunction(() => (name?: string, password?: string) => - getWallet(hre.config.paths.accounts, name, password), - ), - getWallets: lazyFunction(() => (name?: string, password?: string) => - getWallets(hre.config.paths.accounts, name, password), - ), - getSigner: lazyFunction(() => (network?: Network, name?: string, password?: string) => - getSigner(network ?? hre.network, hre.config.paths.accounts, name, password), - ), - getSigners: lazyFunction(() => (network?: Network, name?: string, password?: string) => - getSigners(network ?? hre.network, hre.config.paths.accounts, name, password), - ), - getProvider: lazyFunction(() => (network?: Network, name?: string, password?: string) => - getProvider(network ?? hre.network, hre.config.paths.accounts, name, password), - ), + hre.accounts = lazyObject(() => { + const { SecureAccountsProvider } = require('./lib/provider') as { + SecureAccountsProvider: typeof SecureAccountsProviderT + } + const defaultAccount = hre.config.networks[hre.network.name].secureAccounts?.defaultAccount + const defaultAccountPassword = hre.config.networks[hre.network.name].secureAccounts?.defaultAccountPassword + + return { + provider: () => + SecureAccountsProvider.create( + hre.network.provider, + hre.config.paths.secureAccounts, + defaultAccount, + defaultAccountPassword + ), + getSigner: (accountName?: string, accountPassword?: string) => + getSigner(hre.config.paths.secureAccounts, accountName, accountPassword), + getSigners: (accountName?: string, accountPassword?: string) => + getSigners(hre.config.paths.secureAccounts, accountName, accountPassword), + } + }) +}) + +extendProvider(async (provider, config, network) => { + if (config.networks[network].secureAccounts) { + const { SecureAccountsProvider } = require('./lib/provider') as { + SecureAccountsProvider: typeof SecureAccountsProviderT + } + const defaultAccount = config.networks[network].secureAccounts?.defaultAccount + const defaultAccountPassword = config.networks[network].secureAccounts?.defaultAccountPassword + + return await SecureAccountsProvider.create( + provider, + config.paths.secureAccounts, + defaultAccount, + defaultAccountPassword + ) } + + return provider }) diff --git a/src/lib/account.ts b/src/lib/account.ts index 6263942..05ad804 100644 --- a/src/lib/account.ts +++ b/src/lib/account.ts @@ -1,25 +1,88 @@ import fs from 'fs' import path from 'path' +import { Wallet } from 'ethers' +import { logDebug } from '../helpers/logger' +import { SecureAccountsPluginError } from '../helpers/error' + +import type { HDNodeWallet } from 'ethers' +import { getAccountOrAsk, getPasswordOrAsk } from '../helpers/ask' + export interface SecureAccount { name: string filename: string json: string } -export function getSecureAccounts(rootDir: string): SecureAccount[] { - if (!fs.existsSync(rootDir)) { +export function getSecureAccounts(accountsDir: string): SecureAccount[] { + if (!fs.existsSync(accountsDir)) { return [] } - return fs.readdirSync(rootDir).map((a) => ({ + return fs.readdirSync(accountsDir).map((a) => ({ name: path.parse(a).name, - filename: path.join(rootDir, a), - json: fs.readFileSync(path.join(rootDir, a), 'utf8'), + filename: path.join(accountsDir, a), + json: fs.readFileSync(path.join(accountsDir, a), 'utf8'), })) } -export function getSecureAccount(rootDir: string, name: string): SecureAccount | undefined { - const accounts = getSecureAccounts(rootDir) +export function getSecureAccount(accountsDir: string, name: string): SecureAccount | undefined { + const accounts = getSecureAccounts(accountsDir) return accounts.find((a) => a.name === name) } + +export function accountExists(accountsDir: string, name: string): boolean { + return getSecureAccount(accountsDir, name) !== undefined +} + +export async function encryptAccount( + accountsDir: string, + name: string, + password: string, + mnemonic: string, +): Promise { + const wallet = mnemonic.length === 0 ? Wallet.createRandom() : Wallet.fromPhrase(mnemonic) + const encrypted = await wallet.encrypt(password) + + if (!fs.existsSync(accountsDir)) { + fs.mkdirSync(accountsDir) + logDebug(`Created accounts directory: ${accountsDir}`) + } + + const fileName = path.join(accountsDir, `${name}.json`) + fs.writeFileSync(fileName, encrypted, 'utf8') + logDebug(`Saved account to ${fileName}`) + + return { + name: name, + filename: fileName, + json: encrypted, + } +} + +export async function decryptAccount(account: SecureAccount, password: string): Promise { + const wallet = await Wallet.fromEncryptedJson(account.json, password) + logDebug(`Account unlocked: ${wallet.address}`) + + if (!isHDNodeWallet(wallet) || wallet.mnemonic === null) { + throw new SecureAccountsPluginError('Decrypted account is not valid!') + } + + return wallet.mnemonic.phrase +} + +export async function unlockAccount( + accountsDir: string, + accountName?: string, + accountPassword?: string, +): Promise { + const account = await getAccountOrAsk(accountName, accountsDir) + const password = await getPasswordOrAsk(accountPassword) + + return await decryptAccount(account, password) +} + +// typeguard +function isHDNodeWallet(wallet: Wallet | HDNodeWallet): wallet is HDNodeWallet { + return (wallet as HDNodeWallet).mnemonic !== undefined +} diff --git a/src/lib/provider.ts b/src/lib/provider.ts index 606a7a6..bccd680 100644 --- a/src/lib/provider.ts +++ b/src/lib/provider.ts @@ -1,83 +1,20 @@ -import cloneDeep from 'lodash.clonedeep' -import { EthersProviderWrapper } from '@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper' -import { createProvider } from 'hardhat/internal/core/providers/construction' -import { - HardhatConfig, - HardhatNetworkAccountsConfig, - HardhatNetworkHDAccountsConfig, - HttpNetworkAccountsConfig, - HttpNetworkHDAccountsConfig, - Network, -} from 'hardhat/types' -import { - DEFAULT_HD_COUNT, - DEFAULT_HD_INITIAL_INDEX, - DEFAULT_HD_PASSPHRASE, - removeIndexFromHDPath, -} from './wallet' +import { HDWalletProvider } from 'hardhat/internal/core/providers/accounts' +import { unlockAccount } from './account' -import { logDebug } from '../helpers/logger' -import { getWallet } from './wallet' -import { Mnemonic } from 'ethers' +import type { EIP1193Provider } from 'hardhat/types' -export async function getProvider( - config: HardhatConfig, - _network: Network, - accountsDir: string, - name?: string, - password?: string, -): Promise { - const wallet = await getWallet(accountsDir, name, password) - if (wallet.mnemonic === null || wallet.path === null) { - throw new Error('Wallet is not an HDNodeWallet') +export class SecureAccountsProvider extends HDWalletProvider { + constructor(provider: EIP1193Provider, mnemonic: string) { + super(provider, mnemonic) } - const network = setNetworkMnemonic(_network, wallet.mnemonic, wallet.path) - return createProviderWrapper(config, network) -} - -async function createProviderWrapper(config: HardhatConfig, network: Network) { - const ethereumProvider = await createProvider(config, network.name) - return new EthersProviderWrapper(ethereumProvider) -} - -function setNetworkMnemonic(_network: Network, mnemonic: Mnemonic, path: string): Network { - logDebug(`Cloning network config for ${_network.name} provider`) - const networkConfig = cloneDeep(_network.config) - - logDebug(`Injecting mnemonic into network config for ${_network.name}`) - let networkAccounts = networkConfig.accounts - if ( - isHardhatNetworkHDAccountsConfig(networkAccounts) || - isHttpNetworkHDAccountsConfig(networkAccounts) - ) { - logDebug('Target network already uses HD accounts, overriding mnemonic') - networkAccounts.mnemonic = mnemonic.phrase - // networkAccounts.path = removeIndexFromHDPath(mnemonic.path) - } else { - logDebug('Target network not using HD accounts, setting mnemonic') - networkConfig.accounts = { - mnemonic: mnemonic.phrase, - initialIndex: DEFAULT_HD_INITIAL_INDEX, - count: DEFAULT_HD_COUNT, - path: removeIndexFromHDPath(path), - passphrase: mnemonic.password || DEFAULT_HD_PASSPHRASE, - } + static async create( + provider: EIP1193Provider, + accountsDir: string, + accountName?: string, + accountPassword?: string, + ): Promise { + const phrase = await unlockAccount(accountsDir, accountName, accountPassword) + return new SecureAccountsProvider(provider, phrase) } - - _network.config = networkConfig - return _network -} - -// Type guards -function isHardhatNetworkHDAccountsConfig( - accountsConfig: HardhatNetworkAccountsConfig | HttpNetworkAccountsConfig, -): accountsConfig is HardhatNetworkHDAccountsConfig { - return (accountsConfig as HardhatNetworkHDAccountsConfig).mnemonic !== undefined -} - -function isHttpNetworkHDAccountsConfig( - accountsConfig: HardhatNetworkAccountsConfig | HttpNetworkAccountsConfig, -): accountsConfig is HttpNetworkHDAccountsConfig { - return (accountsConfig as HttpNetworkHDAccountsConfig).mnemonic !== undefined } diff --git a/src/lib/signer.ts b/src/lib/signer.ts index 15f5fef..eadbdeb 100644 --- a/src/lib/signer.ts +++ b/src/lib/signer.ts @@ -1,38 +1,30 @@ -import { HardhatConfig, Network } from 'hardhat/types' -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers' +import { HDNodeWallet, Mnemonic } from 'ethers' +import { unlockAccount } from './account' -import { logDebug } from '../helpers/logger' -import { getProvider } from './provider' +export const DEFAULT_HD_COUNT = 20 +export const DEFAULT_HD_PATH_PREFIX = `m/44'/60'/0'/0/` export async function getSigner( - config: HardhatConfig, - network: Network, accountsDir: string, - name?: string, - password?: string, -): Promise { - const provider = await getProvider(config, network, accountsDir, name, password) - - const signer = provider.getSigner() - const signerWithAddress = await SignerWithAddress.create(signer) - - logDebug(`Signer address: ${signerWithAddress.address}`) - return signerWithAddress + accountName?: string, + accountPassword?: string, +): Promise { + const phrase = await unlockAccount(accountsDir, accountName, accountPassword) + return deriveWallets(phrase, 1)[0] } export async function getSigners( - network: Network, accountsDir: string, - name?: string, - password?: string, -): Promise { - const provider = await getProvider(network, accountsDir, name, password) - - const accounts = await provider.listAccounts() - const signersWithAddress = await Promise.all( - accounts.map((account) => SignerWithAddress.create(provider.getSigner(account))), - ) + accountName?: string, + accountPassword?: string, +): Promise { + const phrase = await unlockAccount(accountsDir, accountName, accountPassword) + return deriveWallets(phrase, DEFAULT_HD_COUNT) +} - logDebug(`Got ${accounts.length} accounts from provider`) - return signersWithAddress +function deriveWallets(phrase: string, count: number): HDNodeWallet[] { + const mnemonic = Mnemonic.fromPhrase(phrase) + return Array.from(Array(count).keys()).map((i) => + HDNodeWallet.fromMnemonic(mnemonic, `${DEFAULT_HD_PATH_PREFIX}${i}`), + ) } diff --git a/src/lib/wallet.ts b/src/lib/wallet.ts deleted file mode 100644 index 722286a..0000000 --- a/src/lib/wallet.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { HDNodeWallet, Wallet } from 'ethers' -import { derivePrivateKeys } from 'hardhat/internal/core/providers/util' - -import { SecureAccountPluginError } from '../helpers/error' -import { logDebug } from '../helpers/logger' -import { getAccountOrAsk, getPasswordOrAsk } from './ask' - -export const DEFAULT_HD_INITIAL_INDEX = 0 -export const DEFAULT_HD_COUNT = 20 -export const DEFAULT_HD_PASSPHRASE = '' - -export async function getWallet( - accountsDir: string, - name?: string, - _password?: string, -): Promise { - const account = await getAccountOrAsk(name, accountsDir) - const password = await getPasswordOrAsk(_password) - - try { - const wallet = await Wallet.fromEncryptedJson(account.json, password) - logDebug(`Account unlocked: ${wallet.address}`) - - if (isHDNodeWallet(wallet)) { - return wallet - } else { - throw new SecureAccountPluginError('Wallet is not an HDNodeWallet') - } - } catch (error) { - throw new SecureAccountPluginError(error as Error) - } -} - -export async function getWallets( - accountsDir: string, - name?: string, - password?: string, -): Promise { - const wallet = await getWallet(accountsDir, name, password) - - if (wallet.mnemonic === null) { - throw new SecureAccountPluginError('Wallet is not an HDNodeWallet') - } - - logDebug(`Deriving private keys from mnemonic`) - return Array.from(Array(DEFAULT_HD_COUNT).keys()).map((i) => wallet.deriveChild(i)) -} - -export function removeIndexFromHDPath(hdpath: string): string { - if (hdpath.endsWith('/')) { - return hdpath - } else { - return hdpath.substring(0, hdpath.lastIndexOf('/') + 1) - } -} - -function isHDNodeWallet(wallet: Wallet | HDNodeWallet): wallet is HDNodeWallet { - return (wallet as HDNodeWallet).mnemonic !== undefined -} diff --git a/src/tasks.ts b/src/tasks.ts index 5aa56e0..8adb7c5 100644 --- a/src/tasks.ts +++ b/src/tasks.ts @@ -1,22 +1,27 @@ import fs from 'fs' -import path from 'path' import { task, subtask } from 'hardhat/config' -import { getSecureAccounts } from './lib/account' +import { accountExists, encryptAccount, getSecureAccounts } from './lib/account' +import { + askForConfirmation, + getAccountOrAsk, + getPasswordOrAsk, + getStringOrAsk, +} from './helpers/ask' import { logDebug } from './helpers/logger' -import { askForConfirmation, getAccountOrAsk, getPasswordOrAsk, getStringOrAsk } from './lib/ask' -import { SecureAccountPluginError } from './helpers/error' +import { SecureAccountsPluginError } from './helpers/error' export const TASK_ACCOUNTS = 'accounts' export const TASK_ACCOUNTS_ADD = 'accounts:add' export const TASK_ACCOUNTS_REMOVE = 'accounts:remove' export const TASK_ACCOUNTS_LIST = 'accounts:list' -export const TASK_ACCOUNTS_UNLOCK_SIGNER = 'accounts:unlock' -export const TASK_ACCOUNTS_UNLOCK_SIGNERS = 'accounts:unlock:signers' -export const TASK_ACCOUNTS_UNLOCK_WALLET = 'accounts:unlock:wallet' -export const TASK_ACCOUNTS_UNLOCK_WALLETS = 'accounts:unlock:wallets' -export const TASK_ACCOUNTS_UNLOCK_PROVIDER = 'accounts:unlock:provider' +export const ACCOUNTS_TASKS = [TASK_ACCOUNTS_ADD, TASK_ACCOUNTS_REMOVE, TASK_ACCOUNTS_LIST] + +task('tt') +.setAction(async (_, hre) => { + console.log(await hre.network.provider.send('eth_accounts')) +}) task(TASK_ACCOUNTS, 'Manage local accounts') .addOptionalPositionalParam('action', 'Action to perform: list, add, remove') @@ -25,96 +30,56 @@ task(TASK_ACCOUNTS, 'Manage local accounts') .setAction(async (taskArgs, hre) => { const action = taskArgs.action ? `accounts:${taskArgs.action}` : TASK_ACCOUNTS_LIST - try { - logDebug(`Running action ${action}`) - await hre.run(action, taskArgs) - } catch (error) { - throw new SecureAccountPluginError('Action not supported. Run `npx hardhat accounts --help` for more info') + if (!ACCOUNTS_TASKS.includes(action)) { + throw new SecureAccountsPluginError( + 'Action not supported. Run `npx hardhat accounts --help` for more info', + ) } + + logDebug(`Running action ${action}`) + await hre.run(action, taskArgs) }) +subtask(TASK_ACCOUNTS_LIST, 'List local accounts').setAction(async (_, hre) => { + const accounts = getSecureAccounts(hre.config.paths.secureAccounts) + + console.log('Managed accounts:') + for (const account of accounts) { + console.log(`> ${account.name} - 0x${JSON.parse(account.json).address}`) + } +}) + subtask(TASK_ACCOUNTS_ADD, 'Add a new account via mnemonic.') .addOptionalParam('name', 'Name of the account') .addOptionalParam('mnemonic', 'Mnemonic to derive the account from') .addOptionalParam('password', 'Password used to encrypt the account') .setAction(async (taskArgs, hre) => { - // Get account name - const accounts = getSecureAccounts(hre.config.paths.accounts) const name = await getStringOrAsk('name', 'Enter account name', taskArgs.name) logDebug(`Account name: ${name}`) - const fileName = path.join(hre.config.paths.accounts, `${name}.json`) - - if (accounts.map((a) => a.name).includes(name)) { - throw new SecureAccountPluginError(`Account with name ${name} already exists!`) + if (accountExists(hre.config.paths.secureAccounts, name)) { + throw new SecureAccountsPluginError(`Account with name ${name} already exists!`) } - // Get account mnemonic - const mnemonic = await getStringOrAsk('mnemonic', 'Enter mnemonic (leave empty to create a random mnemonic)', taskArgs.mnemonic) - const wallet = mnemonic.length === 0 ? hre.ethers.Wallet.createRandom() : hre.ethers.Wallet.fromPhrase(mnemonic) - - // Get account password and ecrypt wallet + const mnemonic = await getStringOrAsk( + 'mnemonic', + 'Enter mnemonic (leave empty to create a random mnemonic)', + taskArgs.mnemonic, + ) const password = await getPasswordOrAsk(taskArgs.password) - const encrypted = await wallet.encrypt(password) - - // Ensure accounts dir exists - if (!fs.existsSync(hre.config.paths.accounts)) { - fs.mkdirSync(hre.config.paths.accounts) - logDebug(`Created accounts directory: ${hre.config.paths.accounts}`) - } - // Write encrypted account to file - fs.writeFileSync(fileName, encrypted, 'utf8') - console.log(`Saved account to ${fileName}`) + const account = await encryptAccount(hre.config.paths.secureAccounts, name, password, mnemonic) + console.log(`Saved account ${name} to ${account.filename}`) }) subtask(TASK_ACCOUNTS_REMOVE, 'Remove an existing account').setAction(async (taskArgs, hre) => { - const account = await getAccountOrAsk(taskArgs.name, hre.config.paths.accounts) + const account = await getAccountOrAsk(taskArgs.name, hre.config.paths.secureAccounts) logDebug(`Attempting to delete ${account.name}...`) - const deleteAccount = await askForConfirmation(`Are you sure you want to delete ${account.name}?`) + const deleteAccount = await askForConfirmation(`Are you sure you want to delete ${account.name}?`) - if (deleteAccount) { + if (deleteAccount) { fs.unlinkSync(account.filename) console.log(`Deleted account ${account.name} from ${account.filename}`) - } -}) - -subtask(TASK_ACCOUNTS_LIST, 'List local accounts').setAction(async (_, hre) => { - const accounts = getSecureAccounts(hre.config.paths.accounts) - - console.log('Managed accounts:') - for (const account of accounts) { - console.log(`> ${account.name} - 0x${JSON.parse(account.json).address}`) } }) - -subtask(TASK_ACCOUNTS_UNLOCK_SIGNER, 'Unlock account, returns a single signer').setAction(async (taskArgs, hre) => { - const signer = await hre.accounts.getSigner(hre.network, taskArgs.name, taskArgs.password) - logDebug(`Account ${signer.address} unlocked!`) - return signer -}) - -subtask(TASK_ACCOUNTS_UNLOCK_SIGNERS, 'Unlock account, returns multiple signers').setAction(async (taskArgs, hre) => { - const signers = await hre.accounts.getSigners(hre.network, taskArgs.name, taskArgs.password) - logDebug(`Account unlocked, returning ${signers.length} signers!`) - return signers -}) - -subtask(TASK_ACCOUNTS_UNLOCK_WALLET, 'Unlock account, returns a single wallet').setAction(async (taskArgs, hre) => { - const wallet = await hre.accounts.getWallet(taskArgs.name, taskArgs.password) - logDebug(`Account ${wallet.address} unlocked!`) - return wallet -}) - -subtask(TASK_ACCOUNTS_UNLOCK_WALLETS, 'Unlock account, returns multiple wallets').setAction(async (taskArgs, hre) => { - const wallets = await hre.accounts.getWallets(taskArgs.name, taskArgs.password) - logDebug(`Account unlocked, returning ${wallets.length} wallets!`) - return wallets -}) - -subtask(TASK_ACCOUNTS_UNLOCK_PROVIDER, 'Unlock account, returns a provider').setAction(async (taskArgs, hre) => { - const provider = await hre.accounts.getProvider(hre.network, taskArgs.name, taskArgs.password) - logDebug(`Account unlocked, returning provider!`) - return provider -}) diff --git a/src/type-extensions.ts b/src/type-extensions.ts index d4404d5..91f66c6 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -1,30 +1,57 @@ -import "hardhat/types/config"; -import "hardhat/types/runtime"; -import { HDNodeWallet } from 'ethers' -import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers"; -import { EthersProviderWrapper } from "@nomiclabs/hardhat-ethers/internal/ethers-provider-wrapper"; -import { Network } from "hardhat/types/runtime"; +import 'hardhat/types/config' +import 'hardhat/types/runtime' -declare module "hardhat/types/config" { - export interface ProjectPathsUserConfig { - accounts?: string; +import type { HDNodeWallet } from 'ethers' +import type { SecureAccountsProvider } from './lib/provider' + +interface SecureAccountsOptions { + enabled?: boolean + defaultAccount?: string + defaultAccountPassword?: string +} + +declare module 'hardhat/types/config' { + interface ProjectPathsConfig { + secureAccounts: string + } + + interface ProjectPathsUserConfig { + secureAccounts?: string + } + + interface HardhatConfig { + secureAccounts?: SecureAccountsOptions + } + + interface HardhatUserConfig { + secureAccounts?: SecureAccountsOptions + } + + interface HardhatNetworkUserConfig { + secureAccounts?: SecureAccountsOptions + } + + interface HardhatNetworkConfig { + secureAccounts?: SecureAccountsOptions + } + + interface HttpNetworkUserConfig { + secureAccounts?: SecureAccountsOptions } - export interface ProjectPathsConfig { - accounts: string; + interface HttpNetworkConfig { + secureAccounts?: SecureAccountsOptions } } -export interface AccountsRuntimeEnvironment { - getWallet(name?: string, password?: string): Promise - getWallets(name?: string, password?: string): Promise - getSigner(network?: Network, name?: string, password?: string): Promise - getSigners(network?: Network, name?: string, password?: string): Promise - getProvider(network?: Network, name?: string, password?: string): Promise +interface SecureAccountsRuntimeEnvironment { + provider: () => Promise + getSigner(name?: string, password?: string): Promise + getSigners(name?: string, password?: string): Promise } -declare module "hardhat/types/runtime" { - export interface HardhatRuntimeEnvironment { - accounts: AccountsRuntimeEnvironment +declare module 'hardhat/types/runtime' { + interface HardhatRuntimeEnvironment { + accounts: SecureAccountsRuntimeEnvironment } } diff --git a/test/environment.test.ts b/test/environment.test.ts index c68d2cc..72e93b3 100644 --- a/test/environment.test.ts +++ b/test/environment.test.ts @@ -1,7 +1,7 @@ import chai, { expect } from 'chai' import chaiAsPromised from 'chai-as-promised' -import { HardhatNetworkAccountsConfig } from 'hardhat/types' import { useEnvironment } from './helpers' +import { getAddress } from 'ethers' import { TEST_MNEMONIC, @@ -9,23 +9,40 @@ import { TEST_NAME, TEST_PASSWORD, TEST_SIGNED_MESSAGE, + HARDHAT_ADDRESSES, } from './mnemonics' chai.use(chaiAsPromised) -describe('Extended environment usage > project using mnemonic', function () { +describe('Extended environment usage > project not using Secure Accounts', function () { useEnvironment('hardhat-project', 'hardhat') - runTests() -}) -describe('Extended environment usage > project using private keys', function () { - useEnvironment('hardhat-project-pkeys', 'hardhat') - runTests() + it('should manage its own accounts', async function () { + const accounts = (await this.hre.network.provider.request({ + method: 'eth_accounts', + })) as string[] + for (let i = 0; i < accounts.length; i++) { + expect(getAddress(accounts[i])).to.equal(HARDHAT_ADDRESSES[i]) + } + }) }) -function runTests() { - it.only('should unlock account and return a single wallet', async function () { - const wallet = await this.hre.accounts.getWallet(TEST_NAME, TEST_PASSWORD) +describe('Extended environment usage > project using Secure Accounts', function () { + useEnvironment('hardhat-project-config', 'hardhat') + + it('should manage secured accounts', async function () { + const accounts = (await this.hre.network.provider.request({ + method: 'eth_accounts', + })) as string[] + for (let i = 0; i < accounts.length; i++) { + expect(getAddress(accounts[i])).to.equal(TEST_ADDRESSES[i]) + } + }) + + it('should have signing keys for secured accounts', async function () {}) + + it('should unlock account and return a single wallet', async function () { + const wallet = await this.hre.accounts.getSigner(TEST_NAME, TEST_PASSWORD) expect(wallet.address).to.equal(TEST_ADDRESSES[0]) expect(wallet?.mnemonic?.phrase).to.equal(TEST_MNEMONIC) @@ -34,47 +51,15 @@ function runTests() { }) it('should unlock account and return multiple wallets', async function () { - const wallets = await this.hre.accounts.getWallets(TEST_NAME, TEST_PASSWORD) + const wallets = await this.hre.accounts.getSigners(TEST_NAME, TEST_PASSWORD) expect(wallets.length).to.equal(20) for (let i = 0; i < 20; i++) { expect(wallets[i].address).to.equal(TEST_ADDRESSES[i]) - expect(wallets[i].mnemonic).to.be.null + expect(wallets[i].mnemonic?.phrase).to.equal(TEST_MNEMONIC) expect(wallets[i].provider).to.be.null expect(wallets[i].signMessage('test')).to.eventually.be.fulfilled } }) - - it('should unlock account and return a single signer', async function () { - const signer = await this.hre.accounts.getSigner(this.hre.network, TEST_NAME, TEST_PASSWORD) - - expect(signer.address).to.equal(TEST_ADDRESSES[0]) - expect(signer.signMessage('test')).to.eventually.equal(TEST_SIGNED_MESSAGE) - expect(signer.provider).to.not.be.null - }) - - it('should unlock account and return multiple signers', async function () { - const signers = await this.hre.accounts.getSigners(this.hre.network, TEST_NAME, TEST_PASSWORD) - - expect(signers.length).to.equal(20) - - for (let i = 0; i < 20; i++) { - expect(signers[i].address).to.equal(TEST_ADDRESSES[i]) - expect(signers[i].provider).to.not.be.null - expect(signers[i].signMessage('test')).to.eventually.be.fulfilled - } - }) - - it('should unlock account and return a provider', async function () { - const provider = await this.hre.accounts.getProvider(this.hre.network, TEST_NAME, TEST_PASSWORD) - - expect(provider).to.not.be.null - expect(provider).to.be.an('object') - - const signer = provider.getSigner() - expect(signer.getAddress()).to.eventually.equal(TEST_ADDRESSES[0]) - expect(signer.signMessage('test')).to.eventually.equal(TEST_SIGNED_MESSAGE) - expect(signer.provider).to.not.be.null - }) -} +}) diff --git a/test/fixture-projects/hardhat-project-config/.accounts/test-account.json b/test/fixture-projects/hardhat-project-config/.accounts/test-account.json new file mode 100644 index 0000000..de055e6 --- /dev/null +++ b/test/fixture-projects/hardhat-project-config/.accounts/test-account.json @@ -0,0 +1,28 @@ +{ + "address": "c108fda1b5b2903751594298769efd4904b146bd", + "id": "37ec99f7-8244-4982-b2d4-173c244784f3", + "version": 3, + "Crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { "iv": "1eb9d55c0882a50e7988a09e674c2402" }, + "ciphertext": "822fd907f44e48d15d500433200ac244b70487813982936a88c0830fa9cd66b6", + "kdf": "scrypt", + "kdfparams": { + "salt": "f6d158afdf9a11d3353fbe736cbb769626c8428015603c6449ca1fa0b42e3c2e", + "n": 131072, + "dklen": 32, + "p": 1, + "r": 8 + }, + "mac": "1af4526f4e62b6722226ee1c3a18d7f5dfff0d5b7862ca123989e7a464153f28" + }, + "x-ethers": { + "client": "ethers.js", + "gethFilename": "UTC--2022-08-24T12-27-39.0Z--c108fda1b5b2903751594298769efd4904b146bd", + "mnemonicCounter": "3bd3b82c7148351fe0cdc005a631d445", + "mnemonicCiphertext": "f2bc1c5598c60fe265bf7908344fde6d", + "path": "m/44'/60'/0'/0/0", + "locale": "en", + "version": "0.1" + } +} diff --git a/test/fixture-projects/hardhat-project-config/.accounts/test.json b/test/fixture-projects/hardhat-project-config/.accounts/test.json new file mode 100644 index 0000000..e1cd96b --- /dev/null +++ b/test/fixture-projects/hardhat-project-config/.accounts/test.json @@ -0,0 +1 @@ +{"address":"e35c3c18bae3202adf0139c0de44b9c3fd07a966","id":"ec3d6fac-be1e-48c6-ad02-2c20d75e2014","version":3,"Crypto":{"cipher":"aes-128-ctr","cipherparams":{"iv":"d585fbce3a871928d99585501bef94ca"},"ciphertext":"4c5825cc790f214093d91abee96b18fb9a9fc3cef77f4d8848d9b0ff4a4f516e","kdf":"scrypt","kdfparams":{"salt":"1814fd470cae9f5cffee245af465cce66e23eb6961e95a3b21405aead11bb38d","n":131072,"dklen":32,"p":1,"r":8},"mac":"c2ba01368c1c0e63045e469a0b2331a144b7fd424bcd439aee0206835b8fade5"},"x-ethers":{"client":"ethers/6.13.2","gethFilename":"UTC--2024-09-27T17-33-24.0Z--e35c3c18bae3202adf0139c0de44b9c3fd07a966","path":"m/44'/60'/0'/0/0","locale":"en","mnemonicCounter":"5a491c1742b8cf7ee8ad71f0cb9f4509","mnemonicCiphertext":"33c73d234ade9579580e6c3a92449ecb","version":"0.1"}} \ No newline at end of file diff --git a/test/fixture-projects/hardhat-project-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-config/hardhat.config.ts new file mode 100644 index 0000000..5910cbc --- /dev/null +++ b/test/fixture-projects/hardhat-project-config/hardhat.config.ts @@ -0,0 +1,27 @@ +import { HardhatUserConfig } from 'hardhat/types' + +import '../../../src/index' + +import { HARDHAT_MNEMONIC, TEST_NAME, TEST_PASSWORD } from '../../mnemonics' + +const config: HardhatUserConfig = { + solidity: '0.7.3', + defaultNetwork: 'hardhat', + paths: { + secureAccounts: '.accounts', + }, + networks: { + hardhat: { + secureAccounts: { + enabled: false, + defaultAccount: TEST_NAME, + defaultAccountPassword: TEST_PASSWORD + }, + accounts: { + mnemonic: HARDHAT_MNEMONIC, + } + }, + }, +} + +export default config diff --git a/test/fixture-projects/hardhat-project-pkeys/hardhat.config.ts b/test/fixture-projects/hardhat-project-pkeys/hardhat.config.ts index 80bd1d9..aeeffca 100644 --- a/test/fixture-projects/hardhat-project-pkeys/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project-pkeys/hardhat.config.ts @@ -8,7 +8,7 @@ const config: HardhatUserConfig = { solidity: '0.7.3', defaultNetwork: 'hardhat', paths: { - accounts: '.accounts', + secureAccounts: '.accounts', }, networks: { hardhat: { diff --git a/test/fixture-projects/hardhat-project/hardhat.config.ts b/test/fixture-projects/hardhat-project/hardhat.config.ts index 83e9847..6478b14 100644 --- a/test/fixture-projects/hardhat-project/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project/hardhat.config.ts @@ -7,9 +7,6 @@ import { HARDHAT_MNEMONIC } from '../../mnemonics' const config: HardhatUserConfig = { solidity: '0.7.3', defaultNetwork: 'hardhat', - paths: { - accounts: '.accounts', - }, networks: { hardhat: { accounts: { diff --git a/test/mnemonics.ts b/test/mnemonics.ts index 8baf1cc..6443e3b 100644 --- a/test/mnemonics.ts +++ b/test/mnemonics.ts @@ -31,6 +31,28 @@ export const TEST_SIGNED_MESSAGE = '0x6086b97f59a07520ea9df5e069c4b6a9bcb6046912 export const HARDHAT_MNEMONIC = 'dust pass blood gate carry daughter claim income similar capable east salad' +export const HARDHAT_ADDRESSES = [ + '0x4cB0Dfe9A86af633CD8E992b96068d925D9b84F6', + '0x4F330be30f5A53C16D953614eFC5f17d1a60b0c6', + '0x90DdbBa0ed5C66dA6Eb3BEF5a4170e1b3172d417', + '0x37F59E77a973dDcEEf98aAAed6E9B2446FF51b4b', + '0x1E80a7ccB47BdC75Ae080dF1dE2c4Ea1329f7bE5', + '0xF14c4156fffcEc199CE133F64DA3AC33aD2eE602', + '0xAF1451EDEb178996B65d63A32a591E2842718D0A', + '0xE1e8f12e714233D5c15F286981D93E0b1150bDE8', + '0x462d3523f670322b6e5E4778597B1A6943eF098e', + '0x52041b5aDD60860959e235E3a0fc5E25e63dfD66', + '0x4d14E46eD59E2831a6Dd17d53126Dbb01a934d7f', + '0xc8df065c49A1c75a13D653Bd3CA5EEe27e7Bb56b', + '0xb1e45C52811E599e97214C930FD8f07802309453', + '0xE89ABC14B3bda6cd1D9A0174a1B05C177FFb277C', + '0x0b4E63AbA6a5E2e507D2Dcc08c5b790637516Aa0', + '0x9e239265618F8e0b33DA282D594C8A485e745DaA', + '0x1bD859B5387E3388055E213D20E2c446633890aa', + '0x301728f0C82Ab06BA76ae3C2627cAB695c52F08f', + '0x4C2F6b00B35dB64d6aFADba0a8ef2004f4A09e9a', + '0x3F09156aAa47b385107a56e54c3CD56b6290d07f', +] export const HARDHAT_PRIVATE_KEYS = [ '0x70cc4d7e39e1adc999a3397231f7b710f13e0d6e0888e700d1075ffa7f60da5c', '0x172c812fe8e8a1fdc205ec196c4fe536ba75f4061cb969b1308adc67c642bb25', diff --git a/yarn.lock b/yarn.lock index 22ae80c..f804703 100644 --- a/yarn.lock +++ b/yarn.lock @@ -376,11 +376,6 @@ "@nomicfoundation/solidity-analyzer-linux-x64-musl" "0.1.2" "@nomicfoundation/solidity-analyzer-win32-x64-msvc" "0.1.2" -"@nomiclabs/hardhat-ethers@^2.1.1": - version "2.1.1" - resolved "https://registry.yarnpkg.com/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.1.1.tgz#3f1d1ab49813d1bae4c035cc1adec224711e528b" - integrity sha512-Gg0IFkT/DW3vOpih4/kMjeZCLYqtfgECLeLXTs7ZDPzcK0cfoc5wKk4nq5n/izCUzdhidO/Utd6ptF9JrWwWVA== - "@scure/base@~1.1.0": version "1.1.1" resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.1.tgz#ebb651ee52ff84f420097055f4bf46cfba403938" @@ -2710,10 +2705,10 @@ type-fest@^0.7.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.7.1.tgz#8dda65feaf03ed78f0a3f9678f1869147f7c5c48" integrity sha512-Ne2YiiGN8bmrmJJEuTWTLJR32nh/JdL1+PSicowtNb0WFpn59GK8/lfD61bVtzguz7b3PBt74nxpv/Pw5po5Rg== -typescript@^4.0.3: - version "4.7.4" - resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.4.tgz#1a88596d1cf47d59507a1bcdfb5b9dfe4d488235" - integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== +typescript@^5.6.2: + version "5.6.2" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" + integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== unbox-primitive@^1.0.2: version "1.0.2" From 6ff11756157ef7ec5546a0fcd39265294eb6a50f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 30 Sep 2024 14:36:57 -0300 Subject: [PATCH 3/9] feat: connect signers to provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- src/index.ts | 28 +++++++++++++--------------- src/lib/signer.ts | 9 +++++++-- src/type-extensions.ts | 4 ++-- test/environment.test.ts | 4 ++-- 4 files changed, 24 insertions(+), 21 deletions(-) diff --git a/src/index.ts b/src/index.ts index 8f396c9..4a5c6a9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,11 +6,13 @@ import { lazyObject } from 'hardhat/plugins' import { getSigner, getSigners } from './lib/signer' import { logDebug } from './helpers/logger' -import type { HardhatConfig, HardhatUserConfig } from 'hardhat/types' +import type { HardhatEthersProvider as HardhatEthersProviderT } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' import type { SecureAccountsProvider as SecureAccountsProviderT } from './lib/provider' +import type { HardhatConfig, HardhatUserConfig } from 'hardhat/types' import './type-extensions' import './tasks' +import { Wallet } from 'ethers' extendConfig((config: HardhatConfig, userConfig: Readonly) => { const userPath = userConfig.paths?.secureAccounts @@ -32,24 +34,20 @@ extendConfig((config: HardhatConfig, userConfig: Readonly) => extendEnvironment((hre) => { hre.accounts = lazyObject(() => { - const { SecureAccountsProvider } = require('./lib/provider') as { - SecureAccountsProvider: typeof SecureAccountsProviderT + const { + HardhatEthersProvider, + } = require('@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider') as { + HardhatEthersProvider: typeof HardhatEthersProviderT } - const defaultAccount = hre.config.networks[hre.network.name].secureAccounts?.defaultAccount - const defaultAccountPassword = hre.config.networks[hre.network.name].secureAccounts?.defaultAccountPassword + + const provider = new HardhatEthersProvider(hre.network.provider, hre.network.name) return { - provider: () => - SecureAccountsProvider.create( - hre.network.provider, - hre.config.paths.secureAccounts, - defaultAccount, - defaultAccountPassword - ), + provider: provider, getSigner: (accountName?: string, accountPassword?: string) => - getSigner(hre.config.paths.secureAccounts, accountName, accountPassword), + getSigner(hre.config.paths.secureAccounts, provider, accountName, accountPassword), getSigners: (accountName?: string, accountPassword?: string) => - getSigners(hre.config.paths.secureAccounts, accountName, accountPassword), + getSigners(hre.config.paths.secureAccounts, provider, accountName, accountPassword), } }) }) @@ -66,7 +64,7 @@ extendProvider(async (provider, config, network) => { provider, config.paths.secureAccounts, defaultAccount, - defaultAccountPassword + defaultAccountPassword, ) } diff --git a/src/lib/signer.ts b/src/lib/signer.ts index eadbdeb..e61eed6 100644 --- a/src/lib/signer.ts +++ b/src/lib/signer.ts @@ -1,25 +1,30 @@ import { HDNodeWallet, Mnemonic } from 'ethers' import { unlockAccount } from './account' +import type { EthereumProvider } from 'hardhat/types' +import type { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' + export const DEFAULT_HD_COUNT = 20 export const DEFAULT_HD_PATH_PREFIX = `m/44'/60'/0'/0/` export async function getSigner( accountsDir: string, + provider: HardhatEthersProvider, accountName?: string, accountPassword?: string, ): Promise { const phrase = await unlockAccount(accountsDir, accountName, accountPassword) - return deriveWallets(phrase, 1)[0] + return deriveWallets(phrase, 1)[0].connect(provider) } export async function getSigners( accountsDir: string, + provider: HardhatEthersProvider, accountName?: string, accountPassword?: string, ): Promise { const phrase = await unlockAccount(accountsDir, accountName, accountPassword) - return deriveWallets(phrase, DEFAULT_HD_COUNT) + return deriveWallets(phrase, DEFAULT_HD_COUNT).map(w => w.connect(provider)) } function deriveWallets(phrase: string, count: number): HDNodeWallet[] { diff --git a/src/type-extensions.ts b/src/type-extensions.ts index 91f66c6..51ab6ba 100644 --- a/src/type-extensions.ts +++ b/src/type-extensions.ts @@ -2,7 +2,7 @@ import 'hardhat/types/config' import 'hardhat/types/runtime' import type { HDNodeWallet } from 'ethers' -import type { SecureAccountsProvider } from './lib/provider' +import type { HardhatEthersProvider } from '@nomicfoundation/hardhat-ethers/internal/hardhat-ethers-provider' interface SecureAccountsOptions { enabled?: boolean @@ -45,7 +45,7 @@ declare module 'hardhat/types/config' { } interface SecureAccountsRuntimeEnvironment { - provider: () => Promise + provider: HardhatEthersProvider getSigner(name?: string, password?: string): Promise getSigners(name?: string, password?: string): Promise } diff --git a/test/environment.test.ts b/test/environment.test.ts index 72e93b3..277d96c 100644 --- a/test/environment.test.ts +++ b/test/environment.test.ts @@ -46,7 +46,7 @@ describe('Extended environment usage > project using Secure Accounts', function expect(wallet.address).to.equal(TEST_ADDRESSES[0]) expect(wallet?.mnemonic?.phrase).to.equal(TEST_MNEMONIC) - expect(wallet.provider).to.be.null + expect(wallet.provider).not.to.be.null expect(wallet.signMessage('test')).to.eventually.equal(TEST_SIGNED_MESSAGE) }) @@ -58,7 +58,7 @@ describe('Extended environment usage > project using Secure Accounts', function for (let i = 0; i < 20; i++) { expect(wallets[i].address).to.equal(TEST_ADDRESSES[i]) expect(wallets[i].mnemonic?.phrase).to.equal(TEST_MNEMONIC) - expect(wallets[i].provider).to.be.null + expect(wallets[i].provider).not.to.be.null expect(wallets[i].signMessage('test')).to.eventually.be.fulfilled } }) From fc4b078639cb8e3eda32478a77c3cfc2f22c1c36 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 30 Sep 2024 14:59:30 -0300 Subject: [PATCH 4/9] test: test signing with provider MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- test/environment.test.ts | 27 +++++++++++++++++++++++++-- test/mnemonics.ts | 27 +++++++++++++++++++++++++-- 2 files changed, 50 insertions(+), 4 deletions(-) diff --git a/test/environment.test.ts b/test/environment.test.ts index 277d96c..483e931 100644 --- a/test/environment.test.ts +++ b/test/environment.test.ts @@ -1,7 +1,7 @@ import chai, { expect } from 'chai' import chaiAsPromised from 'chai-as-promised' import { useEnvironment } from './helpers' -import { getAddress } from 'ethers' +import { ethers, getAddress, Wallet } from 'ethers' import { TEST_MNEMONIC, @@ -10,6 +10,7 @@ import { TEST_PASSWORD, TEST_SIGNED_MESSAGE, HARDHAT_ADDRESSES, + TEST_PRIVATE_KEYS, } from './mnemonics' chai.use(chaiAsPromised) @@ -39,7 +40,29 @@ describe('Extended environment usage > project using Secure Accounts', function } }) - it('should have signing keys for secured accounts', async function () {}) + it('should have signing keys for secured accounts', async function () { + const accounts = (await this.hre.network.provider.request({ + method: 'eth_accounts', + })) as string[] + + for (let i = 0; i < accounts.length; i++) { + expect(getAddress(accounts[i])).to.equal(TEST_ADDRESSES[i]) + } + + const message = "Hello, this is a message to sign"; + const messageHex = ethers.hexlify(ethers.toUtf8Bytes(message)); + + for (let i = 0; i < accounts.length; i++) { + const signature = await this.hre.network.provider.request({ + method: 'eth_sign', + params: [accounts[i], messageHex], + }) as string + + const wallet = new Wallet(TEST_PRIVATE_KEYS[i]) + const walletSignature = await wallet.signMessage(message) + expect(signature).to.equal(walletSignature) + } + }) it('should unlock account and return a single wallet', async function () { const wallet = await this.hre.accounts.getSigner(TEST_NAME, TEST_PASSWORD) diff --git a/test/mnemonics.ts b/test/mnemonics.ts index 6443e3b..85c4467 100644 --- a/test/mnemonics.ts +++ b/test/mnemonics.ts @@ -23,9 +23,32 @@ export const TEST_ADDRESSES = [ '0x52DA80af10C9953D7E66Db961e464f7F7EefCDcD', '0xd476B88E3864916294A3eB5E76aEfFEE6FA35f1a', ] +export const TEST_PRIVATE_KEYS = [ + '0xf2f0d55dc3313ee816a73fbf4ee347ab7c30c030fd12e0950c69b9a8f6783911', + '0xbfb8bb3f5acd45f75d17adc444d5097178e971e0c583ae87357775e2a02e8026', + '0x1f83fba4e590e6caf81ef01dd9544f2b495c04764ea23acb4b6148fea0bb66a8', + '0xdeb1a973a007fad60f84650e986354799ceeb655d360697cb157dd34e68b4d81', + '0x907cd38d4820fbf04370c723916a770465fb4376c1511d5f3f02f2ea0bc9b16e', + '0x711acd1a3233bbc5e6b333f96f90d2bc641f4208ff3f74c75429e38a5ad48708', + '0x7067e06ad8a99d81aa5fa1e876388eeaf11a09455028f9ab21cc9d7e55231687', + '0x8f3ba273bd60427acbb87051405c7a2f14e98dfe10e150cfa9b96d8384af95ae', + '0x2dca965af372c4e4d4907fbb9ab3cde0550151be9031c9374ed0ab3925310993', + '0x37045859016c08f2bf7f26a1339d101c0e5b9cdc79d71d37e5e16866d35d24c7', + '0x94a9899d93c7b278f95b6b820f0ca49dcb93453df3d1a8fd757486af3b85d3b7', + '0x0358cbf57e7b074360599e549fe2069cd68826ff8815e421a74a2e596c7f31ef', + '0xac679b148859ab004b37b56c892fc40a16e2c7655ab5552e223c28f0ddffac38', + '0x36b89b630ada5cfc94f6bdb7b489b855e104c530f12b5ef7032fcdddeec87a54', + '0x6d4bdfa41b936b014b998494909156e0e58a7a96f08ab1101a4709b8fc41c048', + '0x1dd7f3e0ece703749d0089d8d1dec12e6ba75c30565d6c533d077a8e96a4df8b', + '0xfb32d7f89f82703f31ed8945f0e0fdedc379a301f47246b360f955d156023ee8', + '0x699737679c37566d629838eb2bf4ad82e20f2a34c86551f804dd75985fadda5f', + '0x11d15fe0dfc9b39d5769f18190f4c2e6300370294efd6afab284f15967cf2c60', + '0xa566856a93246998317c06d60653949a41e209078734d5d86b1caaf0fd3b379d', +] export const TEST_NAME = 'test-account' export const TEST_PASSWORD = 'batman-with-cheese' -export const TEST_SIGNED_MESSAGE = '0x6086b97f59a07520ea9df5e069c4b6a9bcb60469129b81a779bde0e6ec78166f328b21a2cbe20053a9cf8e1e948d6056c41023c663f3e2a72951f4183447a1e61b' +export const TEST_SIGNED_MESSAGE = + '0x6086b97f59a07520ea9df5e069c4b6a9bcb60469129b81a779bde0e6ec78166f328b21a2cbe20053a9cf8e1e948d6056c41023c663f3e2a72951f4183447a1e61b' // Mnemonic to set on hardhat network export const HARDHAT_MNEMONIC = @@ -56,5 +79,5 @@ export const HARDHAT_ADDRESSES = [ export const HARDHAT_PRIVATE_KEYS = [ '0x70cc4d7e39e1adc999a3397231f7b710f13e0d6e0888e700d1075ffa7f60da5c', '0x172c812fe8e8a1fdc205ec196c4fe536ba75f4061cb969b1308adc67c642bb25', - '0xea57407c4471585357d6030a72597b0a63b1511882ecfe9cf6c29a467ca79649' + '0xea57407c4471585357d6030a72597b0a63b1511882ecfe9cf6c29a467ca79649', ] From 92d11c0c3eabf544d6683a8d4f171c4d83cddafa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Mon, 30 Sep 2024 15:01:44 -0300 Subject: [PATCH 5/9] chore: bump package.json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index b2b5915..c3a8c39 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardhat-secure-accounts", - "version": "1.0.0", + "version": "1.0.1", "description": "Account management plugin for Hardhat", "repository": "github:edgeandnode/hardhat-secure-accounts", "author": "Edge & Node", From 74b858a6dd3940fd9d75bef496dc8ac4815735b0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Thu, 3 Oct 2024 14:39:58 -0300 Subject: [PATCH 6/9] fix: several improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- README.md | 144 +++++++++--------- package.json | 2 +- src/helpers/ask.ts | 4 + src/index.ts | 31 ++-- test/environment.test.ts | 17 +++ .../hardhat.config.ts | 25 +++ .../.accounts/test-account.json | 28 ---- 7 files changed, 141 insertions(+), 110 deletions(-) create mode 100644 test/fixture-projects/hardhat-project-no-accounts/hardhat.config.ts delete mode 100644 test/fixture-projects/hardhat-project/.accounts/test-account.json diff --git a/README.md b/README.md index 3777418..c5c4a49 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # 🔐 Hardhat Secure Accounts -This plugin provides a secure way of storing private keys to use with [Hardhat](https://hardhat.org/). The keys are encrypted using a user-provided password and stored using [keystore](https://julien-maffre.medium.com/what-is-an-ethereum-keystore-file-86c8c5917b97). The plugin also provides several ways of unlocking and using the accounts to sign transactions and messages. +This plugin provides a secure way of storing Ethereum account private keys and mnemonics to use with [Hardhat](https://hardhat.org/). Keys are encrypted using a password and stored with [keystore](https://julien-maffre.medium.com/what-is-an-ethereum-keystore-file-86c8c5917b97). The plugin also provides several ways of unlocking and using the accounts to sign transactions and messages. **Why** @@ -13,12 +13,18 @@ A few reasons why you might want to use this plugin: What this plugin can do for you: - Manage multiple accounts on your hardhat project using mnemonic phrases (TODO: support private keys!) -- Create and access secure keystore files using [ethers](https://docs.ethers.io/v5/) to [encrypt](https://docs.ethers.io/v5/api/signer/#Wallet-encrypt) and [decrypt](https://docs.ethers.io/v5/api/signer/#Wallet-fromEncryptedJsonSync) the private keys. By default keystore files are stored at the root of your project in a `.keystore` folder, you should gitignore this folder as an extra security measure. -- Unlock your accounts and get a wallet, signer or provider to use with your hardhat tasks/scripts/console. +- Unlock your accounts and get a signer or provider to use with your hardhat tasks/scripts/console. + +**How** + +The plugin works as follow: +- Extends the Hardhat provider (`hre.network.provider`) using [extendProvider()](https://hardhat.org/hardhat-runner/docs/advanced/building-plugins#extending-the-hardhat-provider) function +- Create and access secure keystore files using [ethers](https://docs.ethers.io/v6/) to [encrypt](https://docs.ethers.org/v6/api/wallet/#Wallet-encrypt) and [decrypt](https://docs.ethers.org/v6/api/wallet/#Wallet_fromEncryptedJson) the private keys. By default keystore files are stored at the root of your project in a `.keystore` folder, you should gitignore this folder as an extra security measure. +- Extend Hardhat Runtime Environment with several methods to unlock accounts and get signer, wallet and provider instances. ## ⚠️ Disclaimers ⚠️ -- Exercise caution when using this plugin! For any serious production work you should use more reliable and safe ways of securing your keys/contracts such as hardware wallets, multisigs, ownable contracts, etc. +- Exercise caution when using this plugin! This plugin is mostly meant to simplify account key management for non production accounts. For any serious production work you should use more reliable and safe ways of securing your keys/contracts such as hardware wallets, multisigs, ownable contracts, etc. - Because of how [repl](https://github.com/nodejs/repl) works it's not possible to use most of the popular prompt libraries while working on repl environments such as `npx hardhat console`. The plugin supports these environments via usage of [prompt-sync](https://www.npmjs.com/package/prompt-sync) which is a project that's not actively maintained (and it doesn't look as nice!). Please use with caution. @@ -42,9 +48,14 @@ Or, if you are using TypeScript, add this to your hardhat.config.ts: import "hardhat-secure-accounts"; ``` +## Configuration + + + + ## Usage -#### Adding an account +### Adding an account To add an account to your project, run the following command: @@ -54,7 +65,7 @@ npx hardhat accounts add You'll be prompted for an account name, mnemonic and password and the account will be stored under the `.keystore` folder (unless you specify a different path via plugin configuration). -#### Removing an account +### Removing an account To remove an account from your project, run the following command: @@ -62,9 +73,9 @@ To remove an account from your project, run the following command: npx hardhat accounts remove ``` -You'll be prompted for an account nameand the account will be deleted. +You'll be prompted for an account name and the account will be deleted. -#### Listing managed accounts +### Listing managed accounts You can list the accounts you have added to your project by running: @@ -72,66 +83,42 @@ You can list the accounts you have added to your project by running: npx hardhat accounts list ``` -#### Unlocking an account +### Using the accounts + +This plugin offers a few methods for using the accounts in a Hardhat project. Depending on your workflow you might want to choose one over the other. -This plugin offers two methods for unlocking accounts and several ways of using the unlocked account. Depending on your workflow you might want to choose one over the other. +**Hardhat provider extension (recommended)** -Accounts can be unlocked using: -- Hardhat tasks -- Hardhat environment extension +The plugin extends Hardhat's default provider (`hre.network.provider`), decorating it to be a `SecureAccountsProvider` which will know how to sign transactions using the accounts you have added to your project. -With the unlocked account you can: -- Get one or multiple wallet instances (`ethers' Wallet`) -- Get a provider instance (`hardhat's EthersProviderWrapper`) -- Get one or multiple signer instances (`hardhat's SignerWithAddress`) +Note that the provider is not extended by default. See [Configuration](#configuration) for instructions on how to enable it. Additionally, the provider will only be extended if there are accounts available in the project (which need to be created via the add command: `npx hardhat accounts add`). **Hardhat environment extension (recommended)** -The plugin extends hardhat's environment with several convenience methods to unlock accounts. You can use these methods to get a signer, wallet or provider instance to use with your scripts and tasks: +The plugin extends hardhat's environment with several convenience methods to unlock accounts. You can use these methods to get a signer or a provider instance to use with your scripts and tasks: ```typescript import hre from 'hardhat' const signer = await hre.accounts.getSigner() console.log(`Account ${signer.address} unlocked!`) -``` - -See [API reference](#api-reference) for a complete list of the available methods. - -**Hardhat tasks** -For a quick account unlock using the CLI: - -```bash -npx hardhat accounts unlock +await hre.accounts.provider.send('eth_sendTransaction', [{ from: signer.address, to: '0x1234', value: '0x5678' }]) ``` -This can be useful to validate an account password but not much else since the account only remains unlocked until the task ends its execution. If you want to use it in the context of a script/task you can run the task programmatically: - -```typescript -import hre from 'hre' -import { TASK_ACCOUNTS_UNLOCK_SIGNER } from 'hardhat-secure-accounts' +The complete interface for the runtime environment extension is as follows: -const signer = await hre.run(TASK_ACCOUNTS_UNLOCK_SIGNER) -console.log(`Account ${signer.address} unlocked!`) +```ts +interface SecureAccountsRuntimeEnvironment { + provider: HardhatEthersProvider + getSigner(name?: string, password?: string): Promise + getSigners(name?: string, password?: string): Promise +} ``` -See [API reference](#api-reference) for a complete list of the available tasks. - -## API reference - -| Task | CLI | Hardhat task | Hardhat environment extension | Description | -| --- | --- | --- | --- | --- | -| Unlock wallet | `npx hardhat accounts unlock:wallet` | `TASK_ACCOUNTS_UNLOCK_WALLET` | `await hre.accounts.getWallet()` | Returns the main wallet from the mnemonic derivation path. Return type: `Wallet` | -| Unlock wallets | `npx hardhat accounts unlock:wallets` | `TASK_ACCOUNTS_UNLOCK_WALLETS` | `await hre.accounts.getWallets()` | Returns multiple wallets (20) derived from the mnemonic. Return type: `Wallet[]` | -| Unlock signer | `npx hardhat accounts unlock` | `TASK_ACCOUNTS_UNLOCK_SIGNER` | `await hre.accounts.getSigner()` | Returns the main signer from the mnemonic derivation path. Return type: `SignerWithAddress` | -| Unlock signers | `npx hardhat accounts unlock:signers` | `TASK_ACCOUNTS_UNLOCK_SIGNERS` | `await hre.accounts.getSigners()` | Returns multiple signers (20) derived from the mnemonic. Return type: `SignerWithAddress[]` | -| Unlock provider | `npx hardhat accounts unlock:provider` | `TASK_ACCOUNTS_UNLOCK_PROVIDER` | `await hre.accounts.getProvider()` | Returns a provider with pre-configured local accounts based on the mnemonic. Return type: `EthersProviderWrapper` | - - -**Optional parameters** +Note that the provider at `hre.accounts.provider` is a `HardhatEthersProvider` created using the extended `SecureAccountsProvider` provider. -For convenience, all of the tasks and methods listed above have optional parameters that allow passing the `name` and `password` of the account to unlock. If any of the optional parameters are provided the plugin will not prompt the user for that input. This might be useful for scripting or testing purposes. +For convenience, `getSigner()` and `getSigners()` have optional parameters that allow passing the `name` and `password` of the account to unlock. If any of the optional parameters are provided the plugin will not prompt the user for that input. This might be useful for scripting or testing purposes. Example using the different API's: @@ -143,49 +130,68 @@ const signer = await hre.accounts.getSigner('goerli-deployer') console.log(`Account ${signer.address} unlocked!`) // This will not prompt the user for any input -const signer2 = await hre.run(TASK_ACCOUNTS_UNLOCK_SIGNER, { name: 'goerli-deployer', password: 'batman-with-cheese' }) +const signer2 = await hre.accounts.getSigner('goerli-deployer', 'batman-with-cheese' ) console.log(`Account ${signer2.address} unlocked!`) ``` -Or using the CLI: - -```bash -# This will prompt the user only for the account password -npx hardhat accounts unlock --name goerli-deployer -``` - ## Configuration -By default accounts are stored in the root of your hardhat project in a `.keystore` folder. You can change this by adding the following to your hardhat.config.js: +Plugin behavior can be modified via the Hardhat configuration file. The following options are available: -```js -require('hardhat-secure-accounts') +**Accounts directory** +By default accounts are stored in the root of your hardhat project in a `.keystore` folder. You can change this by adding the following to your Hardhat configuration file: -module.exports = { +```ts +const config: HardhatUserConfig = { solidity: '0.7.3', defaultNetwork: 'hardhat', paths: { - accounts: '.accounts', + secureAccounts: '.accounts', // This will store accounts in ./project-root/.accounts folder }, -}; + ... +} +export default config ``` -Or if you are using TypeScript, modify your `hardhat.config.ts`: +**Global settings** +The following optional global settings can be configured: ```ts -import { HardhatUserConfig } from 'hardhat/types' +const config: HardhatUserConfig = { + solidity: '0.7.3', + defaultNetwork: 'hardhat', + ... + secureAccounts: { + enabled: true, // Enable or disable the provider extension + defaultAccount: 'testnet-account-1', // Default account to use when unlocking accounts, setting it will skip the prompt for which account to unlock + defaultAccountPassword: 'secret' // Default password to use when unlocking accounts, setting it will skip the prompt for a password when unlocking -- not recommended! + }, + ... +} +export default config +``` -import 'hardhat-secure-accounts' +**Network settings** +Global settings can also be applied at the network level overriding the global settings. This is useful when you want to use different accounts for different networks: +```ts const config: HardhatUserConfig = { solidity: '0.7.3', defaultNetwork: 'hardhat', - paths: { - accounts: '.accounts', + ... + networks: { + hardhat: { + secureAccounts: { + enabled: false + } + } + ... }, ... + secureAccounts: { + enabled: true + } } - export default config ``` diff --git a/package.json b/package.json index c3a8c39..99ac8cc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardhat-secure-accounts", - "version": "1.0.1", + "version": "1.0.2", "description": "Account management plugin for Hardhat", "repository": "github:edgeandnode/hardhat-secure-accounts", "author": "Edge & Node", diff --git a/src/helpers/ask.ts b/src/helpers/ask.ts index 0b30f79..91f7b96 100644 --- a/src/helpers/ask.ts +++ b/src/helpers/ask.ts @@ -60,6 +60,10 @@ export async function getStringOrAsk( } async function askForAccount(accounts: SecureAccount[]): Promise { + if (accounts.length === 0) { + throw new SecureAccountsPluginError('No accounts found!') + } + const question = 'Choose an account to unlock' let answer: string = '' const options = accounts.map((a) => a.name) diff --git a/src/index.ts b/src/index.ts index 4a5c6a9..fe93c80 100644 --- a/src/index.ts +++ b/src/index.ts @@ -12,7 +12,7 @@ import type { HardhatConfig, HardhatUserConfig } from 'hardhat/types' import './type-extensions' import './tasks' -import { Wallet } from 'ethers' +import { getSecureAccounts } from './lib/account' extendConfig((config: HardhatConfig, userConfig: Readonly) => { const userPath = userConfig.paths?.secureAccounts @@ -54,18 +54,25 @@ extendEnvironment((hre) => { extendProvider(async (provider, config, network) => { if (config.networks[network].secureAccounts) { - const { SecureAccountsProvider } = require('./lib/provider') as { - SecureAccountsProvider: typeof SecureAccountsProviderT - } - const defaultAccount = config.networks[network].secureAccounts?.defaultAccount - const defaultAccountPassword = config.networks[network].secureAccounts?.defaultAccountPassword + const secureAccounts = getSecureAccounts(config.paths.secureAccounts) + + if (secureAccounts.length !== 0) { + logDebug('Creating SecureAccounts provider') + const { SecureAccountsProvider } = require('./lib/provider') as { + SecureAccountsProvider: typeof SecureAccountsProviderT + } + const defaultAccount = config.networks[network].secureAccounts?.defaultAccount + const defaultAccountPassword = config.networks[network].secureAccounts?.defaultAccountPassword - return await SecureAccountsProvider.create( - provider, - config.paths.secureAccounts, - defaultAccount, - defaultAccountPassword, - ) + return await SecureAccountsProvider.create( + provider, + config.paths.secureAccounts, + defaultAccount, + defaultAccountPassword, + ) + } else { + logDebug('No accounts found, using default provider') + } } return provider diff --git a/test/environment.test.ts b/test/environment.test.ts index 483e931..646dd23 100644 --- a/test/environment.test.ts +++ b/test/environment.test.ts @@ -86,3 +86,20 @@ describe('Extended environment usage > project using Secure Accounts', function } }) }) + +describe('Extended environment usage > project using Secure Accounts without accounts', function () { + useEnvironment('hardhat-project-no-accounts', 'hardhat') + + it('should manage its own accounts', async function () { + const accounts = (await this.hre.network.provider.request({ + method: 'eth_accounts', + })) as string[] + for (let i = 0; i < accounts.length; i++) { + expect(getAddress(accounts[i])).to.equal(HARDHAT_ADDRESSES[i]) + } + }) + + it('should throw error when getting signers', async function () { + await expect(this.hre.accounts.getSigners()).to.be.rejectedWith('No accounts found!') + }) +}) diff --git a/test/fixture-projects/hardhat-project-no-accounts/hardhat.config.ts b/test/fixture-projects/hardhat-project-no-accounts/hardhat.config.ts new file mode 100644 index 0000000..8851e37 --- /dev/null +++ b/test/fixture-projects/hardhat-project-no-accounts/hardhat.config.ts @@ -0,0 +1,25 @@ +import { HardhatUserConfig } from 'hardhat/types' + +import '../../../src/index' + +import { HARDHAT_MNEMONIC, TEST_NAME, TEST_PASSWORD } from '../../mnemonics' + +const config: HardhatUserConfig = { + solidity: '0.7.3', + defaultNetwork: 'hardhat', + paths: { + secureAccounts: '.accounts', + }, + networks: { + hardhat: { + secureAccounts: { + enabled: false, + }, + accounts: { + mnemonic: HARDHAT_MNEMONIC, + } + }, + }, +} + +export default config diff --git a/test/fixture-projects/hardhat-project/.accounts/test-account.json b/test/fixture-projects/hardhat-project/.accounts/test-account.json deleted file mode 100644 index de055e6..0000000 --- a/test/fixture-projects/hardhat-project/.accounts/test-account.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "address": "c108fda1b5b2903751594298769efd4904b146bd", - "id": "37ec99f7-8244-4982-b2d4-173c244784f3", - "version": 3, - "Crypto": { - "cipher": "aes-128-ctr", - "cipherparams": { "iv": "1eb9d55c0882a50e7988a09e674c2402" }, - "ciphertext": "822fd907f44e48d15d500433200ac244b70487813982936a88c0830fa9cd66b6", - "kdf": "scrypt", - "kdfparams": { - "salt": "f6d158afdf9a11d3353fbe736cbb769626c8428015603c6449ca1fa0b42e3c2e", - "n": 131072, - "dklen": 32, - "p": 1, - "r": 8 - }, - "mac": "1af4526f4e62b6722226ee1c3a18d7f5dfff0d5b7862ca123989e7a464153f28" - }, - "x-ethers": { - "client": "ethers.js", - "gethFilename": "UTC--2022-08-24T12-27-39.0Z--c108fda1b5b2903751594298769efd4904b146bd", - "mnemonicCounter": "3bd3b82c7148351fe0cdc005a631d445", - "mnemonicCiphertext": "f2bc1c5598c60fe265bf7908344fde6d", - "path": "m/44'/60'/0'/0/0", - "locale": "en", - "version": "0.1" - } -} From 73526a932aa4a935a014f13d6fcb36165436ecac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Thu, 3 Oct 2024 14:44:23 -0300 Subject: [PATCH 7/9] docs: udpated MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index c5c4a49..49da351 100644 --- a/README.md +++ b/README.md @@ -93,6 +93,21 @@ The plugin extends Hardhat's default provider (`hre.network.provider`), decorati Note that the provider is not extended by default. See [Configuration](#configuration) for instructions on how to enable it. Additionally, the provider will only be extended if there are accounts available in the project (which need to be created via the add command: `npx hardhat accounts add`). +Any accounts defined using Hardhat's `accounts` field in the configuration file will be ignored by the plugin: + +```ts +... + hardhat: { + secureAccounts: { + enabled: true, + }, + accounts: { + mnemonic: 'myth like bonus scare over problem client lizard pioneer submit female collect', // ignored + }, + }, +... +``` + **Hardhat environment extension (recommended)** The plugin extends hardhat's environment with several convenience methods to unlock accounts. You can use these methods to get a signer or a provider instance to use with your scripts and tasks: From 8340dc24990ea03ddb6d5d87fe3cc91ea87356aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Thu, 3 Oct 2024 15:51:50 -0300 Subject: [PATCH 8/9] fix: enable flags bug MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- src/index.ts | 2 +- test/fixture-projects/hardhat-project-config/hardhat.config.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/index.ts b/src/index.ts index fe93c80..1467403 100644 --- a/src/index.ts +++ b/src/index.ts @@ -53,7 +53,7 @@ extendEnvironment((hre) => { }) extendProvider(async (provider, config, network) => { - if (config.networks[network].secureAccounts) { + if (config.networks[network].secureAccounts?.enabled || config.secureAccounts?.enabled) { const secureAccounts = getSecureAccounts(config.paths.secureAccounts) if (secureAccounts.length !== 0) { diff --git a/test/fixture-projects/hardhat-project-config/hardhat.config.ts b/test/fixture-projects/hardhat-project-config/hardhat.config.ts index 5910cbc..1f8a12d 100644 --- a/test/fixture-projects/hardhat-project-config/hardhat.config.ts +++ b/test/fixture-projects/hardhat-project-config/hardhat.config.ts @@ -13,7 +13,7 @@ const config: HardhatUserConfig = { networks: { hardhat: { secureAccounts: { - enabled: false, + enabled: true, defaultAccount: TEST_NAME, defaultAccountPassword: TEST_PASSWORD }, From fdca769b94d5da43cf9f7191e04dc381eaffcf20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Migone?= Date: Thu, 3 Oct 2024 15:52:22 -0300 Subject: [PATCH 9/9] chore: bump package json MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Tomás Migone --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 99ac8cc..fb89af9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "hardhat-secure-accounts", - "version": "1.0.2", + "version": "1.0.3", "description": "Account management plugin for Hardhat", "repository": "github:edgeandnode/hardhat-secure-accounts", "author": "Edge & Node",