From 77647f80e97efb67d422233c70f10792d4f7307f Mon Sep 17 00:00:00 2001 From: Eduardo Marchena Date: Wed, 20 Dec 2023 13:16:59 -0500 Subject: [PATCH 1/2] migrate ethers v6 --- .DS_Store | Bin 0 -> 6148 bytes .env | 3 + .prettierrc | 5 - .prettierrc.json | 8 + .vscode/launch.json | 20 + README.md | 7 + .../src.ts/_admin/create-release.d.ts | 2 + .../src.ts/_admin/create-release.d.ts.map | 1 + .../ethers.js/src.ts/_admin/create-release.js | 51 + .../src.ts/_admin/create-release.js.map | 1 + .../src.ts/_admin/generate-diffs.d.ts | 2 + .../src.ts/_admin/generate-diffs.d.ts.map | 1 + .../ethers.js/src.ts/_admin/generate-diffs.js | 41 + .../src.ts/_admin/generate-diffs.js.map | 1 + .../ethers.js/src.ts/_admin/test-browser.d.ts | 32 + .../src.ts/_admin/test-browser.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/test-browser.js | 365 + .../src.ts/_admin/test-browser.js.map | 1 + .../src.ts/_admin/update-changelog.d.ts | 2 + .../src.ts/_admin/update-changelog.d.ts.map | 1 + .../src.ts/_admin/update-changelog.js | 178 + .../src.ts/_admin/update-changelog.js.map | 1 + .../src.ts/_admin/update-version.d.ts | 2 + .../src.ts/_admin/update-version.d.ts.map | 1 + .../ethers.js/src.ts/_admin/update-version.js | 118 + .../src.ts/_admin/update-version.js.map | 1 + .../src.ts/_admin/utils/changelog.d.ts | 7 + .../src.ts/_admin/utils/changelog.d.ts.map | 1 + .../src.ts/_admin/utils/changelog.js | 30 + .../src.ts/_admin/utils/changelog.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/date.d.ts | 2 + .../src.ts/_admin/utils/date.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/date.js | 34 + .../ethers.js/src.ts/_admin/utils/date.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/fs.d.ts | 2 + .../ethers.js/src.ts/_admin/utils/fs.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/fs.js | 15 + dist/ethers.js/src.ts/_admin/utils/fs.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/git.d.ts | 15 + .../src.ts/_admin/utils/git.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/git.js | 124 + dist/ethers.js/src.ts/_admin/utils/git.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/json.d.ts | 4 + .../src.ts/_admin/utils/json.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/json.js | 40 + .../ethers.js/src.ts/_admin/utils/json.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/npm.d.ts | 8 + .../src.ts/_admin/utils/npm.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/npm.js | 124 + dist/ethers.js/src.ts/_admin/utils/npm.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/path.d.ts | 3 + .../src.ts/_admin/utils/path.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/path.js | 15 + .../ethers.js/src.ts/_admin/utils/path.js.map | 1 + dist/ethers.js/src.ts/_admin/utils/run.d.ts | 15 + .../src.ts/_admin/utils/run.d.ts.map | 1 + dist/ethers.js/src.ts/_admin/utils/run.js | 72 + dist/ethers.js/src.ts/_admin/utils/run.js.map | 1 + .../src.ts/_tests/blockchain-data.d.ts | 85 + .../src.ts/_tests/blockchain-data.d.ts.map | 1 + .../src.ts/_tests/blockchain-data.js | 245 + .../src.ts/_tests/blockchain-data.js.map | 1 + .../src.ts/_tests/create-provider.d.ts | 8 + .../src.ts/_tests/create-provider.d.ts.map | 1 + .../src.ts/_tests/create-provider.js | 151 + .../src.ts/_tests/create-provider.js.map | 1 + dist/ethers.js/src.ts/_tests/index.d.ts | 21 + dist/ethers.js/src.ts/_tests/index.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/index.js | 31 + dist/ethers.js/src.ts/_tests/index.js.map | 1 + dist/ethers.js/src.ts/_tests/test-abi.d.ts | 2 + .../ethers.js/src.ts/_tests/test-abi.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-abi.js | 286 + dist/ethers.js/src.ts/_tests/test-abi.js.map | 1 + .../ethers.js/src.ts/_tests/test-address.d.ts | 2 + .../src.ts/_tests/test-address.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-address.js | 115 + .../src.ts/_tests/test-address.js.map | 1 + .../src.ts/_tests/test-contract-integ.d.ts | 2 + .../_tests/test-contract-integ.d.ts.map | 1 + .../src.ts/_tests/test-contract-integ.js | 93 + .../src.ts/_tests/test-contract-integ.js.map | 1 + .../src.ts/_tests/test-contract.d.ts | 2 + .../src.ts/_tests/test-contract.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-contract.js | 386 ++ .../src.ts/_tests/test-contract.js.map | 1 + .../src.ts/_tests/test-crypto-algoswap.d.ts | 2 + .../_tests/test-crypto-algoswap.d.ts.map | 1 + .../src.ts/_tests/test-crypto-algoswap.js | 112 + .../src.ts/_tests/test-crypto-algoswap.js.map | 1 + dist/ethers.js/src.ts/_tests/test-crypto.d.ts | 2 + .../src.ts/_tests/test-crypto.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-crypto.js | 493 ++ .../src.ts/_tests/test-crypto.js.map | 1 + .../src.ts/_tests/test-hash-typeddata.d.ts | 2 + .../_tests/test-hash-typeddata.d.ts.map | 1 + .../src.ts/_tests/test-hash-typeddata.js | 21 + .../src.ts/_tests/test-hash-typeddata.js.map | 1 + dist/ethers.js/src.ts/_tests/test-hash.d.ts | 2 + .../src.ts/_tests/test-hash.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-hash.js | 182 + dist/ethers.js/src.ts/_tests/test-hash.js.map | 1 + .../src.ts/_tests/test-providers-avatar.d.ts | 2 + .../_tests/test-providers-avatar.d.ts.map | 1 + .../src.ts/_tests/test-providers-avatar.js | 48 + .../_tests/test-providers-avatar.js.map | 1 + .../src.ts/_tests/test-providers-ccip.d.ts | 2 + .../_tests/test-providers-ccip.d.ts.map | 1 + .../src.ts/_tests/test-providers-ccip.js | 178 + .../src.ts/_tests/test-providers-ccip.js.map | 1 + .../src.ts/_tests/test-providers-data.d.ts | 2 + .../_tests/test-providers-data.d.ts.map | 1 + .../src.ts/_tests/test-providers-data.js | 218 + .../src.ts/_tests/test-providers-data.js.map | 1 + .../src.ts/_tests/test-providers-errors.d.ts | 2 + .../_tests/test-providers-errors.d.ts.map | 1 + .../src.ts/_tests/test-providers-errors.js | 257 + .../_tests/test-providers-errors.js.map | 1 + .../src.ts/_tests/test-providers-extra.d.ts | 2 + .../_tests/test-providers-extra.d.ts.map | 1 + .../src.ts/_tests/test-providers-extra.js | 28 + .../src.ts/_tests/test-providers-extra.js.map | 1 + .../_tests/test-providers-fallback.d.ts | 10 + .../_tests/test-providers-fallback.d.ts.map | 1 + .../src.ts/_tests/test-providers-fallback.js | 166 + .../_tests/test-providers-fallback.js.map | 1 + .../src.ts/_tests/test-providers-send.d.ts | 2 + .../_tests/test-providers-send.d.ts.map | 1 + .../src.ts/_tests/test-providers-send.js | 65 + .../src.ts/_tests/test-providers-send.js.map | 1 + .../_tests/test-providers-wildcard.d.ts | 2 + .../_tests/test-providers-wildcard.d.ts.map | 1 + .../src.ts/_tests/test-providers-wildcard.js | 32 + .../_tests/test-providers-wildcard.js.map | 1 + dist/ethers.js/src.ts/_tests/test-rlp.d.ts | 2 + .../ethers.js/src.ts/_tests/test-rlp.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-rlp.js | 93 + dist/ethers.js/src.ts/_tests/test-rlp.js.map | 1 + .../src.ts/_tests/test-transaction.d.ts | 2 + .../src.ts/_tests/test-transaction.d.ts.map | 1 + .../src.ts/_tests/test-transaction.js | 340 + .../src.ts/_tests/test-transaction.js.map | 1 + .../src.ts/_tests/test-utils-maths.d.ts | 2 + .../src.ts/_tests/test-utils-maths.d.ts.map | 1 + .../src.ts/_tests/test-utils-maths.js | 194 + .../src.ts/_tests/test-utils-maths.js.map | 1 + .../src.ts/_tests/test-utils-misc.d.ts | 2 + .../src.ts/_tests/test-utils-misc.d.ts.map | 1 + .../src.ts/_tests/test-utils-misc.js | 67 + .../src.ts/_tests/test-utils-misc.js.map | 1 + .../src.ts/_tests/test-utils-units.d.ts | 2 + .../src.ts/_tests/test-utils-units.d.ts.map | 1 + .../src.ts/_tests/test-utils-units.js | 68 + .../src.ts/_tests/test-utils-units.js.map | 1 + .../src.ts/_tests/test-utils-utf8.d.ts | 13 + .../src.ts/_tests/test-utils-utf8.d.ts.map | 1 + .../src.ts/_tests/test-utils-utf8.js | 131 + .../src.ts/_tests/test-utils-utf8.js.map | 1 + .../src.ts/_tests/test-wallet-hd.d.ts | 2 + .../src.ts/_tests/test-wallet-hd.d.ts.map | 1 + .../ethers.js/src.ts/_tests/test-wallet-hd.js | 124 + .../src.ts/_tests/test-wallet-hd.js.map | 1 + .../src.ts/_tests/test-wallet-json.d.ts | 2 + .../src.ts/_tests/test-wallet-json.d.ts.map | 1 + .../src.ts/_tests/test-wallet-json.js | 186 + .../src.ts/_tests/test-wallet-json.js.map | 1 + .../src.ts/_tests/test-wallet-mnemonic.d.ts | 2 + .../_tests/test-wallet-mnemonic.d.ts.map | 1 + .../src.ts/_tests/test-wallet-mnemonic.js | 123 + .../src.ts/_tests/test-wallet-mnemonic.js.map | 1 + dist/ethers.js/src.ts/_tests/test-wallet.d.ts | 2 + .../src.ts/_tests/test-wallet.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/test-wallet.js | 120 + .../src.ts/_tests/test-wallet.js.map | 1 + .../src.ts/_tests/test-wordlists.d.ts | 2 + .../src.ts/_tests/test-wordlists.d.ts.map | 1 + .../ethers.js/src.ts/_tests/test-wordlists.js | 71 + .../src.ts/_tests/test-wordlists.js.map | 1 + dist/ethers.js/src.ts/_tests/types.d.ts | 217 + dist/ethers.js/src.ts/_tests/types.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/types.js | 4 + dist/ethers.js/src.ts/_tests/types.js.map | 1 + dist/ethers.js/src.ts/_tests/utils.d.ts | 9 + dist/ethers.js/src.ts/_tests/utils.d.ts.map | 1 + dist/ethers.js/src.ts/_tests/utils.js | 150 + dist/ethers.js/src.ts/_tests/utils.js.map | 1 + dist/ethers.js/src.ts/_version.d.ts | 5 + dist/ethers.js/src.ts/_version.d.ts.map | 1 + dist/ethers.js/src.ts/_version.js | 9 + dist/ethers.js/src.ts/_version.js.map | 1 + dist/ethers.js/src.ts/abi/abi-coder.d.ts | 60 + dist/ethers.js/src.ts/abi/abi-coder.d.ts.map | 1 + dist/ethers.js/src.ts/abi/abi-coder.js | 214 + dist/ethers.js/src.ts/abi/abi-coder.js.map | 1 + dist/ethers.js/src.ts/abi/bytes32.d.ts | 15 + dist/ethers.js/src.ts/abi/bytes32.d.ts.map | 1 + dist/ethers.js/src.ts/abi/bytes32.js | 45 + dist/ethers.js/src.ts/abi/bytes32.js.map | 1 + .../src.ts/abi/coders/abstract-coder.d.ts | 121 + .../src.ts/abi/coders/abstract-coder.d.ts.map | 1 + .../src.ts/abi/coders/abstract-coder.js | 404 ++ .../src.ts/abi/coders/abstract-coder.js.map | 1 + dist/ethers.js/src.ts/abi/coders/address.d.ts | 13 + .../src.ts/abi/coders/address.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/address.js | 33 + .../src.ts/abi/coders/address.js.map | 1 + .../src.ts/abi/coders/anonymous.d.ts | 15 + .../src.ts/abi/coders/anonymous.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/anonymous.js | 26 + .../src.ts/abi/coders/anonymous.js.map | 1 + dist/ethers.js/src.ts/abi/coders/array.d.ts | 25 + .../src.ts/abi/coders/array.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/array.js | 163 + dist/ethers.js/src.ts/abi/coders/array.js.map | 1 + dist/ethers.js/src.ts/abi/coders/boolean.d.ts | 13 + .../src.ts/abi/coders/boolean.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/boolean.js | 25 + .../src.ts/abi/coders/boolean.js.map | 1 + dist/ethers.js/src.ts/abi/coders/bytes.d.ts | 19 + .../src.ts/abi/coders/bytes.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/bytes.js | 39 + dist/ethers.js/src.ts/abi/coders/bytes.js.map | 1 + .../src.ts/abi/coders/fixed-bytes.d.ts | 15 + .../src.ts/abi/coders/fixed-bytes.d.ts.map | 1 + .../src.ts/abi/coders/fixed-bytes.js | 31 + .../src.ts/abi/coders/fixed-bytes.js.map | 1 + dist/ethers.js/src.ts/abi/coders/null.d.ts | 12 + .../ethers.js/src.ts/abi/coders/null.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/null.js | 28 + dist/ethers.js/src.ts/abi/coders/null.js.map | 1 + dist/ethers.js/src.ts/abi/coders/number.d.ts | 16 + .../src.ts/abi/coders/number.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/number.js | 47 + .../ethers.js/src.ts/abi/coders/number.js.map | 1 + dist/ethers.js/src.ts/abi/coders/string.d.ts | 13 + .../src.ts/abi/coders/string.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/string.js | 25 + .../ethers.js/src.ts/abi/coders/string.js.map | 1 + dist/ethers.js/src.ts/abi/coders/tuple.d.ts | 16 + .../src.ts/abi/coders/tuple.d.ts.map | 1 + dist/ethers.js/src.ts/abi/coders/tuple.js | 66 + dist/ethers.js/src.ts/abi/coders/tuple.js.map | 1 + dist/ethers.js/src.ts/abi/fragments.d.ts | 466 ++ dist/ethers.js/src.ts/abi/fragments.d.ts.map | 1 + dist/ethers.js/src.ts/abi/fragments.js | 1273 ++++ dist/ethers.js/src.ts/abi/fragments.js.map | 1 + dist/ethers.js/src.ts/abi/index.d.ts | 18 + dist/ethers.js/src.ts/abi/index.d.ts.map | 1 + dist/ethers.js/src.ts/abi/index.js | 40 + dist/ethers.js/src.ts/abi/index.js.map | 1 + dist/ethers.js/src.ts/abi/interface.d.ts | 382 ++ dist/ethers.js/src.ts/abi/interface.d.ts.map | 1 + dist/ethers.js/src.ts/abi/interface.js | 1028 +++ dist/ethers.js/src.ts/abi/interface.js.map | 1 + dist/ethers.js/src.ts/abi/typed.d.ts | 570 ++ dist/ethers.js/src.ts/abi/typed.d.ts.map | 1 + dist/ethers.js/src.ts/abi/typed.js | 607 ++ dist/ethers.js/src.ts/abi/typed.js.map | 1 + dist/ethers.js/src.ts/address/address.d.ts | 56 + .../ethers.js/src.ts/address/address.d.ts.map | 1 + dist/ethers.js/src.ts/address/address.js | 161 + dist/ethers.js/src.ts/address/address.js.map | 1 + dist/ethers.js/src.ts/address/checks.d.ts | 81 + dist/ethers.js/src.ts/address/checks.d.ts.map | 1 + dist/ethers.js/src.ts/address/checks.js | 131 + dist/ethers.js/src.ts/address/checks.js.map | 1 + .../src.ts/address/contract-address.d.ts | 48 + .../src.ts/address/contract-address.d.ts.map | 1 + .../src.ts/address/contract-address.js | 74 + .../src.ts/address/contract-address.js.map | 1 + dist/ethers.js/src.ts/address/index.d.ts | 49 + dist/ethers.js/src.ts/address/index.d.ts.map | 1 + dist/ethers.js/src.ts/address/index.js | 29 + dist/ethers.js/src.ts/address/index.js.map | 1 + .../ethers.js/src.ts/constants/addresses.d.ts | 7 + .../src.ts/constants/addresses.d.ts.map | 1 + dist/ethers.js/src.ts/constants/addresses.js | 10 + .../src.ts/constants/addresses.js.map | 1 + dist/ethers.js/src.ts/constants/hashes.d.ts | 7 + .../src.ts/constants/hashes.d.ts.map | 1 + dist/ethers.js/src.ts/constants/hashes.js | 10 + dist/ethers.js/src.ts/constants/hashes.js.map | 1 + dist/ethers.js/src.ts/constants/index.d.ts | 10 + .../ethers.js/src.ts/constants/index.d.ts.map | 1 + dist/ethers.js/src.ts/constants/index.js | 22 + dist/ethers.js/src.ts/constants/index.js.map | 1 + dist/ethers.js/src.ts/constants/numbers.d.ts | 31 + .../src.ts/constants/numbers.d.ts.map | 1 + dist/ethers.js/src.ts/constants/numbers.js | 34 + .../ethers.js/src.ts/constants/numbers.js.map | 1 + dist/ethers.js/src.ts/constants/strings.d.ts | 13 + .../src.ts/constants/strings.d.ts.map | 1 + dist/ethers.js/src.ts/constants/strings.js | 17 + .../ethers.js/src.ts/constants/strings.js.map | 1 + dist/ethers.js/src.ts/contract/contract.d.ts | 168 + .../src.ts/contract/contract.d.ts.map | 1 + dist/ethers.js/src.ts/contract/contract.js | 1011 +++ .../ethers.js/src.ts/contract/contract.js.map | 1 + dist/ethers.js/src.ts/contract/factory.d.ts | 62 + .../src.ts/contract/factory.d.ts.map | 1 + dist/ethers.js/src.ts/contract/factory.js | 117 + dist/ethers.js/src.ts/contract/factory.js.map | 1 + dist/ethers.js/src.ts/contract/index.d.ts | 13 + dist/ethers.js/src.ts/contract/index.d.ts.map | 1 + dist/ethers.js/src.ts/contract/index.js | 24 + dist/ethers.js/src.ts/contract/index.js.map | 1 + dist/ethers.js/src.ts/contract/types.d.ts | 193 + dist/ethers.js/src.ts/contract/types.d.ts.map | 1 + dist/ethers.js/src.ts/contract/types.js | 6 + dist/ethers.js/src.ts/contract/types.js.map | 1 + dist/ethers.js/src.ts/contract/wrappers.d.ts | 143 + .../src.ts/contract/wrappers.d.ts.map | 1 + dist/ethers.js/src.ts/contract/wrappers.js | 200 + .../ethers.js/src.ts/contract/wrappers.js.map | 1 + .../src.ts/crypto/crypto-browser.d.ts | 15 + .../src.ts/crypto/crypto-browser.d.ts.map | 1 + .../ethers.js/src.ts/crypto/crypto-browser.js | 55 + .../src.ts/crypto/crypto-browser.js.map | 1 + dist/ethers.js/src.ts/crypto/crypto.d.ts | 2 + dist/ethers.js/src.ts/crypto/crypto.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/crypto.js | 9 + dist/ethers.js/src.ts/crypto/crypto.js.map | 1 + dist/ethers.js/src.ts/crypto/hmac.d.ts | 25 + dist/ethers.js/src.ts/crypto/hmac.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/hmac.js | 51 + dist/ethers.js/src.ts/crypto/hmac.js.map | 1 + dist/ethers.js/src.ts/crypto/index.d.ts | 25 + dist/ethers.js/src.ts/crypto/index.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/index.js | 49 + dist/ethers.js/src.ts/crypto/index.js.map | 1 + dist/ethers.js/src.ts/crypto/keccak.d.ts | 35 + dist/ethers.js/src.ts/crypto/keccak.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/keccak.js | 52 + dist/ethers.js/src.ts/crypto/keccak.js.map | 1 + dist/ethers.js/src.ts/crypto/pbkdf2.d.ts | 35 + dist/ethers.js/src.ts/crypto/pbkdf2.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/pbkdf2.js | 53 + dist/ethers.js/src.ts/crypto/pbkdf2.js.map | 1 + dist/ethers.js/src.ts/crypto/random.d.ts | 14 + dist/ethers.js/src.ts/crypto/random.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/random.js | 38 + dist/ethers.js/src.ts/crypto/random.js.map | 1 + dist/ethers.js/src.ts/crypto/ripemd160.d.ts | 25 + .../src.ts/crypto/ripemd160.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/ripemd160.js | 42 + dist/ethers.js/src.ts/crypto/ripemd160.js.map | 1 + dist/ethers.js/src.ts/crypto/scrypt.d.ts | 82 + dist/ethers.js/src.ts/crypto/scrypt.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/scrypt.js | 117 + dist/ethers.js/src.ts/crypto/scrypt.js.map | 1 + dist/ethers.js/src.ts/crypto/sha2.d.ts | 47 + dist/ethers.js/src.ts/crypto/sha2.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/sha2.js | 76 + dist/ethers.js/src.ts/crypto/sha2.js.map | 1 + dist/ethers.js/src.ts/crypto/signature.d.ts | 158 + .../src.ts/crypto/signature.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/signature.js | 317 + dist/ethers.js/src.ts/crypto/signature.js.map | 1 + dist/ethers.js/src.ts/crypto/signing-key.d.ts | 122 + .../src.ts/crypto/signing-key.d.ts.map | 1 + dist/ethers.js/src.ts/crypto/signing-key.js | 183 + .../src.ts/crypto/signing-key.js.map | 1 + dist/ethers.js/src.ts/ethers.d.ts | 22 + dist/ethers.js/src.ts/ethers.d.ts.map | 1 + dist/ethers.js/src.ts/ethers.js | 209 + dist/ethers.js/src.ts/ethers.js.map | 1 + dist/ethers.js/src.ts/hash/id.d.ts | 13 + dist/ethers.js/src.ts/hash/id.d.ts.map | 1 + dist/ethers.js/src.ts/hash/id.js | 21 + dist/ethers.js/src.ts/hash/id.js.map | 1 + dist/ethers.js/src.ts/hash/index.d.ts | 13 + dist/ethers.js/src.ts/hash/index.d.ts.map | 1 + dist/ethers.js/src.ts/hash/index.js | 27 + dist/ethers.js/src.ts/hash/index.js.map | 1 + dist/ethers.js/src.ts/hash/message.d.ts | 36 + dist/ethers.js/src.ts/hash/message.d.ts.map | 1 + dist/ethers.js/src.ts/hash/message.js | 56 + dist/ethers.js/src.ts/hash/message.js.map | 1 + dist/ethers.js/src.ts/hash/namehash.d.ts | 20 + dist/ethers.js/src.ts/hash/namehash.d.ts.map | 1 + dist/ethers.js/src.ts/hash/namehash.js | 92 + dist/ethers.js/src.ts/hash/namehash.js.map | 1 + dist/ethers.js/src.ts/hash/solidity.d.ts | 31 + dist/ethers.js/src.ts/hash/solidity.d.ts.map | 1 + dist/ethers.js/src.ts/hash/solidity.js | 109 + dist/ethers.js/src.ts/hash/solidity.js.map | 1 + dist/ethers.js/src.ts/hash/typed-data.d.ts | 150 + .../ethers.js/src.ts/hash/typed-data.d.ts.map | 1 + dist/ethers.js/src.ts/hash/typed-data.js | 508 ++ dist/ethers.js/src.ts/hash/typed-data.js.map | 1 + dist/ethers.js/src.ts/index.d.ts | 11 + dist/ethers.js/src.ts/index.d.ts.map | 1 + dist/ethers.js/src.ts/index.js | 40 + dist/ethers.js/src.ts/index.js.map | 1 + .../src.ts/providers/abstract-provider.d.ts | 451 ++ .../providers/abstract-provider.d.ts.map | 1 + .../src.ts/providers/abstract-provider.js | 1492 +++++ .../src.ts/providers/abstract-provider.js.map | 1 + .../src.ts/providers/abstract-signer.d.ts | 67 + .../src.ts/providers/abstract-signer.d.ts.map | 1 + .../src.ts/providers/abstract-signer.js | 260 + .../src.ts/providers/abstract-signer.js.map | 1 + .../ethers.js/src.ts/providers/community.d.ts | 29 + .../src.ts/providers/community.d.ts.map | 1 + dist/ethers.js/src.ts/providers/community.js | 40 + .../src.ts/providers/community.js.map | 1 + .../ethers.js/src.ts/providers/contracts.d.ts | 36 + .../src.ts/providers/contracts.d.ts.map | 1 + dist/ethers.js/src.ts/providers/contracts.js | 3 + .../src.ts/providers/contracts.js.map | 1 + .../src.ts/providers/default-provider.d.ts | 48 + .../providers/default-provider.d.ts.map | 1 + .../src.ts/providers/default-provider.js | 181 + .../src.ts/providers/default-provider.js.map | 1 + .../src.ts/providers/ens-resolver.d.ts | 147 + .../src.ts/providers/ens-resolver.d.ts.map | 1 + .../src.ts/providers/ens-resolver.js | 531 ++ .../src.ts/providers/ens-resolver.js.map | 1 + dist/ethers.js/src.ts/providers/format.d.ts | 15 + .../src.ts/providers/format.d.ts.map | 1 + dist/ethers.js/src.ts/providers/format.js | 273 + dist/ethers.js/src.ts/providers/format.js.map | 1 + .../src.ts/providers/formatting.d.ts | 268 + .../src.ts/providers/formatting.d.ts.map | 1 + dist/ethers.js/src.ts/providers/formatting.js | 10 + .../src.ts/providers/formatting.js.map | 1 + dist/ethers.js/src.ts/providers/index.d.ts | 47 + .../ethers.js/src.ts/providers/index.d.ts.map | 1 + dist/ethers.js/src.ts/providers/index.js | 80 + dist/ethers.js/src.ts/providers/index.js.map | 1 + dist/ethers.js/src.ts/providers/network.d.ts | 99 + .../src.ts/providers/network.d.ts.map | 1 + dist/ethers.js/src.ts/providers/network.js | 384 ++ .../ethers.js/src.ts/providers/network.js.map | 1 + .../src.ts/providers/pagination.d.ts | 6 + .../src.ts/providers/pagination.d.ts.map | 1 + dist/ethers.js/src.ts/providers/pagination.js | 3 + .../src.ts/providers/pagination.js.map | 1 + .../src.ts/providers/plugin-fallback.d.ts | 13 + .../src.ts/providers/plugin-fallback.d.ts.map | 1 + .../src.ts/providers/plugin-fallback.js | 31 + .../src.ts/providers/plugin-fallback.js.map | 1 + .../src.ts/providers/plugins-network.d.ts | 170 + .../src.ts/providers/plugins-network.d.ts.map | 1 + .../src.ts/providers/plugins-network.js | 195 + .../src.ts/providers/plugins-network.js.map | 1 + .../src.ts/providers/provider-alchemy.d.ts | 31 + .../providers/provider-alchemy.d.ts.map | 1 + .../src.ts/providers/provider-alchemy.js | 137 + .../src.ts/providers/provider-alchemy.js.map | 1 + .../src.ts/providers/provider-ankr.d.ts | 51 + .../src.ts/providers/provider-ankr.d.ts.map | 1 + .../src.ts/providers/provider-ankr.js | 112 + .../src.ts/providers/provider-ankr.js.map | 1 + .../src.ts/providers/provider-browser.d.ts | 56 + .../providers/provider-browser.d.ts.map | 1 + .../src.ts/providers/provider-browser.js | 138 + .../src.ts/providers/provider-browser.js.map | 1 + .../src.ts/providers/provider-cloudflare.d.ts | 14 + .../providers/provider-cloudflare.d.ts.map | 1 + .../src.ts/providers/provider-cloudflare.js | 26 + .../providers/provider-cloudflare.js.map | 1 + .../src.ts/providers/provider-etherscan.d.ts | 141 + .../providers/provider-etherscan.d.ts.map | 1 + .../src.ts/providers/provider-etherscan.js | 590 ++ .../providers/provider-etherscan.js.map | 1 + .../src.ts/providers/provider-fallback.d.ts | 115 + .../providers/provider-fallback.d.ts.map | 1 + .../src.ts/providers/provider-fallback.js | 634 ++ .../src.ts/providers/provider-fallback.js.map | 1 + .../src.ts/providers/provider-infura.d.ts | 90 + .../src.ts/providers/provider-infura.d.ts.map | 1 + .../src.ts/providers/provider-infura.js | 163 + .../src.ts/providers/provider-infura.js.map | 1 + .../providers/provider-ipcsocket-browser.d.ts | 3 + .../provider-ipcsocket-browser.d.ts.map | 1 + .../providers/provider-ipcsocket-browser.js | 6 + .../provider-ipcsocket-browser.js.map | 1 + .../src.ts/providers/provider-ipcsocket.d.ts | 21 + .../providers/provider-ipcsocket.d.ts.map | 1 + .../src.ts/providers/provider-ipcsocket.js | 93 + .../providers/provider-ipcsocket.js.map | 1 + .../src.ts/providers/provider-jsonrpc.d.ts | 350 + .../providers/provider-jsonrpc.d.ts.map | 1 + .../src.ts/providers/provider-jsonrpc.js | 973 +++ .../src.ts/providers/provider-jsonrpc.js.map | 1 + .../src.ts/providers/provider-pocket.d.ts | 54 + .../src.ts/providers/provider-pocket.d.ts.map | 1 + .../src.ts/providers/provider-pocket.js | 109 + .../src.ts/providers/provider-pocket.js.map | 1 + .../src.ts/providers/provider-quicknode.d.ts | 50 + .../providers/provider-quicknode.d.ts.map | 1 + .../src.ts/providers/provider-quicknode.js | 114 + .../providers/provider-quicknode.js.map | 1 + .../src.ts/providers/provider-socket.d.ts | 113 + .../src.ts/providers/provider-socket.d.ts.map | 1 + .../src.ts/providers/provider-socket.js | 344 + .../src.ts/providers/provider-socket.js.map | 1 + .../src.ts/providers/provider-websocket.d.ts | 37 + .../providers/provider-websocket.d.ts.map | 1 + .../src.ts/providers/provider-websocket.js | 109 + .../providers/provider-websocket.js.map | 1 + dist/ethers.js/src.ts/providers/provider.d.ts | 1135 ++++ .../src.ts/providers/provider.d.ts.map | 1 + dist/ethers.js/src.ts/providers/provider.js | 934 +++ .../src.ts/providers/provider.js.map | 1 + .../src.ts/providers/signer-noncemanager.d.ts | 38 + .../providers/signer-noncemanager.d.ts.map | 1 + .../src.ts/providers/signer-noncemanager.js | 106 + .../providers/signer-noncemanager.js.map | 1 + dist/ethers.js/src.ts/providers/signer.d.ts | 118 + .../src.ts/providers/signer.d.ts.map | 1 + dist/ethers.js/src.ts/providers/signer.js | 3 + dist/ethers.js/src.ts/providers/signer.js.map | 1 + .../providers/subscriber-connection.d.ts | 25 + .../providers/subscriber-connection.d.ts.map | 1 + .../src.ts/providers/subscriber-connection.js | 69 + .../providers/subscriber-connection.js.map | 1 + .../src.ts/providers/subscriber-filterid.d.ts | 64 + .../providers/subscriber-filterid.d.ts.map | 1 + .../src.ts/providers/subscriber-filterid.js | 209 + .../providers/subscriber-filterid.js.map | 1 + .../src.ts/providers/subscriber-polling.d.ts | 100 + .../providers/subscriber-polling.d.ts.map | 1 + .../src.ts/providers/subscriber-polling.js | 342 + .../providers/subscriber-polling.js.map | 1 + .../src.ts/providers/ws-browser.d.ts | 3 + .../src.ts/providers/ws-browser.d.ts.map | 1 + dist/ethers.js/src.ts/providers/ws-browser.js | 19 + .../src.ts/providers/ws-browser.js.map | 1 + dist/ethers.js/src.ts/providers/ws.d.ts | 2 + dist/ethers.js/src.ts/providers/ws.d.ts.map | 1 + dist/ethers.js/src.ts/providers/ws.js | 6 + dist/ethers.js/src.ts/providers/ws.js.map | 1 + .../src.ts/transaction/accesslist.d.ts | 6 + .../src.ts/transaction/accesslist.d.ts.map | 1 + .../src.ts/transaction/accesslist.js | 41 + .../src.ts/transaction/accesslist.js.map | 1 + .../ethers.js/src.ts/transaction/address.d.ts | 15 + .../src.ts/transaction/address.d.ts.map | 1 + dist/ethers.js/src.ts/transaction/address.js | 30 + .../src.ts/transaction/address.js.map | 1 + dist/ethers.js/src.ts/transaction/index.d.ts | 25 + .../src.ts/transaction/index.d.ts.map | 1 + dist/ethers.js/src.ts/transaction/index.js | 17 + .../ethers.js/src.ts/transaction/index.js.map | 1 + .../src.ts/transaction/transaction.d.ts | 269 + .../src.ts/transaction/transaction.d.ts.map | 1 + .../src.ts/transaction/transaction.js | 721 ++ .../src.ts/transaction/transaction.js.map | 1 + dist/ethers.js/src.ts/utils/base58.d.ts | 23 + dist/ethers.js/src.ts/utils/base58.d.ts.map | 1 + dist/ethers.js/src.ts/utils/base58.js | 60 + dist/ethers.js/src.ts/utils/base58.js.map | 1 + .../src.ts/utils/base64-browser.d.ts | 4 + .../src.ts/utils/base64-browser.d.ts.map | 1 + dist/ethers.js/src.ts/utils/base64-browser.js | 24 + .../src.ts/utils/base64-browser.js.map | 1 + dist/ethers.js/src.ts/utils/base64.d.ts | 40 + dist/ethers.js/src.ts/utils/base64.d.ts.map | 1 + dist/ethers.js/src.ts/utils/base64.js | 58 + dist/ethers.js/src.ts/utils/base64.js.map | 1 + dist/ethers.js/src.ts/utils/data.d.ts | 93 + dist/ethers.js/src.ts/utils/data.d.ts.map | 1 + dist/ethers.js/src.ts/utils/data.js | 184 + dist/ethers.js/src.ts/utils/data.js.map | 1 + dist/ethers.js/src.ts/utils/errors.d.ts | 512 ++ dist/ethers.js/src.ts/utils/errors.d.ts.map | 1 + dist/ethers.js/src.ts/utils/errors.js | 235 + dist/ethers.js/src.ts/utils/errors.js.map | 1 + dist/ethers.js/src.ts/utils/events.d.ts | 77 + dist/ethers.js/src.ts/utils/events.d.ts.map | 1 + dist/ethers.js/src.ts/utils/events.js | 62 + dist/ethers.js/src.ts/utils/events.js.map | 1 + dist/ethers.js/src.ts/utils/fetch.d.ts | 363 + dist/ethers.js/src.ts/utils/fetch.d.ts.map | 1 + dist/ethers.js/src.ts/utils/fetch.js | 872 +++ dist/ethers.js/src.ts/utils/fetch.js.map | 1 + dist/ethers.js/src.ts/utils/fixednumber.d.ts | 252 + .../src.ts/utils/fixednumber.d.ts.map | 1 + dist/ethers.js/src.ts/utils/fixednumber.js | 528 ++ .../ethers.js/src.ts/utils/fixednumber.js.map | 1 + .../src.ts/utils/geturl-browser.d.ts | 22 + .../src.ts/utils/geturl-browser.d.ts.map | 1 + dist/ethers.js/src.ts/utils/geturl-browser.js | 63 + .../src.ts/utils/geturl-browser.js.map | 1 + dist/ethers.js/src.ts/utils/geturl.d.ts | 10 + dist/ethers.js/src.ts/utils/geturl.d.ts.map | 1 + dist/ethers.js/src.ts/utils/geturl.js | 115 + dist/ethers.js/src.ts/utils/geturl.js.map | 1 + dist/ethers.js/src.ts/utils/index.d.ts | 30 + dist/ethers.js/src.ts/utils/index.d.ts.map | 1 + dist/ethers.js/src.ts/utils/index.js | 78 + dist/ethers.js/src.ts/utils/index.js.map | 1 + dist/ethers.js/src.ts/utils/maths.d.ts | 66 + dist/ethers.js/src.ts/utils/maths.d.ts.map | 1 + dist/ethers.js/src.ts/utils/maths.js | 229 + dist/ethers.js/src.ts/utils/maths.js.map | 1 + dist/ethers.js/src.ts/utils/properties.d.ts | 23 + .../src.ts/utils/properties.d.ts.map | 1 + dist/ethers.js/src.ts/utils/properties.js | 70 + dist/ethers.js/src.ts/utils/properties.js.map | 1 + dist/ethers.js/src.ts/utils/rlp-decode.d.ts | 6 + .../src.ts/utils/rlp-decode.d.ts.map | 1 + dist/ethers.js/src.ts/utils/rlp-decode.js | 83 + dist/ethers.js/src.ts/utils/rlp-decode.js.map | 1 + dist/ethers.js/src.ts/utils/rlp-encode.d.ts | 6 + .../src.ts/utils/rlp-encode.d.ts.map | 1 + dist/ethers.js/src.ts/utils/rlp-encode.js | 53 + dist/ethers.js/src.ts/utils/rlp-encode.js.map | 1 + dist/ethers.js/src.ts/utils/rlp.d.ts | 17 + dist/ethers.js/src.ts/utils/rlp.d.ts.map | 1 + dist/ethers.js/src.ts/utils/rlp.js | 14 + dist/ethers.js/src.ts/utils/rlp.js.map | 1 + dist/ethers.js/src.ts/utils/units.d.ts | 24 + dist/ethers.js/src.ts/utils/units.d.ts.map | 1 + dist/ethers.js/src.ts/utils/units.js | 90 + dist/ethers.js/src.ts/utils/units.js.map | 1 + dist/ethers.js/src.ts/utils/utf8.d.ts | 96 + dist/ethers.js/src.ts/utils/utf8.d.ts.map | 1 + dist/ethers.js/src.ts/utils/utf8.js | 226 + dist/ethers.js/src.ts/utils/utf8.js.map | 1 + dist/ethers.js/src.ts/utils/uuid.d.ts | 8 + dist/ethers.js/src.ts/utils/uuid.d.ts.map | 1 + dist/ethers.js/src.ts/utils/uuid.js | 34 + dist/ethers.js/src.ts/utils/uuid.js.map | 1 + dist/ethers.js/src.ts/wallet/base-wallet.d.ts | 48 + .../src.ts/wallet/base-wallet.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/base-wallet.js | 131 + .../src.ts/wallet/base-wallet.js.map | 1 + dist/ethers.js/src.ts/wallet/hdwallet.d.ts | 248 + .../ethers.js/src.ts/wallet/hdwallet.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/hdwallet.js | 437 ++ dist/ethers.js/src.ts/wallet/hdwallet.js.map | 1 + dist/ethers.js/src.ts/wallet/index.d.ts | 27 + dist/ethers.js/src.ts/wallet/index.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/index.js | 43 + dist/ethers.js/src.ts/wallet/index.js.map | 1 + .../src.ts/wallet/json-crowdsale.d.ts | 27 + .../src.ts/wallet/json-crowdsale.d.ts.map | 1 + .../ethers.js/src.ts/wallet/json-crowdsale.js | 60 + .../src.ts/wallet/json-crowdsale.js.map | 1 + .../src.ts/wallet/json-keystore.d.ts | 89 + .../src.ts/wallet/json-keystore.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/json-keystore.js | 308 + .../src.ts/wallet/json-keystore.js.map | 1 + dist/ethers.js/src.ts/wallet/mnemonic.d.ts | 65 + .../ethers.js/src.ts/wallet/mnemonic.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/mnemonic.js | 150 + dist/ethers.js/src.ts/wallet/mnemonic.js.map | 1 + dist/ethers.js/src.ts/wallet/utils.d.ts | 8 + dist/ethers.js/src.ts/wallet/utils.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/utils.js | 149 + dist/ethers.js/src.ts/wallet/utils.js.map | 1 + dist/ethers.js/src.ts/wallet/wallet.d.ts | 71 + dist/ethers.js/src.ts/wallet/wallet.d.ts.map | 1 + dist/ethers.js/src.ts/wallet/wallet.js | 167 + dist/ethers.js/src.ts/wallet/wallet.js.map | 1 + .../src.ts/wordlists/bit-reader.d.ts | 5 + .../src.ts/wordlists/bit-reader.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/bit-reader.js | 36 + .../src.ts/wordlists/bit-reader.js.map | 1 + .../src.ts/wordlists/decode-owl.d.ts | 9 + .../src.ts/wordlists/decode-owl.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/decode-owl.js | 60 + .../src.ts/wordlists/decode-owl.js.map | 1 + .../src.ts/wordlists/decode-owla.d.ts | 5 + .../src.ts/wordlists/decode-owla.d.ts.map | 1 + .../ethers.js/src.ts/wordlists/decode-owla.js | 32 + .../src.ts/wordlists/decode-owla.js.map | 1 + .../wordlists/generation/encode-latin.d.ts | 25 + .../generation/encode-latin.d.ts.map | 1 + .../wordlists/generation/encode-latin.js | 365 + .../wordlists/generation/encode-latin.js.map | 1 + dist/ethers.js/src.ts/wordlists/index.d.ts | 25 + .../ethers.js/src.ts/wordlists/index.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/index.js | 33 + dist/ethers.js/src.ts/wordlists/index.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-cz.d.ts | 23 + .../src.ts/wordlists/lang-cz.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-cz.js | 35 + .../ethers.js/src.ts/wordlists/lang-cz.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-en.d.ts | 23 + .../src.ts/wordlists/lang-en.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-en.js | 35 + .../ethers.js/src.ts/wordlists/lang-en.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-es.d.ts | 23 + .../src.ts/wordlists/lang-es.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-es.js | 36 + .../ethers.js/src.ts/wordlists/lang-es.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-fr.d.ts | 23 + .../src.ts/wordlists/lang-fr.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-fr.js | 36 + .../ethers.js/src.ts/wordlists/lang-fr.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-it.d.ts | 23 + .../src.ts/wordlists/lang-it.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-it.js | 35 + .../ethers.js/src.ts/wordlists/lang-it.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-ja.d.ts | 27 + .../src.ts/wordlists/lang-ja.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-ja.js | 158 + .../ethers.js/src.ts/wordlists/lang-ja.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-ko.d.ts | 25 + .../src.ts/wordlists/lang-ko.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-ko.js | 93 + .../ethers.js/src.ts/wordlists/lang-ko.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-pt.d.ts | 23 + .../src.ts/wordlists/lang-pt.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-pt.js | 35 + .../ethers.js/src.ts/wordlists/lang-pt.js.map | 1 + dist/ethers.js/src.ts/wordlists/lang-zh.d.ts | 32 + .../src.ts/wordlists/lang-zh.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/lang-zh.js | 96 + .../ethers.js/src.ts/wordlists/lang-zh.js.map | 1 + .../src.ts/wordlists/wordlist-owl.d.ts | 32 + .../src.ts/wordlists/wordlist-owl.d.ts.map | 1 + .../src.ts/wordlists/wordlist-owl.js | 83 + .../src.ts/wordlists/wordlist-owl.js.map | 1 + .../src.ts/wordlists/wordlist-owla.d.ts | 30 + .../src.ts/wordlists/wordlist-owla.d.ts.map | 1 + .../src.ts/wordlists/wordlist-owla.js | 53 + .../src.ts/wordlists/wordlist-owla.js.map | 1 + dist/ethers.js/src.ts/wordlists/wordlist.d.ts | 47 + .../src.ts/wordlists/wordlist.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/wordlist.js | 45 + .../src.ts/wordlists/wordlist.js.map | 1 + .../src.ts/wordlists/wordlists-browser.d.ts | 3 + .../wordlists/wordlists-browser.d.ts.map | 1 + .../src.ts/wordlists/wordlists-browser.js | 8 + .../src.ts/wordlists/wordlists-browser.js.map | 1 + .../src.ts/wordlists/wordlists-extra.d.ts | 9 + .../src.ts/wordlists/wordlists-extra.d.ts.map | 1 + .../src.ts/wordlists/wordlists-extra.js | 20 + .../src.ts/wordlists/wordlists-extra.js.map | 1 + .../ethers.js/src.ts/wordlists/wordlists.d.ts | 16 + .../src.ts/wordlists/wordlists.d.ts.map | 1 + dist/ethers.js/src.ts/wordlists/wordlists.js | 38 + .../src.ts/wordlists/wordlists.js.map | 1 + .../angular/src/app/app.component.d.ts | 12 + .../angular/src/app/app.component.d.ts.map | 1 + .../test-env/angular/src/app/app.component.js | 101 + .../angular/src/app/app.component.js.map | 1 + .../angular/src/app/app.component.spec.d.ts | 2 + .../src/app/app.component.spec.d.ts.map | 1 + .../angular/src/app/app.component.spec.js | 40 + .../angular/src/app/app.component.spec.js.map | 1 + .../test-env/angular/src/app/app.module.d.ts | 3 + .../angular/src/app/app.module.d.ts.map | 1 + .../test-env/angular/src/app/app.module.js | 69 + .../angular/src/app/app.module.js.map | 1 + .../testcases/test-env/angular/src/main.d.ts | 2 + .../test-env/angular/src/main.d.ts.map | 1 + .../testcases/test-env/angular/src/main.js | 7 + .../test-env/angular/src/main.js.map | 1 + .../test-env/test-tsc/js-commonjs.d.ts | 2 + .../test-env/test-tsc/js-commonjs.d.ts.map | 1 + .../test-env/test-tsc/js-commonjs.js | 5 + .../test-env/test-tsc/js-commonjs.js.map | 1 + .../test-env/test-tsc/js-module.d.ts | 2 + .../test-env/test-tsc/js-module.d.ts.map | 1 + .../testcases/test-env/test-tsc/js-module.js | 6 + .../test-env/test-tsc/js-module.js.map | 1 + dist/index.d.ts | 5 + dist/index.d.ts.map | 1 + dist/index.js | 12 + dist/index.js.map | 1 + dist/lacchain-provider.d.ts | 7 + dist/lacchain-provider.d.ts.map | 1 + dist/lacchain-provider.js | 51 + dist/lacchain-provider.js.map | 1 + dist/lacchain-signer.d.ts | 8 + dist/lacchain-signer.d.ts.map | 1 + dist/lacchain-signer.js | 45 + dist/lacchain-signer.js.map | 1 + dist/lacchain-transaction-request.d.ts | 23 + dist/lacchain-transaction-request.d.ts.map | 1 + dist/lacchain-transaction-request.js | 31 + dist/lacchain-transaction-request.js.map | 1 + dist/lacchain-transaction.d.ts | 26 + dist/lacchain-transaction.d.ts.map | 1 + dist/lacchain-transaction.js | 32 + dist/lacchain-transaction.js.map | 1 + dist/test/e2e/deploy-and-tx.test.d.ts | 2 + dist/test/e2e/deploy-and-tx.test.d.ts.map | 1 + dist/test/e2e/deploy-and-tx.test.js | 63 + dist/test/e2e/deploy-and-tx.test.js.map | 1 + dist/test/e2e/test-contract.d.ts | 60 + dist/test/e2e/test-contract.d.ts.map | 1 + dist/test/e2e/test-contract.js | 170 + dist/test/e2e/test-contract.js.map | 1 + dist/test/fixtures copy.d.ts | 8 + dist/test/fixtures copy.d.ts.map | 1 + dist/test/fixtures copy.js | 25 + dist/test/fixtures.d.ts | 8 + dist/test/fixtures.d.ts.map | 1 + dist/test/fixtures.js | 26 + dist/test/fixtures.js.map | 1 + dist/test/index.test.d.ts | 2 + dist/test/index.test.d.ts.map | 1 + dist/test/index.test.js | 12 + dist/test/index.test.js.map | 1 + dist/test/lacchain-provider.test.d.ts | 2 + dist/test/lacchain-provider.test.d.ts.map | 1 + dist/test/lacchain-provider.test.js | 9 + dist/test/lacchain-provider.test.js.map | 1 + dist/test/lacchain-signer.test.d.ts | 2 + dist/test/lacchain-signer.test.d.ts.map | 1 + dist/test/lacchain-signer.test.js | 27 + dist/test/lacchain-signer.test.js.map | 1 + .../lacchain-transaction-request.test.d.ts | 2 + ...lacchain-transaction-request.test.d.ts.map | 1 + .../test/lacchain-transaction-request.test.js | 60 + .../lacchain-transaction-request.test.js.map | 1 + dist/test/lacchain-transaction.test.d.ts | 2 + dist/test/lacchain-transaction.test.d.ts.map | 1 + dist/test/lacchain-transaction.test.js | 76 + dist/test/lacchain-transaction.test.js.map | 1 + jest.config.e2e.js | 11 + jest.config.js | 14 + package-lock.json | 5934 ++++++----------- package.json | 44 +- src/.DS_Store | Bin 0 -> 6148 bytes src/index.ts | 11 +- src/lacchain-provider.ts | 55 + src/lacchain-signer.ts | 63 + src/lacchain-transaction-request.ts | 36 + src/lacchain-transaction.ts | 31 + src/provider.ts | 33 - src/signer.ts | 32 - src/test/e2e/deploy-and-tx.test.ts | 49 + src/test/e2e/test-contract.ts | 166 + src/test/fixtures.ts | 28 + src/test/index.test.ts | 17 + src/test/lacchain-provider.test.ts | 9 + src/test/lacchain-signer.test.ts | 36 + src/test/lacchain-transaction-request.test.ts | 84 + src/test/lacchain-transaction.test.ts | 102 + tests/fixtures.ts | 329 - tests/index.ts | 36 - tsconfig.json | 14 +- tslint.json | 3 - 841 files changed, 44879 insertions(+), 4244 deletions(-) create mode 100644 .DS_Store create mode 100644 .env delete mode 100644 .prettierrc create mode 100644 .prettierrc.json create mode 100644 .vscode/launch.json create mode 100644 dist/ethers.js/src.ts/_admin/create-release.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/create-release.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/create-release.js create mode 100644 dist/ethers.js/src.ts/_admin/create-release.js.map create mode 100644 dist/ethers.js/src.ts/_admin/generate-diffs.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/generate-diffs.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/generate-diffs.js create mode 100644 dist/ethers.js/src.ts/_admin/generate-diffs.js.map create mode 100644 dist/ethers.js/src.ts/_admin/test-browser.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/test-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/test-browser.js create mode 100644 dist/ethers.js/src.ts/_admin/test-browser.js.map create mode 100644 dist/ethers.js/src.ts/_admin/update-changelog.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/update-changelog.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/update-changelog.js create mode 100644 dist/ethers.js/src.ts/_admin/update-changelog.js.map create mode 100644 dist/ethers.js/src.ts/_admin/update-version.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/update-version.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/update-version.js create mode 100644 dist/ethers.js/src.ts/_admin/update-version.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/changelog.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/changelog.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/changelog.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/changelog.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/date.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/date.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/date.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/date.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/fs.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/fs.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/fs.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/fs.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/git.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/git.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/git.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/git.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/json.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/json.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/json.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/json.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/npm.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/npm.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/npm.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/npm.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/path.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/path.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/path.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/path.js.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/run.d.ts create mode 100644 dist/ethers.js/src.ts/_admin/utils/run.d.ts.map create mode 100644 dist/ethers.js/src.ts/_admin/utils/run.js create mode 100644 dist/ethers.js/src.ts/_admin/utils/run.js.map create mode 100644 dist/ethers.js/src.ts/_tests/blockchain-data.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/blockchain-data.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/blockchain-data.js create mode 100644 dist/ethers.js/src.ts/_tests/blockchain-data.js.map create mode 100644 dist/ethers.js/src.ts/_tests/create-provider.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/create-provider.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/create-provider.js create mode 100644 dist/ethers.js/src.ts/_tests/create-provider.js.map create mode 100644 dist/ethers.js/src.ts/_tests/index.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/index.js create mode 100644 dist/ethers.js/src.ts/_tests/index.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-abi.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-abi.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-abi.js create mode 100644 dist/ethers.js/src.ts/_tests/test-abi.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-address.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-address.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-address.js create mode 100644 dist/ethers.js/src.ts/_tests/test-address.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-contract-integ.js create mode 100644 dist/ethers.js/src.ts/_tests/test-contract-integ.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-contract.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-contract.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-contract.js create mode 100644 dist/ethers.js/src.ts/_tests/test-contract.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto.js create mode 100644 dist/ethers.js/src.ts/_tests/test-crypto.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-hash-typeddata.js create mode 100644 dist/ethers.js/src.ts/_tests/test-hash-typeddata.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-hash.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-hash.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-hash.js create mode 100644 dist/ethers.js/src.ts/_tests/test-hash.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-avatar.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-avatar.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-ccip.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-ccip.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-data.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-data.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-data.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-data.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-errors.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-errors.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-extra.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-extra.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-fallback.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-fallback.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-send.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-send.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-send.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-send.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-wildcard.js create mode 100644 dist/ethers.js/src.ts/_tests/test-providers-wildcard.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-rlp.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-rlp.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-rlp.js create mode 100644 dist/ethers.js/src.ts/_tests/test-rlp.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-transaction.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-transaction.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-transaction.js create mode 100644 dist/ethers.js/src.ts/_tests/test-transaction.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-maths.js create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-maths.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-misc.js create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-misc.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-units.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-units.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-units.js create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-units.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-utf8.js create mode 100644 dist/ethers.js/src.ts/_tests/test-utils-utf8.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-hd.js create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-hd.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-json.js create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-json.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet.js create mode 100644 dist/ethers.js/src.ts/_tests/test-wallet.js.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wordlists.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/test-wordlists.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/test-wordlists.js create mode 100644 dist/ethers.js/src.ts/_tests/test-wordlists.js.map create mode 100644 dist/ethers.js/src.ts/_tests/types.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/types.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/types.js create mode 100644 dist/ethers.js/src.ts/_tests/types.js.map create mode 100644 dist/ethers.js/src.ts/_tests/utils.d.ts create mode 100644 dist/ethers.js/src.ts/_tests/utils.d.ts.map create mode 100644 dist/ethers.js/src.ts/_tests/utils.js create mode 100644 dist/ethers.js/src.ts/_tests/utils.js.map create mode 100644 dist/ethers.js/src.ts/_version.d.ts create mode 100644 dist/ethers.js/src.ts/_version.d.ts.map create mode 100644 dist/ethers.js/src.ts/_version.js create mode 100644 dist/ethers.js/src.ts/_version.js.map create mode 100644 dist/ethers.js/src.ts/abi/abi-coder.d.ts create mode 100644 dist/ethers.js/src.ts/abi/abi-coder.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/abi-coder.js create mode 100644 dist/ethers.js/src.ts/abi/abi-coder.js.map create mode 100644 dist/ethers.js/src.ts/abi/bytes32.d.ts create mode 100644 dist/ethers.js/src.ts/abi/bytes32.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/bytes32.js create mode 100644 dist/ethers.js/src.ts/abi/bytes32.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/abstract-coder.js create mode 100644 dist/ethers.js/src.ts/abi/coders/abstract-coder.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/address.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/address.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/address.js create mode 100644 dist/ethers.js/src.ts/abi/coders/address.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/anonymous.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/anonymous.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/anonymous.js create mode 100644 dist/ethers.js/src.ts/abi/coders/anonymous.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/array.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/array.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/array.js create mode 100644 dist/ethers.js/src.ts/abi/coders/array.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/boolean.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/boolean.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/boolean.js create mode 100644 dist/ethers.js/src.ts/abi/coders/boolean.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/bytes.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/bytes.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/bytes.js create mode 100644 dist/ethers.js/src.ts/abi/coders/bytes.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/fixed-bytes.js create mode 100644 dist/ethers.js/src.ts/abi/coders/fixed-bytes.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/null.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/null.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/null.js create mode 100644 dist/ethers.js/src.ts/abi/coders/null.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/number.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/number.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/number.js create mode 100644 dist/ethers.js/src.ts/abi/coders/number.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/string.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/string.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/string.js create mode 100644 dist/ethers.js/src.ts/abi/coders/string.js.map create mode 100644 dist/ethers.js/src.ts/abi/coders/tuple.d.ts create mode 100644 dist/ethers.js/src.ts/abi/coders/tuple.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/coders/tuple.js create mode 100644 dist/ethers.js/src.ts/abi/coders/tuple.js.map create mode 100644 dist/ethers.js/src.ts/abi/fragments.d.ts create mode 100644 dist/ethers.js/src.ts/abi/fragments.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/fragments.js create mode 100644 dist/ethers.js/src.ts/abi/fragments.js.map create mode 100644 dist/ethers.js/src.ts/abi/index.d.ts create mode 100644 dist/ethers.js/src.ts/abi/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/index.js create mode 100644 dist/ethers.js/src.ts/abi/index.js.map create mode 100644 dist/ethers.js/src.ts/abi/interface.d.ts create mode 100644 dist/ethers.js/src.ts/abi/interface.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/interface.js create mode 100644 dist/ethers.js/src.ts/abi/interface.js.map create mode 100644 dist/ethers.js/src.ts/abi/typed.d.ts create mode 100644 dist/ethers.js/src.ts/abi/typed.d.ts.map create mode 100644 dist/ethers.js/src.ts/abi/typed.js create mode 100644 dist/ethers.js/src.ts/abi/typed.js.map create mode 100644 dist/ethers.js/src.ts/address/address.d.ts create mode 100644 dist/ethers.js/src.ts/address/address.d.ts.map create mode 100644 dist/ethers.js/src.ts/address/address.js create mode 100644 dist/ethers.js/src.ts/address/address.js.map create mode 100644 dist/ethers.js/src.ts/address/checks.d.ts create mode 100644 dist/ethers.js/src.ts/address/checks.d.ts.map create mode 100644 dist/ethers.js/src.ts/address/checks.js create mode 100644 dist/ethers.js/src.ts/address/checks.js.map create mode 100644 dist/ethers.js/src.ts/address/contract-address.d.ts create mode 100644 dist/ethers.js/src.ts/address/contract-address.d.ts.map create mode 100644 dist/ethers.js/src.ts/address/contract-address.js create mode 100644 dist/ethers.js/src.ts/address/contract-address.js.map create mode 100644 dist/ethers.js/src.ts/address/index.d.ts create mode 100644 dist/ethers.js/src.ts/address/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/address/index.js create mode 100644 dist/ethers.js/src.ts/address/index.js.map create mode 100644 dist/ethers.js/src.ts/constants/addresses.d.ts create mode 100644 dist/ethers.js/src.ts/constants/addresses.d.ts.map create mode 100644 dist/ethers.js/src.ts/constants/addresses.js create mode 100644 dist/ethers.js/src.ts/constants/addresses.js.map create mode 100644 dist/ethers.js/src.ts/constants/hashes.d.ts create mode 100644 dist/ethers.js/src.ts/constants/hashes.d.ts.map create mode 100644 dist/ethers.js/src.ts/constants/hashes.js create mode 100644 dist/ethers.js/src.ts/constants/hashes.js.map create mode 100644 dist/ethers.js/src.ts/constants/index.d.ts create mode 100644 dist/ethers.js/src.ts/constants/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/constants/index.js create mode 100644 dist/ethers.js/src.ts/constants/index.js.map create mode 100644 dist/ethers.js/src.ts/constants/numbers.d.ts create mode 100644 dist/ethers.js/src.ts/constants/numbers.d.ts.map create mode 100644 dist/ethers.js/src.ts/constants/numbers.js create mode 100644 dist/ethers.js/src.ts/constants/numbers.js.map create mode 100644 dist/ethers.js/src.ts/constants/strings.d.ts create mode 100644 dist/ethers.js/src.ts/constants/strings.d.ts.map create mode 100644 dist/ethers.js/src.ts/constants/strings.js create mode 100644 dist/ethers.js/src.ts/constants/strings.js.map create mode 100644 dist/ethers.js/src.ts/contract/contract.d.ts create mode 100644 dist/ethers.js/src.ts/contract/contract.d.ts.map create mode 100644 dist/ethers.js/src.ts/contract/contract.js create mode 100644 dist/ethers.js/src.ts/contract/contract.js.map create mode 100644 dist/ethers.js/src.ts/contract/factory.d.ts create mode 100644 dist/ethers.js/src.ts/contract/factory.d.ts.map create mode 100644 dist/ethers.js/src.ts/contract/factory.js create mode 100644 dist/ethers.js/src.ts/contract/factory.js.map create mode 100644 dist/ethers.js/src.ts/contract/index.d.ts create mode 100644 dist/ethers.js/src.ts/contract/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/contract/index.js create mode 100644 dist/ethers.js/src.ts/contract/index.js.map create mode 100644 dist/ethers.js/src.ts/contract/types.d.ts create mode 100644 dist/ethers.js/src.ts/contract/types.d.ts.map create mode 100644 dist/ethers.js/src.ts/contract/types.js create mode 100644 dist/ethers.js/src.ts/contract/types.js.map create mode 100644 dist/ethers.js/src.ts/contract/wrappers.d.ts create mode 100644 dist/ethers.js/src.ts/contract/wrappers.d.ts.map create mode 100644 dist/ethers.js/src.ts/contract/wrappers.js create mode 100644 dist/ethers.js/src.ts/contract/wrappers.js.map create mode 100644 dist/ethers.js/src.ts/crypto/crypto-browser.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/crypto-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/crypto-browser.js create mode 100644 dist/ethers.js/src.ts/crypto/crypto-browser.js.map create mode 100644 dist/ethers.js/src.ts/crypto/crypto.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/crypto.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/crypto.js create mode 100644 dist/ethers.js/src.ts/crypto/crypto.js.map create mode 100644 dist/ethers.js/src.ts/crypto/hmac.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/hmac.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/hmac.js create mode 100644 dist/ethers.js/src.ts/crypto/hmac.js.map create mode 100644 dist/ethers.js/src.ts/crypto/index.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/index.js create mode 100644 dist/ethers.js/src.ts/crypto/index.js.map create mode 100644 dist/ethers.js/src.ts/crypto/keccak.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/keccak.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/keccak.js create mode 100644 dist/ethers.js/src.ts/crypto/keccak.js.map create mode 100644 dist/ethers.js/src.ts/crypto/pbkdf2.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/pbkdf2.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/pbkdf2.js create mode 100644 dist/ethers.js/src.ts/crypto/pbkdf2.js.map create mode 100644 dist/ethers.js/src.ts/crypto/random.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/random.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/random.js create mode 100644 dist/ethers.js/src.ts/crypto/random.js.map create mode 100644 dist/ethers.js/src.ts/crypto/ripemd160.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/ripemd160.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/ripemd160.js create mode 100644 dist/ethers.js/src.ts/crypto/ripemd160.js.map create mode 100644 dist/ethers.js/src.ts/crypto/scrypt.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/scrypt.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/scrypt.js create mode 100644 dist/ethers.js/src.ts/crypto/scrypt.js.map create mode 100644 dist/ethers.js/src.ts/crypto/sha2.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/sha2.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/sha2.js create mode 100644 dist/ethers.js/src.ts/crypto/sha2.js.map create mode 100644 dist/ethers.js/src.ts/crypto/signature.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/signature.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/signature.js create mode 100644 dist/ethers.js/src.ts/crypto/signature.js.map create mode 100644 dist/ethers.js/src.ts/crypto/signing-key.d.ts create mode 100644 dist/ethers.js/src.ts/crypto/signing-key.d.ts.map create mode 100644 dist/ethers.js/src.ts/crypto/signing-key.js create mode 100644 dist/ethers.js/src.ts/crypto/signing-key.js.map create mode 100644 dist/ethers.js/src.ts/ethers.d.ts create mode 100644 dist/ethers.js/src.ts/ethers.d.ts.map create mode 100644 dist/ethers.js/src.ts/ethers.js create mode 100644 dist/ethers.js/src.ts/ethers.js.map create mode 100644 dist/ethers.js/src.ts/hash/id.d.ts create mode 100644 dist/ethers.js/src.ts/hash/id.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/id.js create mode 100644 dist/ethers.js/src.ts/hash/id.js.map create mode 100644 dist/ethers.js/src.ts/hash/index.d.ts create mode 100644 dist/ethers.js/src.ts/hash/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/index.js create mode 100644 dist/ethers.js/src.ts/hash/index.js.map create mode 100644 dist/ethers.js/src.ts/hash/message.d.ts create mode 100644 dist/ethers.js/src.ts/hash/message.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/message.js create mode 100644 dist/ethers.js/src.ts/hash/message.js.map create mode 100644 dist/ethers.js/src.ts/hash/namehash.d.ts create mode 100644 dist/ethers.js/src.ts/hash/namehash.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/namehash.js create mode 100644 dist/ethers.js/src.ts/hash/namehash.js.map create mode 100644 dist/ethers.js/src.ts/hash/solidity.d.ts create mode 100644 dist/ethers.js/src.ts/hash/solidity.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/solidity.js create mode 100644 dist/ethers.js/src.ts/hash/solidity.js.map create mode 100644 dist/ethers.js/src.ts/hash/typed-data.d.ts create mode 100644 dist/ethers.js/src.ts/hash/typed-data.d.ts.map create mode 100644 dist/ethers.js/src.ts/hash/typed-data.js create mode 100644 dist/ethers.js/src.ts/hash/typed-data.js.map create mode 100644 dist/ethers.js/src.ts/index.d.ts create mode 100644 dist/ethers.js/src.ts/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/index.js create mode 100644 dist/ethers.js/src.ts/index.js.map create mode 100644 dist/ethers.js/src.ts/providers/abstract-provider.d.ts create mode 100644 dist/ethers.js/src.ts/providers/abstract-provider.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/abstract-provider.js create mode 100644 dist/ethers.js/src.ts/providers/abstract-provider.js.map create mode 100644 dist/ethers.js/src.ts/providers/abstract-signer.d.ts create mode 100644 dist/ethers.js/src.ts/providers/abstract-signer.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/abstract-signer.js create mode 100644 dist/ethers.js/src.ts/providers/abstract-signer.js.map create mode 100644 dist/ethers.js/src.ts/providers/community.d.ts create mode 100644 dist/ethers.js/src.ts/providers/community.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/community.js create mode 100644 dist/ethers.js/src.ts/providers/community.js.map create mode 100644 dist/ethers.js/src.ts/providers/contracts.d.ts create mode 100644 dist/ethers.js/src.ts/providers/contracts.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/contracts.js create mode 100644 dist/ethers.js/src.ts/providers/contracts.js.map create mode 100644 dist/ethers.js/src.ts/providers/default-provider.d.ts create mode 100644 dist/ethers.js/src.ts/providers/default-provider.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/default-provider.js create mode 100644 dist/ethers.js/src.ts/providers/default-provider.js.map create mode 100644 dist/ethers.js/src.ts/providers/ens-resolver.d.ts create mode 100644 dist/ethers.js/src.ts/providers/ens-resolver.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/ens-resolver.js create mode 100644 dist/ethers.js/src.ts/providers/ens-resolver.js.map create mode 100644 dist/ethers.js/src.ts/providers/format.d.ts create mode 100644 dist/ethers.js/src.ts/providers/format.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/format.js create mode 100644 dist/ethers.js/src.ts/providers/format.js.map create mode 100644 dist/ethers.js/src.ts/providers/formatting.d.ts create mode 100644 dist/ethers.js/src.ts/providers/formatting.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/formatting.js create mode 100644 dist/ethers.js/src.ts/providers/formatting.js.map create mode 100644 dist/ethers.js/src.ts/providers/index.d.ts create mode 100644 dist/ethers.js/src.ts/providers/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/index.js create mode 100644 dist/ethers.js/src.ts/providers/index.js.map create mode 100644 dist/ethers.js/src.ts/providers/network.d.ts create mode 100644 dist/ethers.js/src.ts/providers/network.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/network.js create mode 100644 dist/ethers.js/src.ts/providers/network.js.map create mode 100644 dist/ethers.js/src.ts/providers/pagination.d.ts create mode 100644 dist/ethers.js/src.ts/providers/pagination.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/pagination.js create mode 100644 dist/ethers.js/src.ts/providers/pagination.js.map create mode 100644 dist/ethers.js/src.ts/providers/plugin-fallback.d.ts create mode 100644 dist/ethers.js/src.ts/providers/plugin-fallback.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/plugin-fallback.js create mode 100644 dist/ethers.js/src.ts/providers/plugin-fallback.js.map create mode 100644 dist/ethers.js/src.ts/providers/plugins-network.d.ts create mode 100644 dist/ethers.js/src.ts/providers/plugins-network.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/plugins-network.js create mode 100644 dist/ethers.js/src.ts/providers/plugins-network.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-alchemy.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-alchemy.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-alchemy.js create mode 100644 dist/ethers.js/src.ts/providers/provider-alchemy.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ankr.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-ankr.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ankr.js create mode 100644 dist/ethers.js/src.ts/providers/provider-ankr.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-browser.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-browser.js create mode 100644 dist/ethers.js/src.ts/providers/provider-browser.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-cloudflare.js create mode 100644 dist/ethers.js/src.ts/providers/provider-cloudflare.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-etherscan.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-etherscan.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-etherscan.js create mode 100644 dist/ethers.js/src.ts/providers/provider-etherscan.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-fallback.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-fallback.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-fallback.js create mode 100644 dist/ethers.js/src.ts/providers/provider-fallback.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-infura.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-infura.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-infura.js create mode 100644 dist/ethers.js/src.ts/providers/provider-infura.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket.js create mode 100644 dist/ethers.js/src.ts/providers/provider-ipcsocket.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-jsonrpc.js create mode 100644 dist/ethers.js/src.ts/providers/provider-jsonrpc.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-pocket.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-pocket.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-pocket.js create mode 100644 dist/ethers.js/src.ts/providers/provider-pocket.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-quicknode.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-quicknode.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-quicknode.js create mode 100644 dist/ethers.js/src.ts/providers/provider-quicknode.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-socket.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-socket.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-socket.js create mode 100644 dist/ethers.js/src.ts/providers/provider-socket.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider-websocket.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider-websocket.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider-websocket.js create mode 100644 dist/ethers.js/src.ts/providers/provider-websocket.js.map create mode 100644 dist/ethers.js/src.ts/providers/provider.d.ts create mode 100644 dist/ethers.js/src.ts/providers/provider.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/provider.js create mode 100644 dist/ethers.js/src.ts/providers/provider.js.map create mode 100644 dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts create mode 100644 dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/signer-noncemanager.js create mode 100644 dist/ethers.js/src.ts/providers/signer-noncemanager.js.map create mode 100644 dist/ethers.js/src.ts/providers/signer.d.ts create mode 100644 dist/ethers.js/src.ts/providers/signer.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/signer.js create mode 100644 dist/ethers.js/src.ts/providers/signer.js.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-connection.d.ts create mode 100644 dist/ethers.js/src.ts/providers/subscriber-connection.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-connection.js create mode 100644 dist/ethers.js/src.ts/providers/subscriber-connection.js.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts create mode 100644 dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-filterid.js create mode 100644 dist/ethers.js/src.ts/providers/subscriber-filterid.js.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-polling.d.ts create mode 100644 dist/ethers.js/src.ts/providers/subscriber-polling.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/subscriber-polling.js create mode 100644 dist/ethers.js/src.ts/providers/subscriber-polling.js.map create mode 100644 dist/ethers.js/src.ts/providers/ws-browser.d.ts create mode 100644 dist/ethers.js/src.ts/providers/ws-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/ws-browser.js create mode 100644 dist/ethers.js/src.ts/providers/ws-browser.js.map create mode 100644 dist/ethers.js/src.ts/providers/ws.d.ts create mode 100644 dist/ethers.js/src.ts/providers/ws.d.ts.map create mode 100644 dist/ethers.js/src.ts/providers/ws.js create mode 100644 dist/ethers.js/src.ts/providers/ws.js.map create mode 100644 dist/ethers.js/src.ts/transaction/accesslist.d.ts create mode 100644 dist/ethers.js/src.ts/transaction/accesslist.d.ts.map create mode 100644 dist/ethers.js/src.ts/transaction/accesslist.js create mode 100644 dist/ethers.js/src.ts/transaction/accesslist.js.map create mode 100644 dist/ethers.js/src.ts/transaction/address.d.ts create mode 100644 dist/ethers.js/src.ts/transaction/address.d.ts.map create mode 100644 dist/ethers.js/src.ts/transaction/address.js create mode 100644 dist/ethers.js/src.ts/transaction/address.js.map create mode 100644 dist/ethers.js/src.ts/transaction/index.d.ts create mode 100644 dist/ethers.js/src.ts/transaction/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/transaction/index.js create mode 100644 dist/ethers.js/src.ts/transaction/index.js.map create mode 100644 dist/ethers.js/src.ts/transaction/transaction.d.ts create mode 100644 dist/ethers.js/src.ts/transaction/transaction.d.ts.map create mode 100644 dist/ethers.js/src.ts/transaction/transaction.js create mode 100644 dist/ethers.js/src.ts/transaction/transaction.js.map create mode 100644 dist/ethers.js/src.ts/utils/base58.d.ts create mode 100644 dist/ethers.js/src.ts/utils/base58.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/base58.js create mode 100644 dist/ethers.js/src.ts/utils/base58.js.map create mode 100644 dist/ethers.js/src.ts/utils/base64-browser.d.ts create mode 100644 dist/ethers.js/src.ts/utils/base64-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/base64-browser.js create mode 100644 dist/ethers.js/src.ts/utils/base64-browser.js.map create mode 100644 dist/ethers.js/src.ts/utils/base64.d.ts create mode 100644 dist/ethers.js/src.ts/utils/base64.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/base64.js create mode 100644 dist/ethers.js/src.ts/utils/base64.js.map create mode 100644 dist/ethers.js/src.ts/utils/data.d.ts create mode 100644 dist/ethers.js/src.ts/utils/data.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/data.js create mode 100644 dist/ethers.js/src.ts/utils/data.js.map create mode 100644 dist/ethers.js/src.ts/utils/errors.d.ts create mode 100644 dist/ethers.js/src.ts/utils/errors.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/errors.js create mode 100644 dist/ethers.js/src.ts/utils/errors.js.map create mode 100644 dist/ethers.js/src.ts/utils/events.d.ts create mode 100644 dist/ethers.js/src.ts/utils/events.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/events.js create mode 100644 dist/ethers.js/src.ts/utils/events.js.map create mode 100644 dist/ethers.js/src.ts/utils/fetch.d.ts create mode 100644 dist/ethers.js/src.ts/utils/fetch.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/fetch.js create mode 100644 dist/ethers.js/src.ts/utils/fetch.js.map create mode 100644 dist/ethers.js/src.ts/utils/fixednumber.d.ts create mode 100644 dist/ethers.js/src.ts/utils/fixednumber.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/fixednumber.js create mode 100644 dist/ethers.js/src.ts/utils/fixednumber.js.map create mode 100644 dist/ethers.js/src.ts/utils/geturl-browser.d.ts create mode 100644 dist/ethers.js/src.ts/utils/geturl-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/geturl-browser.js create mode 100644 dist/ethers.js/src.ts/utils/geturl-browser.js.map create mode 100644 dist/ethers.js/src.ts/utils/geturl.d.ts create mode 100644 dist/ethers.js/src.ts/utils/geturl.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/geturl.js create mode 100644 dist/ethers.js/src.ts/utils/geturl.js.map create mode 100644 dist/ethers.js/src.ts/utils/index.d.ts create mode 100644 dist/ethers.js/src.ts/utils/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/index.js create mode 100644 dist/ethers.js/src.ts/utils/index.js.map create mode 100644 dist/ethers.js/src.ts/utils/maths.d.ts create mode 100644 dist/ethers.js/src.ts/utils/maths.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/maths.js create mode 100644 dist/ethers.js/src.ts/utils/maths.js.map create mode 100644 dist/ethers.js/src.ts/utils/properties.d.ts create mode 100644 dist/ethers.js/src.ts/utils/properties.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/properties.js create mode 100644 dist/ethers.js/src.ts/utils/properties.js.map create mode 100644 dist/ethers.js/src.ts/utils/rlp-decode.d.ts create mode 100644 dist/ethers.js/src.ts/utils/rlp-decode.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/rlp-decode.js create mode 100644 dist/ethers.js/src.ts/utils/rlp-decode.js.map create mode 100644 dist/ethers.js/src.ts/utils/rlp-encode.d.ts create mode 100644 dist/ethers.js/src.ts/utils/rlp-encode.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/rlp-encode.js create mode 100644 dist/ethers.js/src.ts/utils/rlp-encode.js.map create mode 100644 dist/ethers.js/src.ts/utils/rlp.d.ts create mode 100644 dist/ethers.js/src.ts/utils/rlp.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/rlp.js create mode 100644 dist/ethers.js/src.ts/utils/rlp.js.map create mode 100644 dist/ethers.js/src.ts/utils/units.d.ts create mode 100644 dist/ethers.js/src.ts/utils/units.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/units.js create mode 100644 dist/ethers.js/src.ts/utils/units.js.map create mode 100644 dist/ethers.js/src.ts/utils/utf8.d.ts create mode 100644 dist/ethers.js/src.ts/utils/utf8.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/utf8.js create mode 100644 dist/ethers.js/src.ts/utils/utf8.js.map create mode 100644 dist/ethers.js/src.ts/utils/uuid.d.ts create mode 100644 dist/ethers.js/src.ts/utils/uuid.d.ts.map create mode 100644 dist/ethers.js/src.ts/utils/uuid.js create mode 100644 dist/ethers.js/src.ts/utils/uuid.js.map create mode 100644 dist/ethers.js/src.ts/wallet/base-wallet.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/base-wallet.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/base-wallet.js create mode 100644 dist/ethers.js/src.ts/wallet/base-wallet.js.map create mode 100644 dist/ethers.js/src.ts/wallet/hdwallet.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/hdwallet.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/hdwallet.js create mode 100644 dist/ethers.js/src.ts/wallet/hdwallet.js.map create mode 100644 dist/ethers.js/src.ts/wallet/index.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/index.js create mode 100644 dist/ethers.js/src.ts/wallet/index.js.map create mode 100644 dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/json-crowdsale.js create mode 100644 dist/ethers.js/src.ts/wallet/json-crowdsale.js.map create mode 100644 dist/ethers.js/src.ts/wallet/json-keystore.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/json-keystore.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/json-keystore.js create mode 100644 dist/ethers.js/src.ts/wallet/json-keystore.js.map create mode 100644 dist/ethers.js/src.ts/wallet/mnemonic.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/mnemonic.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/mnemonic.js create mode 100644 dist/ethers.js/src.ts/wallet/mnemonic.js.map create mode 100644 dist/ethers.js/src.ts/wallet/utils.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/utils.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/utils.js create mode 100644 dist/ethers.js/src.ts/wallet/utils.js.map create mode 100644 dist/ethers.js/src.ts/wallet/wallet.d.ts create mode 100644 dist/ethers.js/src.ts/wallet/wallet.d.ts.map create mode 100644 dist/ethers.js/src.ts/wallet/wallet.js create mode 100644 dist/ethers.js/src.ts/wallet/wallet.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/bit-reader.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/bit-reader.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/bit-reader.js create mode 100644 dist/ethers.js/src.ts/wordlists/bit-reader.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owl.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owl.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owl.js create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owl.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owla.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owla.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owla.js create mode 100644 dist/ethers.js/src.ts/wordlists/decode-owla.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/generation/encode-latin.js create mode 100644 dist/ethers.js/src.ts/wordlists/generation/encode-latin.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/index.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/index.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/index.js create mode 100644 dist/ethers.js/src.ts/wordlists/index.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-cz.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-cz.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-cz.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-cz.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-en.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-en.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-en.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-en.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-es.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-es.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-es.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-es.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-fr.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-fr.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-fr.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-fr.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-it.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-it.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-it.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-it.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ja.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ja.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ja.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ja.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ko.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ko.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ko.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-ko.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-pt.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-pt.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-pt.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-pt.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-zh.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/lang-zh.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/lang-zh.js create mode 100644 dist/ethers.js/src.ts/wordlists/lang-zh.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owl.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owl.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owla.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist-owla.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlist.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-browser.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-browser.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-extra.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists-extra.js.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists.d.ts create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists.d.ts.map create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists.js create mode 100644 dist/ethers.js/src.ts/wordlists/wordlists.js.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.js create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.js.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.module.js create mode 100644 dist/ethers.js/testcases/test-env/angular/src/app/app.module.js.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/main.d.ts create mode 100644 dist/ethers.js/testcases/test-env/angular/src/main.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/angular/src/main.js create mode 100644 dist/ethers.js/testcases/test-env/angular/src/main.js.map create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js.map create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts.map create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-module.js create mode 100644 dist/ethers.js/testcases/test-env/test-tsc/js-module.js.map create mode 100644 dist/index.d.ts create mode 100644 dist/index.d.ts.map create mode 100644 dist/index.js create mode 100644 dist/index.js.map create mode 100644 dist/lacchain-provider.d.ts create mode 100644 dist/lacchain-provider.d.ts.map create mode 100644 dist/lacchain-provider.js create mode 100644 dist/lacchain-provider.js.map create mode 100644 dist/lacchain-signer.d.ts create mode 100644 dist/lacchain-signer.d.ts.map create mode 100644 dist/lacchain-signer.js create mode 100644 dist/lacchain-signer.js.map create mode 100644 dist/lacchain-transaction-request.d.ts create mode 100644 dist/lacchain-transaction-request.d.ts.map create mode 100644 dist/lacchain-transaction-request.js create mode 100644 dist/lacchain-transaction-request.js.map create mode 100644 dist/lacchain-transaction.d.ts create mode 100644 dist/lacchain-transaction.d.ts.map create mode 100644 dist/lacchain-transaction.js create mode 100644 dist/lacchain-transaction.js.map create mode 100644 dist/test/e2e/deploy-and-tx.test.d.ts create mode 100644 dist/test/e2e/deploy-and-tx.test.d.ts.map create mode 100644 dist/test/e2e/deploy-and-tx.test.js create mode 100644 dist/test/e2e/deploy-and-tx.test.js.map create mode 100644 dist/test/e2e/test-contract.d.ts create mode 100644 dist/test/e2e/test-contract.d.ts.map create mode 100644 dist/test/e2e/test-contract.js create mode 100644 dist/test/e2e/test-contract.js.map create mode 100644 dist/test/fixtures copy.d.ts create mode 100644 dist/test/fixtures copy.d.ts.map create mode 100644 dist/test/fixtures copy.js create mode 100644 dist/test/fixtures.d.ts create mode 100644 dist/test/fixtures.d.ts.map create mode 100644 dist/test/fixtures.js create mode 100644 dist/test/fixtures.js.map create mode 100644 dist/test/index.test.d.ts create mode 100644 dist/test/index.test.d.ts.map create mode 100644 dist/test/index.test.js create mode 100644 dist/test/index.test.js.map create mode 100644 dist/test/lacchain-provider.test.d.ts create mode 100644 dist/test/lacchain-provider.test.d.ts.map create mode 100644 dist/test/lacchain-provider.test.js create mode 100644 dist/test/lacchain-provider.test.js.map create mode 100644 dist/test/lacchain-signer.test.d.ts create mode 100644 dist/test/lacchain-signer.test.d.ts.map create mode 100644 dist/test/lacchain-signer.test.js create mode 100644 dist/test/lacchain-signer.test.js.map create mode 100644 dist/test/lacchain-transaction-request.test.d.ts create mode 100644 dist/test/lacchain-transaction-request.test.d.ts.map create mode 100644 dist/test/lacchain-transaction-request.test.js create mode 100644 dist/test/lacchain-transaction-request.test.js.map create mode 100644 dist/test/lacchain-transaction.test.d.ts create mode 100644 dist/test/lacchain-transaction.test.d.ts.map create mode 100644 dist/test/lacchain-transaction.test.js create mode 100644 dist/test/lacchain-transaction.test.js.map create mode 100644 jest.config.e2e.js create mode 100644 jest.config.js create mode 100644 src/.DS_Store create mode 100644 src/lacchain-provider.ts create mode 100644 src/lacchain-signer.ts create mode 100644 src/lacchain-transaction-request.ts create mode 100644 src/lacchain-transaction.ts delete mode 100644 src/provider.ts delete mode 100644 src/signer.ts create mode 100644 src/test/e2e/deploy-and-tx.test.ts create mode 100644 src/test/e2e/test-contract.ts create mode 100644 src/test/fixtures.ts create mode 100644 src/test/index.test.ts create mode 100644 src/test/lacchain-provider.test.ts create mode 100644 src/test/lacchain-signer.test.ts create mode 100644 src/test/lacchain-transaction-request.test.ts create mode 100644 src/test/lacchain-transaction.test.ts delete mode 100644 tests/fixtures.ts delete mode 100644 tests/index.ts delete mode 100644 tslint.json diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..d673c50ced2da70c026823ad60b8f0f76a15c773 GIT binary patch literal 6148 zcmeHK-AcnS6i(c99Yg4af_N41cH%mQIJ_x!zJL|IP?@bATCB}zH+wM#eE@wSAH?VJ zoFoN@y%urjK=Pg6r1_xvVT^Ha9yyHJj4=xuB1ff0&|MqaFv*A<$H=E)B15n~!l{Y< zb--_Lu$*P=AuPUse-h`jUhk7{G@6@REvsd9tULcn7XB=l&2ulvZqT}vG6^d^2(RKv zF}8QkWI7AtbdsrpIGRAp?RA_+vhd_QjdE4%>wwj^+GBfvu{d;wCr(#5{lT&;7Q=q8 zD+b4d<+5$<9vq!sjGvR2RK96KIqZ~&fw02^E7^r0c_XhzD(KT3VR9gphczwor6A=Y;d`ln-gRa3+BSb*BE(O%3 z+&nS3E(gCbd9J}yqb_G$%?#t1nXAVOSF?j(sC33%jnoqZ#K0;84Q<+Z{-47yQ~StY zEg_2-AO`*!1H3u%M;5bB75Utr)1T (c.version === version))[0] : changes.shift(); + if (change == null) { + throw new Error(`version not found: ${version}`); + } + console.log(change); + // Find the gitHead and release date + const versions = yield (0, npm_js_1.getVersions)("ethers"); + const ver = versions.filter((c) => (c.version === change.version))[0]; + if (ver == null) { + throw new Error(`no npm version found: ${change.version}`); + } + console.log(ver); + const title = `${change.title.split("(")[0].trim()} (${(0, date_js_1.getDateTime)(new Date(ver.date))})`; + const args = [ + "release", "create", `v${change.version}`, + // "--draft", // DEBUGGING + "--title", title, + "--target", ver.gitHead, + "--notes", change.body.join("\n"), + ]; + console.log(args); + const result = yield (0, run_js_1.run)("gh", args, (0, path_js_1.resolve)(".")); + console.log("Published"); + console.log(`See: ${(result.stdout || "").trim()}`); + }); +})().catch((e) => { + console.log("ERROR"); + console.log(e); +}); +//# sourceMappingURL=create-release.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/create-release.js.map b/dist/ethers.js/src.ts/_admin/create-release.js.map new file mode 100644 index 0000000..f19af09 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/create-release.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-release.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/create-release.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uDAAkD;AAClD,6CAA8C;AAC9C,6CAA0C;AAC1C,2CAAqC;AACrC,2CAA6C;AAG7C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC;AAExC,CAAC;;QAEG,oCAAoC;QACpC,MAAM,OAAO,GAAG,IAAA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,CAAC;SACpC,CAAC;QACF,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAClB,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAC,IAAI,EAAE,IAAI,EAAE,IAAA,iBAAO,EAAC,GAAG,CAAC,CAAC,CAAC;QACnD,OAAO,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,QAAS,CAAC,MAAM,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,IAAI,EAAG,EAAE,CAAC,CAAC;IAC1D,CAAC;CAAA,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE;IACb,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACnB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts b/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts new file mode 100644 index 0000000..35ddf43 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=generate-diffs.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts.map b/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts.map new file mode 100644 index 0000000..34e2525 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/generate-diffs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"generate-diffs.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/generate-diffs.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/generate-diffs.js b/dist/ethers.js/src.ts/_admin/generate-diffs.js new file mode 100644 index 0000000..0503cbe --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/generate-diffs.js @@ -0,0 +1,41 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs_1 = __importDefault(require("fs")); +const npm_js_1 = require("./utils/npm.js"); +const path_js_1 = require("./utils/path.js"); +const git_js_1 = require("./utils/git.js"); +function escver(v) { + return v.replace(/\./, "-"); +} +(function () { + return __awaiter(this, void 0, void 0, function* () { + let versions = yield (0, npm_js_1.getVersions)("ethers"); + versions = versions.filter((h) => (h.version.match(/^6\.[0-9]+\.[0-9]+$/))); + fs_1.default.writeFileSync((0, path_js_1.resolve)("misc/diffs/versions.txt"), versions.map((h) => h.version).join(",")); + for (let i = 0; i < versions.length; i++) { + for (let j = i + 1; j < versions.length; j++) { + const filename = (0, path_js_1.resolve)(`misc/diffs/diff-${escver(versions[i].version)}_${escver(versions[j].version)}.txt`); + if (fs_1.default.existsSync(filename)) { + continue; + } + const tag0 = versions[i].gitHead, tag1 = versions[j].gitHead; + const diff = yield (0, git_js_1.getDiff)((0, path_js_1.resolve)("src.ts"), tag0, tag1); + console.log({ diff }); + fs_1.default.writeFileSync(filename, diff); + } + } + }); +})(); +//# sourceMappingURL=generate-diffs.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/generate-diffs.js.map b/dist/ethers.js/src.ts/_admin/generate-diffs.js.map new file mode 100644 index 0000000..6c9cfc7 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/generate-diffs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"generate-diffs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GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC;gBAC7D,MAAM,IAAI,GAAG,MAAM,IAAA,gBAAO,EAAC,IAAA,iBAAO,EAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;gBAC1D,OAAO,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC;gBACtB,YAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;aACpC;SACJ;IACL,CAAC;CAAA,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/test-browser.d.ts b/dist/ethers.js/src.ts/_admin/test-browser.d.ts new file mode 100644 index 0000000..3c3ec88 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/test-browser.d.ts @@ -0,0 +1,32 @@ +/** + * + * + * Paths + * /index.js => dist/ethers.js + * /tests/utils.js => in-memory hijack + * /static/* => output/* + * - index.html + * - assert.js + * /tests/* => lib.esm/_tests/* + */ +/// +import { WebSocket } from "ws"; +import { Server } from "http"; +export declare function getMime(filename: string): string; +export declare class CDPSession { + #private; + readonly websocket: WebSocket; + constructor(url: string); + get target(): string; + get ready(): Promise; + get done(): Promise; + send(method: string, params: any): Promise; + _send(method: string, params: any): Promise; + navigate(url: string): Promise; +} +export type Options = { + port?: number; + redirects?: Record; +}; +export declare function start(_root: string, options: Options): Promise; +//# sourceMappingURL=test-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/test-browser.d.ts.map b/dist/ethers.js/src.ts/_admin/test-browser.d.ts.map new file mode 100644 index 0000000..b1629d5 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/test-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/test-browser.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;;AAQH,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAE/B,OAAO,EAAgB,MAAM,EAAE,MAAM,MAAM,CAAC;AAuB5C,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAShD;AAOD,qBAAa,UAAU;;IACnB,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAclB,GAAG,EAAE,MAAM;IA4EvB,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAKzB;IAED,IAAI,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAE1B;IAEK,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAO/C,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO,CAAC,GAAG,CAAC;IAahD,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG7C;AAED,MAAM,MAAM,OAAO,GAAG;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACtC,CAAC;AAgCF,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CAyGtE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/test-browser.js b/dist/ethers.js/src.ts/_admin/test-browser.js new file mode 100644 index 0000000..f1bd60a --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/test-browser.js @@ -0,0 +1,365 @@ +"use strict"; +/** + * + * + * Paths + * /index.js => dist/ethers.js + * /tests/utils.js => in-memory hijack + * /static/* => output/* + * - index.html + * - assert.js + * /tests/* => lib.esm/_tests/* + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _CDPSession_id, _CDPSession_resp, _CDPSession_readyOpen, _CDPSession_readyPage, _CDPSession_target, _CDPSession_session, _CDPSession_done, _CDPSession_exit; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.start = exports.CDPSession = exports.getMime = void 0; +// See: https://vanilla.aslushnikov.com/?Console +const fs_1 = __importDefault(require("fs")); +const child_process_1 = __importDefault(require("child_process")); +const zlib_1 = __importDefault(require("zlib")); +const ws_1 = require("ws"); +const http_1 = require("http"); +const path_1 = require("path"); +const mimes = { + css: "text/css", + doctree: "application/x-doctree", + eot: "application/vnd.ms-fontobject", + gif: "image/gif", + html: "text/html", + ico: "image/x-icon", + js: "application/javascript", + jpg: "image/jpeg", + jpeg: "image/jpeg", + json: "application/json", + map: "application/json", + md: "text/markdown", + png: "image/png", + svg: "image/svg+xml", + ttf: "application/x-font-ttf", + txt: "text/plain", + woff: "application/font-woff" +}; +function getMime(filename) { + const mime = mimes[(filename.split('.').pop() || "").toLowerCase()]; + if (mime == null) { + console.log(`WARN: NO MIME for ${filename}`); + return "application/octet-stream"; + } + return mime; +} +exports.getMime = getMime; +class CDPSession { + constructor(url) { + _CDPSession_id.set(this, void 0); + _CDPSession_resp.set(this, void 0); + _CDPSession_readyOpen.set(this, void 0); + _CDPSession_readyPage.set(this, void 0); + _CDPSession_target.set(this, void 0); + _CDPSession_session.set(this, void 0); + _CDPSession_done.set(this, void 0); + _CDPSession_exit.set(this, void 0); + this.websocket = new ws_1.WebSocket(url); + __classPrivateFieldSet(this, _CDPSession_id, 1, "f"); + __classPrivateFieldSet(this, _CDPSession_resp, new Map(), "f"); + __classPrivateFieldSet(this, _CDPSession_exit, (status) => { }, "f"); + __classPrivateFieldSet(this, _CDPSession_done, new Promise((resolve) => { + __classPrivateFieldSet(this, _CDPSession_exit, resolve, "f"); + }), "f"); + __classPrivateFieldSet(this, _CDPSession_target, "", "f"); + __classPrivateFieldSet(this, _CDPSession_session, "", "f"); + const readyOpen = new Promise((resolve, reject) => { + this.websocket.onopen = () => __awaiter(this, void 0, void 0, function* () { resolve(); }); + }); + const readyPage = (() => __awaiter(this, void 0, void 0, function* () { + yield readyOpen; + const target = yield this._send("Target.getTargets", {}); + if (target.targetInfos.length) { + __classPrivateFieldSet(this, _CDPSession_target, target.targetInfos[0].targetId, "f"); + } + else { + const target = yield this._send("Target.createTarget", { url: "" }); + __classPrivateFieldSet(this, _CDPSession_target, target.targetId, "f"); + } + const attached = yield this._send("Target.attachToTarget", { + targetId: __classPrivateFieldGet(this, _CDPSession_target, "f"), + flatten: true + }); + __classPrivateFieldSet(this, _CDPSession_session, attached.sessionId, "f"); + }))(); + __classPrivateFieldSet(this, _CDPSession_readyOpen, readyOpen, "f"); + __classPrivateFieldSet(this, _CDPSession_readyPage, readyPage, "f"); + this.websocket.onmessage = (_msg) => { + const msg = JSON.parse(_msg.data); + if (msg.id != null) { + const responder = __classPrivateFieldGet(this, _CDPSession_resp, "f").get(msg.id); + __classPrivateFieldGet(this, _CDPSession_resp, "f").delete(msg.id); + if (responder == null) { + console.log("WARN: unknown request ${ msg.id }"); + return; + } + if (msg.error) { + responder.reject(new Error(msg.error)); + } + else { + responder.resolve(msg.result); + } + } + else { + if (msg.method === "Console.messageAdded") { + const text = msg.params.message.text; + if (text.startsWith("#status")) { + __classPrivateFieldGet(this, _CDPSession_exit, "f").call(this, parseInt(text.split("=").pop())); + } + console.log(text); + //console.log(msg.params.message.text, `${ msg.params.message.url }:${ msg.params.message.line }`); + } + else if (msg.method === "Target.attachedToTarget") { + } + else { + console.log(`WARN: Unhandled event - ${JSON.stringify(msg)}`); + } + } + }; + this.websocket.onerror = (error) => { + console.log(`WARN: WebSocket error - ${JSON.stringify(error)}`); + }; + } + get target() { + return __classPrivateFieldGet(this, _CDPSession_target, "f"); + } + get ready() { + return (() => __awaiter(this, void 0, void 0, function* () { + yield __classPrivateFieldGet(this, _CDPSession_readyOpen, "f"); + yield __classPrivateFieldGet(this, _CDPSession_readyPage, "f"); + }))(); + } + get done() { + return __classPrivateFieldGet(this, _CDPSession_done, "f"); + } + send(method, params) { + return __awaiter(this, void 0, void 0, function* () { + yield __classPrivateFieldGet(this, _CDPSession_readyOpen, "f"); + yield __classPrivateFieldGet(this, _CDPSession_readyPage, "f"); + return this._send(method, params); + }); + } + _send(method, params) { + var _a, _b; + return __awaiter(this, void 0, void 0, function* () { + const id = (__classPrivateFieldSet(this, _CDPSession_id, (_b = __classPrivateFieldGet(this, _CDPSession_id, "f"), _a = _b++, _b), "f"), _a); + const payload = { id, method, params }; + if (__classPrivateFieldGet(this, _CDPSession_session, "f")) { + payload.sessionId = __classPrivateFieldGet(this, _CDPSession_session, "f"); + } + this.websocket.send(JSON.stringify(payload)); + return new Promise((resolve, reject) => { + __classPrivateFieldGet(this, _CDPSession_resp, "f").set(id, { resolve, reject }); + }); + }); + } + navigate(url) { + return __awaiter(this, void 0, void 0, function* () { + yield this.send("Page.navigate", { url }); + }); + } +} +exports.CDPSession = CDPSession; +_CDPSession_id = new WeakMap(), _CDPSession_resp = new WeakMap(), _CDPSession_readyOpen = new WeakMap(), _CDPSession_readyPage = new WeakMap(), _CDPSession_target = new WeakMap(), _CDPSession_session = new WeakMap(), _CDPSession_done = new WeakMap(), _CDPSession_exit = new WeakMap(); +const TestData = (function () { + function load(tag) { + const filename = (0, path_1.resolve)("testcases", tag + ".json.gz"); + const data = zlib_1.default.gunzipSync(fs_1.default.readFileSync(filename)); + return [String(data.length), zlib_1.default.deflateRawSync(data).toString("base64")].join(","); + } + let data = []; + data.push(`import { ethers } from "/index.js";`); + data.push(`import { inflate } from "/static/tiny-inflate.js";`); + data.push(`const fs = new Map();`); + for (const filename of fs_1.default.readdirSync("testcases")) { + if (!filename.endsWith(".json.gz")) { + continue; + } + const tag = filename.split(".")[0]; + data.push(`fs.set(${JSON.stringify(tag)}, ${JSON.stringify(load(tag))});`); + } + data.push(`export function loadTests(tag) {`); + data.push(` const data = fs.get(tag);`); + data.push(` if (data == null) { throw new Error("missing tag: " + tag); }`); + data.push(` const comps = data.split(",");`); + data.push(` const result = new Uint8Array(parseInt(comps[0]));`); + data.push(` inflate(ethers.decodeBase64(comps[1]), result);`); + data.push(` return JSON.parse(ethers.toUtf8String(result))`); + data.push(`}`); + return data.join("\n"); +})(); +function start(_root, options) { + if (options == null) { + options = {}; + } + if (options.port == null) { + options.port = 8000; + } + const server = (0, http_1.createServer)((req, resp) => { + const url = (req.url || "").split("?")[0]; + let transform = false; + let filename; + if (url === "/") { + filename = "./misc/test-browser/index.html"; + } + else if (url === "/ethers.js" || url === "/index.js") { + filename = "./dist/ethers.js"; + } + else if (url === "/ethers.js.map") { + filename = "./dist/ethers.js.map"; + } + else if (url.startsWith("/static/")) { + filename = "./misc/test-browser/" + url.substring(8); + } + else if (url === "/tests/utils.js") { + //console.log({ status: 200, content: `<>` }); + resp.writeHead(200, { + "Content-Length": TestData.length, + "Content-Type": getMime("testdata.js") + }); + resp.end(TestData); + return; + } + else if (url.startsWith("/tests/")) { + transform = true; + filename = (0, path_1.join)("./lib.esm/_tests", url.substring(7)); + } + else { + //console.log("FALLBACK"); + filename = url.substring(1); + } + // Make sure we aren't crawling out of our sandbox + if (url[0] !== "/" || filename.substring(0, filename.length) !== filename) { + //console.log({ status: 403, reason: "escaping" }); + resp.writeHead(403); + resp.end(); + return; + } + try { + const stat = fs_1.default.statSync(filename); + if (stat.isDirectory()) { + // Redirect bare directory to its path (i.e. "/foo" => "/foo/") + if (url[url.length - 1] !== "/") { + //console.log({ status: 301, location: (url + "/") }); + resp.writeHead(301, { Location: url + "/" }); + resp.end(); + return; + } + filename += "/index.html"; + } + let content = fs_1.default.readFileSync(filename); + if (transform) { + content = Buffer.from(content.toString().replace(/import ([^;]*) from "([^"]*)";/g, (all, names, filename) => { + switch (filename) { + case "assert": + //case "path": + //case "fs": + //case "zlib": + return `import ${names} from "/static/${filename}.js"`; + } + return all; + })); + } + //console.log({ status: 200, filename }); + resp.writeHead(200, { + "Content-Length": content.length, + "Content-Type": getMime(filename) + }); + resp.end(content); + return; + } + catch (error) { + if (error.code === "ENOENT") { + //console.log({ status: 404, filename }); + console.log(`WARN: Not found - ${filename}`); + resp.writeHead(404, {}); + resp.end(); + return; + } + //console.log({ status: 500, error: error.toString() }); + console.log(`WARN: Server error - ${error.toString()}`); + resp.writeHead(500, {}); + resp.end(); + return; + } + }); + return new Promise((resolve, reject) => { + server.listen(options.port, () => { + console.log(`Server running on: http://localhost:${options.port}`); + resolve(server); + }); + }); +} +exports.start = start; +(function () { + return __awaiter(this, void 0, void 0, function* () { + yield start((0, path_1.resolve)("."), { port: 8000 }); + const cmds = [ + "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome", + "/usr/bin/chromium" + ].filter((f) => { try { + fs_1.default.accessSync(f); + return true; + } + catch (error) { + return false; + } }); + if (cmds.length === 0) { + throw new Error("no installed browser found"); + } + const cmd = cmds[0]; + const args = ["--headless", "--disable-gpu", "--remote-debugging-port=8022"]; + const browser = child_process_1.default.spawn(cmd, args); + let url = yield new Promise((resolve, reject) => { + browser.stdout.on("data", (data) => { + console.log("OUT", data.toString()); + }); + browser.stderr.on("data", (data) => { + const text = data.toString(); + for (const line of text.split("\n")) { + const match = line.match(/^DevTools listening on (.*)$/); + if (match) { + resolve(match[1]); + return; + } + } + }); + }); + console.log("URL:", url); + const session = new CDPSession(url); + yield session.ready; + yield session.send("Console.enable", {}); + yield session.navigate("http:/\/localhost:8000"); + const status = yield session.done; + console.log("STATUS:", status); + process.exit(status); + }); +})(); +//# sourceMappingURL=test-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/test-browser.js.map b/dist/ethers.js/src.ts/_admin/test-browser.js.map new file mode 100644 index 0000000..6de2ea2 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/test-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/test-browser.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAAgD;AAEhD,4CAAoB;AACpB,kEAA0C;AAC1C,gDAAwB;AAExB,2BAA+B;AAE/B,+BAA4C;AAC5C,+BAAqC;AAErC,MAAM,KAAK,GAA2B;IACpC,GAAG,EAAE,UAAU;IACf,OAAO,EAAE,uBAAuB;IAChC,GAAG,EAAE,+BAA+B;IACpC,GAAG,EAAE,WAAW;IAChB,IAAI,EAAE,WAAW;IACjB,GAAG,EAAE,cAAc;IACnB,EAAE,EAAE,wBAAwB;IAC5B,GAAG,EAAE,YAAY;IACjB,IAAI,EAAE,YAAY;IAClB,IAAI,EAAE,kBAAkB;IACxB,GAAG,EAAE,kBAAkB;IACvB,EAAE,EAAE,eAAe;IACnB,GAA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,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;oBACjC,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,8BAA8B,CAAC,CAAA;oBACxD,IAAI,KAAK,EAAE;wBACP,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;wBAClB,OAAO;qBACV;iBACJ;YACL,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;QAEzB,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;QACpC,MAAM,OAAO,CAAC,KAAK,CAAC;QACpB,MAAM,OAAO,CAAC,IAAI,CAAC,gBAAgB,EAAE,EAAG,CAAC,CAAC;QAC1C,MAAM,OAAO,CAAC,QAAQ,CAAC,wBAAwB,CAAC,CAAC;QAEjD,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC;QAClC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;QAC/B,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzB,CAAC;CAAA,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-changelog.d.ts b/dist/ethers.js/src.ts/_admin/update-changelog.d.ts new file mode 100644 index 0000000..9559d61 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-changelog.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=update-changelog.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-changelog.d.ts.map b/dist/ethers.js/src.ts/_admin/update-changelog.d.ts.map new file mode 100644 index 0000000..7fea9d3 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-changelog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"update-changelog.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/update-changelog.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-changelog.js b/dist/ethers.js/src.ts/_admin/update-changelog.js new file mode 100644 index 0000000..a1b6645 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-changelog.js @@ -0,0 +1,178 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const fs_1 = __importDefault(require("fs")); +const git_js_1 = require("./utils/git.js"); +const json_js_1 = require("./utils/json.js"); +const path_js_1 = require("./utils/path.js"); +const npm_js_1 = require("./utils/npm.js"); +const date_js_1 = require("./utils/date.js"); +function repeat(c, length) { + if (c.length === 0) { + throw new Error("too short"); + } + while (c.length < length) { + c += c; + } + return c.substring(0, length); +} +function getChanges(tag0, tag1) { + return __awaiter(this, void 0, void 0, function* () { + const result = []; + const logs = yield (0, git_js_1.getLogs)(null, { tag0, tag1 }); + for (const log of logs) { + if (log.body.startsWith("admin:") || log.body.startsWith("docs:")) { + continue; + } + let message = log.body; + const issues = []; + message = message.replace(/\((([0-9#,]|\s)*)\)/g, (all, text) => { + text = text.replace(/#([0-9]+)/g, (all, issue) => { + issues.push(issue); + return ""; + }); + if (text.replace(/,/g, "").trim()) { + console.log(`WARNING: commit leftovers ${JSON.stringify(text)}`); + } + return ""; + }).replace(/\.+\s*$/, "").trim(); + result.push({ message, issues, commit: log.commit }); + } + return result; + }); +} +(function () { + return __awaiter(this, void 0, void 0, function* () { + // Get the already included versions in the CHANGELOG + const present = [{ version: "null", body: [] }]; + { + const content = fs_1.default.readFileSync((0, path_js_1.resolve)("CHANGELOG.md")).toString(); + for (const line of content.split("\n")) { + let match = line.match(/^ethers\/v(\S+)\s/); + if (match) { + present.push({ version: match[1], body: [line] }); + } + else { + present[present.length - 1].body.push(line); + } + } + for (const { body } of present) { + while (body[body.length - 1].trim() === "") { + body.pop(); + } + } + } + // Get the remote versions (along with their date and gitHead) + let versions = yield (0, npm_js_1.getVersions)("ethers"); + versions = versions.filter((v) => (v.version.match(/^6\.[0-9]+\.[0-9]+$/))); + const entries = []; + const getPresent = (version) => { + const pres = present.filter((p) => (p.version === version)); + return pres.length ? pres[0] : null; + }; + // Add the first entry, which has no previous version to compare against + { + const pres = getPresent(versions[0].version); + if (pres) { + entries.push(pres); + } + else { + entries.push({ + date: (0, date_js_1.getDateTime)(new Date(versions[0].date)), + version: versions[0].version, + changes: [{ + message: "Initial release", + issues: [], + commit: versions[0].gitHead + }] + }); + } + } + // Add each version, with preference given to present entries, as + // they may have been updated manually + let lastVer = versions[0]; + for (let i = 1; i < versions.length; i++) { + const ver = versions[i]; + // Prefer present entries + const pres = getPresent(ver.version); + if (pres) { + entries.push(pres); + lastVer = ver; + continue; + } + // Get the entry info from git + const version = ver.version; + const date = (0, date_js_1.getDateTime)(new Date(ver.date)); + const changes = yield getChanges(lastVer.gitHead, ver.gitHead); + entries.push({ date, version, changes }); + lastVer = ver; + } + // If this is a new version (not present in npm) add the changes + // from the lastest version until HEAD. + const curVer = (0, json_js_1.loadJson)((0, path_js_1.resolve)("package.json")).version; + if (curVer !== lastVer) { + // Include any present entry, as it was placed here by a + // previous run of update-changelog and may have been + // modified manually + const pres = getPresent(curVer); + if (pres) { + console.log(`WARNING: existing entry for ${curVer}; duplicating`); + entries.push(pres); + } + // Also include theentry from git + const latest = yield getChanges(lastVer.gitHead, "HEAD"); + if (latest.length) { + entries.push({ + date: (0, date_js_1.getDateTime)(new Date()), + version: curVer, + changes: latest + }); + } + } + // Gerenate the CHANGELOG.md output + const output = []; + output.push("Change Log"); + output.push("=========="); + output.push(""); + output.push("This change log is maintained by `src.ts/_admin/update-changelog.ts` but may also be manually updated."); + output.push(""); + for (const ver of entries.reverse()) { + // Present entry; include verbatim + if ("body" in ver) { + ver.body.forEach((line) => output.push(line)); + output.push(""); + continue; + } + // Entry from git; format it nicely + const title = `ethers/v${ver.version} (${ver.date})`; + output.push(title); + output.push(repeat("-", title.length)); + output.push(""); + for (const change of ver.changes) { + let line = ` - ${change.message} (`; + line += change.issues.map((i) => { + return `[#${i}](https:/\/github.com/ethers-io/ethers.js/issues/${i})`; + }).join(", "); + if (change.issues.length) { + line += "; "; + } + line += `[${change.commit.substring(0, 7)}](https:/\/github.com/ethers-io/ethers.js/commit/${change.commit})).`; + output.push(line); + } + output.push(""); + } + fs_1.default.writeFileSync((0, path_js_1.resolve)("CHANGELOG.md"), output.join("\n")); + }); +})(); +//# sourceMappingURL=update-changelog.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-changelog.js.map b/dist/ethers.js/src.ts/_admin/update-changelog.js.map new file mode 100644 index 0000000..2d36e67 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-changelog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"update-changelog.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/update-changelog.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,4CAAoB;AAEpB,2CAAyC;AACzC,6CAA2C;AAC3C,6CAA0C;AAC1C,2CAA6C;AAC7C,6CAA8C;AAE9C,SAAS,MAAM,CAAC,CAAS,EAAE,MAAc;IACrC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;IACrD,OAAM,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE;QAAE,CAAC,IAAI,CAAC,CAAC;KAAE;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AC,CAAE,oDAAqD,MAAM,CAAC,MAAO,KAAK,CAAC;gBACpH,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;aACpB;YACD,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACnB;QAED,YAAE,CAAC,aAAa,CAAC,IAAA,iBAAO,EAAC,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IACjE,CAAC;CAAA,CAAC,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-version.d.ts b/dist/ethers.js/src.ts/_admin/update-version.d.ts new file mode 100644 index 0000000..933287b --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-version.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=update-version.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-version.d.ts.map b/dist/ethers.js/src.ts/_admin/update-version.d.ts.map new file mode 100644 index 0000000..852166a --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-version.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"update-version.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/update-version.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-version.js b/dist/ethers.js/src.ts/_admin/update-version.js new file mode 100644 index 0000000..49ce46d --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-version.js @@ -0,0 +1,118 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const semver_1 = __importDefault(require("semver")); +const index_js_1 = require("../utils/index.js"); +const fs_js_1 = require("./utils/fs.js"); +const git_js_1 = require("./utils/git.js"); +const json_js_1 = require("./utils/json.js"); +const path_js_1 = require("./utils/path.js"); +const cache = {}; +function getNpmPackage(name) { + return __awaiter(this, void 0, void 0, function* () { + if (!cache[name]) { + const resp = yield (new index_js_1.FetchRequest("https:/\/registry.npmjs.org/" + name)).send(); + resp.assertOk(); + cache[name] = resp.bodyJson; + } + return cache[name] || null; + }); +} +function writeVersion(version) { + const content = `/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */\n\n/**\n * The current version of Ethers.\n */\nexport const version: string = "${version}";\n`; + (0, fs_js_1.atomicWrite)((0, path_js_1.resolve)("src.ts/_version.ts"), content); +} +(function () { + return __awaiter(this, void 0, void 0, function* () { + // Local pkg + const pkgPath = (0, path_js_1.resolve)("package.json"); + const pkgInfo = (0, json_js_1.loadJson)(pkgPath); + const tag = pkgInfo.publishConfig.tag; + // Get the remote version that matches our dist-tag + const remoteInfo = yield getNpmPackage(pkgInfo.name); + const remoteVersion = remoteInfo["dist-tags"][tag]; + // Remote pkg + const remotePkgInfo = remoteInfo.versions[remoteVersion]; + const remoteGitHead = remotePkgInfo.gitHead; + let gitHead = ""; + for (const log of yield (0, git_js_1.getLogs)(["."])) { + if (log.body.startsWith("admin:")) { + continue; + } + if (log.body.startsWith("docs:")) { + continue; + } + if (log.body.startsWith("tests:")) { + continue; + } + gitHead = log.commit; + break; + } + if (gitHead === "") { + throw new Error("no meaningful commit found"); + } + // There are new commits, not reflected in the package + // published on npm; update the gitHead and version + if (gitHead !== remoteGitHead) { + // Bump the version from the remote version + if (tag.indexOf("beta") >= 0) { + // Still a beta branch; advance the beta version + const prerelease = semver_1.default.prerelease(remoteVersion); + if (prerelease == null || prerelease.length !== 2) { + throw new Error("no prerelease found"); + } + pkgInfo.version = semver_1.default.inc(remoteVersion, "prerelease", String(prerelease[0])); + } + else if (semver_1.default.minor(remoteVersion) == semver_1.default.minor(pkgInfo.version)) { + // If we want to bump the minor version, it was done explicitly in the pkg + pkgInfo.version = semver_1.default.inc(remoteVersion, "patch"); + } + pkgInfo.gitHead = gitHead; + // Save the package.json + const check = { "default": 1, "require": 1, "import": 1, "types": 1 }; + (0, json_js_1.saveJson)(pkgPath, pkgInfo, (path, a, b) => { + if ((path.startsWith("./") || path === ".") && check[a] && check[b]) { + const cmp = a.localeCompare(b); + if (cmp === 0) { + return cmp; + } + // Make sure require comes first; it has the types built-in + // so its ok + if (a === "require") { + return -1; + } + if (b === "require") { + return 1; + } + // Favour types the next-first and default for last + if (a === "types" || b === "default") { + return -1; + } + if (b === "types" || a === "default") { + return 1; + } + return cmp; + } + return a.localeCompare(b); + }); + // Save the src.ts/_version.ts + writeVersion(pkgInfo.version); + } + }); +})().catch((error) => { + console.log("ERROR"); + console.log(error); + process.exit(1); +}); +//# sourceMappingURL=update-version.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/update-version.js.map b/dist/ethers.js/src.ts/_admin/update-version.js.map new file mode 100644 index 0000000..43391c2 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/update-version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"update-version.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_admin/update-version.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,gDAAiD;AAEjD,yCAA4C;AAC5C,2CAAyC;AACzC,6CAAqD;AACrD,6CAA0C;AAE1C,MAAM,KAAK,GAAwB,EAAG,CAAC;AAEvC,SAAe,aAAa,CAAC,IAAY;;QACrC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,uBAAY,CAAC,8BAA8B,GAAG,IAAI,CAAC,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,UAAU,CAAC,IAAI,CAAC,IAAI,IAAI,KAAK,GAAG,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,EAAE;oBACjE,MAAM,GAAG,GAAG,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;oBAC/B,IAAI,GAAG,KAAK,CAAC,EAAE;wBAAE,OAAO,GAAG,CAAC;qBAAE;oBAE9B,2DAA2D;oBAC3D,YAAY;oBACZ,IAAI,CAAC,KAAK,SAAS,EAAE;wBAAE,OAAO,CAAC,CAAC,CAAC;qBAAE;oBACnC,IAAI,CAAC,KAAK,SAAS,EAAE;wBAAE,OAAO,CAAC,CAAC;qBAAE;oBAElC,mDAAmD;oBACnD,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,SAAS,EAAE;wBAAE,OAAO,CAAC,CAAC,CAAC;qBAAE;oBACpD,IAAI,CAAC,KAAK,OAAO,IAAI,CAAC,KAAK,SAAS,EAAE;wBAAE,OAAO,CAAC,CAAC;qBAAE;oBACnD,OAAO,GAAG,CAAC;iBACd;gBACD,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;YAEH,8BAA8B;YAC9B,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;SACjC;IAEL,CAAC;CAAA,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACjB,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACrB,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACnB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts b/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts new file mode 100644 index 0000000..27d912f --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts @@ -0,0 +1,7 @@ +export type ChangeVersion = { + version: string; + title: string; + body: Array; +}; +export declare function getChanges(): Array; +//# sourceMappingURL=changelog.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts.map new file mode 100644 index 0000000..6f15011 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/changelog.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"changelog.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/changelog.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACvB,CAAC;AAEF,wBAAgB,UAAU,IAAI,KAAK,CAAC,aAAa,CAAC,CAqBjD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/changelog.js b/dist/ethers.js/src.ts/_admin/utils/changelog.js new file mode 100644 index 0000000..fbb7102 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/changelog.js @@ -0,0 +1,30 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getChanges = void 0; +const fs_1 = __importDefault(require("fs")); +const path_js_1 = require("./path.js"); +function getChanges() { + const changes = [ + { title: "", version: "null", body: [] } + ]; + const content = fs_1.default.readFileSync((0, path_js_1.resolve)("CHANGELOG.md")).toString(); + for (const line of content.split("\n")) { + let match = line.match(/^ethers\/v(\S+)\s/); + if (match) { + changes.push({ version: match[1], title: line.trim(), body: [] }); + } + else { + const l = line.trim(); + if (l && !l.match(/^-+$/)) { + changes[changes.length - 1].body.push(l); + } + } + } + changes.shift(); + return changes; +} +exports.getChanges = getChanges; +//# sourceMappingURL=changelog.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/changelog.js.map b/dist/ethers.js/src.ts/_admin/utils/changelog.js.map new file mode 100644 index 0000000..14a99a6 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/changelog.js.map @@ -0,0 +1 @@ +{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/changelog.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,uCAAoC;AAQpC,SAAgB,UAAU;IACtB,MAAM,OAAO,GAAyB;QAClC,EAAE,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,EAAG,EAAE;KAC5C,CAAC;IAEF,MAAM,OAAO,GAAG,YAAE,CAAC,YAAY,CAAC,IAAA,iBAAO,EAAC,cAAc,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC;IACpE,KAAK,MAAM,IAAI,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;QACpC,IAAI,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC5C,IAAI,KAAK,EAAE;YACP,OAAO,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAG,EAAE,CAAC,CAAC;SACtE;aAAM;YACH,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;gBACvB,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aAC5C;SACJ;KACJ;IAED,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,OAAO,OAAO,CAAC;AACnB,CAAC;AArBD,gCAqBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/date.d.ts b/dist/ethers.js/src.ts/_admin/utils/date.d.ts new file mode 100644 index 0000000..73e011d --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/date.d.ts @@ -0,0 +1,2 @@ +export declare function getDateTime(date: Date): string; +//# sourceMappingURL=date.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/date.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/date.d.ts.map new file mode 100644 index 0000000..a2e4235 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/date.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"date.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/date.ts"],"names":[],"mappings":"AAqBA,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAK9C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/date.js b/dist/ethers.js/src.ts/_admin/utils/date.js new file mode 100644 index 0000000..57fb29b --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/date.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDateTime = void 0; +function repeat(c, length) { + if (c.length === 0) { + throw new Error("too short"); + } + while (c.length < length) { + c += c; + } + return c.substring(0, length); +} +function zpad(value, length) { + if (length == null) { + length = 2; + } + const str = String(value); + return repeat("0", length - str.length) + str; +} +function getDate(date) { + return [ + date.getFullYear(), + zpad(date.getMonth() + 1), + zpad(date.getDate()) + ].join("-"); +} +function getDateTime(date) { + return getDate(date) + " " + [ + zpad(date.getHours()), + zpad(date.getMinutes() + 1) + ].join(":"); +} +exports.getDateTime = getDateTime; +//# sourceMappingURL=date.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/date.js.map b/dist/ethers.js/src.ts/_admin/utils/date.js.map new file mode 100644 index 0000000..40906e1 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/date.js.map @@ -0,0 +1 @@ +{"version":3,"file":"date.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/date.ts"],"names":[],"mappings":";;;AACA,SAAS,MAAM,CAAC,CAAS,EAAE,MAAc;IACrC,IAAI,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;IACrD,OAAM,CAAC,CAAC,MAAM,GAAG,MAAM,EAAE;QAAE,CAAC,IAAI,CAAC,CAAC;KAAE;IACpC,OAAO,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC;AAClC,CAAC;AAED,SAAS,IAAI,CAAC,KAAa,EAAE,MAAe;IACxC,IAAI,MAAM,IAAI,IAAI,EAAE;QAAE,MAAM,GAAG,CAAC,CAAC;KAAE;IACnC,MAAM,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,CAAC,GAAG,GAAG,CAAC;AAClD,CAAC;AAED,SAAS,OAAO,CAAC,IAAU;IACvB,OAAO;QACH,IAAI,CAAC,WAAW,EAAE;QAClB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;QACzB,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;KACvB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC;AAED,SAAgB,WAAW,CAAC,IAAU;IAClC,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,GAAG,GAAG;QACzB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;QACrB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;KAC9B,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC;AALD,kCAKC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/fs.d.ts b/dist/ethers.js/src.ts/_admin/utils/fs.d.ts new file mode 100644 index 0000000..fc65297 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/fs.d.ts @@ -0,0 +1,2 @@ +export declare function atomicWrite(path: string, value: string | Uint8Array): void; +//# sourceMappingURL=fs.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/fs.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/fs.d.ts.map new file mode 100644 index 0000000..2303bd9 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/fs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/fs.ts"],"names":[],"mappings":"AAIA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAI1E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/fs.js b/dist/ethers.js/src.ts/_admin/utils/fs.js new file mode 100644 index 0000000..d81a3da --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/fs.js @@ -0,0 +1,15 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.atomicWrite = void 0; +const fs_1 = __importDefault(require("fs")); +const path_js_1 = require("./path.js"); +function atomicWrite(path, value) { + const tmp = (0, path_js_1.resolve)(".atomic-tmp"); + fs_1.default.writeFileSync(tmp, value); + fs_1.default.renameSync(tmp, path); +} +exports.atomicWrite = atomicWrite; +//# sourceMappingURL=fs.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/fs.js.map b/dist/ethers.js/src.ts/_admin/utils/fs.js.map new file mode 100644 index 0000000..36363d2 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/fs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fs.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/fs.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,uCAAoC;AAEpC,SAAgB,WAAW,CAAC,IAAY,EAAE,KAA0B;IAChE,MAAM,GAAG,GAAG,IAAA,iBAAO,EAAC,aAAa,CAAC,CAAC;IACnC,YAAE,CAAC,aAAa,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC7B,YAAE,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;AAC7B,CAAC;AAJD,kCAIC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/git.d.ts b/dist/ethers.js/src.ts/_admin/utils/git.d.ts new file mode 100644 index 0000000..4fe7e80 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/git.d.ts @@ -0,0 +1,15 @@ +export declare function getGitTag(filename: string): Promise; +export declare function getModifiedTime(filename: string): Promise; +export interface GitLog { + commit: string; + author: string; + date: string; + body: string; +} +export declare function getLogs(files?: null | Array, range?: null | { + tag0: string; + tag1: string; +}, limit?: null | number): Promise>; +export declare function getDiff(filename: string, tag0: string, tag1: string): Promise; +export declare function getTags(): Promise>; +//# sourceMappingURL=git.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/git.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/git.d.ts.map new file mode 100644 index 0000000..c009540 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/git.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/git.ts"],"names":[],"mappings":"AASA,wBAAsB,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAUxE;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAiB9E;AAED,MAAM,WAAW,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,wBAAsB,OAAO,CAAC,KAAK,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAsCxJ;AAED,wBAAsB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAI3F;AAED,wBAAsB,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAItD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/git.js b/dist/ethers.js/src.ts/_admin/utils/git.js new file mode 100644 index 0000000..f1a6888 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/git.js @@ -0,0 +1,124 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getTags = exports.getDiff = exports.getLogs = exports.getModifiedTime = exports.getGitTag = void 0; +const path_1 = require("path"); +const url_1 = require("url"); +const run_js_1 = require("./run.js"); +const __filename = (0, url_1.fileURLToPath)(import.meta.url); +const __dirname = (0, path_1.dirname)(__filename); +// Returns the most recent git commit hash for a given filename +function getGitTag(filename) { + return __awaiter(this, void 0, void 0, function* () { + const result = yield (0, run_js_1.run)("git", ["log", "-n", "1", "--", filename], __dirname); + if (!result.ok) { + throw new Error(`git log error`); + } + let log = result.stdout.trim(); + if (!log) { + return null; + } + const hashMatch = log.match(/^commit\s+([0-9a-f]{40})\n/i); + if (!hashMatch) { + return null; + } + return hashMatch[1]; + }); +} +exports.getGitTag = getGitTag; +function getModifiedTime(filename) { + return __awaiter(this, void 0, void 0, function* () { + const result = yield (0, run_js_1.run)("git", ["log", "-n", "1", "--", filename], __dirname); + if (!result.ok) { + throw new Error(`git log error`); + } + let log = result.stdout.trim(); + if (!log) { + return null; + } + for (let line of log.split("\n")) { + line = line.trim(); + if (!line) { + break; + } + const match = line.match(/^date:\s+(.*)$/i); + if (match) { + return (new Date(match[1].trim())).getTime(); + ; + } + } + return null; + }); +} +exports.getModifiedTime = getModifiedTime; +function getLogs(files, range, limit) { + return __awaiter(this, void 0, void 0, function* () { + const args = ["log", "-n", String((limit != null) ? limit : 100)]; + if (range) { + args.push(`${range.tag0}..${range.tag1}`); + } + if (files) { + args.push("--"); + files.forEach((f) => args.push(f)); + } + const exec = yield (0, run_js_1.run)("git", args); + if (!exec.ok) { + throw new Error(`git log error`); + } + const log = exec.stdout.trim(); + if (!log) { + return []; + } + const results = [{ commit: "", author: "", date: "", body: "" }]; + for (const line of log.split("\n")) { + const hashMatch = line.match(/^commit\s+([0-9a-f]{40})/i); + if (hashMatch) { + results.push({ commit: hashMatch[1], author: "", date: "", body: "" }); + } + else { + if (line.startsWith("Author:")) { + results[results.length - 1].author = line.substring(7).trim(); + } + else if (line.startsWith("Date:")) { + results[results.length - 1].date = line.substring(5).trim(); + } + else { + results[results.length - 1].body = (results[results.length - 1].body + " " + line).trim(); + } + } + } + // Nix the bootstrap entry + results.shift(); + return results; + }); +} +exports.getLogs = getLogs; +function getDiff(filename, tag0, tag1) { + return __awaiter(this, void 0, void 0, function* () { + const result = yield (0, run_js_1.run)("git", ["diff", `${tag0}..${tag1}`, "--", filename]); + if (!result.ok) { + throw new Error(`git log error`); + } + return result.stdout.trim(); + }); +} +exports.getDiff = getDiff; +function getTags() { + return __awaiter(this, void 0, void 0, function* () { + const result = yield (0, run_js_1.run)("git", ["tag"]); + if (!result.ok) { + throw new Error(`git log error`); + } + return result.stdout.trim().split("\n"); + }); +} +exports.getTags = getTags; +//# sourceMappingURL=git.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/git.js.map b/dist/ethers.js/src.ts/_admin/utils/git.js.map new file mode 100644 index 0000000..2257bcb --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/git.js.map @@ -0,0 +1 @@ +{"version":3,"file":"git.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/git.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,+BAA+B;AAC/B,6BAAmC;AAEnC,qCAA+B;AAE/B,MAAM,UAAU,GAAG,IAAA,mBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA;AACjD,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,UAAU,CAAC,CAAA;AAErC,+DAA+D;AAC/D,SAAsB,SAAS,CAAC,QAAgB;;QAC5C,MAAM,MAAM,GAAG,MAAM,IAAA,YAAG,EAAC,KAAK,EAAE,CAAE,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,CAAE,EAAE,SAAS,CAAC,CAAC;QACjF,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,eAAe,CAAC,CAAC;SAAE;QAErD,IAAI,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAC/B,IAAI,CAAC,GAAG,EAAE;YAAE,OAAO,IAA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AAK,CAAC,eAAe,CAAC,CAAC;SAAE;QACrD,OAAO,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC5C,CAAC;CAAA;AAJD,0BAIC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/json.d.ts b/dist/ethers.js/src.ts/_admin/utils/json.d.ts new file mode 100644 index 0000000..23d3a44 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/json.d.ts @@ -0,0 +1,4 @@ +export declare function loadJson(path: string): any; +export type SortFunc = (parent: string, a: string, b: string) => number; +export declare function saveJson(filename: string, data: any, sort?: boolean | SortFunc): any; +//# sourceMappingURL=json.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/json.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/json.d.ts.map new file mode 100644 index 0000000..dcd7c28 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/json.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/json.ts"],"names":[],"mappings":"AAKA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,GAAG,CAE1C;AAID,MAAM,MAAM,QAAQ,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AAExE,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,GAAG,CA0BpF"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/json.js b/dist/ethers.js/src.ts/_admin/utils/json.js new file mode 100644 index 0000000..e110a7c --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/json.js @@ -0,0 +1,40 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.saveJson = exports.loadJson = void 0; +const fs_1 = __importDefault(require("fs")); +const fs_js_1 = require("./fs.js"); +function loadJson(path) { + return JSON.parse(fs_1.default.readFileSync(path).toString()); +} +exports.loadJson = loadJson; +function saveJson(filename, data, sort) { + let replacer = undefined; + if (sort) { + replacer = (key, value) => { + if (Array.isArray(value)) { + // pass + } + else if (value && typeof (value) === "object") { + const keys = Object.keys(value); + let sortFunc; + if (typeof (sort) === "function") { + sortFunc = function (a, b) { + return sort(key, a, b); + }; + } + keys.sort(sortFunc); + return keys.reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + return value; + }; + } + (0, fs_js_1.atomicWrite)(filename, JSON.stringify(data, replacer, 2) + "\n"); +} +exports.saveJson = saveJson; +//# sourceMappingURL=json.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/json.js.map b/dist/ethers.js/src.ts/_admin/utils/json.js.map new file mode 100644 index 0000000..1893d52 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/json.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/json.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AAEpB,mCAAsC;AAGtC,SAAgB,QAAQ,CAAC,IAAY;IACjC,OAAO,IAAI,CAAC,KAAK,CAAC,YAAE,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC;AACxD,CAAC;AAFD,4BAEC;AAMD,SAAgB,QAAQ,CAAC,QAAgB,EAAE,IAAS,EAAE,IAAyB;IAE3E,IAAI,QAAQ,GAA2B,SAAS,CAAC;IACjD,IAAI,IAAI,EAAE;QACN,QAAQ,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YACtB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;gBACtB,OAAO;aACV;iBAAM,IAAI,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;gBAC5C,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;gBAChC,IAAI,QAAwD,CAAC;gBAC7D,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;oBAC7B,QAAQ,GAAG,UAAS,CAAS,EAAE,CAAS;wBACpC,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;oBAC3B,CAAC,CAAA;iBACJ;gBACD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBACpB,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,GAAG,EAAE,EAAE;oBAC9B,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC;oBACxB,OAAO,KAAK,CAAC;gBACjB,CAAC,EAAuB,EAAE,CAAC,CAAC;aAC/B;YACD,OAAO,KAAK,CAAC;QACjB,CAAC,CAAC;KACL;IAED,IAAA,mBAAW,EAAC,QAAQ,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AACpE,CAAC;AA1BD,4BA0BC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/npm.d.ts b/dist/ethers.js/src.ts/_admin/utils/npm.d.ts new file mode 100644 index 0000000..28b8b6b --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/npm.d.ts @@ -0,0 +1,8 @@ +export declare function _getNpmPackage(name: string): Promise; +export type Version = { + version: string; + gitHead: string; + date: string; +}; +export declare function getVersions(name: string): Promise>; +//# sourceMappingURL=npm.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/npm.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/npm.d.ts.map new file mode 100644 index 0000000..407e7d1 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/npm.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"npm.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/npm.ts"],"names":[],"mappings":"AAIA,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAQ/D;AAED,MAAM,MAAM,OAAO,GAAG;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,wBAAsB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAYvE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/npm.js b/dist/ethers.js/src.ts/_admin/utils/npm.js new file mode 100644 index 0000000..dbc70f4 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/npm.js @@ -0,0 +1,124 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getVersions = exports._getNpmPackage = void 0; +const index_js_1 = require("../../utils/index.js"); +const cache = {}; +function _getNpmPackage(name) { + return __awaiter(this, void 0, void 0, function* () { + if (!cache[name]) { + const resp = yield (new index_js_1.FetchRequest("https:/\/registry.npmjs.org/" + name)).send(); + resp.assertOk(); + cache[name] = resp.bodyJson; + } + return cache[name] || null; + }); +} +exports._getNpmPackage = _getNpmPackage; +function getVersions(name) { + return __awaiter(this, void 0, void 0, function* () { + const result = []; + const pkg = yield _getNpmPackage(name); + for (const version in pkg.versions) { + const gitHead = pkg.versions[version].gitHead; + const date = pkg.time[version]; + if (gitHead == null || date == null) { + continue; + } + result.push({ date, gitHead, version }); + } + return result; + }); +} +exports.getVersions = getVersions; +/* +(async function() { + //console.log(await _getNpmPackage("ethers")); + console.log(await getGitHeads("ethers")); +})(); +*/ +/* +import semver from "semver"; + +import { FetchRequest } from "../../utils/index.js"; + +export type PackageInfo = { + dependencies: { [ name: string ]: string }; + devDependencies: { [ name: string ]: string }; + gitHead: string; + name: string; + version: string; + tarballHash: string; + location: "remote" | "local"; + _ethers_nobuild: boolean; +}; + +export class Package { + readonly #info: PackageInfo; + + constructor(info: PackageInfo) { + this.#info = info; + } + + get name(): string { return this.#info.name; } + get version(): string { return this.#info.version; } + + get dependencies(): Record { return this.#info.dependencies; } + get devDependencies(): Record { return this.#info.devDependencies; } + + get gitHead(): string { return this.#info.gitHead; } + get tarballHash(): string { return this.#info.tarballHash; } + +} + + +const cache: Record = { }; + +async function getPackageInfo(name: string): Promise { + if (!cache[name]) { + const resp = await (new FetchRequest("https:/\/registry.npmjs.org/" + name)).send(); + resp.assertOk(); + cache[name] = resp.bodyJson(); + } + + return cache[name] || null; +} + +export async function getPackage(name: string, version?: string): Promise { + const infos = await getPackageInfo(name); + if (infos == null) { return null; } + + if (version == null) { + const versions = Object.keys(infos.versions); + versions.sort(semver.compare); + + // HACK: So v5 continues working while v6 is managed by reticulate + version = "6.0.0"; + while (version.indexOf("beta") >= 0 || semver.gte(version, "6.0.0")) { + version = versions.pop(); + } + } + + const info = infos.versions[version]; + + return new Package({ + dependencies: (info.dependencies || {}), + devDependencies: (info.devDependencies || {}), + gitHead: info.gitHead, + location: "remote", + name: info.name, + tarballHash: info.tarballHash, + version : info.version, + _ethers_nobuild: !!info._ethers_nobuild, + }); +} +*/ +//# sourceMappingURL=npm.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/npm.js.map b/dist/ethers.js/src.ts/_admin/utils/npm.js.map new file mode 100644 index 0000000..298c053 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/npm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"npm.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/npm.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mDAAoD;AAEpD,MAAM,KAAK,GAAwB,EAAG,CAAC;AAEvC,SAAsB,cAAc,CAAC,IAAY;;QAC7C,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACd,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,uBAAY,CAAC,8BAA8B,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACpF,IAAI,CAAC,QAAQ,EAAE,CAAC;YAChB,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,QAAQ,CAAC;SAC/B;QAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC;IAC/B,CAAC;CAAA;AARD,wCAQC;AAQD,SAAsB,WAAW,CAAC,IAAY;;QAC1C,MAAM,MAAM,GAAmB,EAAG,CAAC;QAEnC,MAAM,GAAG,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC;QACvC,KAAK,MAAM,OAAO,IAAI,GAAG,CAAC,QAAQ,EAAE;YAChC,MAAM,OAAO,GAAG,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC;YAC9C,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC/B,IAAI,OAAO,IAAI,IAAI,IAAI,IAAI,IAAI,IAAI,EAAE;gBAAE,SAAS;aAAE;YAClD,MAAM,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC;SAC3C;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CAAA;AAZD,kCAYC;AACD;;;;;EAKE;AACF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA2EE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/path.d.ts b/dist/ethers.js/src.ts/_admin/utils/path.d.ts new file mode 100644 index 0000000..e146d5d --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/path.d.ts @@ -0,0 +1,3 @@ +export declare const ROOT: string; +export declare function resolve(...args: Array): string; +//# sourceMappingURL=path.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/path.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/path.d.ts.map new file mode 100644 index 0000000..3871fab --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/path.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/path.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,IAAI,QAAmC,CAAC;AAErD,wBAAgB,OAAO,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM,CAItD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/path.js b/dist/ethers.js/src.ts/_admin/utils/path.js new file mode 100644 index 0000000..8bd585d --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/path.js @@ -0,0 +1,15 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolve = exports.ROOT = void 0; +const path_1 = require("path"); +const url_1 = require("url"); +const __filename = (0, url_1.fileURLToPath)(import.meta.url); +const __dirname = (0, path_1.dirname)(__filename); +exports.ROOT = (0, path_1.resolve)(__dirname, "../../../"); +function resolve(...args) { + args = args.slice(); + args.unshift(exports.ROOT); + return path_1.resolve.apply(null, args); +} +exports.resolve = resolve; +//# sourceMappingURL=path.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/path.js.map b/dist/ethers.js/src.ts/_admin/utils/path.js.map new file mode 100644 index 0000000..ac6d8ae --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/path.js.map @@ -0,0 +1 @@ +{"version":3,"file":"path.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/path.ts"],"names":[],"mappings":";;;AAAA,+BAAoD;AACpD,6BAAoC;AAEpC,MAAM,UAAU,GAAG,IAAA,mBAAa,EAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,IAAA,cAAO,EAAC,UAAU,CAAC,CAAC;AAEzB,QAAA,IAAI,GAAG,IAAA,cAAQ,EAAC,SAAS,EAAE,WAAW,CAAC,CAAC;AAErD,SAAgB,OAAO,CAAC,GAAG,IAAmB;IAC1C,IAAI,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;IACpB,IAAI,CAAC,OAAO,CAAC,YAAI,CAAC,CAAC;IACnB,OAAO,cAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;AACtC,CAAC;AAJD,0BAIC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/run.d.ts b/dist/ethers.js/src.ts/_admin/utils/run.d.ts new file mode 100644 index 0000000..393e7d4 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/run.d.ts @@ -0,0 +1,15 @@ +/// +export declare class RunResult { + #private; + constructor(progname: string, args: Array, status: null | number, stdout: string | Buffer, stderr: string | Buffer); + get cmd(): string; + get stderr(): string | null; + get _stderr(): string | Buffer; + get stdout(): string; + get _stdout(): string | Buffer; + get status(): null | number; + get ok(): boolean; + assertOk(message?: string): void; +} +export declare function run(progname: string, args?: Array, currentWorkingDirectory?: string): RunResult; +//# sourceMappingURL=run.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/run.d.ts.map b/dist/ethers.js/src.ts/_admin/utils/run.d.ts.map new file mode 100644 index 0000000..a2683cd --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/run.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/run.ts"],"names":[],"mappings":";AAEA,qBAAa,SAAS;;gBAMN,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,IAAI,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAO1H,IAAI,GAAG,IAAI,MAAM,CAAsB;IAEvC,IAAI,MAAM,IAAI,MAAM,GAAG,IAAI,CAE1B;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,MAAM,CAE7B;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,OAAO,IAAI,MAAM,GAAG,MAAM,CAE7B;IAED,IAAI,MAAM,IAAI,IAAI,GAAG,MAAM,CAAyB;IAEpD,IAAI,EAAE,IAAI,OAAO,CAEhB;IAED,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI;CAKnC;AAED,wBAAgB,GAAG,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,uBAAuB,CAAC,EAAE,MAAM,GAAG,SAAS,CAgBvG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/run.js b/dist/ethers.js/src.ts/_admin/utils/run.js new file mode 100644 index 0000000..15b3f10 --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/run.js @@ -0,0 +1,72 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _RunResult_cmd, _RunResult_status, _RunResult_stdout, _RunResult_stderr; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.run = exports.RunResult = void 0; +const child_process_1 = require("child_process"); +class RunResult { + constructor(progname, args, status, stdout, stderr) { + _RunResult_cmd.set(this, void 0); + _RunResult_status.set(this, void 0); + _RunResult_stdout.set(this, void 0); + _RunResult_stderr.set(this, void 0); + __classPrivateFieldSet(this, _RunResult_cmd, `${progname} ${args.map((a) => JSON.stringify(a))}`, "f"); + __classPrivateFieldSet(this, _RunResult_status, status, "f"); + __classPrivateFieldSet(this, _RunResult_stdout, stdout, "f"); + __classPrivateFieldSet(this, _RunResult_stderr, stderr, "f"); + } + get cmd() { return __classPrivateFieldGet(this, _RunResult_cmd, "f"); } + get stderr() { + return this._stderr.toString() || null; + } + get _stderr() { + return __classPrivateFieldGet(this, _RunResult_stderr, "f"); + } + get stdout() { + return this._stdout.toString(); + } + get _stdout() { + return __classPrivateFieldGet(this, _RunResult_stdout, "f"); + } + get status() { return __classPrivateFieldGet(this, _RunResult_status, "f"); } + get ok() { + return (__classPrivateFieldGet(this, _RunResult_stderr, "f").length === 0 && __classPrivateFieldGet(this, _RunResult_status, "f") === 0); + } + assertOk(message) { + if (!this.ok) { + throw new Error(message || `failed to run: ${__classPrivateFieldGet(this, _RunResult_cmd, "f")}`); + } + } +} +exports.RunResult = RunResult; +_RunResult_cmd = new WeakMap(), _RunResult_status = new WeakMap(), _RunResult_stdout = new WeakMap(), _RunResult_stderr = new WeakMap(); +; +function run(progname, args, currentWorkingDirectory) { + if (args == null) { + args = []; + } + const options = {}; + if (currentWorkingDirectory) { + options.cwd = currentWorkingDirectory; + } + const child = (0, child_process_1.spawnSync)(progname, args, options); + const result = new RunResult(progname, args, child.status, child.stdout, child.stderr); + if (child.error) { + const error = child.error; + error.result = result; + throw error; + } + return result; +} +exports.run = run; +//# sourceMappingURL=run.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_admin/utils/run.js.map b/dist/ethers.js/src.ts/_admin/utils/run.js.map new file mode 100644 index 0000000..9c059ec --- /dev/null +++ b/dist/ethers.js/src.ts/_admin/utils/run.js.map @@ -0,0 +1 @@ +{"version":3,"file":"run.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/_admin/utils/run.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,iDAA0C;AAE1C,MAAa,SAAS;IAMlB,YAAY,QAAgB,EAAE,IAAmB,EAAE,MAAqB,EAAE,MAAuB,EAAE,MAAuB;QALjH,iCAAa;QACb,oCAAuB;QACvB,oCAAyB;QACzB,oCAAyB;QAG9B,uBAAA,IAAI,kBAAQ,GAAI,QAAS,IAAK,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,EAAE,MAAA,CAAC;QACnE,uBAAA,IAAI,qBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,qBAAW,MAAM,MAAA,CAAC;QACtB,uBAAA,IAAI,qBAAW,MAAM,MAAA,CAAC;IAC1B,CAAC;IAED,IAAI,GAAG,KAAa,OAAO,uBAAA,IAAI,sBAAK,CAAC,CAAC,CAAC;IAEvC,IAAI,MAAM;QACN,OAAO,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,IAAI,CAAC;IAC3C,CAAC;IAED,IAAI,OAAO;QACP,OAAO,uBAAA,IAAI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AC;KACf;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAhBD,kBAgBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts b/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts new file mode 100644 index 0000000..1af3cb5 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts @@ -0,0 +1,85 @@ +export type TestBlockchainNetwork = "mainnet" | "goerli"; +export interface TestBlockchainAddress { + test: string; + address: string; + code?: string; + nonce?: number; + name?: string; + balance?: bigint; + storage?: Record; +} +export interface TestBlockchainBlock { + test: string; + hash: string; + parentHash: string; + number: number; + timestamp: number; + nonce: string; + difficulty: bigint; + gasLimit: bigint; + gasUsed: bigint; + miner: string; + extraData: string; + transactions: Array; + baseFeePerGas?: bigint; +} +export interface TestBlockchainTransaction { + test: string; + hash: string; + blockHash: string; + blockNumber: number; + type: number; + from: string; + gasPrice: bigint; + gasLimit: bigint; + to: string; + value: bigint; + nonce: number; + data: string; + signature: { + r: string; + s: string; + yParity: 0 | 1; + v: number; + networkV: null | bigint; + }; + creates: null | string; + chainId: bigint; + accessList?: Array>>; + maxPriorityFeePerGas?: bigint; + maxFeePerGas?: bigint; +} +export interface TestBlockchainReceipt { + test: string; + blockHash: string; + blockNumber: number; + type: number; + contractAddress: null | string; + cumulativeGasUsed: bigint; + from: string; + gasUsed: bigint; + gasPrice: bigint; + logs: Array<{ + address: string; + blockHash: string; + blockNumber: number; + data: string; + index: number; + topics: Array; + transactionHash: string; + transactionIndex: number; + }>; + logsBloom: string; + root: null | string; + status: null | number; + to: string; + hash: string; + index: number; +} +export declare const testAddress: Record>; +export declare const testBlock: Record>; +export declare const testTransaction: Record>; +export declare const testReceipt: Record>; +export declare const networkNames: Array; +export declare function networkFeatureAtBlock(feature: string, block: number): boolean; +//# sourceMappingURL=blockchain-data.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts.map b/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts.map new file mode 100644 index 0000000..8a22af0 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/blockchain-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"blockchain-data.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/blockchain-data.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,qBAAqB,GAC7B,SAAS,GAAG,QAAQ,CAAC;AAEzB,MAAM,WAAW,qBAAqB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;CACnC;AAED,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAE5B,aAAa,CAAC,EAAE,MAAM,CAAA;CACzB;AAED,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IAEpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE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AA;IACF,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,IAAI,GAAG,MAAM,CAAC;IACpB,MAAM,EAAE,IAAI,GAAG,MAAM,CAAC;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAA;CAChB;AAED,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAuBnF,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,mBAAmB,CAAC,CA8D/E,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,yBAAyB,CAAC,CAwD3F,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,MAAM,CAAC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAsFnF,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,qBAAqB,CAErD,CAAC;AACF,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAQ7E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/blockchain-data.js b/dist/ethers.js/src.ts/_tests/blockchain-data.js new file mode 100644 index 0000000..b109fea --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/blockchain-data.js @@ -0,0 +1,245 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.networkFeatureAtBlock = exports.networkNames = exports.testReceipt = exports.testTransaction = exports.testBlock = exports.testAddress = void 0; +; +exports.testAddress = { + mainnet: [ + { + test: "old-account", + address: "0xAC1639CF97a3A46D431e6d1216f576622894cBB5", + balance: BigInt("4813414100000000"), + nonce: 3, + code: "0x" + }, { + test: "TheDAO-splitter-contract", + address: "0x3474627D4F63A678266BC17171D87f8570936622", + code: "0x606060405260e060020a60003504630b3ed5368114602e57806337b0574a14605257806356fa47f0146062575b005b602c6004356000546101009004600160a060020a03908116339091161460bb575b50565b60005460ff166060908152602090f35b602c60043560005460ff1615609657600160a060020a038116600034606082818181858883f193505050501515604f576002565b33600160a060020a0316600034606082818181858883f193505050501515604f576002565b600080546101009004600160a060020a03169082606082818181858883f193505050501515604f57600256", + storage: { + "0": "0x0000000000000000000000b2682160c482eb985ec9f3e364eec0a904c44c2300" + } + }, { + test: "ricmoo.firefly.eth", + address: "0x8ba1f109551bD432803012645Ac136ddd64DBA72", + name: "ricmoo.firefly.eth" + }, + ], + goerli: [] +}; +exports.testBlock = { + mainnet: [ + { + test: "old-homestead-block", + hash: "0x3d6122660cc824376f11ee842f83addc3525e2dd6756b9bcf0affa6aa88cf741", + parentHash: "0xb495a1d7e6663152ae92708da4843337b958146015a2802f4193a410044698c9", + number: 3, + timestamp: 1438270048, + nonce: "0x2e9344e0cbde83ce", + difficulty: BigInt(17154715646), + gasLimit: BigInt("0x1388"), + gasUsed: BigInt("0"), + miner: "0x5088D623ba0fcf0131E0897a91734A4D83596AA0", + extraData: "0x476574682f76312e302e302d66633739643332642f6c696e75782f676f312e34", + transactions: [] + }, + { + test: "london-block", + number: 14413999, + hash: "0x6c79356d40ebb6ed63dc19f5d407f8f1c876047b59dc1a4598cce0e64dcabec5", + parentHash: "0xbf09b0e215f247a5066d19ece5b4c66960771d45fae62985e8d751fb1adcfe2f", + timestamp: 1647654576, + nonce: "0xb4bc9979af5369fe", + difficulty: BigInt("12841513359509721"), + gasLimit: BigInt("30087914"), + gasUsed: BigInt("2008910"), + miner: "0x2A20380DcA5bC24D052acfbf79ba23e988ad0050", + extraData: "0x706f6f6c696e2e636f6d21f7092f019bb92a76", + baseFeePerGas: BigInt("40911884304"), + transactions: [ + "0x1c3a398933db10634631f54b435c40c8805c13f12bbac7c3dab858ca44213fa2", + "0xd98947cbdd892cc7f679c903903e6d18a5c5afb19e94437beba79372ad71c347", + "0x4d66190deb55b5820cb0ce9adb972f646fa0f3e64eaeee674bbf3d054bf3d883", + "0x9db7bd5f4c91d6103c714bcbc35df3dc708daa668aaef7449b589dbd3be24dac", + "0x126a43ae4ade4b7fc5c8ac9ebd3dbcf7314f63c60f2804fb49aa25b5c7d80bb1", + "0x82a90aa4b3b1b7873b117c3ff1ca7165ae34b2fc0788cc0cbfd41805d588590d", + "0x7f694a6a9972457753ed3dec164f17272b1c8b1da4eab149df95e31a3e72f606", + "0xdce1cba1ff33f0c23881087d49de3b34fe84c8a6883f3edd75b04fc23e458aac", + "0xbe1c69f825279cebef42d1f0e07397dcddef7fb278b0195e295ede3e156836c4", + "0x1d2f007b3c0f894403973a30e5ffaa78589f873d963e9554c6bb1bd7a3127245", + "0x9c8c78191cf4ae9ae8eee1165153eabe24dbd8b9509b83d5f0caeea85251bb2f", + "0x42e956f4b3dd6535359b272a0d2dab995c364cb48baaf8d0a1981995f3f8c808", + "0xdc2c2e99393e24d5dc66e38665fa1d1ff007d92088ef3fd2549545fdbe862ef6", + "0xaad7be28fffd2e77e8e40bf57f2ac140aa8283ec93c7f3f61a82c79405602f53", + "0x4735f1421b7b30283e87e0799e82e54307d3e5ba14cd54ad8420b57577489a71", + "0x0b9d6aa23aa439b41e86595f2ad91f498adffa3e6e7cb26ac7d73252e59fd3de", + "0xcd93e19bd5d5c5a834fec613116fa01f46eddfd2faa20ef302271b874b9d812a", + "0x5bf1976574a637f5ac0b8bda1a792fa16cc7ce9624d32e9bd6bd9aa6a8f19d2f", + "0x2e778da4f66f10f7b681b605635c6599cdbeea167fc1c4396a097aef5d06de61", + "0xd5fd68eebc4c870ccda081786a74c75c250e9e2d8269b8935edb3adb11b80bb2", + "0x2aec42a11c1d8c1e5198d54aacbc6bebb09bcd5e78f6af81ea09d65c9064734a", + "0xbea2e364ea4959ec438d9ccc2d2f7120c7eaba3b177cc0d7df8ff65d866ef89f", + "0xf48bbb0f838353060da4126a555ce532abf497a9d1108001afffaac513a59ddf", + "0xf5664e4372cce62733a6610efb7701a4a0e552d81f8caa764d8474b3070c6617", + "0x9d3732ddbd20610008ff737da2f61120734a1cbfa864374bcbcf10051e6048cb", + "0xc4d0df5bc6fa51b34ac3c898866d779d4e51a6be4d13be1ec3084b7229b03b47", + "0x90c86ec98b8ad98049b4ee54cb3aa72c5ae743077b830e8a294aa5dc47a1fb18" + ] + } + ], + goerli: [], +}; +exports.testTransaction = { + mainnet: [ + { + test: "legacy", + hash: "0xccc90ab97a74c952fb3376c4a3efb566a58a10df62eb4d44a61e106fcf10ec61", + blockHash: "0x9653f180a5720f3634816eb945a6d722adee52cc47526f6357ac10adaf368135", + blockNumber: 4097745, + // index: 18, + type: 0, + from: "0x32DEF047DeFd076DB21A2D759aff2A591c972248", + gasPrice: BigInt("0x4a817c800"), + gasLimit: BigInt("0x3d090"), + to: "0x6fC21092DA55B392b045eD78F4732bff3C580e2c", + value: BigInt("0x186cc6acd4b0000"), + nonce: 0, + data: "0xf2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f0000000000000000000000000000000000000000000000000000", + signature: { + r: "0x1e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265", + s: "0x269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54", + yParity: 1, + v: 28, + networkV: BigInt(38), + }, + creates: null, + chainId: BigInt(1) + }, + { + test: "EIP-1559", + hash: "0x8ff41d0ba5d239acc8c123ff12451a2c15721c838f657e583d355999af4a4349", + blockHash: '0x9d4c3bef68e119841281105da96beb1c7252f357340d7a3355236b3332b197b0', + blockNumber: 12966000, + // index: 185, + type: 2, + from: '0x5afFBa12E9332bbc0E221c8E7BEf7CB7cfB3F281', + to: '0x2258CcD34ae29E6B199b6CD64eb2aEF157df7CdE', + gasLimit: BigInt("21000"), + nonce: 2, + data: '0x', + value: BigInt("1100000000000000"), + gasPrice: BigInt("70578812137"), + maxPriorityFeePerGas: BigInt("1000000000"), + maxFeePerGas: BigInt("131115411100"), + chainId: BigInt(1), + signature: { + r: "0xdd26e5478d0aa84e334a0393d335ab24b83de8ecae9290305f15ab884ded246c", + s: "0x6494b4f61b0d9a5a82ecb86d72b301f859f404f0bec9682bbfff619903ecfbe2", + yParity: 1, + v: 28, + networkV: null + }, + creates: null, + accessList: [] + } + ], + goerli: [] +}; +exports.testReceipt = { + mainnet: [ + { + test: "legacy", + //byzantium: false, + blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + type: 0, + contractAddress: null, + cumulativeGasUsed: BigInt(0x1cca2e), + from: "0x18C6045651826824FEBBD39d8560584078d1b247", + gasUsed: BigInt(0x14bb7), + gasPrice: BigInt(4100000000), + logs: [ + { + address: "0x314159265dD8dbb310642f98f50C066173C1259b", + blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + data: "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247", + index: 0x1a, + topics: [ + "0xce0457fe73731f824cc272376169235128c118b49d344817417c6d108d155e82", + "0x93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae", + "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1" + ], + transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + transactionIndex: 0x39, + }, + { + address: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", + blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566", + blockNumber: 0x3c92b5, + data: "0x000000000000000000000000000000000000000000000000002386f26fc1000000000000000000000000000000000000000000000000000000000000595a32ce", + index: 0x1b, + topics: [ + "0x0f0c27adfd84b60b6f456b0e87cdccb1e5fb9603991588d87fa99f5b6b61e670", + "0xf0106919d12469348e14ad6a051d0656227e1aba2fefed41737fdf78421b20e1", + "0x00000000000000000000000018c6045651826824febbd39d8560584078d1b247" + ], + transactionHash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + transactionIndex: 0x39, + } + ], + logsBloom: "0x00000000000000040000000000100000010000000000000040000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000200000010000000004000000000000000000000000000000000002000000000000000000000000400000000020000000000000000000000000000000000000004000000000000000000000000000000000000000000000000801000000000000000000000020000000000040000000040000000000000000002000000004000000000000000000000000000000000000000000000010000000000000000000000000000000000200000000000000000", + root: "0x9b550a9a640ce50331b64504ef87aaa7e2aaf97344acb6ff111f879b319d2590", + // Should be null for pre-byzantium, but some nodes have backfilled it + status: 1, + to: "0x6090A6e47849629b7245Dfa1Ca21D94cd15878Ef", + hash: "0xc6fcb7d00d536e659a4559d2de29afa9e364094438fef3e72ba80728ce1cb616", + index: 0x39 + }, { + test: "byzantium", + //byzantium: true, + blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", + blockNumber: 0x444f76, + type: 0, + contractAddress: null, + cumulativeGasUsed: BigInt(0x15bfe7), + from: "0x18C6045651826824FEBBD39d8560584078d1b247", + gasUsed: BigInt(0x1b968), + gasPrice: BigInt(1000000000), + logs: [ + { + address: "0xb90E64082D00437e65A76d4c8187596BC213480a", + blockHash: "0x34e5a6cfbdbb84f7625df1de69d218ade4da72f4a2558064a156674e72e976c9", + blockNumber: 0x444f76, + data: "0x", + index: 0x10, + topics: [ + "0x748d071d1992ee1bfe7a39058114d0a50d5798fe8eb3a9bfb4687f024629a2ce", + "0x5574aa58f7191ccab6de6cf75fe2ea0484f010b852fdd8c6b7ae151d6c2f4b83" + ], + transactionHash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", + transactionIndex: 0x1e, + } + ], + logsBloom: "0x00000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000010000000000000000000800000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000800000000000000000800000000000000000000000000000000000000", + root: null, + status: 1, + to: "0xb90E64082D00437e65A76d4c8187596BC213480a", + hash: "0x7f1c6a58dc880438236d0b0a4ae166e9e9a038dbea8ec074149bd8b176332cac", + index: 0x1e + } + ], + goerli: [] +}; +exports.networkNames = [ + "mainnet", "goerli" +]; +function networkFeatureAtBlock(feature, block) { + switch (feature) { + case "byzantium": + return block >= 4370000; + default: + break; + } + throw new Error(`unknown feature: ${feature}`); +} +exports.networkFeatureAtBlock = networkFeatureAtBlock; +//# sourceMappingURL=blockchain-data.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/blockchain-data.js.map b/dist/ethers.js/src.ts/_tests/blockchain-data.js.map new file mode 100644 index 0000000..f66e321 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/blockchain-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"blockchain-data.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/blockchain-data.ts"],"names":[],"mappings":";;;AAuFC,CAAC;AAEW,QAAA,WAAW,GAAgE;IACpF,OAAO,EAAE;QACL;YACI,IAAI,EAAE,aAAa;YACnB,OAAO,EAAE,4CAA4C;YACrD,OAAO,EAAE,MAAM,CAAC,kBAAkB,CAAC;YACnC,KAAK,EAAE,CAAC;YACR,IAAI,EAAE,IAAI;SACb,EAAE;YACC,IAAI,EAAE,0BAA0B;YAChC,OAAO,EAAE,4CAA4C;YACrD,IAAI,EAAE,kdAAkd;YACxd,OAAO,EAAE;gBACL,GAAG,EAAE,oEAAoE;aAC5E;SACJ,EAAE;YACC,IAAI,EAAE,oBAAoB;YAC1B,OAAO,EAAE,4CAA4C;YACrD,IAAI,EAAE,oBAAoB;SAC7B;KACJ;IACD,MAAM,EAAE,EACP;CACJ,CAAC;AAEW,QAAA,SAAS,GAA8D;IAChF,OAAO,EAAE;QACL;YACI,IAAI,EAAE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I,EAAE,oEAAoE;YAC1E,KAAK,EAAE,IAAI;SACd,EAAE;YACC,IAAI,EAAE,WAAW;YACjB,kBAAkB;YAClB,SAAS,EAAE,oEAAoE;YAC/E,WAAW,EAAE,QAAQ;YACrB,IAAI,EAAE,CAAC;YACP,eAAe,EAAE,IAAI;YACrB,iBAAiB,EAAE,MAAM,CAAC,QAAQ,CAAC;YACnC,IAAI,EAAE,4CAA4C;YAClD,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC;YACxB,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC;YAC5B,IAAI,EAAE;gBACF;oBACI,OAAO,EAAE,4CAA4C;oBACrD,SAAS,EAAE,oEAAoE;oBAC/E,WAAW,EAAE,QAAQ;oBACrB,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,IAAI;oBACX,MAAM,EAAE;wBACJ,oEAAoE;wBACpE,oEAAoE;qBACvE;oBACD,eAAe,EAAE,oEAAoE;oBACrF,gBAAgB,EAAE,IAAI;iBACzB;aACJ;YACD,SAAS,EAAE,ogBAAogB;YAC/gB,IAAI,EAAE,IAAI;YACV,MAAM,EAAE,CAAC;YACT,EAAE,EAAE,4CAA4C;YAChD,IAAI,EAAE,oEAAoE;YAC1E,KAAK,EAAE,IAAI;SACd;KACJ;IACD,MAAM,EAAE,EACP;CACJ,CAAC;AAEW,QAAA,YAAY,GAAiC;IACtD,SAAS,EAAE,QAAQ;CACtB,CAAC;AACF,SAAgB,qBAAqB,CAAC,OAAe,EAAE,KAAa;IAChE,QAAQ,OAAO,EAAE;QACb,KAAK,WAAW;YACZ,OAAO,KAAK,IAAI,OAAO,CAAC;QAC5B;YACI,MAAM;KACb;IACD,MAAM,IAAI,KAAK,CAAC,oBAAqB,OAAQ,EAAE,CAAC,CAAC;AACrD,CAAC;AARD,sDAQC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/create-provider.d.ts b/dist/ethers.js/src.ts/_tests/create-provider.d.ts new file mode 100644 index 0000000..ef373e8 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/create-provider.d.ts @@ -0,0 +1,8 @@ +import type { AbstractProvider } from "../index.js"; +export declare function setupProviders(): void; +export declare const providerNames: readonly string[]; +export declare function getProviderNetworks(provider: string): Array; +export declare function getProvider(provider: string, network: string): null | AbstractProvider; +export declare function checkProvider(provider: string, network: string): boolean; +export declare function connect(network: string): AbstractProvider; +//# sourceMappingURL=create-provider.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/create-provider.d.ts.map b/dist/ethers.js/src.ts/_tests/create-provider.d.ts.map new file mode 100644 index 0000000..1055d23 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/create-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"create-provider.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/create-provider.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AA2FpD,wBAAgB,cAAc,IAAI,IAAI,CAKrC;AAED,eAAO,MAAM,aAAa,mBAAuD,CAAC;AAQlF,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAInE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,gBAAgB,CAgBtF;AAED,wBAAgB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAGxE;AAED,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB,CAIzD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/create-provider.js b/dist/ethers.js/src.ts/_tests/create-provider.js new file mode 100644 index 0000000..4def72c --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/create-provider.js @@ -0,0 +1,151 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.connect = exports.checkProvider = exports.getProvider = exports.getProviderNetworks = exports.providerNames = exports.setupProviders = void 0; +const index_js_1 = require("../index.js"); +; +const ethNetworks = ["default", "mainnet", "goerli"]; +//const maticNetworks = [ "matic", "maticmum" ]; +const ProviderCreators = [ + { + name: "AlchemyProvider", + networks: ethNetworks, + create: function (network) { + return new index_js_1.AlchemyProvider(network, "YrPw6SWb20vJDRFkhWq8aKnTQ8JRNRHM"); + } + }, + /* + { + name: "AnkrProvider", + networks: ethNetworks.concat([ "matic", "arbitrum" ]), + create: function(network: string) { + return new AnkrProvider(network); + } + }, + */ + /* + { + name: "CloudflareProvider", + networks: [ "default", "mainnet" ], + create: function(network: string) { + return new CloudflareProvider(network); + } + }, + */ + { + name: "EtherscanProvider", + networks: ethNetworks, + create: function (network) { + return new index_js_1.EtherscanProvider(network, "FPFGK6JSW2UHJJ2666FG93KP7WC999MNW7"); + } + }, + { + name: "InfuraProvider", + networks: ethNetworks, + create: function (network) { + return new index_js_1.InfuraProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); + } + }, + { + name: "InfuraWebsocketProvider", + networks: ethNetworks, + create: function (network) { + return index_js_1.InfuraProvider.getWebSocketProvider(network, "49a0efa3aaee4fd99797bfa94d8ce2f1"); + } + }, + /* + { + name: "PocketProvider", + networks: ethNetworks, + create: function(network: string) { + return new PocketProvider(network); + } + }, + */ + { + name: "QuickNodeProvider", + networks: ethNetworks, + create: function (network) { + return new index_js_1.QuickNodeProvider(network); + } + }, + { + name: "FallbackProvider", + networks: ethNetworks, + create: function (network) { + const providers = []; + for (const providerName of ["AlchemyProvider", "AnkrProvider", "EtherscanProvider", "InfuraProvider"]) { + const provider = getProvider(providerName, network); + if (provider) { + providers.push(provider); + } + } + if (providers.length === 0) { + throw new Error("UNSUPPORTED NETWORK"); + } + return new index_js_1.FallbackProvider(providers); + } + }, +]; +let setup = false; +const cleanup = []; +function setupProviders() { + after(function () { + for (const func of cleanup) { + func(); + } + }); + setup = true; +} +exports.setupProviders = setupProviders; +exports.providerNames = Object.freeze(ProviderCreators.map((c) => (c.name))); +function getCreator(provider) { + const creators = ProviderCreators.filter((c) => (c.name === provider)); + if (creators.length === 1) { + return creators[0]; + } + return null; +} +function getProviderNetworks(provider) { + const creator = getCreator(provider); + if (creator) { + return creator.networks; + } + return []; +} +exports.getProviderNetworks = getProviderNetworks; +function getProvider(provider, network) { + if (setup == false) { + throw new Error("MUST CALL setupProviders in root context"); + } + const creator = getCreator(provider); + try { + if (creator) { + const provider = creator.create(network); + if (provider) { + cleanup.push(() => { provider.destroy(); }); + } + return provider; + } + } + catch (error) { + if (!(0, index_js_1.isError)(error, "INVALID_ARGUMENT")) { + throw error; + } + } + return null; +} +exports.getProvider = getProvider; +function checkProvider(provider, network) { + const creator = getCreator(provider); + return (creator != null); +} +exports.checkProvider = checkProvider; +function connect(network) { + const provider = getProvider("InfuraProvider", network); + if (provider == null) { + throw new Error(`could not connect to ${network}`); + } + return provider; +} +exports.connect = connect; +//# sourceMappingURL=create-provider.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/create-provider.js.map b/dist/ethers.js/src.ts/_tests/create-provider.js.map new file mode 100644 index 0000000..c89c6da --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/create-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"create-provider.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/create-provider.ts"],"names":[],"mappings":";;;AAAA,0CAWqB;AAQpB,CAAC;AAEF,MAAM,WAAW,GAAG,CAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,CAAE,CAAC;AACvD,gDAAgD;AAEhD,MAAM,gBAAgB,GAA2B;IAC7C;QACI,IAAI,EAAE,iBAAiB;QACvB,QAAQ,EAAE,WAAW;QACrB,MAAM,EAAE,UAAS,OAAe;YAC5B,OAAO,IAAI,0BAAe,CAAC,OAAO,EAAE,kCAAkC,CAAC,CAAC;QAC5E,CAAC;KACJ;IACD;;;;;;;;MAQE;IACF;;;;;;;;MAQ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AAO,CAAC,CAAC;YACzC,IAAI,QAAQ,EAAE;gBACV,OAAO,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,QAAQ,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;aAC/C;YACD,OAAO,QAAQ,CAAC;SACnB;KACJ;IAAC,OAAO,KAAK,EAAE;QACZ,IAAI,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC,EAAE;YAAE,MAAM,KAAK,CAAC;SAAE;KAC5D;IACD,OAAO,IAAI,CAAC;AAChB,CAAC;AAhBD,kCAgBC;AAED,SAAgB,aAAa,CAAC,QAAgB,EAAE,OAAe;IAC3D,MAAM,OAAO,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;IACrC,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC;AAC7B,CAAC;AAHD,sCAGC;AAED,SAAgB,OAAO,CAAC,OAAe;IACnC,MAAM,QAAQ,GAAG,WAAW,CAAC,gBAAgB,EAAE,OAAO,CAAC,CAAC;IACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,wBAAyB,OAAQ,EAAE,CAAC,CAAC;KAAE;IAC/E,OAAO,QAAQ,CAAC;AACpB,CAAC;AAJD,0BAIC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/index.d.ts b/dist/ethers.js/src.ts/_tests/index.d.ts new file mode 100644 index 0000000..2fa3fd5 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/index.d.ts @@ -0,0 +1,21 @@ +import "./test-abi.js"; +import "./test-address.js"; +import "./test-contract.js"; +import "./test-crypto.js"; +import "./test-hash.js"; +import "./test-hash-typeddata.js"; +import "./test-providers-avatar.js"; +import "./test-providers-ccip.js"; +import "./test-providers-wildcard.js"; +import "./test-rlp.js"; +import "./test-transaction.js"; +import "./test-utils-maths.js"; +import "./test-utils-misc.js"; +import "./test-utils-units.js"; +import "./test-utils-utf8.js"; +import "./test-wallet.js"; +import "./test-wallet-hd.js"; +import "./test-wallet-json.js"; +import "./test-wallet-mnemonic.js"; +import "./test-wordlists.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/index.d.ts.map b/dist/ethers.js/src.ts/_tests/index.d.ts.map new file mode 100644 index 0000000..fc63218 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/index.ts"],"names":[],"mappings":"AAAA,OAAO,eAAe,CAAC;AACvB,OAAO,mBAAmB,CAAA;AAC1B,OAAO,oBAAoB,CAAC;AAC5B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,gBAAgB,CAAC;AACxB,OAAO,0BAA0B,CAAC;AAClC,OAAO,4BAA4B,CAAC;AACpC,OAAO,0BAA0B,CAAC;AAClC,OAAO,8BAA8B,CAAC;AACtC,OAAO,eAAe,CAAA;AACtB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,sBAAsB,CAAC;AAC9B,OAAO,kBAAkB,CAAC;AAC1B,OAAO,qBAAqB,CAAC;AAC7B,OAAO,uBAAuB,CAAC;AAC/B,OAAO,2BAA2B,CAAC;AACnC,OAAO,qBAAqB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/index.js b/dist/ethers.js/src.ts/_tests/index.js new file mode 100644 index 0000000..525dba3 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/index.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +require("./test-abi.js"); +require("./test-address.js"); +require("./test-contract.js"); +require("./test-crypto.js"); +require("./test-hash.js"); +require("./test-hash-typeddata.js"); +require("./test-providers-avatar.js"); +require("./test-providers-ccip.js"); +require("./test-providers-wildcard.js"); +require("./test-rlp.js"); +require("./test-transaction.js"); +require("./test-utils-maths.js"); +require("./test-utils-misc.js"); +require("./test-utils-units.js"); +require("./test-utils-utf8.js"); +require("./test-wallet.js"); +require("./test-wallet-hd.js"); +require("./test-wallet-json.js"); +require("./test-wallet-mnemonic.js"); +require("./test-wordlists.js"); +////import "./test-contract-integ.js"; +////import "./test-providers-data.js"; +//import "./test-providers-errors.js"; +////import "./test-providers-extra.js"; +////import "./test-providers-send.js"; +/* +test-crypto-algoswap.ts +*/ +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/index.js.map b/dist/ethers.js/src.ts/_tests/index.js.map new file mode 100644 index 0000000..f004ac6 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/index.ts"],"names":[],"mappings":";;AAAA,yBAAuB;AACvB,6BAA0B;AAC1B,8BAA4B;AAC5B,4BAA0B;AAC1B,0BAAwB;AACxB,oCAAkC;AAClC,sCAAoC;AACpC,oCAAkC;AAClC,wCAAsC;AACtC,yBAAsB;AACtB,iCAA+B;AAC/B,iCAA+B;AAC/B,gCAA8B;AAC9B,iCAA+B;AAC/B,gCAA8B;AAC9B,4BAA0B;AAC1B,+BAA6B;AAC7B,iCAA+B;AAC/B,qCAAmC;AACnC,+BAA6B;AAE7B,sCAAsC;AAEtC,sCAAsC;AACtC,sCAAsC;AACtC,uCAAuC;AACvC,sCAAsC;AAEtC;;EAEE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-abi.d.ts b/dist/ethers.js/src.ts/_tests/test-abi.d.ts new file mode 100644 index 0000000..5a0731b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-abi.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-abi.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-abi.d.ts.map b/dist/ethers.js/src.ts/_tests/test-abi.d.ts.map new file mode 100644 index 0000000..44f0318 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-abi.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-abi.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-abi.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-abi.js b/dist/ethers.js/src.ts/_tests/test-abi.js new file mode 100644 index 0000000..7f55c7b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-abi.js @@ -0,0 +1,286 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +function equal(actual, expected) { + switch (expected.type) { + case "address": + case "boolean": + case "hexstring": + case "string": + assert_1.default.equal(actual, expected.value); + return; + case "number": + assert_1.default.equal(actual, BigInt(expected.value)); + return; + case "array": + case "object": + assert_1.default.ok(Array.isArray(actual), "!array"); + assert_1.default.equal(actual.length, expected.value.length, ".length mismatch"); + for (let i = 0; i < actual.length; i++) { + equal(actual[i], expected.value[i]); + } + return; + } + throw new Error(`unsupported: ${expected}`); +} +describe("Tests ABI Coder", function () { + const tests = (0, utils_js_1.loadTests)("abi"); + for (const test of tests) { + it(`tests ABI encoding: (${test.name})`, function () { + const encoded = index_js_1.AbiCoder.defaultAbiCoder().encode([test.type], [test.value]); + assert_1.default.equal(encoded, test.encoded, "encoded"); + }); + } + for (const test of tests) { + it(`tests ABI decoding: (${test.name})`, function () { + const decoded = index_js_1.AbiCoder.defaultAbiCoder().decode([test.type], test.encoded)[0]; + equal(decoded, test.verbose); + }); + } +}); +describe("Test Bytes32 strings", function () { + const tests = [ + { + name: "ricmoo.firefly.eth", + str: "ricmoo.firefly.eth", + expected: '0x7269636d6f6f2e66697265666c792e6574680000000000000000000000000000' + }, + { + name: "empty string", + str: "", + expected: '0x0000000000000000000000000000000000000000000000000000000000000000' + } + ]; + for (const { name, str, expected } of tests) { + it(`encodes and decodes Bytes32 strings: ${name}`, function () { + const bytes32 = (0, index_js_1.encodeBytes32String)(str); + const decoded = (0, index_js_1.decodeBytes32String)(bytes32); + assert_1.default.equal(bytes32, expected, 'formatted correctly'); + assert_1.default.equal(decoded, str, "parsed correctly"); + }); + } +}); +describe("Test Interface", function () { + const iface = new index_js_1.Interface([ + "function balanceOf(address owner) returns (uint)", + "event Transfer(address indexed from, address indexed to, uint amount)", + // #4244 + "event RedemptionRequested(bytes20 indexed walletPubKeyHash, bytes redeemerOutputScript, address indexed redeemer, uint64 requestedAmount, uint64 treasuryFee, uint64 txMaxFee)" + ]); + it("does interface stuff; @TODO expand this", function () { + const addr = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + const addr2 = "0xAC1639CF97a3A46D431e6d1216f576622894cBB5"; + const data = iface.encodeFunctionData("balanceOf", [addr]); + assert_1.default.equal(data, "0x70a082310000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72", "encoded"); + const decoded = iface.decodeFunctionData("balanceOf", data); + assert_1.default.equal(decoded.length, 1, "decoded.length"); + assert_1.default.equal(decoded[0], addr, "decoded[0]"); + const tx = iface.parseTransaction({ data, value: 10 }); + assert_1.default.ok(tx != null, "tx == null"); + assert_1.default.equal(tx.name, "balanceOf", "tx.balanceOf"); + assert_1.default.equal(tx.signature, "balanceOf(address)", "tx.balanceOf"); + assert_1.default.equal(tx.args.length, 1, "tx.args.length"); + assert_1.default.equal(tx.args[0], addr, "tx.args[0]"); + assert_1.default.equal(tx.selector, "0x70a08231", "tx.selector"); + assert_1.default.equal(tx.value, BigInt(10), "tx.value"); + const result = iface.encodeFunctionResult("balanceOf", [123]); + assert_1.default.equal(result, "0x000000000000000000000000000000000000000000000000000000000000007b", "result"); + const value = iface.decodeFunctionResult("balanceOf", result); + assert_1.default.equal(value.length, 1, "result.length"); + assert_1.default.equal(value[0], BigInt(123), "result.value[0]"); + // @TODO: parseResult + const filter = iface.encodeFilterTopics("Transfer", [addr, addr2]); + assert_1.default.equal(filter.length, 3); + assert_1.default.equal(filter[0], "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"); + assert_1.default.equal(filter[1], "0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72"); + assert_1.default.equal(filter[2], "0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5"); + // See: #4244 + // https://goerli.etherscan.io/tx/0xe61cef4cd706db8e23114717a207d76cc6b0df0b74ec52805551c4d1bf347a27#eventlog + // See `RedemptionRequested` event. + { + const walletPubKeyHash = "0x03b74d6893ad46dfdd01b9e0e3b3385f4fce2d1e"; + const redeemer = "0x086813525A7dC7dafFf015Cdf03896Fd276eab60"; + const filterWithBytes20 = iface.encodeFilterTopics("RedemptionRequested", [walletPubKeyHash, undefined, redeemer]); + assert_1.default.equal(filterWithBytes20.length, 3); + assert_1.default.equal(filterWithBytes20[0], "0x97a0199072f487232635d50ab75860891afe0b91c976ed2fc76502c4d82d0d95"); + assert_1.default.equal(filterWithBytes20[1], "0x03b74d6893ad46dfdd01b9e0e3b3385f4fce2d1e000000000000000000000000"); + assert_1.default.equal(filterWithBytes20[2], "0x000000000000000000000000086813525a7dc7dafff015cdf03896fd276eab60"); + } + const eventLog = iface.encodeEventLog("Transfer", [addr, addr2, 234]); + assert_1.default.equal(eventLog.data, "0x00000000000000000000000000000000000000000000000000000000000000ea"); + assert_1.default.deepEqual(eventLog.topics, [ + "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef", + "0x0000000000000000000000008ba1f109551bd432803012645ac136ddd64dba72", + "0x000000000000000000000000ac1639cf97a3a46d431e6d1216f576622894cbb5" + ]); + const values = iface.decodeEventLog("Transfer", eventLog.data, eventLog.topics); + assert_1.default.equal(values.length, 3); + assert_1.default.equal(values[0], addr); + assert_1.default.equal(values[1], addr2); + assert_1.default.equal(values[2], BigInt(234)); + const log = iface.parseLog(eventLog); + assert_1.default.ok(log != null); + assert_1.default.equal(log.name, "Transfer"); + assert_1.default.equal(log.signature, "Transfer(address,address,uint256)"); + assert_1.default.equal(log.topic, "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"); + assert_1.default.equal(log.args.length, 3); + assert_1.default.equal(log.args[0], "0x8ba1f109551bD432803012645Ac136ddd64DBA72"); + assert_1.default.equal(log.args[1], "0xAC1639CF97a3A46D431e6d1216f576622894cBB5"); + assert_1.default.equal(log.args[2], BigInt(234)); + }); + // See #4248 + it("formats JSON ABI parameters with default empty string for `name` key", function () { + assert_1.default.deepEqual(JSON.parse(iface.getFunction("balanceOf").format('json')), { + constant: false, + inputs: [ + { name: "owner", type: "address" } + ], + name: "balanceOf", + outputs: [ + { name: "", type: "uint256" } + ], + payable: false, + type: "function", + }); + }); +}); +describe("Tests Legacy ABI formats", function () { + // See: #3932 + const iface = new index_js_1.Interface([ + { + name: "implicitView", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "constant": true, + "payable": false, + "type": "function" + }, + { + name: "implicitSendNonpay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "constant": false, + "payable": false, + "type": "function" + }, + { + name: "implicitSendPay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "constant": false, + "payable": true, + "type": "function" + }, + { + name: "implicitSendImplicitPay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "constant": false, + "type": "function" + }, + { + name: "implicitSendExplicitPay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + payable: true, + type: "function" + }, + { + name: "implicitSendExplicitNonpay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + payable: false, + type: "function" + }, + { + name: "implicitAll", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "type": "function" + }, + { + name: "explicitView", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "stateMutability": "view", + "constant": true, + "payable": false, + "type": "function" + }, + { + name: "explicitPure", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "stateMutability": "pure", + "constant": true, + "payable": false, + "type": "function" + }, + { + name: "explicitPay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "stateMutability": "payable", + "constant": true, + "payable": true, + "type": "function" + }, + { + name: "explicitNonpay", + outputs: [], + inputs: [ + { type: "int128", name: "arg0" } + ], + "stateMutability": "nonpayable", + "constant": true, + "payable": false, + "type": "function" + }, + ]); + function test(name, isConst, payable, stateMutability) { + it(`tests ABI configuration: ${name}`, function () { + const f = iface.getFunction(name); + assert_1.default.ok(!!f, `missing ${name}`); + assert_1.default.equal(f.constant, isConst, `${name}.constant`); + assert_1.default.equal(f.stateMutability, stateMutability, `${name}.stateMutability`); + assert_1.default.equal(f.payable, payable, `${name}.payable`); + }); + } + test("explicitView", true, false, "view"); + test("explicitPure", true, false, "pure"); + test("explicitPay", false, true, "payable"); + test("explicitNonpay", false, false, "nonpayable"); + test("implicitView", true, false, "view"); + test("implicitSendNonpay", false, false, "nonpayable"); + test("implicitSendPay", false, true, "payable"); + test("implicitSendImplicitPay", false, true, "payable"); + test("implicitSendExplicitPay", false, true, "payable"); + test("implicitSendExplicitNonpay", false, false, "nonpayable"); + test("implicitAll", false, true, "payable"); +}); +//# sourceMappingURL=test-abi.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-abi.js.map b/dist/ethers.js/src.ts/_tests/test-abi.js.map new file mode 100644 index 0000000..959a216 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-abi.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-abi.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-abi.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,yCAAuC;AAIvC,0CAGqB;AAErB,SA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,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;IACxD,IAAI,CAAC,4BAA4B,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,CAAC,CAAC;IAC/D,IAAI,CAAC,aAAa,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,CAAC,CAAC;AAChD,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-address.d.ts b/dist/ethers.js/src.ts/_tests/test-address.d.ts new file mode 100644 index 0000000..afa579d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-address.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-address.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-address.d.ts.map b/dist/ethers.js/src.ts/_tests/test-address.d.ts.map new file mode 100644 index 0000000..9bb44b8 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-address.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-address.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-address.js b/dist/ethers.js/src.ts/_tests/test-address.js new file mode 100644 index 0000000..a5be0ee --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-address.js @@ -0,0 +1,115 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("computes checksum address", function () { + const tests = (0, utils_js_1.loadTests)("accounts"); + for (const test of tests) { + it(`computes the checksum address: ${test.name}`, function () { + assert_1.default.equal((0, index_js_1.getAddress)(test.address), test.address); + assert_1.default.equal((0, index_js_1.getAddress)(test.icap), test.address); + assert_1.default.equal((0, index_js_1.getAddress)(test.address.substring(2)), test.address); + assert_1.default.equal((0, index_js_1.getAddress)(test.address.toLowerCase()), test.address); + assert_1.default.equal((0, index_js_1.getAddress)("0x" + test.address.substring(2).toUpperCase()), test.address); + }); + } + const invalidAddresses = [ + { name: "null", value: null }, + { name: "number", value: 1234 }, + { name: "emtpy bytes", value: "0x" }, + { name: "too short", value: "0x8ba1f109551bd432803012645ac136ddd64dba" }, + { name: "too long", value: "0x8ba1f109551bd432803012645ac136ddd64dba7200" }, + ]; + invalidAddresses.forEach(({ name, value }) => { + it(`correctly fails on invalid address: ${name}`, function () { + assert_1.default.throws(function () { + (0, index_js_1.getAddress)(value); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid address/) && + error.argument === "address" && + error.value === value); + }); + }); + }); + it("correctly fails on invalid checksum", function () { + const value = "0x8ba1f109551bD432803012645Ac136ddd64DBa72"; + assert_1.default.throws(function () { + (0, index_js_1.getAddress)(value); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^bad address checksum/) && + error.argument === "address" && + error.value === value); + }); + }); + it("correctly fails on invalid IBAN checksum", function () { + const value = "XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"; + assert_1.default.throws(function () { + (0, index_js_1.getAddress)(value); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^bad icap checksum/) && + error.argument === "address" && + error.value === value); + }); + }); +}); +describe("computes ICAP address", function () { + const tests = (0, utils_js_1.loadTests)("accounts"); + for (const test of tests) { + it(`computes the ICAP address: ${test.name}`, function () { + assert_1.default.equal((0, index_js_1.getIcapAddress)(test.address), test.icap); + assert_1.default.equal((0, index_js_1.getAddress)(test.address.toLowerCase()), test.address); + assert_1.default.equal((0, index_js_1.getAddress)("0x" + test.address.substring(2).toUpperCase()), test.address); + }); + } +}); +describe("computes create address", function () { + const tests = (0, utils_js_1.loadTests)("create"); + for (const { sender, creates } of tests) { + for (const { name, nonce, address } of creates) { + it(`computes the create address: ${name}`, function () { + assert_1.default.equal((0, index_js_1.getCreateAddress)({ from: sender, nonce }), address); + }); + } + } +}); +describe("computes create2 address", function () { + const tests = (0, utils_js_1.loadTests)("create2"); + for (const { sender, creates } of tests) { + for (const { name, salt, initCodeHash, address } of creates) { + it(`computes the create2 address: ${name}`, function () { + assert_1.default.equal((0, index_js_1.getCreate2Address)(sender, salt, initCodeHash), address); + }); + } + } + const sender = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + const salt = "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36deac8"; + const initCodeHash = "0x8452c9b9140222b08593a26daa782707297be9f7b3e8281d7b4974769f19afd0"; + it("correctly fails on invalid salt", function () { + const badSalt = "0x1c8aff950685c2ed4bc3174f3472287b56d9517b9c948127319a09a7a36dea"; + assert_1.default.throws(function () { + (0, index_js_1.getCreate2Address)(sender, badSalt, initCodeHash); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.argument === "salt" && + error.value === badSalt); + }); + }); + it("correctly fails on invalid initCodeHash", function () { + const badInitCodeHash = "0x8452c9b9140222b08593a26daa782707297be9f7b3e8281d7b4974769f19af"; + assert_1.default.throws(function () { + (0, index_js_1.getCreate2Address)(sender, salt, badInitCodeHash); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.argument === "initCodeHash" && + error.value === badInitCodeHash); + }); + }); +}); +//# sourceMappingURL=test-address.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-address.js.map b/dist/ethers.js/src.ts/_tests/test-address.js.map new file mode 100644 index 0000000..a48d0c2 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-address.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-address.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAQvC,0CAGqB;AAGrB,QAAQ,CAAC,2BAA2B,EAAE;IAClC,MAAM,KAAK,GAAG,IAAA,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KAAK,KAAK,eAAe,CAAC,CAAC;QACzC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts b/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts new file mode 100644 index 0000000..404e7e4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-contract-integ.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts.map b/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts.map new file mode 100644 index 0000000..89e37f6 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract-integ.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract-integ.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-contract-integ.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract-integ.js b/dist/ethers.js/src.ts/_tests/test-contract-integ.js new file mode 100644 index 0000000..becdda4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract-integ.js @@ -0,0 +1,93 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +describe("Tests contract integration", function () { + const provider = new index_js_1.ethers.JsonRpcProvider("http:/\/127.0.0.1:8545"); + const abi = [ + "constructor(address owner, uint maxSupply)", + "function mint(address target) returns (bool minted)", + "function totalSupply() view returns (uint supply)", + "function balanceOf(address target) view returns (uint balance)", + "event Minted(address target)" + ]; + let address = null; + it("deploys a contract", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + const bytecode = "0x60c060405234801561001057600080fd5b506040516105863803806105868339818101604052810190610032919061010e565b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508060a08181525050505061014e565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006100a58261007a565b9050919050565b6100b58161009a565b81146100c057600080fd5b50565b6000815190506100d2816100ac565b92915050565b6000819050919050565b6100eb816100d8565b81146100f657600080fd5b50565b600081519050610108816100e2565b92915050565b6000806040838503121561012557610124610075565b5b6000610133858286016100c3565b9250506020610144858286016100f9565b9150509250929050565b60805160a051610414610172600039600060fa0152600061021f01526104146000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806318160ddd146100515780636a6278421461006f57806370a082311461009f5780638da5cb5b146100cf575b600080fd5b6100596100ed565b604051610066919061025c565b60405180910390f35b610089600480360381019061008491906102da565b6100f6565b6040516100969190610322565b60405180910390f35b6100b960048036038101906100b491906102da565b6101d2565b6040516100c6919061025c565b60405180910390f35b6100d761021b565b6040516100e4919061034c565b60405180910390f35b60008054905090565b60007f00000000000000000000000000000000000000000000000000000000000000006000541061012657600080fd5b600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600081548092919061017690610396565b919050555060008081548092919061018d90610396565b91905055507f90ddedd5a25821bba11fbb98de02ec1f75c1be90ae147d6450ce873e7b78b5d8826040516101c1919061034c565b60405180910390a160019050919050565b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60007f0000000000000000000000000000000000000000000000000000000000000000905090565b6000819050919050565b61025681610243565b82525050565b6000602082019050610271600083018461024d565b92915050565b600080fd5b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b60006102a78261027c565b9050919050565b6102b78161029c565b81146102c257600080fd5b50565b6000813590506102d4816102ae565b92915050565b6000602082840312156102f0576102ef610277565b5b60006102fe848285016102c5565b91505092915050565b60008115159050919050565b61031c81610307565b82525050565b60006020820190506103376000830184610313565b92915050565b6103468161029c565b82525050565b6000602082019050610361600083018461033d565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006103a182610243565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036103d3576103d2610367565b5b60018201905091905056fea26469706673582212200a979ea2bfdf429b5546fa25906c9d20a3d67ef5fbe531f31d2cc83533e3239564736f6c63430008120033"; + const signer = yield provider.getSigner(0); + const factory = new index_js_1.ethers.ContractFactory(abi, bytecode, signer); + const contract = yield factory.deploy(signer, 100); + address = yield contract.getAddress(); + yield contract.waitForDeployment(); + const deployed = yield provider.getCode(address); + assert_1.default.ok(deployed != "0x", "has bytescode"); + }); + }); + it("runs contract operations", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + assert_1.default.ok(address != null); + const signer = yield provider.getSigner(0); + const CustomContract = index_js_1.ethers.BaseContract.buildClass(abi); + const contract = new CustomContract(address, signer); //ethers.Contract.from(address, abi, signer); + // Test implicit staticCall (i.e. view/pure) + { + const supply0 = yield contract.totalSupply(); + assert_1.default.equal(supply0, BigInt(0), "initial supply 0; default"); + } + // Test explicit staticCall + { + const supply0 = yield contract.totalSupply.staticCall(); + assert_1.default.equal(supply0, BigInt(0), "initial supply 0; staticCall"); + } + // Test staticCallResult (positional and named) + { + const supply0 = yield contract.totalSupply.staticCallResult(); + assert_1.default.equal(supply0[0], BigInt(0), "initial supply 0; staticCallResult"); + assert_1.default.equal(supply0.supply, BigInt(0), "initial supply 0; staticCallResult"); + } + // Test populateTransaction + const txInfo = yield contract.mint.populateTransaction(signer); + assert_1.default.equal(txInfo.to, address, "populateTransaction.to"); + const txInfoData = index_js_1.ethers.hexlify(index_js_1.ethers.concat([ + "0x6a627842", + index_js_1.ethers.zeroPadValue(yield signer.getAddress(), 32) + ])); + assert_1.default.equal(txInfo.data, txInfoData, "populateTransaction.data"); + // Test minting (default) + const tx = yield contract.mint(signer); + const receipt = yield tx.wait(); + assert_1.default.ok(receipt, "receipt"); + // Check the receipt has parsed the events + assert_1.default.equal(receipt.logs.length, 1, "logs.length"); + assert_1.default.ok(receipt instanceof index_js_1.ethers.ContractTransactionReceipt, "receipt typeof"); + assert_1.default.ok(receipt.logs[0] instanceof index_js_1.ethers.EventLog, "receipt.log typeof"); + assert_1.default.equal(receipt.logs[0].fragment && receipt.logs[0].fragment.name, "Minted", "logs[0].fragment.name"); + assert_1.default.equal(receipt.logs[0].args[0], yield signer.getAddress(), "logs[0].args[0]"); + assert_1.default.equal(receipt.logs[0].args.target, yield signer.getAddress(), "logs[0].args.target"); + // Check the state has been adjusted + assert_1.default.equal(yield contract.totalSupply(), BigInt(1), "initial supply 1; default"); + assert_1.default.equal(yield contract.balanceOf(signer), BigInt(1), "balanceOf(signer)"); + // Test minting (explicit) + const tx2 = yield contract.mint.send(signer); + yield tx2.wait(); + // Check the state has been adjusted + assert_1.default.equal(yield contract.totalSupply(), BigInt(2), "initial supply 2; default"); + }); + }); +}); +//# sourceMappingURL=test-contract-integ.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract-integ.js.map b/dist/ethers.js/src.ts/_tests/test-contract-integ.js.map new file mode 100644 index 0000000..dee49f9 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract-integ.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract-integ.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-contract-integ.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B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AAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;YAE/E,0BAA0B;YAC1B,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;YAEjB,oCAAoC;YACpC,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,2BAA2B,CAAC,CAAC;QACvF,CAAC;KAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract.d.ts b/dist/ethers.js/src.ts/_tests/test-contract.d.ts new file mode 100644 index 0000000..1427a86 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-contract.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract.d.ts.map b/dist/ethers.js/src.ts/_tests/test-contract.d.ts.map new file mode 100644 index 0000000..fa77a18 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-contract.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract.js b/dist/ethers.js/src.ts/_tests/test-contract.js new file mode 100644 index 0000000..4f1fc82 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract.js @@ -0,0 +1,386 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const create_provider_js_1 = require("./create-provider.js"); +const index_js_1 = require("../index.js"); +(0, create_provider_js_1.setupProviders)(); +describe("Test Contract", function () { + const addr = "0x99417252Aad7B065940eBdF50d665Fb8879c5958"; + const abi = [ + "error CustomError1(uint256 code, string message)", + "event EventUint256(uint256 indexed value)", + "event EventAddress(address indexed value)", + "event EventString(string value)", + "event EventBytes(bytes value)", + "function testCustomError1(bool pass, uint code, string calldata message) pure returns (uint256)", + "function testErrorString(bool pass, string calldata message) pure returns (uint256)", + "function testPanic(uint256 code) returns (uint256)", + "function testEvent(uint256 valueUint256, address valueAddress, string valueString, bytes valueBytes) public", + "function testCallAdd(uint256 a, uint256 b) pure returns (uint256 result)", + ]; + it("tests contract calls", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + const provider = (0, create_provider_js_1.getProvider)("InfuraProvider", "goerli"); + const contract = new index_js_1.Contract(addr, abi, provider); + assert_1.default.equal(yield contract.testCallAdd(4, 5), BigInt(9), "testCallAdd(4, 5)"); + assert_1.default.equal(yield contract.testCallAdd(6, 0), BigInt(6), "testCallAdd(6, 0)"); + }); + }); + it("tests events", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.getProvider)("InfuraProvider", "goerli"); + assert_1.default.ok(provider); + const contract = new index_js_1.Contract(addr, abi, provider); + const signer = new index_js_1.Wallet((process.env.FAUCET_PRIVATEKEY), provider); + const contractSigner = contract.connect(signer); + const vUint256 = 42; + const vAddrName = "ethers.eth"; + const vAddr = "0x228568EA92aC5Bc281c1E30b1893735c60a139F1"; + const vString = "Hello"; + const vBytes = "0x12345678"; + let hash = null; + // Test running a listener for a specific event + const specificEvent = new Promise((resolve, reject) => { + contract.on("EventUint256", (value, event) => __awaiter(this, void 0, void 0, function* () { + // Triggered by someone else + if (hash == null || hash !== event.log.transactionHash) { + return; + } + try { + assert_1.default.equal(event.filter, "EventUint256", "event.filter"); + assert_1.default.equal(event.fragment.name, "EventUint256", "event.fragment.name"); + assert_1.default.equal(event.log.address, addr, "event.log.address"); + assert_1.default.equal(event.args.length, 1, "event.args.length"); + assert_1.default.equal(event.args[0], BigInt(42), "event.args[0]"); + const count = yield contract.listenerCount("EventUint256"); + yield event.removeListener(); + assert_1.default.equal(yield contract.listenerCount("EventUint256"), count - 1, "decrement event count"); + resolve(null); + } + catch (e) { + event.removeListener(); + reject(e); + } + })); + }); + // Test running a listener on all (i.e. "*") events + const allEvents = new Promise((resolve, reject) => { + const waitingFor = { + EventUint256: vUint256, + EventAddress: vAddr, + EventString: vString, + EventBytes: vBytes + }; + contract.on("*", (event) => { + // Triggered by someone else + if (hash == null || hash !== event.log.transactionHash) { + return; + } + try { + const name = event.eventName; + assert_1.default.equal(event.args[0], waitingFor[name], `${name}`); + delete waitingFor[name]; + if (Object.keys(waitingFor).length === 0) { + event.removeListener(); + resolve(null); + } + } + catch (error) { + reject(error); + } + }); + }); + // Send a transaction to trigger some events + const tx = yield contractSigner.testEvent(vUint256, vAddr, vString, vBytes); + hash = tx.hash; + const checkEvent = (filter, event) => { + const values = { + EventUint256: vUint256, + EventString: vString, + EventAddress: vAddr, + EventBytes: vBytes + }; + assert_1.default.ok(event instanceof index_js_1.EventLog, `queryFilter(${filter}):isEventLog`); + const name = event.eventName; + assert_1.default.equal(event.address, addr, `queryFilter(${filter}):address`); + assert_1.default.equal(event.args[0], values[name], `queryFilter(${filter}):args[0]`); + }; + const checkEventFilter = (filter) => __awaiter(this, void 0, void 0, function* () { + const events = (yield contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); + assert_1.default.equal(events.length, 1, `queryFilter(${filter}).length`); + checkEvent(filter, events[0]); + return events[0]; + }); + const receipt = yield tx.wait(); + // Check the logs in the receipt + for (const log of receipt.logs) { + checkEvent("receipt", log); + } + // Various options for queryFilter + yield checkEventFilter("EventUint256"); + yield checkEventFilter(["EventUint256"]); + yield checkEventFilter([["EventUint256"]]); + yield checkEventFilter("EventUint256(uint)"); + yield checkEventFilter(["EventUint256(uint)"]); + yield checkEventFilter([["EventUint256(uint)"]]); + yield checkEventFilter([["EventUint256", "EventUint256(uint)"]]); + yield checkEventFilter("0x85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea337"); + // Query by Event + yield checkEventFilter(contract.filters.EventUint256); + // Query by Deferred Topic Filter; address + yield checkEventFilter(contract.filters.EventUint256(vUint256)); + // Query by Deferred Topic Filter; address + yield checkEventFilter(contract.filters.EventAddress(vAddr)); + // Query by Deferred Topic Filter; ENS name => address + yield checkEventFilter(contract.filters.EventAddress(vAddrName)); + // Multiple Methods + { + const filter = [["EventUint256", "EventString"]]; + const events = (yield contract.queryFilter(filter, -10)).filter((e) => (e.transactionHash === hash)); + assert_1.default.equal(events.length, 2, `queryFilter(${filter}).length`); + for (const event of events) { + checkEvent(filter, event); + } + } + yield specificEvent; + yield allEvents; + }); + }); + it("tests the _in_ operator for functions", function () { + const contract = new index_js_1.Contract(addr, abi); + assert_1.default.equal("testCallAdd" in contract, true, "has(testCallAdd)"); + assert_1.default.equal("nonExist" in contract, false, "has(nonExist)"); + { + const sig = "function testCallAdd(uint256 a, uint256 b) pure returns (uint256 result)"; + assert_1.default.equal(sig in contract, true, `has(${sig})`); + assert_1.default.equal("function nonExist()" in contract, false, "has(function nonExist())"); + } + assert_1.default.equal("0xf24684e5" in contract, true, "has(0xf24684e5)"); + assert_1.default.equal("0xbad01234" in contract, false, "has(0xbad01234)"); + }); + it("tests the _in_ operator for events", function () { + const contract = new index_js_1.Contract(addr, abi); + assert_1.default.equal("EventUint256" in contract.filters, true, "has(EventUint256)"); + assert_1.default.equal("NonExist" in contract.filters, false, "has(NonExist)"); + { + const sig = "event EventUint256(uint256 indexed value)"; + assert_1.default.equal(sig in contract.filters, true, `has(${sig})`); + assert_1.default.equal("event NonExist()" in contract.filters, false, "has(event NonExist())"); + } + { + const hash = "0x85c55bbb820e6d71c71f4894e57751de334b38c421f9c170b0e66d32eafea337"; + const badHash = "0xbad01234567890ffbad01234567890ffbad01234567890ffbad01234567890ff"; + assert_1.default.equal(hash in contract.filters, true, `has(${hash})`); + assert_1.default.equal(badHash in contract.filters, false, `has(${badHash})`); + } + }); +}); +describe("Test Typed Contract Interaction", function () { + const tests = [ + { + types: ["uint8", "uint16", "uint24", "uint32", "uint40", "uint48", "uint56", "uint64", "uint72", "uint80", "uint88", "uint96", "uint104", "uint112", "uint120", "uint128", "uint136", "uint144", "uint152", "uint160", "uint168", "uint176", "uint184", "uint192", "uint200", "uint208", "uint216", "uint224", "uint232", "uint240", "uint248", "uint256", "int8", "int16", "int24", "int32", "int40", "int48", "int56", "int64", "int72", "int80", "int88", "int96", "int104", "int112", "int120", "int128", "int136", "int144", "int152", "int160", "int168", "int176", "int184", "int192", "int200", "int208", "int216", "int224", "int232", "int240", "int248", "int256"], + valueFunc: (type) => { return 42; } + }, + { + types: [ + "bytes1", "bytes2", "bytes3", "bytes4", "bytes5", "bytes6", "bytes7", "bytes8", "bytes9", "bytes10", "bytes11", "bytes12", "bytes13", "bytes14", "bytes15", "bytes16", "bytes17", "bytes18", "bytes19", "bytes20", "bytes21", "bytes22", "bytes23", "bytes24", "bytes25", "bytes26", "bytes27", "bytes28", "bytes29", "bytes30", "bytes31", "bytes32", + "bytes" + ], + valueFunc: (type) => { + const length = type.substring(5); + if (length) { + const value = new Uint8Array(parseInt(length)); + value.fill(42); + return value; + } + return "0x123456"; + } + }, { + types: ["bool"], + valueFunc: (type) => { return true; } + }, { + types: ["address"], + valueFunc: (type) => { return "0x643aA0A61eADCC9Cc202D1915D942d35D005400C"; } + }, { + types: ["string"], + valueFunc: (type) => { return "someString"; } + } + ]; + const abi = []; + for (let i = 1; i <= 32; i++) { + abi.push(`function testTyped(uint${i * 8}) public pure returns (string memory)`); + abi.push(`function testTyped(int${i * 8}) public pure returns (string memory)`); + abi.push(`function testTyped(bytes${i}) public pure returns (string memory)`); + } + abi.push(`function testTyped(address) public pure returns (string memory)`); + abi.push(`function testTyped(bool) public pure returns (string memory)`); + abi.push(`function testTyped(bytes memory) public pure returns (string memory)`); + abi.push(`function testTyped(string memory) public pure returns (string memory)`); + const addr = "0x838f41545DA5e18AA0e1ab391085d22E172B7B02"; + const provider = (0, create_provider_js_1.getProvider)("InfuraProvider", "goerli"); + const contract = new index_js_1.Contract(addr, abi, provider); + for (const { types, valueFunc } of tests) { + for (const type of types) { + const value = valueFunc(type); + it(`tests typed value: Typed.from(${type})`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + const v = index_js_1.Typed.from(type, value); + const result = yield contract.testTyped(v); + assert_1.default.equal(result, type); + }); + }); + it(`tests typed value: Typed.${type}()`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + const v = index_js_1.Typed[type](value); + const result = yield contract.testTyped(v); + assert_1.default.equal(result, type); + }); + }); + } + } +}); +describe("Test Contract Fallback", function () { + const tests = [ + { + name: "none", + address: "0x0ccdace3d8353fed9b87a2d63c40452923ccdae5", + abi: [], + sendNone: { error: "no fallback" }, + sendData: { error: "no fallback" }, + sendValue: { error: "no fallback" }, + sendDataAndValue: { error: "no fallback" }, + }, + { + name: "non-payable fallback", + address: "0x3f10193f79a639b11ec9d2ab42a25a4a905a8870", + abi: [ + "fallback()" + ], + sendNone: { data: "0x" }, + sendData: { data: "0x1234" }, + sendValue: { error: "overrides.value" }, + sendDataAndValue: { error: "overrides.value" }, + }, + { + name: "payable fallback", + address: "0xe2de6b97c5eb9fee8a47ca6c0fa642331e0b6330", + abi: [ + "fallback() payable" + ], + sendNone: { data: "0x" }, + sendData: { data: "0x1234" }, + sendValue: { data: "0x" }, + sendDataAndValue: { data: "0x1234" }, + }, + { + name: "receive-only", + address: "0xf8f2afbbe37f6a4520e4db7f99495655aa31229b", + abi: [ + "receive()" + ], + sendNone: { data: "0x" }, + sendData: { error: "overrides.data" }, + sendValue: { data: "0x" }, + sendDataAndValue: { error: "overrides.data" }, + }, + { + name: "receive and payable fallback", + address: "0x7d97ca5d9dea1cd0364f1d493252006a3c4e18a0", + abi: [ + "fallback() payable", + "receive()" + ], + sendNone: { data: "0x" }, + sendData: { data: "0x1234" }, + sendValue: { data: "0x" }, + sendDataAndValue: { data: "0x1234" }, + }, + { + name: "receive and non-payable fallback", + address: "0x5b59d934f0d22b15e73b5d6b9ae83486b70df67e", + abi: [ + "fallback()", + "receive()" + ], + sendNone: { data: "0x" }, + sendData: { data: "0x" }, + sendValue: { data: "0x" }, + sendDataAndValue: { error: "overrides" }, + }, + ]; + const provider = (0, create_provider_js_1.getProvider)("InfuraProvider", "goerli"); + const testGroups = [ + { + group: "sendNone", + tx: {} + }, + { + group: "sendData", + tx: { data: "0x1234" } + }, + { + group: "sendValue", + tx: { value: 123 } + }, + { + group: "sendDataAndValue", + tx: { data: "0x1234", value: 123 } + }, + ]; + for (const { group, tx } of testGroups) { + for (const test of tests) { + const { name, address, abi } = test; + const send = test[group]; + const contract = new index_js_1.Contract(address, abi, provider); + it(`test contract fallback checks: ${group} - ${name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const func = function () { + return __awaiter(this, void 0, void 0, function* () { + if (abi.length === 0) { + throw new Error("no fallback"); + } + assert_1.default.ok(contract.fallback); + return yield contract.fallback.populateTransaction(tx); + }); + }; + if ("data" in send) { + yield func(); + //const result = await func(); + //@TODO: Test for the correct populated tx + //console.log(result); + assert_1.default.ok(true); + } + else { + yield assert_1.default.rejects(func, function (error) { + if (error.message === send.error) { + return true; + } + if ((0, index_js_1.isError)(error, "INVALID_ARGUMENT")) { + return error.argument === send.error; + } + console.log("EE", error); + return true; + }); + } + }); + }); + } + } +}); +//# sourceMappingURL=test-contract.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-contract.js.map b/dist/ethers.js/src.ts/_tests/test-contract.js.map new file mode 100644 index 0000000..3522540 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-contract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-contract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oDAA4B;AAE5B,6DAAmE;AAEnE,0CAEqB;AAGrB,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,eAAe,EAAE;IACtB,MAAM,IAAI,GAAG,4CAA4C,CAAC;IAC1D,MAAM,GAAG,GAAG;QACR,kDAAkD;QAElD,2CAA2C;QAC3C,2CAA2C;QAC3C,iCAAiC;QACjC,+BAA+B;QAE/B,iGAAiG;QACjG,qFAAqF;QACrF,oDAAoD;QACpD,6GAA6G;QAC7G,0EAA0E;KAC7E,CAAC;IAEF,EAAE,CAAC,sBAAsB,EAAE;;YACvB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAEpB,MAAM,QAAQ,GAAG,IAAA,gCAAW,EAAC,gBAAgB,EAAE,QAAQ,CAAC,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,CAAC,CAAC;YAEnD,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;YAC/E,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,mBAAmB,CAAC,CAAC;QACnF,CAAC;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,KAAK,IAAI,CAAC,KAAK,CAAC;6BACxC;4BACD,OAAO,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;4BACzB,OAAO,IAAI,CAAC;wBAChB,CAAC,CAAC,CAAC;qBACN;gBACL,CAAC;aAAA,CAAC,CAAC;SACN;KACJ;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts new file mode 100644 index 0000000..8c2f71d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-crypto-algoswap.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts.map b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts.map new file mode 100644 index 0000000..5aee820 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-crypto-algoswap.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-crypto-algoswap.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js new file mode 100644 index 0000000..4f279bf --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js @@ -0,0 +1,112 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +describe("test registration", function () { + let hijack = ""; + function getHijack(algo) { + return function (...args) { + hijack = `hijacked ${algo}: ${JSON.stringify(args)}`; + return "0x42"; + }; + } + const tests = [ + { + name: "keccak256", + params: ["0x"], + hijackTag: 'hijacked keccak256: [{}]', + algorithm: index_js_1.keccak256 + }, + { + name: "sha256", + params: ["0x"], + hijackTag: 'hijacked sha256: [{}]', + algorithm: index_js_1.sha256 + }, + { + name: "sha512", + params: ["0x"], + hijackTag: 'hijacked sha512: [{}]', + algorithm: index_js_1.sha512 + }, + { + name: "ripemd160", + params: ["0x"], + hijackTag: 'hijacked ripemd160: [{}]', + algorithm: index_js_1.ripemd160 + }, + { + name: "pbkdf2", + params: ["0x", "0x", 1024, 32, "sha256"], + hijackTag: 'hijacked pbkdf2: [{},{},1024,32,"sha256"]', + algorithm: index_js_1.pbkdf2 + }, + { + name: "scryptSync", + params: ["0x", "0x", 1024, 8, 1, 32], + hijackTag: 'hijacked scryptSync: [{},{},1024,8,1,32]', + algorithm: index_js_1.scryptSync + }, + { + name: "scrypt", + params: ["0x", "0x", 1024, 8, 1, 32], + hijackTag: 'hijacked scrypt: [{},{},1024,8,1,32,null]', + algorithm: index_js_1.scrypt + }, + { + name: "computeHmac", + params: ["sha256", "0x", "0x"], + hijackTag: 'hijacked computeHmac: ["sha256",{},{}]', + algorithm: index_js_1.computeHmac + }, + { + name: "randomBytes", + params: [32], + hijackTag: "hijacked randomBytes: [32]", + algorithm: index_js_1.randomBytes, + postCheck: (value) => { + return (value instanceof Uint8Array && value.length === 32); + } + } + ]; + tests.forEach(({ name, params, hijackTag, algorithm, postCheck }) => { + it(`swaps in hijacked callback: ${name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const initial = yield algorithm(...params); + algorithm.register(getHijack(name)); + assert_1.default.equal(yield algorithm(...params), "0x42"); + assert_1.default.equal(hijack, hijackTag); + algorithm.register(algorithm._); + if (postCheck) { + assert_1.default.ok(postCheck(yield algorithm(...params))); + } + else { + assert_1.default.equal(yield algorithm(...params), initial); + } + }); + }); + }); + it("prevents swapping after locked", function () { + (0, index_js_1.lock)(); + tests.forEach(({ name, params, hijackTag, algorithm }) => { + assert_1.default.throws(function () { + algorithm.register(getHijack("test")); + }, function (error) { + return (error.message === `${name} is locked`); + }); + }); + }); +}); +//# sourceMappingURL=test-crypto-algoswap.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js.map b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js.map new file mode 100644 index 0000000..fa1eb4b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto-algoswap.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-crypto-algoswap.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-crypto-algoswap.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,0CAMqB;AAmBrB,QAAQ,CAAC,mBAAmB,EAAE;IAE1B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,SAAS,SAAS,CAAC,IAAY;QAC3B,OAAO,UAAS,GAAG,IAAgB;YAC/B,MAAM,GAAG,YAAa,IAAK,KAAM,IAAI,CAAC,SAAS,CAAC,IAAI,CAAE,EAAE,CAAC;YACzD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAA;IACL,CAAC;IAED,MAAM,KAAK,GAAoB;QAC3B;YACI,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,0BAA0B;YACrC,SAAS,EAAE,oBAAS;SACvB;QACD;YACI,IAAI,EAAE,QAAQ;YACd,MAAM,EAAE,CAAE,IAAI,CAAE;YAChB,SAAS,EAAE,uBAAuB;Y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CAAC;AAEP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto.d.ts b/dist/ethers.js/src.ts/_tests/test-crypto.d.ts new file mode 100644 index 0000000..5e2048d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-crypto.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto.d.ts.map b/dist/ethers.js/src.ts/_tests/test-crypto.d.ts.map new file mode 100644 index 0000000..fbc52e5 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-crypto.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-crypto.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto.js b/dist/ethers.js/src.ts/_tests/test-crypto.js new file mode 100644 index 0000000..eac99c2 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto.js @@ -0,0 +1,493 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +const index_js_2 = require("../index.js"); +describe("test hashing", function () { + const tests = (0, utils_js_1.loadTests)("hashes"); + tests.forEach((test) => { + it(`computes sha2-256: ${test.name}`, function () { + assert_1.default.equal((0, index_js_2.sha256)(test.data), test.sha256); + }); + }); + tests.forEach((test) => { + it(`computes sha2-512: ${test.name}`, function () { + assert_1.default.equal((0, index_js_2.sha512)(test.data), test.sha512); + }); + }); + tests.forEach((test) => { + it(`computes ripemd160: ${test.name}`, function () { + assert_1.default.equal((0, index_js_2.ripemd160)(test.data), test.ripemd160); + }); + }); + tests.forEach((test) => { + it(`computes keccak256: ${test.name}`, function () { + assert_1.default.equal((0, index_js_2.keccak256)(test.data), test.keccak256); + }); + }); +}); +describe("test password-based key derivation", function () { + const tests = (0, utils_js_1.loadTests)("pbkdf"); + tests.forEach((test) => { + it(`computes pbkdf2: ${test.name}`, function () { + const password = (0, index_js_1.getBytes)(test.password); + const salt = (0, index_js_1.getBytes)(test.salt); + const { iterations, algorithm, key } = test.pbkdf2; + const result = (0, index_js_2.pbkdf2)(password, salt, iterations, test.dkLen, algorithm); + assert_1.default.equal(result, key); + }); + }); + tests.forEach((test) => { + it(`computes scrypt (sync): ${test.name}`, function () { + this.timeout(1000); + const password = (0, index_js_1.getBytes)(test.password); + const salt = (0, index_js_1.getBytes)(test.salt); + const { N, r, p, key } = test.scrypt; + const result = (0, index_js_2.scryptSync)(password, salt, N, r, p, test.dkLen); + assert_1.default.equal(result, key); + }); + }); + tests.forEach((test) => { + it(`computes scrypt (async): ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(1000); + const password = (0, index_js_1.getBytes)(test.password); + const salt = (0, index_js_1.getBytes)(test.salt); + const { N, r, p, key } = test.scrypt; + let progressCount = 0, progressOk = true, lastProgress = -1; + const result = yield (0, index_js_2.scrypt)(password, salt, N, r, p, test.dkLen, (progress) => { + if (progress < lastProgress) { + progressOk = false; + } + lastProgress = progress; + progressCount++; + }); + assert_1.default.ok(progressOk, "progress was not monotonically increasing"); + assert_1.default.ok(progressCount > 100, "progress callback was called at leat 100 times"); + assert_1.default.equal(result, key); + }); + }); + }); +}); +describe("test hmac", function () { + const tests = (0, utils_js_1.loadTests)("hmac"); + tests.forEach((test) => { + it(`computes hmac: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const { algorithm, key, data } = test; + assert_1.default.equal((0, index_js_2.computeHmac)(algorithm, key, data), test.hmac); + }); + }); + }); +}); +describe("tests ECDH shared secret", function () { + const tests = [ + { + "name": "test-0", + "keyA": "0xb484f7e25b06a887c3a01c97db40b5d96a1bd1ce69f342442a8395bfc995c34c", + "keyB": "0x407f75dc7d9f420c54bcc51189a16841b75aab53827d3ed54d5548448136f577", + "shared": "0x04131c0361e18fbdfb1575b06763225e8e7d4b6d33a6b6f369f20ff05bb6bb79cf6f510154615774f14a68ec405244fc8cba9fecdf012d22988575bf7f72f55cea" + }, + { + "name": "test-1", + "keyA": "0x953287b3e32f93c3ae8974d380b88f9a6d89ce2969c4b589cf4d068ec719c885", + "keyB": "0xf92ec8bea281236772a90219e9c661d475c6dd457dbf71f3076e9f136a7dee2b", + "shared": "0x04b0d910de1a56e19a300e4cf7d8946fab088da26bad0be01b3139af7f61633387c110d00a9f4059a75808c7471665242996b0999677bfef0f8c9b2eb9cb7ff3f0" + }, + { + "name": "test-2", + "keyA": "0xe47de7c043683a3facabbd72097c5c1c9148fc2d66854dfc32df924bfdb45a13", + "keyB": "0x5bfe0ef6a3c40797a4b013d01bbc02dfb150c46cb04c85a52be5d5d370d1f60a", + "shared": "0x04abcb75054302b210ac0ab42d412e47cc08bfc0d29298edc3a1c0f11d88c49240a8f922ca57dfbc003e6655337c75d5598b704ea91546206d9495aa61213aa96a" + }, + { + "name": "test-3", + "keyA": "0x3f0b65deb1a95ec280649e81b933ef382441fdc875f6280d782e45628f0dccd7", + "keyB": "0x3aeb016c64f23b276f816aa5494a2cec07361d2a4a0d4992a5b99764127e8f9e", + "shared": "0x04de883e02e1842f87796a83790b646615902e2a0612477bc63002f23a94d700c15632660cf6018f10a81785a9f294dd100309e397e88e7d1b7d70f601a4cf3b1b" + }, + { + "name": "test-4", + "keyA": "0xb9f059a915d6421848ae4344c64f1803342a7991c1fd567d61238aaaab583a5a", + "keyB": "0x0beb07549d6496d635c45152673455268f4beb89c07ff049c6e269dfa867ac2c", + "shared": "0x0411f59f62bd3033dba981f23fac5cc0718737dabeea9f060d0fd572383007402b539dd60b23b936c7842fcf16f4fb0524cc07ab02a06c3be8b33113a20f3d47d0" + }, + { + "name": "test-5", + "keyA": "0xb48da3af696d7893c818b5e38ff682ab77818dccb80599f36b5108ad25214cf0", + "keyB": "0xac732d7e814ef45ef8a7acf31c4f04eef30247c992b558c8523f4894e599e772", + "shared": "0x0499778f55f0e87e28d72991c380a2ea5147f0336f5bc7d7ef6a1b2ef25e8949d05e3a5e60a1d605abe69427daf321a118f648c4b4da2529843b5409df921fb927" + }, + { + "name": "test-6", + "keyA": "0x90b5123740bf282e9622ff8a2511692e0abc897bd61a64f49c2497967cb45dd5", + "keyB": "0x471e8f4b20e3328d4a25c20dad734e0bdc160c6c3dd3709858ca6ba6ce74d24b", + "shared": "0x04428de953d7409c419a6f11622c4a4d087082b54bc8207c514534ecf7901723c1f58359631ba94e95c05d934a2eedcecd705bbb61dd8f57cbb08572dc69e6a782" + }, + { + "name": "test-7", + "keyA": "0x9f7f6431c1318481003fd21871b4b8a86ca779caaef10fec2209479b5072ea15", + "keyB": "0xb6be68f448ac1092a704613f3a75324b5c58157f3595c48a3825a0089d7f9d3c", + "shared": "0x0468218704c8c364d4d1838c7f66ccab205797eab0b02b93b75cf4e4437dbe13e7d9d0830971758b3a65e75eab577954b42f6721c104e4b876b77b8db63d23d43d" + }, + { + "name": "test-8", + "keyA": "0xb9113e35ac2f7ba2a315e9f4301275cf561b91860f612d14a351273e38c04966", + "keyB": "0x00c3101f5d3d6272299180fd426dc1554854cb06dc911bc85fa97327d4fa3f21", + "shared": "0x04532cc9a89b735f0a11a0dbbbd40b05460dcf8e41e9da8359c727336a245d5d9babcca050434b81c01a6c70bd27692123f99377f22c0651bc0b01ae9871624894" + }, + { + "name": "test-9", + "keyA": "0xf569179eccaaf12c837a7362b7fbe41976dbf760270fa759e3dff18ae2bbe5fd", + "keyB": "0xc8654bad899f2e827d581f45db8b7f295a0dcfe5253577d8604c08d589180527", + "shared": "0x04d3568b0d1203d09cf9d1707c3ed1a44eb0230d2169c19c89433df8330010160885e6e626ce4505ac6ce7dda68bd57d2ddaa07a5ef5a4685c6a4e3784b8ad9184" + }, + { + "name": "test-10", + "keyA": "0x0ffd74c78276a1bcffe332b0545400e5992c87f2a2f91caa71ad76215ed2b229", + "keyB": "0x47dcfdf847d5b572784d546e0c5048aa4e613e74936fcc5438b75370d5f5525a", + "shared": "0x040fc7a5c5a7f9bfb98b596d698dbb0a87e1dcd50457544644acfb09ee3802835bbadc7717d06f4cc19af3bd308755eedfb162055b08134d63a49231ef9a38e503" + }, + { + "name": "test-11", + "keyA": "0x9777dd28dd62dbf7b17244b8e7b49b3cb673b81ef9dabbb196c23ccd3d0b22e6", + "keyB": "0xbc1f73ca7cdc51e1264429d6f6b581c75b3a5986cb993f09ab779156764ae1b1", + "shared": "0x04493d9be34f59077b11f56f8f883bb1f9ff247500f482f3ff6c1adcee9860442529b957a92ddc3a40391859e3b853b95c8e2159cf2dcfcf70ad4d6b7b55386f37" + }, + { + "name": "test-12", + "keyA": "0xd0ae54b6b72ddc5b8ed416251671bb488f9bd18e63fc60ed10dbcd12920d2f65", + "keyB": "0x2bcfd3837358a43cb181613ebdb152d72efc9fe7dada0c6bc44eb84d61070e2a", + "shared": "0x049f2d2eb2a6ba4937ab44c8ab1769c4b64b74b4d187f965c5ec1272cbe53d79858c8bcadfc17a37d95633da3881fb0e2900a1dfd1ac7160d67fa3dbd81b3de268" + }, + { + "name": "test-13", + "keyA": "0x14dbcd45b32a3ece2adb1691352096d395354928f7ceb5197c85cfe95b4e23eb", + "keyB": "0x111ed2f1a9fafbe021cb07033f0a1d45084fbb6b2facd008fe1d89e7ad029ae8", + "shared": "0x0441389bf60228a087c317d6a07b41ce9da09a4749c6b595ba5d8deef7eb7d8c21d266450b3df6a2a2d29ed149e909b3381604c74b5154da7cdcb9bb26336a6aa5" + }, + { + "name": "test-14", + "keyA": "0x3e7d474097eb34d76c38d4bc586f9cefc3bed6d8c172e4e5fea4016e0f820e1c", + "keyB": "0x3d8c224427a5cc554fd064020017c20f655c347f344afa68d133b1e3b8bfb0d6", + "shared": "0x04acd1f4ff562dd474f6ecda6f94b9d6eac65c497f0b103f1b6bcf03fd306f82505d5c5aa9de302f9c0577e479392795eaa13d68e2c6fe665ed7dc249d5a9ca7bd" + }, + { + "name": "test-15", + "keyA": "0xa79deef7a811761554cc019967eeb15ad61b6a69b266e3a091c1e00d3bcd2057", + "keyB": "0x43fcca9678c66d1ef35617ade47cf015f75da19d1b7189144a0be0c1631a4a00", + "shared": "0x0470131669ac84dc65ada0c23469b39cc42a54df3482577427a7aab58bddaf13dc05469397717be0882fa7c37b8b7bbfbf49b500d1f17a3b6fe8c7f233eb2ac2b1" + }, + { + "name": "test-16", + "keyA": "0x1945930000f6a3bdf339d5b632c3864f9ce8a0370243dd2bdcf805aa8f9e80e8", + "keyB": "0xa97c423f9cc5827730b33ba804d15c8c97406f154a71561e3ed263299781e591", + "shared": "0x0414fca0eb5db9d0b52f64b5e7b794659e87f2ee6816e83076d1e16446f5e9646fb1dd042027eee659363958d472f4a38f9bc400556dd85c7802eb1b87d4250581" + }, + { + "name": "test-17", + "keyA": "0x5f6e300343975539ba132a6bf26c2b3fa827ee558bb6698c86bbc84ea8a71577", + "keyB": "0xc015b1dddc249815a81d9c7f54f4676b10a3ec321d9d0ddd35b800557fed6431", + "shared": "0x0476371203edee28e291a2b0fabccdf1018c395b090a8ffff2feec116d3cd103e6d3fa1ea02ddecdbd392dc076ea959c318abf2d69c06e35a92e4f09249d4d73b6" + }, + { + "name": "test-18", + "keyA": "0x3f4f0a728833e864f96e202060239743ceb1150cc75094195e6bd4f53e7bf62a", + "keyB": "0x5a7b89392da6f39464967d315ecfbe8822b75062d68f3a43cc2a928a6abf2993", + "shared": "0x04959db3cb80d503579bc587399d09b043778c66115d1354ce449e060d3599bf2faa4adcf7da0419aa0af732ab5b82fe3ed68e5e5860dd2f6610f3f4f2ca7351eb" + }, + { + "name": "test-19", + "keyA": "0xc3106be0925e0d69703e4ea6d3dbee7903a8b8bb293ae59b2f90b0efdb0b3a1a", + "keyB": "0x44cf9575f03af5afc03c36f62433ebd52579d894c759cab76d29a4b9d0bae083", + "shared": "0x04a980b037da455ec856a7e3a9f63e8b9daf73f8e1e929f3f10e2c4b603b5bca48264c057ce04a25f5f48d87d27a43f7192aaac3340d7d5972e2ad3efc5de20c13" + }, + { + "name": "test-20", + "keyA": "0xb6c7bd2ba0d2b30d3e56d038398c2c937fb5cae348accdc060fb882903312008", + "keyB": "0x9ed8d5fb02fa0e825e7e095cfd32f9e817e8cd030c4363470f55d17e37cf73ef", + "shared": "0x042aa9b64ce873f5a3005a8eaee54e823f17633eec0a808ce0e24286f3c169485c2b7145f10deee39073056ce69c7d8bbbd2ff693b33b8749ae2b2f47e2e342397" + }, + { + "name": "test-21", + "keyA": "0x9f44756603bca7e87e2dd718ef2323f12854056aae86dc9e31715f97c0b3dc12", + "keyB": "0xd1ae23664d6320f9989b031cd7357fe346e207ffe73ed51de7c485754b8f1578", + "shared": "0x04037ab94245dad8282b4fabfec79ae5ca26367db2f45a183eb4c0f0c9ab7bf0d2b33503981159468f660711fb956eb730675b1e34f1e7d0aca07b936b64c47d56" + }, + { + "name": "test-22", + "keyA": "0x4c6307b149f1052290dc0140d6d597c25ddd23bc0ca826a9f44215009d13dad5", + "keyB": "0x9845254fdb40c7c74d0f9f3c6f73ce97a27f4306368685448b1f72dfbb3dd5d9", + "shared": "0x04f0ea5528a2efa16d424dbc07d49d3d2943e842289c6472f1cdeded965438326af76bb47449b417ef3b82130096f3c019d0ae3ffc3c9631f065a3285ba8539bfd" + }, + { + "name": "test-23", + "keyA": "0xab6ac9d67466cae30d31584104970e1093ebda6690dc9bf7bea1f66f07ddfcb7", + "keyB": "0xc0f58e549e7984e780cbc307b2a6b4c4863302474d271637586fa7cc0e389df8", + "shared": "0x045d5fd0d76d168b746462231a5bfb07fc175f43b206622781614e3df3491ba4c3738c4d3ae2d7f18ab0570c86aeb139778219fcc57cac3d42726de0f38d31b52a" + }, + { + "name": "test-24", + "keyA": "0x5b0e950974450f38dba31e01379814f0ed1b0f983cfda62dfecff5cd3e8db391", + "keyB": "0x4739f9e168dee9af2c8a9107b18738c9e3335115af8a431810ecce5269fba577", + "shared": "0x04da8ab5cf841804f0b5845f36e46e3463dfa3d6d9e7a306962062b729c680b2e8fdbf2b3eb2bdcc90d2884b9217dbdb3ad3620cd844982f19920e5d4f59353504" + }, + { + "name": "test-25", + "keyA": "0x9f3583cffcbe992d4a537defb5d8479c2bfa96a39a3f33fcf40123854bc96ea4", + "keyB": "0x42fe9367ef668babd70d4f5e836627cc78990b8a1738a56adf23baebf9410b48", + "shared": "0x0414edfdae5d2db370a51b5cf45ee6049621f52dd15eb5136c795ed364221c0a5c0f32e9ebbc9211b121ccc06516756e9280b210abe5b1a8f6c658dc69c39341f5" + }, + { + "name": "test-26", + "keyA": "0x289406a24a7794b04469a4acf9846e905ed4cae37349101db835f90e25d09605", + "keyB": "0xb2d58cdc470106c12f538b4516559d8ecaad0bcae063848a44f8639168453b93", + "shared": "0x04a9a80e466ea54aa0651eccde081e47637d2c142e1aaaf42572ee0753a49f7667c94b99f5bc2bf632b1330e3ffef95d009560e61084cbc07aab020282af5721f9" + }, + { + "name": "test-27", + "keyA": "0xd9bcf36ef585f59e1570904784f0a3df6435c798bec7e1c406e922d51f98b510", + "keyB": "0x40244928c9d371a427a0ce96530120deee3d31af086db679ee6bd8c1a7773030", + "shared": "0x04ac55594d87dfdd8af303c5f92745d49fba6ff15afb628212bc5d432d97bbd909938873c298fb93c851d901bf178e14ef1d590ff0dca7f7ead5613e97e3a824db" + }, + { + "name": "test-28", + "keyA": "0x301b79d85431a2c8bc21236cc58e1221eeb0862d3e3cfb29534423e6992e7591", + "keyB": "0xe6a62f0c49971b7b11477fc964d777de92267ab09f1465520ca31edcd7abaffe", + "shared": "0x049b7326b33eacc5ee3c102cae791d1835219253b70596f6a36892f2bb35fda1aebd661c781ac38b2461ac67b80ea1c18cd0230d024712a4e1826a6c5463874b0f" + }, + { + "name": "test-29", + "keyA": "0x49542517ff2bd70e851405cf285cf2280f84af838e2b0a68ed779f96d0ce62eb", + "keyB": "0x48ffc78034851d2f4e610bc11b97c21d42f5d7bbada2415ee8f03f6b643c92b7", + "shared": "0x04dc12a233b08ff25ee7806cfede3565dedd663e0cd25108ad233b6c5c8f8c25fe82d4b2820fa44e0ef86d51d0eada0033854a1199644204f9233887e457775bb0" + }, + { + "name": "test-30", + "keyA": "0x6597a9b39b58bd47561fd4058894ee327368fdd8b8b267efa0596793c3852ed8", + "keyB": "0xbcab19f22f0cca9fc791f998a5717bc4c81853ff4f1c974a7dde7ecef41b4802", + "shared": "0x043d622a7f3255437c9f6459e68d5e3333d377b76ac053a50affbdf88c555508c42000b092dbb07b72ecf5887766ebb2e47afdb3d8324b7938d9255171d971b1a8" + }, + { + "name": "test-31", + "keyA": "0x4127797885e7b8b7c882fec5cf38be273f42de47261e8ea4aab49769d606dd01", + "keyB": "0xc82a9b18f2f060adaf4f7cf56f29a2f4859d12a452b8b9f079f8850423fba666", + "shared": "0x045e7b62ced9cebd94d2115b11f2e9ca6f9a66119a17296613a60439d2960747f927c305822fe15582bb62f48c574aa7c89e7b2c8e5d4affc86f097e794bdf029d" + }, + { + "name": "test-32", + "keyA": "0xf5ffbd9bf88dd867ace131df25fc9bd9ab87b7834d91786f110f40eb2e7b73b2", + "keyB": "0x203fe0bd83081d65fe45f194c373dd84c61fcdcfd4783d18e0e060f56efde038", + "shared": "0x04cddff70996f116a874442da0a33ac3df0e99f063bd1066644e6ca88442bda15d5b46fe8c6de7467a13c65febf4a6d258ffae99784c21fa61fa8a3b384b666154" + }, + { + "name": "test-33", + "keyA": "0x5073d19c09be03d0c41cef0b950e13b85ee87c4c1642061addbdfd34c3258618", + "keyB": "0x37cf3617c1728e613c738c9b61fc84b76490128b3a584a861862416b1bb5ca60", + "shared": "0x046234004e627b076d7bb6b6aedae341ab755f5f3dbca295fb2a70ae3206f26543c8f031605764e7dfb377a12c0be3a61df6983707ba62955487cc36ba8e8c0812" + }, + { + "name": "test-34", + "keyA": "0x0378dd63bb9f1fd4b0b7c266239ca574c7f6f7ca62645b3e9edcf763918eb110", + "keyB": "0xfd144b5e82bb6dbbcc9e9b714d64e283b748e85ba93b0113727fc1670251c6dc", + "shared": "0x0481f04971c2282e9850ee373aba6ec92390e3ff12b95d86d339dfce7dfa592f012ef71875aba27adec232a90f209f420c6e7c73fd40f165ba9b6196a10ca5e82b" + }, + { + "name": "test-35", + "keyA": "0xfa99235e06ec83c103ab50653ff5af505b085892781a6e743c7398219562ffe4", + "keyB": "0x6a8850083fdf6ecb9f9bdb613f1c6706fe233e2e74fad460f7c650751bf999e9", + "shared": "0x0407117676960073ab08890efd07eb6222584b2c8ad9a1eb64f9e610138c10a4d59f4ca496910ac35a1fad24e56fc08020ffac2dfabb2d79bbcc041e70dffb203c" + }, + { + "name": "test-36", + "keyA": "0x3abcf36699a174e462196891e49e72759f707d7f82ae5e64a49f1273927802ae", + "keyB": "0x44212cd650066f2371908cc6ba520061745db823c64b8b99dae535e364fe7034", + "shared": "0x04c354916600479cbbf9d91f5b851ee075f0aac99befa434f3f3b30fa887a0a7af71129ea47b388ac41538a71f9e52f68473ccc2611ace7cdd999ee036bc43b459" + }, + { + "name": "test-37", + "keyA": "0x858512678a61f3d286fd1a90cb8fb8960d8cffaa31686706d0a879d66acabc7f", + "keyB": "0x490e29655cb5da0dcd2f60e4583cb41b7ad9a801fbc00a2927968f06b0c14852", + "shared": "0x040dde94c952ec15bcba15d773ba0dfa9cb5ed7731cda1b7f8110fa91f843173f83d577f601b61f2df21b9f7cbf2b1d54792a6f9403c2446a480af7b69e23b8d21" + }, + { + "name": "test-38", + "keyA": "0xaeb4d6c2a817e5882f991f0c3c81d0f6f2d3d8854d472511a211cae67adae695", + "keyB": "0x72c297384a02544ba9719c0ce1f0ad3cb4e89b57536880f65c0462d1f058a55f", + "shared": "0x041a61bd828eacb1aaacbbb3b0291d691f5fc1462f16fc55f828b1f28e73342957de6b718501e66c3a1885ce16e124adb600457095ba770f58be012d0b69ca949a" + }, + { + "name": "test-39", + "keyA": "0xb0fc529ff1bb4a7985663d54b279cbf4a597ec922a810ca16b87697ef3ef0dd3", + "keyB": "0xaf6019921bc7db54c334102a766d32d3ff06fd68ed08efe8ca2a35ce5074dcd0", + "shared": "0x04b49b24610350fde84bf067affc1d9f7ac549b3c4c05fa963aade41e65d6645cf867466f6c87e11298cb433f45f65eec4c5d88e76acdd5515a92802ded42c6e0a" + }, + { + "name": "test-40", + "keyA": "0x160fdb84df11195fb0d33335e593499c3505cadce25ffdf6cdd8af0cb78d400c", + "keyB": "0xb37568a52ead1debcb2d402fa3d58f212a37321aae2cea1b90b263a3276bfdce", + "shared": "0x04091c2e14e517d9990425bb5d0a9e48f3bfe27a1cb673182fe1f7dc27bd6a56043a7745c9d27052e60ce72a1d82357f6675fadf9994add784c45821f52f2b094e" + }, + { + "name": "test-41", + "keyA": "0x253ca7443d94998bab1f508e3424c662831c6be6ec5d387e97c79f078087ff15", + "keyB": "0x38102245618fddf8a1bd7de152c6fa630523223b89a1649d5f2fa5f9e47ffe4a", + "shared": "0x04046754be94d9ad925f67b1bc80fe32cd6920f9f80327cdc83f68e95d999b1d8ab7b41844db1c1ea66662b42737169daefc675c9364583565e3982b674d8a30dd" + }, + { + "name": "test-42", + "keyA": "0xef558874b5b1d5915c83e3c1e4554d73de1e9943af445eba3f6516b731cc0126", + "keyB": "0x956e32c2e87263215b8c31c7f2e7311d6acad863f3c428b0625c9376cbc405cd", + "shared": "0x047e9265334e20ad8747098147b0eabb6d01c8ab12722cf0bbede05c1beaa67e8e770e04e19cf6035f48289fbe85cd4b9496a9ca5a90d088f8e75a0c1c6c7f1cc8" + }, + { + "name": "test-43", + "keyA": "0x32c00e0d3a2ba3db6685058e1327dcee6425068190890439391fdb95857f27b0", + "keyB": "0x8b39021f7ad57a101534977d323c0349cecc8405d93286c6e71a441f4cc16c86", + "shared": "0x04c8095c862e64f6866fd3c177ed898fa3ca5da2d585c60ea4646d8f2cb9f332dbd54ca9d3b2a9e852a15189a0eb97a8edfaa114a01277418aa2ecfdfb3770caa0" + }, + { + "name": "test-44", + "keyA": "0x40627c6987e20c07014833e23a0b9304bbaf66525a59b892e224944b56d3117a", + "keyB": "0xe23607bff98d5699816836f65e5405f2e60d4fe2449979acd43ee2b3e9bfc218", + "shared": "0x04be3ec3c188e7c74944d42beddf19003aeb0ccf8cccf8532b220dc666520f277e8b98b87ee694e8c76256e51ebf69433479c69a4ccef3032e9cb550632db539f8" + }, + { + "name": "test-45", + "keyA": "0x46c25bcd7d2f8ce6d27148a11f18e0314046260433f8cc6421be4dcd72a6e088", + "keyB": "0xf29022ca90a60d455d0b1470034d1c7fbba27a9997b1940a9373a97d092f965e", + "shared": "0x041f5fd1dd02afa8ce5d2877a05ce92a4db5aef022a8203551590343352c1bd6e71cad811974a74f49d140949aa091dc4262cf7da0b48bdfa26939cf4b9c461f52" + }, + { + "name": "test-46", + "keyA": "0x6d6b69d4f9fafd986e5b1a9c36f3021aae9ce64c027f1bf9bd9e9e12d86a276b", + "keyB": "0xeed0cabb4ae5a696e762c98e6d697bd88a89d9a0b38458c6e696f0748e404fe6", + "shared": "0x04f2f9c8fa945577d7188292f5c4a4fad80bdcc3db44d6d5c15bda5a23971ac7046cb8af44bb5864a9e0e82c921805663c539a22f8c5ef22187062564f1359f4d2" + }, + { + "name": "test-47", + "keyA": "0xf6b6d733b8c473a562f7a23c7cbb23f40273d809d13aeb308149ad709c674300", + "keyB": "0xd873a7d24c1f498a43c181f566f265cda248f9e2df8a825e69a73aeb1437dad9", + "shared": "0x0495f669c1c7271be4c8e628017ef570a0cb903887c3ea4897f09cc9ecd2a4f6b043e1fa41d1ddbf8f01e60368bc95e81ae2a8bf4922374294b0836ff7e43ad2ab" + }, + { + "name": "test-48", + "keyA": "0x28410a640558a5da5b7746a46a9cdefc704ba2944f23699d3767f6505a97eb78", + "keyB": "0xfd1a548275be4d922cc294276d7b059cea0fbbcb629be29bb8072de597a96597", + "shared": "0x04fca25ec051c8532f664fe2c2e213d1bd3e298422232dd34e821245256e0bff4ff80fb1f03524fd57d1d4a6effc076899cc21dde0be10d60016c20c33b7524d00" + }, + { + "name": "test-49", + "keyA": "0x89e51abd416ad4579d523bed183da74b991c589decb982649a0abedfe6061c0f", + "keyB": "0x22b4cad2ade397b86756c2457516cd23d0858700b0597fdb2433e891efa435e3", + "shared": "0x049316e68898db5d7c987fbfa371b1fbd6a56d585bde1017a825d1dfaad406b428a505e773e63ddd0244b0e25ddc1b08dda6dd9968673f7b10c40d8fe8a1e1d55f" + }, + { + "name": "test-50", + "keyA": "0x2c645e1abac8e5848617067e6c3d739a6f126484d27f73bc8fdfdc9f0ac3ff04", + "keyB": "0x71252585fb806d9273c0103dcf642b419e7632ef3aeba3efc6c71863b50ae177", + "shared": "0x04886ec11347e30fc5e68a353201d702c4425358791ea6a6213c444c7489e38103c953fe13f4238dbe769f0d6208f693e356f81e7037977cf8a5b04661e37d2569" + }, + { + "name": "test-51", + "keyA": "0x572a1ce3adfc10ca3afc39262d36c329ba44d7cfa6ca5c62d2e882ac25480d47", + "keyB": "0x2b9081d499417315277663c86e25dd7898ea67e969b632dd11e80d29e92b557f", + "shared": "0x0424c5ae82f447c156d97ed31c83f36cf3416cb4a72666bb4e8a61687a4ba4ae22b42f7d18579ff204f7974af9f8dcc51d8f9eabc45c720f607478ba78c2b2921c" + }, + { + "name": "test-52", + "keyA": "0x60ba350fb7e0729ad992f53a314eacce65da6897856e362d2ef0959e890b9e99", + "keyB": "0x6a9629c655cf4f8b8816e95df1c14f769cb946431c6da17a04423ceef8979ee1", + "shared": "0x04831e236ece1bde7db14b819c06e0a17964b88b5fc4e8253a8dc316d613fad8ffdb5117eb920f34ce838d6861caa0e885e3c20d37cfd20e19d1092d52976e0f91" + }, + { + "name": "test-53", + "keyA": "0x32eb6769ade64560a016e080f5e16ea97b2d0cb96b730e9c5c809bfd19a002c4", + "keyB": "0x7dff2eb8455b0e9c0fd38838db3d3de96067a6efc05d21d1bb303ca0bd52d87d", + "shared": "0x04b0cf54b0590546e434a5e3d2071c3c022d4b3b571660b359cee7d199e525965e9f38d12436affda7741d5b752e0b430149a1ec6d7835a6999e64b3ea324e91c6" + }, + { + "name": "test-54", + "keyA": "0x70446e5ede6e26b96d3cecfe8afc35055a0a90f83c7db4d1b8a819d5cddb6642", + "keyB": "0x2df217bf6e92875e35af50bfa301059b2ddf593c0694b70116a8c87ee27ef4c9", + "shared": "0x0458e1554b06a40b9508d86d5cedeb3dccb82053881393306b1894d198412500dc0efa4dad2265d7532e59d06f71cf33f3d48728b4707434a5c722eea8d9a9acbc" + }, + { + "name": "test-55", + "keyA": "0x64e16f672ec5aba6be5a4965d44bd7224aae65d444ceee6dd58690e527b36186", + "keyB": "0xefb054ff4222e8e493cb667f56129dc1b6a3437581280a3f984ff0ea09ec3029", + "shared": "0x04c806576fb79b4d7d38d00a3ee2c2896dfb1b29ef3a42ac72a82c7bf7626f2073a79aec8ee2c3c101845ce5171b27a9f23075ed74ccdae088956e3dcdbae74e7d" + }, + { + "name": "test-56", + "keyA": "0x284a5592ab3fa9b8df2bf927761a667118697cd7413c255ef3cce9e9de76c321", + "keyB": "0x52d0033d83fbdeb0b7c8d21b475ec637fabfcc7c2593494d7e846ecd974083af", + "shared": "0x04e092613c7552c3180bdb041c32b9763804e6703c2c116009f1012526002472b5b627a85cb50c90942fe177bd36e2d4fbd8e9d835c72a607ee07ffead29cf12eb" + }, + { + "name": "test-57", + "keyA": "0x488e6c2d97fe0ff3f5357254658ae487ade54bdf7bf871ffdfe27079cbeff103", + "keyB": "0x00f8632a6982d58c25236ce1952c19052f6b08edad61edd166570a8679a98f5c", + "shared": "0x048f02436bb55798561a6a78aacbeec67f0acd8ba88e99af6ec1b7b5152d9a5d7691a905c11fe26c2ba3d72be918f6ee7c3e66115a31a7f199f33073f6f5087181" + }, + { + "name": "test-58", + "keyA": "0x0067fd2eec16c7ddf9a364f591d47394bfc12fd2b3ccff1bf1013e92e969f6f0", + "keyB": "0x76f1e3f4abfb237ec3ac6e72a56f25bfa06e7561bc5fdc4823282f9db40c49d4", + "shared": "0x04975e88ffcd670b06e7752d3d375613d0cd614f2b3a812e684342dcc16be6de336af2bb30ab25da0362ecf43752b477b412081d723f5c6840ea78deacd5f76b4a" + }, + { + "name": "test-59", + "keyA": "0x4ff02743564c317a3578c08f7961a204d48e511e31688ba069037f6090235b37", + "keyB": "0xcf22489e1b9058b4a645e38504eaa32e031dea44e1465eb1122e14e4847c9744", + "shared": "0x04e584b571a9f99087bc6cb7818741cfc3b630ec412f64da1ada72de17279afa60258c5844cc2c7c1416548497b083f2aeb035c8945c0aa03a25b97bad7870c136" + }, + { + "name": "test-60", + "keyA": "0xd140deee768594cea37e2eb5c89c60228083f93866ebd62c7c07a1a9f8a9bf58", + "keyB": "0xc9f2edf7ccd6db9f21ef5a3966ee11694dec652d60ef21a540802db8b990c370", + "shared": "0x0451b4a54b1fcdcbe4f5b97b3003bce3cc91f362cf2baa696ad0abca3cd21b12d4e4f3d1b0dc1c18599917f5fc9be7825d23999769d3811edf61a7ecc34525b403" + }, + { + "name": "test-61", + "keyA": "0x63dcf1d3db0d89a37df3734e88f601412a184030f15474a0d9687e3105361161", + "keyB": "0x5370bec049bcd28507f4078783d9378cd84b8e05230089e8987d3a485c945b08", + "shared": "0x04e27e5ec5eb72fa6bda376f832b4730d6f7b9104594fa191ac87198f0d4aeed47c79568cf8f59fae0e43e8bf0931c491eda0cce1f19efc4153aacde94e673ba7f" + }, + { + "name": "test-62", + "keyA": "0x465d0d758d8c7664d9e1bfa46fb5fb8e27265cb4bc28c0f7752d596910545028", + "keyB": "0xeff55416a21e627ec4c55a08c9a3f7378ae2953fd5bf0926bde15965cf6b4d5d", + "shared": "0x0487b20dbad3b5443594fc66470559206c37440a01ef91c24c38a51bc7bcf7676409789c6bc214087947ab8d0359927080422b2ecbd23e765bf6a79e4bbb456796" + }, + { + "name": "test-63", + "keyA": "0x28469aab3ebc9efdec35b19e7c42a26311c649267ac92ae2ef2f5c8880eb517c", + "keyB": "0x786e828e92abb73818380b37395c67dcb6a72f3e0a440bdf1f5f132a0621fc78", + "shared": "0x046bfff91c9b31abb6df020018b66734c7f9fc4f7294c809c706b76c308982e5d75c10200fbdf67d75ba4b154223f591bfe3504006ba69634d4025c57b9af4ab73" + } + ]; + for (const { name, keyA, keyB, shared } of tests) { + it(`tests shared secrets match: ${name}`, function () { + const signA = new index_js_2.SigningKey(keyA); + const signB = new index_js_2.SigningKey(keyB); + assert_1.default.equal(signA.computeSharedSecret(signB.publicKey), shared, "privA + pubB"); + assert_1.default.equal(signB.computeSharedSecret(signA.publicKey), shared, "pubA + privB"); + assert_1.default.equal(signA.computeSharedSecret(signB.privateKey), shared, "privA + privB"); + }); + } +}); +//# sourceMappingURL=test-crypto.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-crypto.js.map b/dist/ethers.js/src.ts/_tests/test-crypto.js.map new file mode 100644 index 0000000..1850444 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-crypto.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-crypto.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAEvC,0CAAuC;AAIvC,0CAKqB;AAGrB,QAAQ,CAAC,cAAc,EAAE;IACrB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAe,QAAQ,CAAC,CAAC;IAEhD,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACnB,EAAE,CAAC,sBAAuB,IAAI,CAAC,IAA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 100644 index 0000000..ff78269 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-hash-typeddata.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts.map b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts.map new file mode 100644 index 0000000..d98e0de --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-hash-typeddata.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-hash-typeddata.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js new file mode 100644 index 0000000..575d578 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js @@ -0,0 +1,21 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("Tests Typed Data (EIP-712)", function () { + const tests = (0, utils_js_1.loadTests)("typed-data"); + for (const test of tests) { + it(`tests encoding typed-data: ${test.name}`, function () { + const encoder = index_js_1.TypedDataEncoder.from(test.types); + assert_1.default.equal(encoder.primaryType, test.primaryType, "primaryType"); + assert_1.default.equal(encoder.encode(test.data), test.encoded, "encoded"); + assert_1.default.equal(index_js_1.TypedDataEncoder.getPrimaryType(test.types), test.primaryType, "primaryType"); + assert_1.default.equal(index_js_1.TypedDataEncoder.hash(test.domain, test.types, test.data), test.digest, "digest"); + }); + } +}); +//# sourceMappingURL=test-hash-typeddata.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js.map b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js.map new file mode 100644 index 0000000..c319707 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash-typeddata.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-hash-typeddata.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-hash-typeddata.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAC5B,yCAAuC;AAGvC,0CAA+C;AAG/C,QAAQ,CAAC,4BAA4B,EAAE;IACnC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAoB,YAAY,CAAC,CAAC;IACzD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,8BAA+B,IAAI,CAAC,IAAK,EAAE,EAAE;YAC5C,MAAM,OAAO,GAAG,2BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;YAClD,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YACnE,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAEjE,gBAAM,CAAC,KAAK,CAAC,2BAAgB,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;YAC3F,gBAAM,CAAC,KAAK,CAAC,2BAAgB,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QACnG,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash.d.ts b/dist/ethers.js/src.ts/_tests/test-hash.d.ts new file mode 100644 index 0000000..ca5de7a --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-hash.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash.d.ts.map b/dist/ethers.js/src.ts/_tests/test-hash.d.ts.map new file mode 100644 index 0000000..0aa5c54 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-hash.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-hash.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash.js b/dist/ethers.js/src.ts/_tests/test-hash.js new file mode 100644 index 0000000..2d24383 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash.js @@ -0,0 +1,182 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const utils_js_1 = require("./utils.js"); +//import { dnsEncode, isValidName, namehash } from "../index.js"; +describe("Tests Namehash", function () { + const tests = (0, utils_js_1.loadTests)("namehash"); + for (const test of tests) { + if (!test.error) { + it(`hashes ENS name: ${JSON.stringify(test.name)}`, function () { + const actual = (0, index_js_1.namehash)(test.ensName); + assert_1.default.equal(actual, test.namehash, "namehash"); + // The empty string is not a valid ENS name + if (test.ensName) { + assert_1.default.ok((0, index_js_1.isValidName)(test.ensName), "isValidName"); + } + }); + } + } + for (const test of tests) { + if (test.error) { + it(`correctly fails to hash ENS name: ${test.error} ${JSON.stringify(test.name)}`, function () { + assert_1.default.throws(function () { + const actual = (0, index_js_1.namehash)(test.ensName); + console.log("Failed to throw", actual); + }, (error) => { + return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") && + error.argument === "name" && error.value === test.ensName); + }); + // The empty string is not a valid ENS name + if (test.ensName) { + assert_1.default.ok(!(0, index_js_1.isValidName)(test.ensName), "!isValidName"); + } + }); + } + } +}); +/* +describe("Tests Bad ENS Names", function() { + const badTests: Array<{ ensName: any, prefix: string }> = [ + { ensName: ".", prefix: "missing component" }, + { ensName:"..", prefix: "missing component" }, + { ensName:"ricmoo..eth", prefix: "missing component" }, + { ensName:"ricmoo...eth", prefix: "missing component" }, + { ensName:".foo", prefix: "missing component" }, + { ensName:"foo.", prefix: "missing component" }, + { ensName: 1234, prefix: "not a string" }, + { ensName: true, prefix: "not a string" }, + ]; + + // The empty string is not a valid name, but has a valid namehash + // (the zero hash) as it is the base case for recursion + it("empty ENS name", function() { + assert.ok(!isValidName(""), "!isValidName"); + }); + + for (const { ensName, prefix } of badTests) { + it(`fails on bad ENS name: ${ JSON.stringify(ensName) }`, function() { + assert.ok(!isValidName(ensName), "!isValidName"); + assert.throws(() => { + const result = namehash(ensName); + console.log(result); + }, (error) => { + const errorPrefix = `invalid ENS name; ${ prefix }`; + return (error.code === "INVALID_ARGUMENT" && + error.argument === "name" && error.value === ensName && + error.message.substring(0, errorPrefix.length) === errorPrefix); + }); + }); + } +}); + +describe("Tests DNS Encoding", function() { + const tests: Array<{ ensName: string, dnsEncoded: string}> = [ + { ensName: "", dnsEncoded: "0x00" }, + { ensName: "ricmoo.eth", dnsEncoded: "0x067269636d6f6f0365746800" }, + ]; + + for (const { ensName, dnsEncoded } of tests) { + it(`computes the DNS Encoding: ${ JSON.stringify(ensName) }`, function() { + assert.equal(dnsEncode(ensName), dnsEncoded, "dnsEncoded"); + }); + } +}); + +describe("Tests DNS Names", function() { + const badTests: Array<{ ensName: any, prefix: string}> = [ + { ensName: ".", prefix: "invalid DNS name; missing component" }, + { ensName: "foo..bar", prefix: "invalid DNS name; missing component" }, + { ensName: ".foo", prefix: "invalid DNS name; missing component" }, + { ensName: "foo.", prefix: "invalid DNS name; missing component" }, + { ensName: 1234, prefix: "invalid DNS name; not a string" }, + { ensName: true, prefix: "invalid DNS name; not a string" }, + ]; + + for (const { ensName, prefix } of badTests) { + it(`fails on bad DNS name: ${ JSON.stringify(ensName) }`, function() { + assert.throws(() => { + const result = dnsEncode(ensName); + console.log(result); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.argument === "name" && error.value === ensName && + error.message.substring(0, prefix.length) === prefix); + }); + }); + } + + { + const ensName = "foobar012345678901234567890123456789012345678901234567890123456789"; + const prefix = "too long"; + it(`fails on bad DNS name: ${ JSON.stringify(ensName) }`, function() { + assert.throws(() => { + const result = dnsEncode(ensName); + console.log(result); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.argument === "value" && error.value === ensName && + error.message.substring(0, prefix.length) === prefix); + }); + }); + } + +}); +*/ +describe("Test EIP-191 Personal Message Hash", function () { + const tests = [ + { + test: "hello-world", + message: "Hello World", + hash: "0xa1de988600a42c4b4ab089b619297c17d53cffae5d5120d82d8a92d0bb3b78f2" + }, + { + test: "binary-message", + message: new Uint8Array([0x42, 0x43]), + hash: "0x0d3abc18ec299cf9b42ba439ac6f7e3e6ec9f5c048943704e30fc2d9c7981438" + }, + { + test: "hex-looking-string", + message: "0x4243", + hash: "0x6d91b221f765224b256762dcba32d62209cf78e9bebb0a1b758ca26c76db3af4" + } + ]; + for (const test of tests) { + it(`tests hashMessage: ${test.test}`, function () { + assert_1.default.equal((0, index_js_1.hashMessage)(test.message), test.hash); + }); + } +}); +describe("Test Solidity Hash functions", function () { + const tests = (0, utils_js_1.loadTests)("solidity-hashes"); + for (const test of tests) { + it(`computes the solidity keccak256: ${test.name}`, function () { + assert_1.default.equal((0, index_js_1.solidityPackedKeccak256)(test.types, test.values), test.keccak256); + }); + } + for (const test of tests) { + it(`computes the solidity sha256: ${test.name}`, function () { + assert_1.default.equal((0, index_js_1.solidityPackedSha256)(test.types, test.values), test.sha256); + }); + } + const badTypes = [ + { types: ["uint5"], values: [1] }, + { types: ["bytes0"], values: ["0x"] }, + { types: ["blorb"], values: [false] }, + ]; + for (const { types, values } of badTypes) { + it("correctly fails on invalid type", function () { + assert_1.default.throws(function () { + const result = (0, index_js_1.solidityPacked)(types, values); + console.log(result); + }, function (error) { + return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") && error.argument === "type"); + }); + }); + } +}); +//# sourceMappingURL=test-hash.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-hash.js.map b/dist/ethers.js/src.ts/_tests/test-hash.js.map new file mode 100644 index 0000000..3648cf5 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-hash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-hash.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-hash.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAKqB;AAErB,yCAAsC;AAKtC,iEAAiE;AAEjE,QAAQ,CAAC,gBAAgB,EAAE;IACvB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAmB,UAAU,CAAC,CAAC;IAEtD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;YACb,EAAE,CAAC,oBAAqB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAE,EAAE,EAAE;gBAClD,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEtC,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;gBAEhD,2CAA2C;gBAC3C,IAAI,IAAI,CAAC,OAAO,EAAE;oBACd,gBAAM,CAAC,EAAE,CAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,OAAO,CAAC,EAAE,aAAa,CAAC,CAAC;iBACvD;YACL,CAAC,CAAC,CAAC;SACN;KACJ;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,IAAI,IAAI,CAAC,KAAK,EAAE;Y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AI,QAAQ,EAAE;QACtC,EAAE,CAAC,iCAAiC,EAAE;YAClC,gBAAM,CAAC,MAAM,CAAC;gBACV,MAAM,MAAM,GAAG,IAAA,yBAAc,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;gBAC7C,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;YACxB,CAAC,EAAE,UAAU,KAAK;gBACd,OAAO,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC,IAAI,KAAK,CAAC,QAAQ,KAAK,MAAM,CAAC,CAAC;YAC7E,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts new file mode 100644 index 0000000..437efc5 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-avatar.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts.map new file mode 100644 index 0000000..467ce3f --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-avatar.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-avatar.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-avatar.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-avatar.js b/dist/ethers.js/src.ts/_tests/test-providers-avatar.js new file mode 100644 index 0000000..0fd1ebc --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-avatar.js @@ -0,0 +1,48 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const create_provider_js_1 = require("./create-provider.js"); +(0, create_provider_js_1.setupProviders)(); +describe("Resolve ENS avatar", function () { + [ + { title: "data", name: "data-avatar.tests.ethers.eth", value: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAQAAAAECAMAAACeL25MAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyVpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDYuMC1jMDAyIDc5LjE2NDQ4OCwgMjAyMC8wNy8xMC0yMjowNjo1MyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIDIyLjAgKE1hY2ludG9zaCkiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6NUQ4NTEyNUIyOEIwMTFFQzg0NTBDNTU2RDk1NTA5NzgiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6NUQ4NTEyNUMyOEIwMTFFQzg0NTBDNTU2RDk1NTA5NzgiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDo1RDg1MTI1OTI4QjAxMUVDODQ1MEM1NTZEOTU1MDk3OCIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDo1RDg1MTI1QTI4QjAxMUVDODQ1MEM1NTZEOTU1MDk3OCIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkbM0uMAAAAGUExURQAA/wAAAHtivz4AAAAOSURBVHjaYmDABAABBgAAFAABaEkyYwAAAABJRU5ErkJggg==" }, + { title: "ipfs", name: "ipfs-avatar.tests.ethers.eth", value: "https:/\/gateway.ipfs.io/ipfs/QmQsQgpda6JAYkFoeVcj5iPbwV3xRcvaiXv3bhp1VuYUqw" }, + { title: "url", name: "url-avatar.tests.ethers.eth", value: "https:/\/ethers.org/static/logo.png" }, + ].forEach((test) => { + it(`Resolves avatar for ${test.title}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + const avatar = yield provider.getAvatar(test.name); + assert_1.default.equal(test.value, avatar, "avatar url"); + }); + }); + }); + /* + // @TODO: Set up some examples on goerli + [ + { title: "ERC-1155", name: "nick.eth", value: "https:/\/lh3.googleusercontent.com/hKHZTZSTmcznonu8I6xcVZio1IF76fq0XmcxnvUykC-FGuVJ75UPdLDlKJsfgVXH9wOSmkyHw0C39VAYtsGyxT7WNybjQ6s3fM3macE" }, + // { title: "ERC-721", name: "brantly.eth", value: "https:/\/api.wrappedpunks.com/images/punks/2430.png" } + ].forEach((test) => { + it(`Resolves avatar for ${ test.title }`, async function() { + this.timeout(60000); + const provider = connect("mainnet"); + const avatar = await provider.getAvatar(test.name); + assert.equal(avatar, test.value, "avatar url"); + }); + }); + */ +}); +//# sourceMappingURL=test-providers-avatar.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-avatar.js.map b/dist/ethers.js/src.ts/_tests/test-providers-avatar.js.map new file mode 100644 index 0000000..d23f0c6 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-avatar.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-avatar.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-avatar.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,6DAA+D;AAE/D,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,oBAAoB,EAAE;IAC3B;QACI,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,owCAAowC,EAAE;QACp0C,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,8BAA8B,EAAE,KAAK,EAAE,8EAA8E,EAAE;QAC9I,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,6BAA6B,EAAE,KAAK,EAAE,qCAAqC,EAAE;KACtG,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACf,EAAE,CAAC,uBAAwB,IAAI,CAAC,KAAM,EAAE,EAAE;;gBACtC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;gBACpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;gBACnC,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnD,gBAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;YACnD,CAAC;SAAA,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IACP;;;;;;;;;;;;;MAaE;AACF,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts new file mode 100644 index 0000000..7fb8212 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-ccip.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts.map new file mode 100644 index 0000000..28feb2d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-ccip.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-ccip.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-ccip.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-ccip.js b/dist/ethers.js/src.ts/_tests/test-providers-ccip.js new file mode 100644 index 0000000..fbe6dba --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-ccip.js @@ -0,0 +1,178 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const create_provider_js_1 = require("./create-provider.js"); +(0, create_provider_js_1.setupProviders)(); +describe("Test CCIP execution", function () { + // This matches the verify method in the Solidity contract against the + // processed data from the endpoint + const verify = function (sender, data, result) { + const check = (0, index_js_1.concat)([ + (0, index_js_1.toBeArray)((0, index_js_1.dataLength)(sender)), sender, + (0, index_js_1.toBeArray)((0, index_js_1.dataLength)(data)), data + ]); + assert_1.default.equal(result, (0, index_js_1.keccak256)(check), "response is equal"); + }; + const address = "0x6C5ed35574a9b4d163f75bBf0595F7540D8FCc2d"; + const calldata = "0x1234"; + it("testGet passes under normal operation", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGet(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + const result = yield provider.call(tx); + verify(address, calldata, result); + }); + }); + it("testGet should fail with CCIP not explicitly enabled by overrides", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGet(bytes callData = "0x1234") + const tx = { + to: address, + data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield provider.call(tx); + console.log(result); + }); + }, (error) => { + const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; + return ((0, index_js_1.isCallException)(error) && error.data === offchainErrorData); + }); + }); + }); + it("testGet should fail with CCIP explicitly disabled on provider", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + provider.disableCcipRead = true; + // testGetFail(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0xa5f3271e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield provider.call(tx); + console.log(result); + }); + }, (error) => { + const offchainErrorData = "0x556f18300000000000000000000000006c5ed35574a9b4d163f75bbf0595f7540d8fcc2d00000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; + return ((0, index_js_1.isCallException)(error) && error.data === offchainErrorData); + }); + }); + }); + it("testGetFail should fail if all URLs 5xx", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGetFail(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0x36f9cea6000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield provider.call(tx); + console.log(result); + }); + }, (error) => { + const infoJson = '{"urls":["https:/\/ethers.ricmoo.workers.dev/status/500/{sender}/{data}"],"errorMessages":["hello world"]}'; + return ((0, index_js_1.isError)(error, "OFFCHAIN_FAULT") && error.reason === "500_SERVER_ERROR" && + JSON.stringify(error.info) === infoJson); + }); + }); + }); + it("testGetSenderFail should fail if sender does not match", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGetSenderFail(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0x64bff6d1000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000", + }; + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield provider.call(tx); + console.log(result); + }); + }, (error) => { + const errorArgsJson = '["0x0000000000000000000000000000000000000000",["https://ethers.ricmoo.workers.dev/test-ccip-read/{sender}/{data}"],"0x1234","0xb1494be1","0x4d792065787472612064617461"]'; + const offchainErrorData = "0x556f1830000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000140b1494be100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000004068747470733a2f2f6574686572732e7269636d6f6f2e776f726b6572732e6465762f746573742d636369702d726561642f7b73656e6465727d2f7b646174617d00000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d4d79206578747261206461746100000000000000000000000000000000000000"; + return ((0, index_js_1.isCallException)(error) && error.data === offchainErrorData && + error.revert && + error.revert.signature === "OffchainLookup(address,string[],bytes,bytes4,bytes)" && + JSON.stringify(error.revert.args) === errorArgsJson); + }); + }); + }); + it("testGetMissing should fail if early URL 4xx", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGetMissing(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0x4ece8d7d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield provider.call(tx); + console.log(result); + }); + }, (error) => { + const infoJson = '{"url":"https:/\/ethers.ricmoo.workers.dev/status/404/{sender}/{data}","errorMessage":"hello world"}'; + return ((0, index_js_1.isError)(error, "OFFCHAIN_FAULT") && error.reason === "404_MISSING_RESOURCE" && + JSON.stringify(error.info || "") === infoJson); + }); + }); + }); + it("testGetFallback passes if any URL returns correctly", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testGetFallback(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0xedf4a021000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + const result = yield provider.call(tx); + verify(address, calldata, result); + }); + }); + it("testPost passes under normal operation", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const provider = (0, create_provider_js_1.connect)("goerli"); + // testPost(bytes callData = "0x1234") + const tx = { + to: address, enableCcipRead: true, + data: "0x66cab49d000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000021234000000000000000000000000000000000000000000000000000000000000" + }; + const result = yield provider.call(tx); + verify(address, calldata, result); + }); + }); +}); +//# sourceMappingURL=test-providers-ccip.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-ccip.js.map b/dist/ethers.js/src.ts/_tests/test-providers-ccip.js.map new file mode 100644 index 0000000..499526b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-ccip.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-ccip.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-ccip.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,0CAKqB;AAErB,6DAA+D;AAE/D,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,qBAAqB,EAAE;IAE5B,sEAAsE;IACtE,mCAAmC;IACnC,MAAM,MAAM,GAAG,UAAS,MAAc,EAAE,IAAY,EAAE,MAAc;QAChE,MAAM,KAAK,GAAG,IAAA,iBAAM,EAAC;YACjB,IAAA,oBAAS,EAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,CAAC,EAAE,MAAM;YACrC,IAAA,oBAAS,EAAC,IAAA,qBAAU,EAAC,IAAI,CAAC,CAAC,EAAE,IAAI;SACpC,CAAC,CAAC;QACH,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,mBAAmB,CAAC,CAAC;IAChE,CAAC,CAAA;IAED,MAAM,OAAO,GAAG,4CAA4C,CAAC;IAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC;IAE1B,EAAE,CAAC,uCAAuC,EAAE;;YACxC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAEpB,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;YAEnC,qCAAqC;YACrC,MAAM,EAAE,GAAG;gBACP,EAAE,EAAE,OAAO,EAAE,cAAc,EAAE,IAAI;gBACjC,IAAI,EAAE,4MAA4M;aACrN,CAAA;YAED,MAAM,MAA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ts/_tests/test-providers-data.d.ts new file mode 100644 index 0000000..c9920ec --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-data.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-data.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-data.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-data.d.ts.map new file mode 100644 index 0000000..7332b62 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-data.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-data.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-data.js b/dist/ethers.js/src.ts/_tests/test-providers-data.js new file mode 100644 index 0000000..6b58a14 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-data.js @@ -0,0 +1,218 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const create_provider_js_1 = require("./create-provider.js"); +const utils_js_1 = require("./utils.js"); +const blockchain_data_js_1 = require("./blockchain-data.js"); +(0, create_provider_js_1.setupProviders)(); +function forEach(prefix, tests, func) { + for (const networkName of blockchain_data_js_1.networkNames) { + const networkTests = tests[networkName]; + if (networkTests == null) { + continue; + } + for (const test of networkTests) { + for (const providerName of create_provider_js_1.providerNames) { + if (!(0, create_provider_js_1.checkProvider)(providerName, networkName)) { + continue; + } + // Let the testcase skip this by returning null + const testFunc = func(providerName, test); + if (testFunc == null) { + continue; + } + // Prepare the testcase + (0, utils_js_1.retryIt)(`${prefix}: ${providerName}:${networkName}.${test.test}`, function () { + return __awaiter(this, void 0, void 0, function* () { + // Create a provider + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + try { + assert_1.default.ok(provider != null, "missing provider"); + yield testFunc(provider); + } + catch (error) { + // Shutdown socket-based provider, otherwise its socket will prevent + // this process from exiting + if (provider.destroy) { + provider.destroy(); + } + throw error; + } + // Shutdown socket-based provider, otherwise its socket will prevent + // this process from exiting + if (provider.destroy) { + provider.destroy(); + } + }); + }); + } + } + } +} +describe("Test Provider Address operations", function () { + forEach("test getBalance(address)", blockchain_data_js_1.testAddress, (providerName, test) => { + if (test.balance == null) { + return null; + } + return (provider) => __awaiter(this, void 0, void 0, function* () { + assert_1.default.equal(yield provider.getBalance(test.address), test.balance); + }); + }); + forEach("test getCode(address)", blockchain_data_js_1.testAddress, (providerName, test) => { + if (test.code == null) { + return null; + } + return (provider) => __awaiter(this, void 0, void 0, function* () { + assert_1.default.equal(yield provider.getCode(test.address), test.code); + }); + }); + /* + forEach("test lookupAddress(address)", testAddress, (provider, test) => { + if (test.name == null) { return null; } + return async () => { + assert.equal(await provider.lookupAddress(test.address), test.name); + }; + }); + + forEach("test resolveName(name)", testAddress, (provider, test) => { + if (test.name == null) { return null; } + return async () => { + assert.equal(await provider.lookupAddress((test.name)), test.address); + }; + }); + */ + forEach("test getStorage(address)", blockchain_data_js_1.testAddress, (providerName, test) => { + if (test.storage == null) { + return null; + } + return (provider) => __awaiter(this, void 0, void 0, function* () { + for (const key in test.storage) { + assert_1.default.equal(yield provider.getStorage(test.address, key), test.storage[key]); + } + }); + }); + forEach("test getTransactionCount(address)", blockchain_data_js_1.testAddress, (providerName, test) => { + if (test.balance == null) { + return null; + } + return (provider) => __awaiter(this, void 0, void 0, function* () { + assert_1.default.equal(yield provider.getTransactionCount(test.address), test.nonce); + }); + }); +}); +function assertObj(prefix, actual, expected) { + assert_1.default.ok(actual != null, `${prefix} is null`); + for (const key in expected) { + if (expected[key] === undefined) { + continue; + } + assert_1.default.equal(actual[key], expected[key], `${prefix}.${key}`); + } +} +function assertBlock(actual, expected) { + // Check transactions + for (let i = 0; i < expected.transactions.length; i++) { + const expectedTx = expected.transactions[i]; + if (typeof (expectedTx) === "string") { + assert_1.default.equal(actual.transactions[i], expectedTx, `block.transactions[${i}]`); + } + else { + throw new Error("@TODO"); + } + } + // Remove the transactions and test keys + expected = Object.assign({}, expected, { transactions: undefined, test: undefined }); + // Check remaining keys + assertObj("block", actual, expected); +} +function assertTransaction(actual, expected) { + // @TODO: Accesslist + // Check signature + assertObj("tx.signature", actual.signature, expected.signature); + // Remove the transactions and test keys + expected = Object.assign({}, expected, { + accessList: undefined, + signature: undefined, + test: undefined + }); + // Check remaining keys + assertObj("tx", actual, expected); +} +function assertReceipt(actual, expected) { + // Check logs + for (let i = 0; i < expected.logs.length; i++) { + let expectedLog = expected.logs[i]; + for (let j = 0; j < expectedLog.topics.length; j++) { + assert_1.default.equal(actual.logs[i].topics[j], expectedLog.topics[j], `receipt.logs[${i}].topics[${j}]`); + } + expectedLog = Object.assign({}, expectedLog, { topics: undefined }); + assertObj(`receipt.log[${i}]`, actual.logs[i], expectedLog); + } + // Remove the transactions and test keys + expected = Object.assign({}, expected, { logs: undefined, test: undefined }); + // In Byzantium, the root was dropped and the status was added + if ((0, blockchain_data_js_1.networkFeatureAtBlock)("byzantium", expected.blockNumber)) { + expected = Object.assign({}, expected, { root: undefined }); + } + else { + expected = Object.assign({}, expected, { status: undefined }); + } + // Check remaining keys + assertObj("receipt", actual, expected); +} +describe("Test Provider Block operations", function () { + forEach("test getBlock(blockHash)", blockchain_data_js_1.testBlock, (providerName, test) => { + // Etherscan does not support getting a block by blockhash + if (providerName === "EtherscanProvider") { + return null; + } + return (provider) => __awaiter(this, void 0, void 0, function* () { + assertBlock(yield provider.getBlock(test.hash), test); + }); + }); + forEach("test getBlock(blockNumber)", blockchain_data_js_1.testBlock, (providerName, test) => { + return (provider) => __awaiter(this, void 0, void 0, function* () { + assertBlock(yield provider.getBlock(test.number), test); + }); + }); +}); +describe("Test Provider Transaction operations", function () { + forEach("test getTransaction(hash)", blockchain_data_js_1.testTransaction, (providerName, test) => { + return (provider) => __awaiter(this, void 0, void 0, function* () { + assertTransaction(yield provider.getTransaction(test.hash), test); + }); + }); + forEach("test getTransactionReceipt(hash)", blockchain_data_js_1.testReceipt, (providerName, test) => { + return (provider) => __awaiter(this, void 0, void 0, function* () { + const receipt = yield provider.getTransactionReceipt(test.hash); + assert_1.default.ok(receipt != null, "receipt != null"); + // Cloudflare doesn't return the root in legacy receipts; but it isn't + // *actually* that important, so we'll give it a pass... + if (providerName === "CloudflareProvider" || providerName === "AnkrProvider" || providerName === "PocketProvider") { + test = Object.assign({}, test, { root: undefined }); + } + //if (providerName === "PocketProvider") { + //} + assertReceipt(receipt, test); + }); + }); + forEach("test lookupAddress(addr) == null", blockchain_data_js_1.testReceipt, (providerName, test) => { + return (provider) => __awaiter(this, void 0, void 0, function* () { + const name = yield provider.lookupAddress("0x0123456789012345678901234567890123456789"); + assert_1.default.ok(name == null, "name == null"); + }); + }); +}); +//# sourceMappingURL=test-providers-data.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-data.js.map b/dist/ethers.js/src.ts/_tests/test-providers-data.js.map new file mode 100644 index 0000000..c40b079 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-data.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,6DAE8B;AAC9B,yCAAqC;AAKrC,6DAG8B;AAK9B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AC;IAEH,OAAO,CAAC,kCAAkC,EAAE,gCAAW,EAAE,CAAC,YAAY,EAAE,IAAI,EAAE,EAAE;QAC5E,OAAO,CAAO,QAAQ,EAAE,EAAE;YACtB,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,aAAa,CAAC,4CAA4C,CAAC,CAAA;YACvF,gBAAM,CAAC,EAAE,CAAC,IAAI,IAAI,IAAI,EAAE,cAAc,CAAC,CAAC;QAC5C,CAAC,CAAA,CAAC;IACN,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts new file mode 100644 index 0000000..c179d1a --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-errors.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts.map new file mode 100644 index 0000000..63f68b6 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-errors.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-errors.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-errors.js b/dist/ethers.js/src.ts/_tests/test-providers-errors.js new file mode 100644 index 0000000..b91e6c4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-errors.js @@ -0,0 +1,257 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const create_provider_js_1 = require("./create-provider.js"); +const utils_js_1 = require("./utils.js"); +(0, create_provider_js_1.setupProviders)(); +describe("Tests Provider Call Exception", function () { + const panics = [ + //{ code: 0x00, reason: "GENERIC_PANIC" }, + { code: 0x01, reason: "ASSERT_FALSE" }, + { code: 0x11, reason: "OVERFLOW" }, + { code: 0x12, reason: "DIVIDE_BY_ZERO" }, + //{ code: 0x21, reason: "ENUM_RANGE_ERROR" }, + //{ code: 0x22, reason: "BAD_STORAGE_DATA" }, + { code: 0x31, reason: "STACK_UNDERFLOW" }, + { code: 0x32, reason: "ARRAY_RANGE_ERROR" }, + //{ code: 0x41, reason: "OUT_OF_MEMORY" }, + //{ code: 0x51, reason: "UNINITIALIZED_FUNCTION_CALL" }, + ]; + const testAddr = "0xF20Ba47c47a32fc2d9ad846fF06f2fa6e89eeC74"; + const networkName = "goerli"; + for (const { code, reason } of panics) { + for (const method of ["call", "estimateGas"]) { + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + it(`tests panic code: ${providerName}.${method}.${reason}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + const data = (0, index_js_1.concat)([ + (0, index_js_1.dataSlice)((0, index_js_1.id)("testPanic(uint256)"), 0, 4), + (0, index_js_1.zeroPadValue)((0, index_js_1.toBeArray)(code), 32) + ]); + yield (0, utils_js_1.stall)(1000); + const tx = { to: testAddr, data }; + try { + const result = yield (method === "call" ? provider.call(tx) : provider.estimateGas(tx)); + console.log(result); + assert_1.default.ok(false, "panic call did not throw"); + } + catch (error) { + assert_1.default.ok((0, index_js_1.isCallException)(error), "isCallException"); + // Check some basics + assert_1.default.equal(error.action, method, `error.action == ${method}`); + assert_1.default.equal(error.reason, `Panic due to ${reason}(${code})`, "error.reason"); + // Check the transaciton + assert_1.default.equal(error.transaction.to, tx.to, `error.transaction.to`); + assert_1.default.equal(error.transaction.data, tx.data, `error.transaction.data`); + // We have no invocation data + assert_1.default.equal(error.invocation, null, `error.invocation != null`); + // Check the revert + assert_1.default.ok(error.revert != null, "error.revert == null"); + assert_1.default.equal(error.revert.name, "Panic", `error.revert.name`); + assert_1.default.equal(error.revert.signature, "Panic(uint256)", `error.revert.signature`); + assert_1.default.equal(error.revert.args.length, 1, `error.revert.args.length`); + assert_1.default.equal(error.revert.args[0], code, `error.revert.args[0]`); + } + }); + }); + } + } + } + const customErrors = [ + { + name: "CustomError1", + signature: "testCustomError1(bool,uint256,string)", + data: "0xdb7342480000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000b68656c6c6f20776f726c64000000000000000000000000000000000000000000", + //data: "0x852d0c740000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000b48656c6c6f20576f726c64000000000000000000000000000000000000000000", + message: `execution reverted (unknown custom error)`, + reason: null, + revert: null, + }, + { + name: "Error", + signature: "testErrorString(bool,string)", + data: "0xb206699b00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000b68656c6c6f20776f726c64000000000000000000000000000000000000000000", + //data: "0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000b48656c6c6f20576f726c64000000000000000000000000000000000000000000" + message: `execution reverted: "hello world"`, + reason: "hello world", + revert: { + signature: "Error(string)", + name: "Error", + args: ['hello world'] + } + }, + ]; + for (const { data, message, name, reason, revert } of customErrors) { + for (const method of ["call", "estimateGas"]) { + const tx = { to: testAddr, data }; + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + it(`tests custom errors: ${providerName}.${method}.${name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(10000); + try { + const result = yield (method === "call" ? provider.call(tx) : provider.estimateGas(tx)); + console.log(result); + assert_1.default.ok(false, "panic call did not throw"); + } + catch (error) { + assert_1.default.ok((0, index_js_1.isCallException)(error), "isCallException"); + // Check some basics + assert_1.default.equal(error.action, method, `error.action == ${method}`); + assert_1.default.ok(error.message.startsWith(message), "error.message == message"); + if (reason) { + assert_1.default.equal(error.reason, reason, "error.reason"); + } + else { + assert_1.default.ok(error.reason == null, "error.reason != null"); + } + if (revert) { + assert_1.default.ok(error.revert != null, "error.revert == null"); + assert_1.default.equal(error.revert.name, revert.name, "error.revert.name"); + assert_1.default.equal(error.revert.signature, revert.signature, "error.revert.signature"); + assert_1.default.equal(error.revert.args.length, revert.args.length, "error.revert.args.length"); + for (let i = 0; i < revert.args.length; i++) { + assert_1.default.equal(error.revert.args[i], revert.args[i], `error.revert.args[${i}]`); + } + } + else { + assert_1.default.ok(error.revert == null, "error.revert != null"); + } + } + }); + }); + } + } + } +}); +describe("Test Provider Blockchain Errors", function () { + const wallet = new index_js_1.Wallet((process.env.FAUCET_PRIVATEKEY)); + const networkName = "goerli"; + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + // The CI runs multiple tests at once; minimize colliding with + // the initial tx by using a random value, so we can detect + // replacements we didn't do. + const value = Math.trunc(Math.random() * 2048) + 2; + it(`tests underpriced replacement transaction: ${providerName}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const w = wallet.connect(provider); + let tx1 = null; + let nonce = null; + ; + for (let i = 0; i < 10; i++) { + nonce = yield w.getNonce("pending"); + try { + tx1 = yield w.sendTransaction({ + nonce, to: wallet, value + }); + } + catch (error) { + // Another CI host beat us to this nonce + if ((0, index_js_1.isError)(error, "REPLACEMENT_UNDERPRICED") || (0, index_js_1.isError)(error, "NONCE_EXPIRED")) { + yield (0, utils_js_1.stall)(1000); + continue; + } + console.log("EE-tx1", nonce, value, error); + throw error; + } + break; + } + if (tx1 == null || nonce == null) { + throw new Error("could not send initial tx"); + } + const rejection = assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + // Send another tx with the same nonce + const tx2 = yield w.sendTransaction({ + nonce, to: wallet, value: 1 + }); + console.log({ tx1, tx2 }); + }); + }, (error) => { + return (0, index_js_1.isError)(error, "REPLACEMENT_UNDERPRICED"); + }); + // Wait for the first tx to get mined so we start with a + // clean slate on the next provider + yield tx1.wait(); + // This should have already happened + yield rejection; + }); + }); + } + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + it(`tests insufficient funds: ${providerName}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const w = index_js_1.Wallet.createRandom().connect(provider); + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield w.sendTransaction({ + to: wallet, value: 1 + }); + console.log(tx); + }); + }, (error) => { + return ((0, index_js_1.isError)(error, "INSUFFICIENT_FUNDS") && + typeof (error.transaction.from) === "string" && + error.transaction.from.toLowerCase() === w.address.toLowerCase()); + }); + }); + }); + } + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + it(`tests nonce expired: ${providerName}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(60000); + const w = wallet.connect(provider); + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield w.sendTransaction({ + to: wallet, nonce: 1, value: 1 + }); + console.log(tx); + }); + }, (error) => { + if (!(0, index_js_1.isError)(error, "NONCE_EXPIRED")) { + console.log(error); + } + return (0, index_js_1.isError)(error, "NONCE_EXPIRED"); + }); + }); + }); + } +}); +//# sourceMappingURL=test-providers-errors.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-errors.js.map b/dist/ethers.js/src.ts/_tests/test-providers-errors.js.map new file mode 100644 index 0000000..a1d1bd4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-errors.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-errors.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,oDAA4B;AAE5B,0CAIqB;AAErB,6DAAkF;AAClF,yCAAmC;AAiBnC,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,+BAA+B,EAAE;IAEtC,MAAM,MAAM,GAA4C;QACpD,0CAA0C;QAC1C,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,cAAc,EAAE;QACtC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE;QAClC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,gBAAgB,EAAE;QACxC,6CAA6C;QAC7C,6CAA6C;QAC7C,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,iBAAiB,EAAE;QACzC,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE;QAC3C,0CAA0C;QAC1C,wDAAwD;KAC3D,CAAC;IAEF,MAAM,QAAQ,GAAG,4CAA4C,CAAC;IAE9D,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC7B,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,MAAM,EAAE;QACnC,KAAK,MAAM,MAAM,IAAI,CAAE,MAAM,EAAE,aAAa,CAAE,EAAE;YAC5C,KAAK,MAA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,CAAC;yBACjC,CAAC,CAAC;wBACH,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;oBACpB,CAAC;iBAAA,EAAE,CAAC,KAAK,EAAE,EAAE;oBACT,IAAI,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,eAAe,CAAC,EAAE;wBAClC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;qBACtB;oBACD,OAAO,IAAA,kBAAO,EAAC,KAAK,EAAE,eAAe,CAAC,CAAC;gBAC3C,CAAC,CAAC,CAAC;YACP,CAAC;SAAA,CAAC,CAAC;KACN;AAEL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts new file mode 100644 index 0000000..63c52de --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-extra.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts.map new file mode 100644 index 0000000..03af117 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-extra.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-extra.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-extra.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-extra.js b/dist/ethers.js/src.ts/_tests/test-providers-extra.js new file mode 100644 index 0000000..4d5a7d4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-extra.js @@ -0,0 +1,28 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const utils_js_1 = require("./utils.js"); +describe("Test Etherscan extra APIs", function () { + (0, utils_js_1.retryIt)("test etherscanProvider.getContract", function () { + return __awaiter(this, void 0, void 0, function* () { + const provider = new index_js_1.EtherscanProvider("mainnet", "FPFGK6JSW2UHJJ2666FG93KP7WC999MNW7"); + const contract = yield provider.getContract("dai.tokens.ethers.eth"); + assert_1.default.ok(contract != null, "contract == null"); + assert_1.default.equal(yield contract.symbol(), "DAI", "contract.symbol"); + }); + }); +}); +//# sourceMappingURL=test-providers-extra.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-extra.js.map b/dist/ethers.js/src.ts/_tests/test-providers-extra.js.map new file mode 100644 index 0000000..2fb1a58 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-extra.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-extra.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,0CAAgD;AAEhD,yCAAqC;AAGrC,QAAQ,CAAC,2BAA2B,EAAE;IAClC,IAAA,kBAAO,EAAC,oCAAoC,EAAE;;YAC1C,MAAM,QAAQ,GAAG,IAAI,4BAAiB,CAAC,SAAS,EAAE,oCAAoC,CAAC,CAAC;YACxF,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,uBAAuB,CAAC,CAAC;YACrE,gBAAM,CAAC,EAAE,CAAC,QAAQ,IAAI,IAAI,EAAE,kBAAkB,CAAC,CAAC;YAChD,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,iBAAiB,CAAC,CAAC;QACpE,CAAC;KAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts new file mode 100644 index 0000000..6b3b554 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts @@ -0,0 +1,10 @@ +import { AbstractProvider, Network } from "../index.js"; +import type { PerformActionRequest } from "../index.js"; +export type Performer = (req: PerformActionRequest) => Promise; +export declare class MockProvider extends AbstractProvider { + readonly _perform: Performer; + constructor(perform: Performer); + _detectNetwork(): Promise; + perform(req: PerformActionRequest): Promise; +} +//# sourceMappingURL=test-providers-fallback.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts.map new file mode 100644 index 0000000..8890e23 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-fallback.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-fallback.ts"],"names":[],"mappings":"AAEA,OAAO,EAGH,gBAAgB,EAAoB,OAAO,EAE9C,MAAM,aAAa,CAAC;AAErB,OAAO,KAAK,EACR,oBAAoB,EACvB,MAAM,aAAa,CAAC;AAWrB,MAAM,MAAM,SAAS,GAAG,CAAC,GAAG,EAAE,oBAAoB,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEpE,qBAAa,YAAa,SAAQ,gBAAgB;IAC9C,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;gBAEjB,OAAO,EAAE,SAAS;IAKxB,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IAElC,OAAO,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;CAGzD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-fallback.js b/dist/ethers.js/src.ts/_tests/test-providers-fallback.js new file mode 100644 index 0000000..ed11f03 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-fallback.js @@ -0,0 +1,166 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MockProvider = void 0; +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const network = index_js_1.Network.from("mainnet"); +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +class MockProvider extends index_js_1.AbstractProvider { + constructor(perform) { + super(network, { cacheTimeout: -1 }); + this._perform = perform; + } + _detectNetwork() { + return __awaiter(this, void 0, void 0, function* () { return network; }); + } + perform(req) { + return __awaiter(this, void 0, void 0, function* () { + return yield this._perform(req); + }); + } +} +exports.MockProvider = MockProvider; +describe("Test Fallback broadcast", function () { + const txHash = "0x33017397ef7c7943dee3b422aec52b0a210de58d73d49c1b3ce455970f01c83a"; + function test(actions) { + return __awaiter(this, void 0, void 0, function* () { + // https://sepolia.etherscan.io/tx/0x33017397ef7c7943dee3b422aec52b0a210de58d73d49c1b3ce455970f01c83a + const tx = "0x02f87683aa36a7048459682f00845d899ef982520894b5bdaa442bb34f27e793861c456cd5bdc527ac8c89056bc75e2d6310000080c001a07503893743e94445b2361a444343757e6f59d52e19e9b3f65eb138d802eaa972a06e4e9bc10ff55474f9aac0a4c284733b4195cb7b273de5e7465ce75a168e0c38"; + const providers = actions.map(({ timeout, error }) => { + return new MockProvider((r) => __awaiter(this, void 0, void 0, function* () { + if (r.method === "getBlockNumber") { + return 1; + } + if (r.method === "broadcastTransaction") { + yield stall(timeout); + if (error) { + throw error; + } + return txHash; + } + throw new Error(`unhandled method: ${r.method}`); + })); + }); + ; + const provider = new index_js_1.FallbackProvider(providers); + return yield provider.broadcastTransaction(tx); + }); + } + it("picks late non-failed broadcasts", function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield test([ + { timeout: 200, error: (0, index_js_1.makeError)("already seen", "UNKNOWN_ERROR") }, + { timeout: 4000, error: (0, index_js_1.makeError)("already seen", "UNKNOWN_ERROR") }, + { timeout: 400 }, + ]); + (0, assert_1.default)(result.hash === txHash, "result.hash === txHash"); + }); + }); + it("picks late non-failed broadcasts with quorum-met red-herrings", function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield test([ + { timeout: 200, error: (0, index_js_1.makeError)("bad nonce", "NONCE_EXPIRED") }, + { timeout: 400, error: (0, index_js_1.makeError)("bad nonce", "NONCE_EXPIRED") }, + { timeout: 1000 }, + ]); + (0, assert_1.default)(result.hash === txHash, "result.hash === txHash"); + }); + }); + it("insufficient funds short-circuit broadcast", function () { + return __awaiter(this, void 0, void 0, function* () { + yield assert_1.default.rejects(function () { + return __awaiter(this, void 0, void 0, function* () { + const result = yield test([ + { timeout: 200, error: (0, index_js_1.makeError)("is broke", "INSUFFICIENT_FUNDS") }, + { timeout: 400, error: (0, index_js_1.makeError)("is broke", "INSUFFICIENT_FUNDS") }, + { timeout: 800 }, + { timeout: 1000 }, + ]); + console.log(result); + }); + }, function (error) { + (0, assert_1.default)((0, index_js_1.isError)(error, "INSUFFICIENT_FUNDS")); + return true; + }); + }); + }); +}); +describe("Test Inflight Quorum", function () { + // Fires the %%actions%% as providers which will delay before returning, + // and returns an array of arrays, where each sub-array indicates which + // providers were inflight at once. + function test(actions, quorum) { + return __awaiter(this, void 0, void 0, function* () { + const inflights = [[]]; + const configs = actions.map(({ delay, stallTimeout, priority, weight }, index) => ({ + provider: new MockProvider((r) => __awaiter(this, void 0, void 0, function* () { + if (r.method === "getBlockNumber") { + return 1; + } + if (r.method === "getBalance") { + // Add this as inflight + let last = inflights.pop(); + if (last == null) { + throw new Error("no elements"); + } + inflights.push(last); + last = last.slice(); + last.push(index); + inflights.push(last); + // Do the thing + yield stall(delay); + // Remove as inflight + last = inflights.pop(); + if (last == null) { + throw new Error("no elements"); + } + inflights.push(last); + last = last.filter((v) => (v !== index)); + inflights.push(last); + return 0; + } + console.log(r); + throw new Error(`unhandled method: ${r.method}`); + })), + stallTimeout, priority, weight + })); + const provider = new index_js_1.FallbackProvider(configs, network, { + cacheTimeout: -1, pollingInterval: 100, + quorum + }); + yield provider.getBalance(index_js_1.ZeroAddress); + return inflights; + }); + } + // See: #4298 + it("applies weights against inflight requests", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(2000); + const inflights = yield test([ + { delay: 50, stallTimeout: 1000, priority: 1, weight: 2 }, + { delay: 50, stallTimeout: 1000, priority: 1, weight: 2 }, + ], 2); + // Make sure there is never more than 1 inflight provider at once + for (const running of inflights) { + assert_1.default.ok(running.length <= 1, `too many inflight requests: ${JSON.stringify(inflights)}`); + } + }); + }); + // @TODO: add lots more tests, checking on priority, weight and stall + // configurations +}); +//# sourceMappingURL=test-providers-fallback.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-fallback.js.map b/dist/ethers.js/src.ts/_tests/test-providers-fallback.js.map new file mode 100644 index 0000000..ec1982b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-fallback.js","sourceRoot":"","s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AO,SAAS,CAAC;QACrB,CAAC;KAAA;IAED,aAAa;IACb,EAAE,CAAC,2CAA2C,EAAE;;YAC5C,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAEnB,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC;gBACzB,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;gBACzD,EAAE,KAAK,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;aAC5D,EAAE,CAAC,CAAC,CAAC;YAEN,iEAAiE;YACjE,KAAK,MAAM,OAAO,IAAI,SAAS,EAAE;gBAC7B,gBAAM,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,EAAE,+BAAgC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAE,EAAE,CAAC,CAAC;aAChG;QACL,CAAC;KAAA,CAAC,CAAC;IAEH,qEAAqE;IACrE,wBAAwB;AAC5B,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts b/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts new file mode 100644 index 0000000..f13272e --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-send.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts.map new file mode 100644 index 0000000..90910f4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-send.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-send.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-send.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-send.js b/dist/ethers.js/src.ts/_tests/test-providers-send.js new file mode 100644 index 0000000..a5caf44 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-send.js @@ -0,0 +1,65 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const create_provider_js_1 = require("./create-provider.js"); +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +(0, create_provider_js_1.setupProviders)(); +describe("Sends Transactions", function () { + const wallet = new index_js_1.Wallet((process.env.FAUCET_PRIVATEKEY)); + console.log("Faucet Address:", wallet.address); + const networkName = "goerli"; + for (const providerName of create_provider_js_1.providerNames) { + const provider = (0, create_provider_js_1.getProvider)(providerName, networkName); + if (provider == null) { + continue; + } + it(`tests sending: ${providerName}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(180000); + const w = wallet.connect(provider); + const dustAddr = index_js_1.Wallet.createRandom().address; + // Retry if another CI instance used our value + let tx = null; + for (let i = 0; i < 10; i++) { + try { + tx = yield w.sendTransaction({ + to: dustAddr, + value: 42, + type: 2 + }); + break; + } + catch (error) { + if ((0, index_js_1.isError)(error, "REPLACEMENT_UNDERPRICED") || (0, index_js_1.isError)(error, "NONCE_EXPIRED")) { + yield stall(1000); + continue; + } + throw error; + } + } + assert_1.default.ok(!!tx, "too many retries"); + //const receipt = + yield provider.waitForTransaction(tx.hash, null, 60000); //tx.wait(); + //console.log(receipt); + const balance = yield provider.getBalance(dustAddr); + assert_1.default.equal(balance, BigInt(42), "target balance after send"); + }); + }); + } +}); +//# sourceMappingURL=test-providers-send.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-send.js.map b/dist/ethers.js/src.ts/_tests/test-providers-send.js.map new file mode 100644 index 0000000..84f3bde --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-send.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-send.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-send.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,0CAA8C;AAE9C,6DAAkF;AAIlF,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,oBAAoB,EAAE;IAE3B,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAS,CAAC,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAC,CAAC;IACnE,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAE/C,MAAM,WAAW,GAAG,QAAQ,CAAC;IAC7B,KAAK,MAAM,YAAY,IAAI,kCAAa,EAAE;QACtC,MAAM,QAAQ,GAAG,IAAA,gCAAW,EAAC,YAAY,EAAE,WAAW,CAAC,CAAC;QACxD,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,SAAS;SAAE;QAEnC,EAAE,CAAC,kBAAmB,YAAa,EAAE,EAAE;;gBACnC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAErB,MAA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new file mode 100644 index 0000000..b6f58c0 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-providers-wildcard.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts.map b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts.map new file mode 100644 index 0000000..c6f73fe --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-wildcard.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-wildcard.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js new file mode 100644 index 0000000..2e28331 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js @@ -0,0 +1,32 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const create_provider_js_1 = require("./create-provider.js"); +(0, create_provider_js_1.setupProviders)(); +describe("Test EIP-2544 ENS wildcards", function () { + const provider = (0, create_provider_js_1.connect)("goerli"); + it("Resolves recursively", function () { + return __awaiter(this, void 0, void 0, function* () { + const resolver = yield provider.getResolver("ricmoose.hatch.eth"); + assert_1.default.ok(resolver, "failed to get resolver"); + assert_1.default.equal(resolver.address, "0x15abA1fa74Bfdecd63A71218DC632d4328Db8168", "address"); + assert_1.default.equal(yield resolver.supportsWildcard(), true, "supportsWildcard()"); + // Test pass-through avatar + assert_1.default.equal(yield resolver.getAvatar(), "https:/\/static.ricmoo.com/uploads/profile-06cb9c3031c9.jpg", "getAvatar()"); + assert_1.default.equal(yield resolver.getAddress(), "0x4B711A377B1b3534749FBe5e59Bcf7F94d92EA98", "getAddress()"); + }); + }); +}); +//# sourceMappingURL=test-providers-wildcard.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js.map b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js.map new file mode 100644 index 0000000..49f3536 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-providers-wildcard.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-providers-wildcard.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-providers-wildcard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,6DAA+D;AAE/D,IAAA,mCAAc,GAAE,CAAC;AAEjB,QAAQ,CAAC,6BAA6B,EAAE;IACpC,MAAM,QAAQ,GAAG,IAAA,4BAAO,EAAC,QAAQ,CAAC,CAAC;IAEnC,EAAE,CAAC,sBAAsB,EAAE;;YACvB,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;YAClE,gBAAM,CAAC,EAAE,CAAC,QAAQ,EAAE,wBAAwB,CAAC,CAAC;YAE9C,gBAAM,CAAC,KAAK,CAAC,QAAQ,CAAC,OAAO,EAAE,4CAA4C,EAAE,SAAS,CAAC,CAAC;YACxF,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,gBAAgB,EAAE,EAAE,IAAI,EAAE,oBAAoB,CAAC,CAAC;YAE5E,2BAA2B;YAC3B,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,SAAS,EAAE,EAAE,6DAA6D,EAAE,aAAa,CAAC,CAAC;YAEvH,gBAAM,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,UAAU,EAAE,EAAE,4CAA4C,EAAE,cAAc,CAAC,CAAC;QAC5G,CAAC;KAAA,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-rlp.d.ts b/dist/ethers.js/src.ts/_tests/test-rlp.d.ts new file mode 100644 index 0000000..2a353b7 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-rlp.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-rlp.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-rlp.d.ts.map b/dist/ethers.js/src.ts/_tests/test-rlp.d.ts.map new file mode 100644 index 0000000..b679e11 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-rlp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-rlp.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-rlp.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-rlp.js b/dist/ethers.js/src.ts/_tests/test-rlp.js new file mode 100644 index 0000000..58c6ac0 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-rlp.js @@ -0,0 +1,93 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("Test RLP Coder", function () { + const tests = (0, utils_js_1.loadTests)("rlp"); + tests.forEach(({ name, encoded, decoded }) => { + it(`encodes RLP: ${name}`, function () { + assert_1.default.equal((0, index_js_1.encodeRlp)(decoded), encoded); + }); + }); + tests.forEach(({ name, encoded, decoded }) => { + it(`decodes RLP: ${name}`, function () { + assert_1.default.deepEqual((0, index_js_1.decodeRlp)(encoded), decoded); + }); + }); +}); +describe("Test bad RLP Data", function () { + it("correctly fails encoding data with invalid values", function () { + assert_1.default.throws(() => { + (0, index_js_1.encodeRlp)(["0x1234", 1234]); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.argument === "object" && + error.value === 1234); + }); + }); + it("correctlyfails decoding data with trailing junk", function () { + assert_1.default.throws(() => { + // Zeros_1 + (0, index_js_1.decodeRlp)("0x0042"); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^unexpected junk after rlp payload/) && + error.argument === "data" && + error.value === "0x0042"); + }); + }); + it("correctlyfails decoding short data", function () { + assert_1.default.throws(() => { + (0, index_js_1.decodeRlp)("0x"); + }, (error) => { + return (error.code === "BUFFER_OVERRUN" && + error.message.match(/^data too short/) && + (0, index_js_1.hexlify)(error.buffer) === "0x" && + error.offset === 1 && + error.length === 0); + }); + }); + it("correctlyfails decoding short data in child", function () { + assert_1.default.throws(() => { + (0, index_js_1.decodeRlp)("0xc8880102030405060708"); + }, (error) => { + return (error.code === "BUFFER_OVERRUN" && + error.message.match(/^child data too short/) && + (0, index_js_1.hexlify)(error.buffer) === "0xc8880102030405060708" && + error.offset === 0 && + error.length === 8); + }); + }); + it("correctlyfails decoding short segment data", function () { + assert_1.default.throws(() => { + // [["0x4243"], ["0x3145"]] = 0xc8 c3 82 4243 c3 82 3145 + // XXXX + (0, index_js_1.decodeRlp)("0xc8c382c3823145"); + }, (error) => { + return (error.code === "BUFFER_OVERRUN" && + error.message.match(/^data short segment too short/) && + (0, index_js_1.hexlify)(error.buffer) === "0xc8c382c3823145" && + error.offset === 9 && + error.length === 7); + }); + }); +}); +/* + utils.RLP.encode([["0x4243"], ["0x3145"]]) + + 0xc8 c3 82 4243 c3 82 3145 + + { + "name": "arrayShort2", + "decoded": [ + "0x48656c6c6f20576f726c64", + "0x48656c6c6f20576f726c64" + ], + "encoded": "0xd8 8b 48656c6c6f20576f726c64 8b 48656c6c6f20576f726c64" + }, +*/ +//# sourceMappingURL=test-rlp.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-rlp.js.map b/dist/ethers.js/src.ts/_tests/test-rlp.js.map new file mode 100644 index 0000000..592600c --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-rlp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-rlp.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-rlp.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAEvC,0CAA4D;AAI5D,QAAQ,CAAC,gBAAgB,EAAE;IAEvB,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAc,KAAK,CAAC,CAAC;IAE5C,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACzC,EAAE,CAAC,gBAAiB,IAAK,EAAE,EAAE;YACzB,gBAAM,CAAC,KAAK,CAAC,IAAA,oBAAS,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;QACzC,EAAE,CAAC,gBAAiB,IAAK,EAAE,EAAE;YACzB,gBAAM,CAAC,SAAS,CAAC,IAAA,oBAAS,EAAC,OAAO,CAAC,EAAE,OAAO,CAAC,CAAC;QAClD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,mBAAmB,EAAE;IAC1B,EAAE,CAAC,mDAAmD,EAAE;QACpD,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,IAAA,oBAAS,EAAC,CAAE,QAAQ,EAAmB,IAA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wBAAwB,CAAC,CAAC;QACxC,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB;gBACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;gBAC5C,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,KAAK,wBAAwB;gBAClD,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAE,4CAA4C,EAAE;QAC9C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,wDAAwD;YACxD,6CAA6C;YAC7C,IAAA,oBAAS,EAAC,kBAAkB,CAAC,CAAC;QAClC,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,gBAAgB;gBACnC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,+BAA+B,CAAC;gBACpD,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,KAAK,kBAAkB;gBAC5C,KAAK,CAAC,MAAM,KAAK,CAAC;gBAClB,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,CAAA;QAC3B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH;;;;;;;;;;;;;EAaE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-transaction.d.ts b/dist/ethers.js/src.ts/_tests/test-transaction.d.ts new file mode 100644 index 0000000..5da5478 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-transaction.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-transaction.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-transaction.d.ts.map b/dist/ethers.js/src.ts/_tests/test-transaction.d.ts.map new file mode 100644 index 0000000..6059622 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-transaction.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-transaction.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-transaction.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-transaction.js b/dist/ethers.js/src.ts/_tests/test-transaction.js new file mode 100644 index 0000000..bc7b56b --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-transaction.js @@ -0,0 +1,340 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +const BN_0 = BigInt(0); +describe("Tests Unsigned Transaction Serializing", function () { + const tests = (0, utils_js_1.loadTests)("transactions"); + for (const test of tests) { + it(`serialized unsigned legacy transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 0, + accessList: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined + }); + // Use the testcase sans the chainId for a legacy test + if (txData.chainId != null && parseInt(txData.chainId) != 0) { + txData.chainId = "0x00"; + } + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.unsignedSerialized, test.unsignedLegacy, "unsignedLegacy"); + }); + } + for (const test of tests) { + // Unsupported parameters for EIP-155; i.e. unspecified chain ID + if (!test.unsignedEip155) { + continue; + } + it(`serialized unsigned EIP-155 transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 0, + accessList: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined + }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.unsignedSerialized, test.unsignedEip155, "unsignedEip155"); + }); + } + for (const test of tests) { + it(`serialized unsigned Berlin transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 1, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined + }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.unsignedSerialized, test.unsignedBerlin, "unsignedBerlin"); + }); + } + for (const test of tests) { + it(`serialized unsigned London transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { type: 2 }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.unsignedSerialized, test.unsignedLondon, "unsignedLondon"); + }); + } +}); +describe("Tests Signed Transaction Serializing", function () { + const tests = (0, utils_js_1.loadTests)("transactions"); + for (const test of tests) { + it(`serialized signed legacy transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 0, + accessList: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + signature: test.signatureLegacy + }); + // Use the testcase sans the chainId for a legacy test + if (txData.chainId != null && parseInt(txData.chainId) != 0) { + txData.chainId = "0x00"; + } + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.serialized, test.signedLegacy, "signedLegacy"); + }); + } + for (const test of tests) { + if (!test.unsignedEip155) { + continue; + } + it(`serialized signed EIP-155 transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 0, + accessList: undefined, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined, + signature: test.signatureEip155 + }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.serialized, test.signedEip155, "signedEip155"); + }); + } + for (const test of tests) { + it(`serialized signed Berlin transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 1, + maxFeePerGas: undefined, + maxPriorityFeePerGas: undefined + }, { signature: test.signatureBerlin }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.serialized, test.signedBerlin, "signedBerlin"); + }); + } + for (const test of tests) { + it(`serialized signed London transaction: ${test.name}`, function () { + const txData = Object.assign({}, test.transaction, { + type: 2, + signature: test.signatureLondon + }); + const tx = index_js_1.Transaction.from(txData); + assert_1.default.equal(tx.serialized, test.signedLondon, "signedLondon"); + }); + } +}); +function assertTxUint(actual, _expected, name) { + const expected = (_expected != null ? BigInt(_expected) : null); + assert_1.default.equal(actual, expected, name); +} +function assertTxEqual(actual, expected) { + assert_1.default.equal(actual.to, expected.to, "to"); + assert_1.default.equal(actual.nonce, expected.nonce, "nonce"); + assertTxUint(actual.gasLimit, expected.gasLimit, "gasLimit"); + assertTxUint(actual.gasPrice, expected.gasPrice, "gasPrice"); + assertTxUint(actual.maxFeePerGas, expected.maxFeePerGas, "maxFeePerGas"); + assertTxUint(actual.maxPriorityFeePerGas, expected.maxPriorityFeePerGas, "maxPriorityFeePerGas"); + assert_1.default.equal(actual.data, expected.data, "data"); + assertTxUint(actual.value, expected.value, "value"); + if (expected.accessList) { + assert_1.default.equal(JSON.stringify(actual.accessList), JSON.stringify(expected.accessList), "accessList"); + } + else { + assert_1.default.equal(actual.accessList, null, "accessList:!null"); + } + assertTxUint(actual.chainId, expected.chainId, "chainId"); +} +function addDefault(tx, key, defaultValue) { + if (tx[key] == null) { + tx[key] = defaultValue; + } +} +function addDefaults(tx) { + tx = Object.assign({}, tx); + addDefault(tx, "nonce", 0); + addDefault(tx, "gasLimit", BN_0); + addDefault(tx, "gasPrice", BN_0); + addDefault(tx, "maxFeePerGas", BN_0); + addDefault(tx, "maxPriorityFeePerGas", BN_0); + addDefault(tx, "value", BN_0); + addDefault(tx, "data", "0x"); + addDefault(tx, "accessList", []); + addDefault(tx, "chainId", BN_0); + return tx; +} +describe("Tests Unsigned Transaction Parsing", function () { + const tests = (0, utils_js_1.loadTests)("transactions"); + for (const test of tests) { + it(`parses unsigned legacy transaction: ${test.name}`, function () { + const tx = index_js_1.Transaction.from(test.unsignedLegacy); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + expected.accessList = null; + expected.chainId = BN_0; + assertTxEqual(tx, expected); + }); + } + for (const test of tests) { + if (!test.unsignedEip155) { + continue; + } + it(`parses unsigned EIP-155 transaction: ${test.name}`, function () { + const tx = index_js_1.Transaction.from(test.unsignedEip155); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + expected.accessList = null; + assertTxEqual(tx, expected); + }); + } + for (const test of tests) { + it(`parses unsigned Berlin transaction: ${test.name}`, function () { + const tx = index_js_1.Transaction.from(test.unsignedBerlin); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + assertTxEqual(tx, expected); + }); + } + for (const test of tests) { + it(`parses unsigned London transaction: ${test.name}`, function () { + const tx = index_js_1.Transaction.from(test.unsignedLondon); + const expected = addDefaults(test.transaction); + expected.gasPrice = null; + assertTxEqual(tx, expected); + }); + } +}); +describe("Tests Signed Transaction Parsing", function () { + const tests = (0, utils_js_1.loadTests)("transactions"); + for (const test of tests) { + it(`parses signed legacy transaction: ${test.name}`, function () { + let tx = index_js_1.Transaction.from(test.signedLegacy); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + expected.accessList = null; + expected.chainId = BN_0; + for (let i = 0; i < 2; i++) { + assertTxEqual(tx, expected); + assert_1.default.equal(tx.typeName, "legacy", "typeName"); + assert_1.default.equal(tx.isLegacy(), true, "isLegacy"); + assert_1.default.equal(tx.isBerlin(), false, "isBerlin"); + assert_1.default.equal(tx.isLondon(), false, "isLondon"); + assert_1.default.ok(!!tx.signature, "signature:!null"); + assert_1.default.equal(tx.signature.r, test.signatureLegacy.r, "signature.r"); + assert_1.default.equal(tx.signature.s, test.signatureLegacy.s, "signature.s"); + assert_1.default.equal(BigInt(tx.signature.v), BigInt(test.signatureLegacy.v), "signature.v"); + tx = tx.clone(); + } + }); + } + for (const test of tests) { + if (!test.unsignedEip155) { + continue; + } + it(`parses signed EIP-155 transaction: ${test.name}`, function () { + let tx = index_js_1.Transaction.from(test.signedEip155); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + expected.accessList = null; + for (let i = 0; i < 2; i++) { + assertTxEqual(tx, expected); + assert_1.default.equal(tx.typeName, "legacy", "typeName"); + assert_1.default.equal(tx.isLegacy(), true, "isLegacy"); + assert_1.default.equal(tx.isBerlin(), false, "isBerlin"); + assert_1.default.equal(tx.isLondon(), false, "isLondon"); + assert_1.default.ok(!!tx.signature, "signature:!null"); + assert_1.default.equal(tx.signature.r, test.signatureEip155.r, "signature.r"); + assert_1.default.equal(tx.signature.s, test.signatureEip155.s, "signature.s"); + assert_1.default.equal(tx.signature.networkV, BigInt(test.signatureEip155.v), "signature.v"); + tx = tx.clone(); + } + }); + } + for (const test of tests) { + it(`parses signed Berlin transaction: ${test.name}`, function () { + let tx = index_js_1.Transaction.from(test.signedBerlin); + const expected = addDefaults(test.transaction); + expected.maxFeePerGas = null; + expected.maxPriorityFeePerGas = null; + for (let i = 0; i < 2; i++) { + assertTxEqual(tx, expected); + assert_1.default.equal(tx.typeName, "eip-2930", "typeName"); + assert_1.default.equal(tx.isLegacy(), false, "isLegacy"); + assert_1.default.equal(tx.isBerlin(), true, "isBerlin"); + assert_1.default.equal(tx.isLondon(), false, "isLondon"); + assert_1.default.ok(!!tx.signature, "signature:!null"); + assert_1.default.equal(tx.signature.r, test.signatureBerlin.r, "signature.r"); + assert_1.default.equal(tx.signature.s, test.signatureBerlin.s, "signature.s"); + assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureBerlin.v), "signature.v"); + tx = tx.clone(); + } + }); + } + for (const test of tests) { + it(`parses signed London transaction: ${test.name}`, function () { + let tx = index_js_1.Transaction.from(test.signedLondon); + const expected = addDefaults(test.transaction); + expected.gasPrice = null; + for (let i = 0; i < 2; i++) { + assertTxEqual(tx, expected); + assert_1.default.equal(tx.typeName, "eip-1559", "typeName"); + assert_1.default.equal(tx.isLegacy(), false, "isLegacy"); + assert_1.default.equal(tx.isBerlin(), false, "isBerlin"); + assert_1.default.equal(tx.isLondon(), true, "isLondon"); + assert_1.default.ok(!!tx.signature, "signature:!null"); + assert_1.default.equal(tx.signature.r, test.signatureLondon.r, "signature.r"); + assert_1.default.equal(tx.signature.s, test.signatureLondon.s, "signature.s"); + assert_1.default.equal(tx.signature.yParity, parseInt(test.signatureLondon.v), "signature.v"); + // Test cloning + tx = tx.clone(); + } + }); + } +}); +describe("Tests Transaction Parameters", function () { + const badData = [ + { + name: "accessList=0x09", + data: "0x02c9010203040580070809", + message: "invalid access list", + argument: "accessList" + }, + { + name: "accessList=[0x09]", + data: "0x02ca0102030405800708c109", + message: "invalid address-slot set", + argument: "accessList" + }, + { + name: "accessList=[0x09,0x10]", + data: "0x02cb0102030405800708c20910", + message: "invalid address-slot set", + argument: "accessList" + }, + { + name: "accessList=[0x09,[HASH]] (bad address)", + data: "0x02ed0102030405800708e4e309e1a024412927c99a717115f5308c0ebd11136659b3cb6291abb4a8f87e9856a12538", + message: "invalid address", + argument: "accessList" + }, + { + name: "accessList=[ADDR,[0x09]] (bad slot)", + data: "0x02e10102030405800708d8d794939d33ff01840e9eeeb67525ec2f7035af41a4b1c109", + message: "invalid slot", + argument: "accessList" + } + ]; + for (const { name, data, argument, message } of badData) { + it(`correctly fails on bad accessList: ${name}`, function () { + assert_1.default.throws(() => { + // The access list is a single value: 0x09 instead of + // structured data + const result = index_js_1.Transaction.from(data); + console.log(result); + }, (error) => { + return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") && + error.argument === argument && + (message == null || error.message.startsWith(message))); + }); + }); + } +}); +//# sourceMappingURL=test-transaction.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-transaction.js.map b/dist/ethers.js/src.ts/_tests/test-transaction.js.map new file mode 100644 index 0000000..0c0e5c1 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-transaction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-transaction.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-transaction.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;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C,KAAK,CAAC,QAAQ,KAAK,QAAQ;oBAC3B,CAAC,OAAO,IAAI,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;YAChE,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KAEN;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts b/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts new file mode 100644 index 0000000..af3deca --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-utils-maths.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts.map b/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts.map new file mode 100644 index 0000000..a065106 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-maths.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-maths.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-maths.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-maths.js b/dist/ethers.js/src.ts/_tests/test-utils-maths.js new file mode 100644 index 0000000..9be8765 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-maths.js @@ -0,0 +1,194 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +describe("Tests Quantity Functions", function () { + const quantities = [ + { + name: "zero number", + value: 0, + expected: "0x0" + }, + { + name: "zero single hex", + value: "0x0", + expected: "0x0" + }, + { + name: "zero double hex", + value: "0x00", + expected: "0x0" + }, + { + name: "zero array(0)", + value: new Uint8Array([]), + expected: "0x0" + }, + { + name: "zero array(1)", + value: new Uint8Array([0]), + expected: "0x0" + }, + { + name: "single hex digit", + value: 0x5, + expected: "0x5" + }, + { + name: "double hex digit", + value: 0x42, + expected: "0x42" + }, + { + name: "big array, odd output", + value: new Uint8Array([0x0f, 254, 253, 252]), + expected: "0xffefdfc" + }, + { + name: "big array, even output", + value: new Uint8Array([255, 254, 253, 252]), + expected: "0xfffefdfc" + }, + ]; + for (const { name, value, expected } of quantities) { + it(`computes quantity: ${name}`, function () { + assert_1.default.equal((0, index_js_1.toQuantity)(value), expected); + }); + } +}); +describe("Tests Bad Math Values", function () { + const badBigInts = [ + { + name: "empty string", + value: "", + error: "invalid BigNumberish string" + }, + { + name: "non-numeric string", + value: "foobar", + error: "invalid BigNumberish string" + }, + { + name: "double negative sign", + value: "--42", + error: "invalid BigNumberish string" + }, + { + name: "non-numeric thing", + value: true, + error: "invalid BigNumberish value" + }, + ]; + for (const { name, value, error } of badBigInts) { + it(`correctly fails on bad bigint: ${name}`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.getBigInt)(value); + console.log(result); + }, (e) => { + return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") && + e.message.startsWith(error)); + }); + }); + } + const badNumbers = [ + { + name: "empty string", + value: "", + error: "invalid numeric string" + }, + { + name: "non-numeric string", + value: "foobar", + error: "invalid numeric string" + }, + { + name: "double negative sign", + value: "--42", + error: "invalid numeric string" + }, + { + name: "non-numeric thing", + value: true, + error: "invalid numeric value" + }, + { + name: "too big", + value: Number.MAX_SAFE_INTEGER + 10, + error: "overflow" + }, + { + name: "too small", + value: -Number.MAX_SAFE_INTEGER - 10, + error: "overflow" + }, + ]; + for (const { name, value, error } of badNumbers) { + it(`correctly fails on bad numeric: ${name}`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.getNumber)(value); + console.log(result); + }, (e) => { + return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") && + e.message.startsWith(error)); + }); + }); + } + const badHex = [ + { + name: "negative value", + value: -4, + error: "unsigned value cannot be negative" + }, + { + name: "width too short", + value: 0x123456, + width: 2, + error: "value exceeds width" + }, + ]; + for (const { name, value, error, width } of badHex) { + it(`correctly fails on bad toBeHex values: ${name}`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.toBeHex)(value, width); + console.log(result); + }, (e) => { + return ((0, index_js_1.isError)(e, "NUMERIC_FAULT") && e.fault === "overflow" && + e.message.startsWith(error)); + }); + }); + } + it(`correctly fails on nad toBeArray values: negative value`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.toBeArray)(-4); + console.log(result); + }, (e) => { + return ((0, index_js_1.isError)(e, "NUMERIC_FAULT") && e.fault === "overflow" && + e.message.startsWith("unsigned value cannot be negative")); + }); + }); +}); +describe("Tests Twos Compliemnts Functions", function () { + const tests = [ + { width: 8, value: 0, twos: 0 }, + { width: 8, value: 1, twos: 1 }, + { width: 8, value: -1, twos: 0xff }, + { width: 8, value: 127, twos: 127 }, + { width: 8, value: -128, twos: 0x80 }, + ]; + for (const { twos, width, value } of tests) { + it(`computes twos compliment values: ${value}[${width} bits]`, function () { + const result = (0, index_js_1.toTwos)(value, width); + assert_1.default.equal(result, twos); + }); + } + for (const { twos, width, value } of tests) { + it(`computes values from twos compliment: ${value}[${width} bits]`, function () { + const result = (0, index_js_1.fromTwos)(twos, width); + assert_1.default.equal(result, value); + }); + } +}); +//# sourceMappingURL=test-utils-maths.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-maths.js.map b/dist/ethers.js/src.ts/_tests/test-utils-maths.js.map new file mode 100644 index 0000000..fed09b9 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-maths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-maths.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-maths.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAIqB;AAErB,QAAQ,CAAC,0BAA0B,EAAE;IACjC,MA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AAG,EAAE,IAAI,EAAE,GAAG,EAAE;QACnC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,EAAE;KACxC,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE;QACxC,EAAE,CAAC,oCAAqC,KAAM,IAAK,KAAM,QAAQ,EAAE;YAC/D,MAAM,MAAM,GAAG,IAAA,iBAAM,EAAC,KAAK,EAAE,KAAK,CAAC,CAAC;YACpC,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;QAC/B,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,KAAK,EAAE;QACxC,EAAE,CAAC,yCAA0C,KAAM,IAAK,KAAM,QAAQ,EAAE;YACpE,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;YACrC,gBAAM,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAChC,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts b/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts new file mode 100644 index 0000000..db71352 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-utils-misc.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts.map b/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts.map new file mode 100644 index 0000000..c260b20 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-misc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-misc.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-misc.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-misc.js b/dist/ethers.js/src.ts/_tests/test-utils-misc.js new file mode 100644 index 0000000..c479320 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-misc.js @@ -0,0 +1,67 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +describe("Base64 Coding", function () { + const tests = [ + { + name: "wikipedia", + plaintext: (0, index_js_1.toUtf8Bytes)("Many hands make light work."), + encoded: "TWFueSBoYW5kcyBtYWtlIGxpZ2h0IHdvcmsu" + } + ]; + for (const test of tests) { + it(`encodes base64: ${test.name}`, function () { + assert_1.default.equal((0, index_js_1.encodeBase64)(test.plaintext), test.encoded); + }); + } + for (const test of tests) { + it(`decodes base64: ${test.name}`, function () { + const decoded = (0, index_js_1.decodeBase64)(test.encoded); + assert_1.default.equal(decoded.length, test.plaintext.length, "data.length"); + for (let i = 0; i < decoded.length; i++) { + assert_1.default.equal(decoded[i], test.plaintext[i]); + } + }); + } +}); +describe("Test Minor Features", function () { + it("checks types in defineProperties", function () { + const any = {}; + const values = { + vAny: any, + vBigint: BigInt(60), + vBoolean: true, + vNumber: 42, + vString: "some string", + }; + const item = {}; + (0, index_js_1.defineProperties)(item, values, { + vAny: "any", + vBigint: "bigint", + vBoolean: "boolean", + vNumber: "number", + vString: "string" + }); + assert_1.default.equal(item.vAny, any, "vAny"); + assert_1.default.equal(item.vBoolean, true, "vBoolenay"); + assert_1.default.equal(item.vNumber, 42, "nNumber"); + assert_1.default.equal(item.vString, "some string", "any"); + }); + it("correctly throws if defineProperty type mismatch", function () { + assert_1.default.throws(() => { + const item = {}; + const values = { vBoolean: 42 }; + (0, index_js_1.defineProperties)(item, values, { vBoolean: "boolean" }); + console.log(values); + }, (error) => { + return ((0, index_js_1.isError)(error, "INVALID_ARGUMENT") && + error.argument === "value.vBoolean" && + error.value === 42); + }); + }); +}); +//# sourceMappingURL=test-utils-misc.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-misc.js.map b/dist/ethers.js/src.ts/_tests/test-utils-misc.js.map new file mode 100644 index 0000000..f8f7590 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-misc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-misc.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-misc.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAIqB;AAGrB,QAAQ,CAAC,eAAe,EAAE;IACtB,MAAM,KAAK,GAAG;QACV;YACI,IAAI,EAAE,WAAW;YACjB,SAAS,EAAE,IAAA,sBAAW,EAAC,6BAA6B,CAAC;YACrD,OAAO,EAAE,sCAAsC;SAClD;KACJ,CAAC;IAEF,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,gBAAM,CAAC,KAAK,CAAC,IAAA,uBAAY,EAAC,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7D,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,mBAAoB,IAAI,CAAC,IAAK,EAAE,EAAE;YACjC,MAAM,OAAO,GAAG,IAAA,uBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC3C,gBAAM,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;YACnE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;g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AAgB,EAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,CAAC,CAAC;YAExD,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACxB,CAAC,EAAE,CAAC,KAAK,EAAE,EAAE;YACT,OAAO,CAAC,IAAA,kBAAO,EAAC,KAAK,EAAE,kBAAkB,CAAC;gBACtC,KAAK,CAAC,QAAQ,KAAK,gBAAgB;gBACnC,KAAK,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC;QAC5B,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts b/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts new file mode 100644 index 0000000..989039c --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-utils-units.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts.map b/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts.map new file mode 100644 index 0000000..6e3c998 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-units.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-units.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-units.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-units.js b/dist/ethers.js/src.ts/_tests/test-utils-units.js new file mode 100644 index 0000000..6be8c4e --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-units.js @@ -0,0 +1,68 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("Tests unit conversion", function () { + const tests = (0, utils_js_1.loadTests)("units"); + const units = [ + { unit: "ether", format: "ether_format", decimals: 18 }, + { unit: "kwei", format: "kwei_format", decimals: 3 }, + { unit: "mwei", format: "mwei_format", decimals: 6 }, + { unit: "gwei", format: "gwei_format", decimals: 9 }, + { unit: "szabo", format: "szabo_format", decimals: 12 }, + { unit: "finney", format: "finney_format", decimals: 15 }, + ]; + for (const { unit, format, decimals } of units) { + for (const test of tests) { + const str = (test[format]); + if (str == null) { + continue; + } + it(`converts wei to ${unit} string: ${test.name}`, function () { + const wei = BigInt(test.wei); + if (decimals === 18) { + assert_1.default.equal((0, index_js_1.formatEther)(wei), str, "formatEther"); + assert_1.default.equal((0, index_js_1.formatUnits)(wei), str, "formatUnits"); + } + assert_1.default.equal((0, index_js_1.formatUnits)(wei, unit), str, `formatUnits(${unit})`); + assert_1.default.equal((0, index_js_1.formatUnits)(wei, decimals), str, `formatUnits(${decimals})`); + }); + } + for (const test of tests) { + const str = (test[format]); + if (str == null) { + continue; + } + it(`converts ${format} string to wei: ${test.name}`, function () { + const wei = BigInt(test.wei); + if (decimals === 18) { + assert_1.default.equal((0, index_js_1.parseEther)(str), wei, "parseEther"); + assert_1.default.equal((0, index_js_1.parseUnits)(str), wei, "parseUnits"); + } + assert_1.default.equal((0, index_js_1.parseUnits)(str, unit), wei, `parseUnits(${unit})`); + assert_1.default.equal((0, index_js_1.parseUnits)(str, decimals), wei, `parseUnits(${decimals})`); + }); + } + } +}); +describe("Tests bad unit conversion", function () { + it("correctly fails to convert non-string value", function () { + assert_1.default.throws(() => { + (0, index_js_1.parseUnits)(3, "ether"); + }, (error) => { + return error.message.startsWith("value must be a string"); + }); + }); + it("correctly fails to convert unknown unit", function () { + assert_1.default.throws(() => { + (0, index_js_1.parseUnits)("3", "foobar"); + }, (error) => { + return error.message.startsWith("invalid unit"); + }); + }); +}); +//# sourceMappingURL=test-utils-units.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-units.js.map b/dist/ethers.js/src.ts/_tests/test-utils-units.js.map new file mode 100644 index 0000000..d431bf3 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-units.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-units.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-units.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAEvC,0CAA+E;AAK/E,QAAQ,CAAC,uBAAuB,EAAE;IAC9B,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAe,OAAO,CAAC,CAAC;IAE/C,MAAM,KAAK,GAAG;QACV,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,QAAQ,EAAE,CAAC,EAAE;QACpD,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,QAAQ,EAAE,EAAE,EAAE;QACvD,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,EAAE,EAAE;KAC5D,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,KAAK,EAAE;QAE5C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;YACtB,MAAM,GAAG,GAAkB,CAAO,IAAK,CAAC,MAAM,CAAC,CAAC,CAAC;YACjD,IAAI,GAAG,IAAI,IAAI,EAAE;gBAAE,SAAS;aAAE;YAE9B,EAAE,CAAC,mBAAoB,IAAK,YAAa,IAAI,CAAC,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,EAAE,GAAG,EAAE,cAAe,IAAK,GAAG,CAAC,CAAC;gBAClE,gBAAM,CAAC,KAAK,CAAC,IAAA,qBAAU,EAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,GAAG,EAAE,cAAe,QAAS,GAAG,CAAC,CAAC;YAC9E,CAAC,CAAC,CAAC;SACN;KAEJ;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,2BAA2B,EAAE;IAClC,EAAE,CAAC,6CAA6C,EAAE;QAC9C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,IAAA,qBAAU,EAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QAChC,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,wBAAwB,CAAC,CAAC;QAC9D,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yCAAyC,EAAE;QAC1C,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;YACf,IAAA,qBAAU,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC;QAC9B,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;YACd,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,cAAc,CAAC,CAAC;QACpD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts b/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts new file mode 100644 index 0000000..04d7c49 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts @@ -0,0 +1,13 @@ +export type TestCaseBadString = { + name: string; + bytes: Uint8Array; + ignore: string; + replace: string; + error: string; +}; +export type TestCaseCodePoints = { + name: string; + text: string; + codepoints: Array; +}; +//# sourceMappingURL=test-utils-utf8.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts.map b/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts.map new file mode 100644 index 0000000..8578b27 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-utf8.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-utf8.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-utf8.ts"],"names":[],"mappings":"AAOA,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAA;CAChB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-utf8.js b/dist/ethers.js/src.ts/_tests/test-utils-utf8.js new file mode 100644 index 0000000..fa58749 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-utf8.js @@ -0,0 +1,131 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +describe("Tests UTF-8 bad strings", function () { + const tests = [ + { + name: "unexpected continue", + bytes: new Uint8Array([0x41, 0x80, 0x42, 0x43]), + ignore: "ABC", + replace: "A\ufffdBC", + error: "UNEXPECTED_CONTINUE" + }, + { + name: "bad prefix", + bytes: new Uint8Array([0x41, 0xf8, 0x42, 0x43]), + ignore: "ABC", + replace: "A\ufffdBC", + error: "BAD_PREFIX" + }, + { + name: "bad prefix (multiple)", + bytes: new Uint8Array([0x41, 0xf8, 0x88, 0x88, 0x42, 0x43]), + ignore: "ABC", + replace: "A\ufffdBC", + error: "BAD_PREFIX" + }, + { + name: "OVERRUN", + bytes: new Uint8Array([0x41, 0x42, 0xe2, 0x82 /* 0xac */]), + ignore: "AB", + replace: "AB\ufffd", + error: "OVERRUN" + }, + { + name: "missing continue", + bytes: new Uint8Array([0x41, 0x42, 0xe2, 0xe2, 0x82, 0xac, 0x43]), + ignore: "AB\u20acC", + replace: "AB\ufffd\u20acC", + error: "MISSING_CONTINUE" + }, + { + name: "out-of-range", + bytes: new Uint8Array([0x41, 0x42, 0xf7, 0xbf, 0xbf, 0xbf, 0x43]), + ignore: "ABC", + replace: "AB\ufffdC", + error: "OUT_OF_RANGE" + }, + { + name: "UTF-16 surrogate (low)", + bytes: new Uint8Array([0x41, 0x42, 0xed, 0xa0, 0x80, 0x43]), + ignore: "ABC", + replace: "AB\ufffdC", + error: "UTF16_SURROGATE" + }, + { + name: "UTF-16 surrogate (high)", + bytes: new Uint8Array([0x41, 0x42, 0xed, 0xbf, 0xbf, 0x43]), + ignore: "ABC", + replace: "AB\ufffdC", + error: "UTF16_SURROGATE" + }, + { + name: "overlong", + bytes: new Uint8Array([0xf0, 0x82, 0x82, 0xac]), + ignore: "", + replace: "\u20ac", + error: "OVERLONG" + } + ]; + for (const { name, bytes, ignore, replace, error } of tests) { + it(`correctly handles ${name}: replace strategy`, function () { + const result = (0, index_js_1.toUtf8String)(bytes, index_js_1.Utf8ErrorFuncs.replace); + assert_1.default.equal(result, replace); + }); + it(`correctly handles ${name}: ignore strategy`, function () { + const result = (0, index_js_1.toUtf8String)(bytes, index_js_1.Utf8ErrorFuncs.ignore); + assert_1.default.equal(result, ignore); + }); + it(`correctly handles ${name}: error strategy`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.toUtf8String)(bytes); + console.log(result); + }, (e) => { + return (e.message.indexOf(error) >= 0); + }); + }); + } + it("correctly fails to get UTF-8 bytes from incomplete surrogate", function () { + assert_1.default.throws(() => { + const text = String.fromCharCode(0xd800); + ; + const result = (0, index_js_1.toUtf8Bytes)(text); + console.log(result); + }, (error) => { + return (error.message.startsWith("invalid surrogate pair")); + }); + }); + it("correctly fails to get UTF-8 bytes from invalid surrogate pair", function () { + assert_1.default.throws(() => { + const text = String.fromCharCode(0xd800, 0xdbff); + ; + const result = (0, index_js_1.toUtf8Bytes)(text); + console.log(result); + }, (error) => { + return (error.message.startsWith("invalid surrogate pair")); + }); + }); +}); +describe("Tests UTF-8 bad strings", function () { + const tests = [ + { + name: "the Euro symbol", + text: "AB\u20acC", + codepoints: [0x41, 0x42, 0x20ac, 0x43] + }, + ]; + for (const { name, text, codepoints } of tests) { + it(`expands strings to codepoints: ${name}`, function () { + const result = (0, index_js_1.toUtf8CodePoints)(text); + assert_1.default.equal(result.length, codepoints.length, "codepoints.length"); + for (let i = 0; i < result.length; i++) { + assert_1.default.equal(result[i], codepoints[i], `codepoints[${i}]`); + } + }); + } +}); +//# sourceMappingURL=test-utils-utf8.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-utils-utf8.js.map b/dist/ethers.js/src.ts/_tests/test-utils-utf8.js.map new file mode 100644 index 0000000..ce244fe --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-utils-utf8.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-utils-utf8.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-utils-utf8.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAGqB;AAgBrB,QAAQ,CAAC,yBAAyB,EAAE;IAEhC,MAAM,KAAK,GAA6B;QACpC;YACI,IAAI,EAAE,qBAAqB;YAC3B,KAAK,EAAE,IAAI,UAAU,CAAC,CAAE,IAAI,EAAG,IAAI,EAAG,IAAI,EAAG,IAAI,CAAE,CAAC;YACpD,MAAM,EAAE,KAAK;YACb,OAAO,EAAE,WAAW;YACpB,KAAK,EAAE,qBAAqB;SAC/B;QACD;YACI,IAAI,EAAE,YAA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BAAiB;YACvB,IAAI,EAAE,WAAW;YACjB,UAAU,EAAE,CAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAE;SAC3C;KACJ,CAAC;IAEF,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,KAAK,EAAE;QAC5C,EAAE,CAAC,kCAAmC,IAAK,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,IAAA,2BAAgB,EAAC,IAAI,CAAC,CAAC;YACtC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,MAAM,EAAE,mBAAmB,CAAC,CAAC;YACpE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;gBACpC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,cAAe,CAAE,GAAG,CAAC,CAAC;aAChE;QACL,CAAC,CAAC,CAAC;KACN;AAEL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts b/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts new file mode 100644 index 0000000..da7ceeb --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-wallet-hd.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts.map b/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts.map new file mode 100644 index 0000000..b5e0927 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-hd.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet-hd.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet-hd.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-hd.js b/dist/ethers.js/src.ts/_tests/test-wallet-hd.js new file mode 100644 index 0000000..ac92c6d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-hd.js @@ -0,0 +1,124 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +const decoder = new TextDecoder(); +function fromHex(hex) { + const data = (0, index_js_1.getBytes)(hex); + return decoder.decode(data); +} +describe("Test HDWallets", function () { + function checkWallet(wallet, test) { + assert_1.default.equal(wallet.chainCode, test.chainCode, "chainCode"); + assert_1.default.equal(wallet.depth, test.depth, "depth"); + assert_1.default.equal(wallet.index, test.index, "index"); + assert_1.default.equal(wallet.fingerprint, test.fingerprint, "fingerprint"); + assert_1.default.equal(wallet.parentFingerprint, test.parentFingerprint, "parentFingerprint"); + assert_1.default.equal(wallet.publicKey, test.publicKey, "publicKey"); + if (wallet instanceof index_js_1.HDNodeWallet) { + assert_1.default.equal(wallet.extendedKey, test.xpriv, "xpriv"); + assert_1.default.equal(wallet.privateKey, test.privateKey, "privateKey"); + assert_1.default.equal(wallet.neuter().extendedKey, test.xpub, "xpub"); + } + else if (wallet instanceof index_js_1.HDNodeVoidWallet) { + assert_1.default.equal(wallet.extendedKey, test.xpub, "xpub"); + } + } + const tests = (0, utils_js_1.loadTests)("mnemonics"); + const checks = []; + tests.forEach((test) => { + // The phrase and password are stored in the test as hex so they + // are safe as ascii7 values for viewing, printing, etc. + const phrase = fromHex(test.phrase); + const password = fromHex(test.password); + const wordlist = index_js_1.wordlists[test.locale]; + if (wordlist == null) { + it(`tests ${test.name}`, function () { + this.skip(); + }); + return; + } + const mnemonic = index_js_1.Mnemonic.fromPhrase(phrase, password, wordlist); + function checkMnemonic(actual) { + assert_1.default.equal(actual.phrase, phrase, "phrase"); + assert_1.default.equal(actual.password, password, "password"); + assert_1.default.equal(actual.wordlist.locale, test.locale, "locale"); + assert_1.default.equal(actual.entropy, mnemonic.entropy, "entropy"); + assert_1.default.equal(actual.computeSeed(), mnemonic.computeSeed(), "seed"); + } + checks.push({ + phrase, password, wordlist, mnemonic, checkMnemonic, test + }); + }); + for (const { test, checkMnemonic, phrase, password, wordlist } of checks) { + it(`computes the HD keys by mnemonic: ${test.name}`, function () { + for (const subtest of test.nodes) { + const w = index_js_1.HDNodeWallet.fromPhrase(phrase, password, subtest.path, wordlist); + assert_1.default.ok(w instanceof index_js_1.HDNodeWallet, "instanceof HDNodeWallet"); + assert_1.default.equal(w.path, subtest.path, "path"); + checkWallet(w, subtest); + assert_1.default.ok(!!w.mnemonic, "has mnemonic"); + checkMnemonic(w.mnemonic); + } + }); + } + for (const { test } of checks) { + it(`computes the HD keys by entropy: ${test.name}`, function () { + const seedRoot = index_js_1.HDNodeWallet.fromSeed(test.seed); + for (const subtest of test.nodes) { + const w = seedRoot.derivePath(subtest.path); + assert_1.default.ok(w instanceof index_js_1.HDNodeWallet, "instanceof HDNodeWallet"); + assert_1.default.equal(w.path, subtest.path, "path"); + checkWallet(w, subtest); + assert_1.default.equal(w.mnemonic, null); + } + }); + } + for (const { test } of checks) { + it(`computes the HD keys by enxtended private key: ${test.name}`, function () { + for (const subtest of test.nodes) { + const w = index_js_1.HDNodeWallet.fromExtendedKey(subtest.xpriv); + assert_1.default.ok(w instanceof index_js_1.HDNodeWallet, "instanceof HDNodeWallet"); + checkWallet(w, subtest); + assert_1.default.equal(w.mnemonic, null); + } + }); + } + for (const { test, phrase, password, wordlist } of checks) { + it(`computes the neutered HD keys by paths: ${test.name}`, function () { + const root = index_js_1.HDNodeWallet.fromPhrase(phrase, password, "m", wordlist).neuter(); + for (const subtest of test.nodes) { + if (subtest.path.indexOf("'") >= 0) { + assert_1.default.throws(() => { + const w = root.derivePath(subtest.path); + console.log(w); + }, (error) => { + return (error.code === "UNSUPPORTED_OPERATION" && + error.message.match(/^cannot derive child of neutered node/) && + error.operation === "deriveChild"); + }); + } + else { + const w = root.derivePath(subtest.path); + assert_1.default.ok(w instanceof index_js_1.HDNodeVoidWallet, "instanceof HDNodeVoidWallet"); + assert_1.default.equal(w.path, subtest.path, "path"); + checkWallet(w, subtest); + } + } + }); + } + for (const { test } of checks) { + it(`computes the neutered HD keys by enxtended public key: ${test.name}`, function () { + for (const subtest of test.nodes) { + const w = index_js_1.HDNodeWallet.fromExtendedKey(subtest.xpub); + assert_1.default.ok(w instanceof index_js_1.HDNodeVoidWallet, "instanceof HDNodeVoidWallet"); + checkWallet(w, subtest); + } + }); + } +}); +//# sourceMappingURL=test-wallet-hd.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-hd.js.map b/dist/ethers.js/src.ts/_tests/test-wallet-hd.js.map new file mode 100644 index 0000000..970c341 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-hd.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet-hd.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet-hd.ts"],"names":[],"mappings":";;;;;AACA,oDAA4B;AAE5B,yCAAuC;AAEvC,0CAGqB;AAOrB,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC;AAClC,SAAS,OAAO,CAAC,GAAW;IACxB,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,GAAG,CAAC,CAAC;IAC3B,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AAChC,CAAC;AAWD,QAAQ,CAAC,gBAAgB,EAAE;IACvB,SAAS,WAAW,CAAC,MAAuC,EAAE,IAA0B;QACpF,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,CAAC;QAC5D,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,CAA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K,aAAa,CAAC,CAAC;oBAC3C,CAAC,CAAC,CAAC;iBACN;qBAAM;oBACH,MAAM,CAAC,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACxC,gBAAM,CAAC,EAAE,CAAC,CAAC,YAAY,2BAAgB,EAAE,6BAA6B,CAAC,CAAC;oBACxE,gBAAM,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,CAAA;oBAC1C,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;iBAC3B;aACJ;QACL,CAAC,CAAC,CAAC;KACN;IAED,KAAK,MAAM,EAAE,IAAI,EAAE,IAAI,MAAM,EAAE;QAC3B,EAAE,CAAC,0DAA2D,IAAI,CAAC,IAAK,EAAE,EAAE;YACxE,KAAK,MAAM,OAAO,IAAI,IAAI,CAAC,KAAK,EAAE;gBAC9B,MAAM,CAAC,GAAG,uBAAY,CAAC,eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;gBACrD,gBAAM,CAAC,EAAE,CAAC,CAAC,YAAY,2BAAgB,EAAE,6BAA6B,CAAC,CAAC;gBACxE,WAAW,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;aAC3B;QACL,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts b/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts new file mode 100644 index 0000000..f6b292d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-wallet-json.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts.map b/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts.map new file mode 100644 index 0000000..06acc1e --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-json.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet-json.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet-json.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-json.js b/dist/ethers.js/src.ts/_tests/test-wallet-json.js new file mode 100644 index 0000000..67c3a91 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-json.js @@ -0,0 +1,186 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("Tests JSON Wallet Formats", function () { + const tests = (0, utils_js_1.loadTests)("wallets"); + tests.forEach((test) => { + if (test.type !== "crowdsale") { + return; + } + it(`tests decrypting Crowdsale JSON: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const password = (0, index_js_1.getBytes)(test.password); + const account = (0, index_js_1.decryptCrowdsaleJson)(test.content, password); + assert_1.default.equal(account.address, test.address, "address"); + }); + }); + }); + tests.forEach((test) => { + if (test.type !== "keystore") { + return; + } + it(`tests decrypting Keystore JSON (sync): ${test.name}`, function () { + this.timeout(20000); + const password = (0, index_js_1.getBytes)(test.password); + const account = (0, index_js_1.decryptKeystoreJsonSync)(test.content, password); + //console.log(account); + assert_1.default.equal(account.address, test.address, "address"); + }); + }); + tests.forEach((test) => { + if (test.type !== "keystore") { + return; + } + it(`tests decrypting Keystore JSON (async): ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(20000); + const password = (0, index_js_1.getBytes)(test.password); + const account = yield (0, index_js_1.decryptKeystoreJson)(test.content, password); + //console.log(account); + assert_1.default.equal(account.address, test.address, "address"); + }); + }); + }); + tests.forEach((test) => { + it(`tests decrypting JSON (sync): ${test.name}`, function () { + this.timeout(20000); + const password = (0, index_js_1.getBytes)(test.password); + const wallet = index_js_1.Wallet.fromEncryptedJsonSync(test.content, password); + //console.log(wallet); + assert_1.default.equal(wallet.address, test.address, "address"); + }); + }); + tests.forEach((test) => { + it(`tests decrypting JSON (async): ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(20000); + const password = (0, index_js_1.getBytes)(test.password); + const wallet = yield index_js_1.Wallet.fromEncryptedJson(test.content, password); + //console.log(wallet); + assert_1.default.equal(wallet.address, test.address, "address"); + }); + }); + }); + it("tests encrypting wallet with mnemonic", function () { + this.timeout(20000); + const wallet = index_js_1.HDNodeWallet.createRandom(); + assert_1.default.ok(wallet.mnemonic, "mnemonic"); + const phrase = wallet.mnemonic.phrase; + const json = wallet.encryptSync("foobar"); + const wallet2 = index_js_1.Wallet.fromEncryptedJsonSync(json, "foobar"); + assert_1.default.ok(wallet2 instanceof index_js_1.HDNodeWallet && wallet2.mnemonic); + assert_1.default.equal(wallet2.mnemonic.phrase, phrase, "phrase"); + assert_1.default.equal(wallet2.address, wallet.address, "address"); + }); +}); +describe("Tests Extra JSON Wallet Functions", function () { + const badCrowdsales = [ + { + name: "undefined", + value: undefined + }, + { + name: "junk string", + value: "junk!" + }, + { + name: "non-string", + value: 42 + }, + { + name: "JSON without encseed", + value: JSON.stringify({ foo: "bar" }) + }, + ]; + for (const { name, value } of badCrowdsales) { + it(`tests the invalid isCrowdsale wallet: ${name}`, function () { + assert_1.default.equal((0, index_js_1.isCrowdsaleJson)(value), false); + }); + } + const badKeystoreOptions = [ + { + name: "invalid salt type", + options: { salt: 42 }, + error: "invalid BytesLike value" + }, + { + name: "invalid uuid type", + options: { uuid: 42 }, + error: "invalid BytesLike value" + }, + { + name: "invalid uuid length", + options: { uuid: "0x1234" }, + error: "invalid options.uuid" + }, + { + name: "invalid iv type", + options: { iv: 42 }, + error: "invalid BytesLike value" + }, + { + name: "invalid iv length", + options: { iv: "0x1234" }, + error: "invalid options.iv" + }, + { + name: "invalid scrypt N (non-one-hot-encoded)", + options: { scrypt: { N: 1023 } }, + error: "invalid scrypt N parameter" + }, + { + name: "invalid scrypt N (non-integer)", + options: { scrypt: { N: 1.5 } }, + error: "invalid scrypt N parameter" + }, + { + name: "invalid scrypt r", + options: { scrypt: { r: 1.5 } }, + error: "invalid scrypt r parameter" + }, + { + name: "invalid scrypt p", + options: { scrypt: { p: 1.5 } }, + error: "invalid scrypt p parameter" + }, + ]; + const wallet = index_js_1.Wallet.createRandom(); + const account = { address: wallet.address, privateKey: wallet.privateKey }; + const password = "foobar"; + for (const { name, options, error } of badKeystoreOptions) { + it(`tests bad keystore options: ${name}`, function () { + assert_1.default.throws(() => { + const result = (0, index_js_1.encryptKeystoreJsonSync)(account, password, options); + console.log(result); + }, (e) => { + return ((0, index_js_1.isError)(e, "INVALID_ARGUMENT") && + e.message.startsWith(error)); + }); + }); + } + // Mainly to round out weird edge cases in coverage + it("tests encryption with options (sync)", function () { + assert_1.default.ok((0, index_js_1.encryptKeystoreJsonSync)(account, password)); + }); + // Mainly to round out weird edge cases in coverage + it("tests encryption with options (async)", function () { + return __awaiter(this, void 0, void 0, function* () { + assert_1.default.ok(yield (0, index_js_1.encryptKeystoreJson)(account, password)); + }); + }); +}); +//# sourceMappingURL=test-wallet-json.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-json.js.map b/dist/ethers.js/src.ts/_tests/test-wallet-json.js.map new file mode 100644 index 0000000..8920987 --- /dev/null +++ b/dist/ethers.js/src.ts/_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,CAAC,sCAAsC,EAAE;QACvC,gBAAM,CAAC,EAAE,CAAC,IAAA,kCAAuB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;IAC1D,CAAC,CAAC,CAAC;IAEH,mDAAmD;IACnD,EAAE,CAAC,uCAAuC,EAAE;;YACxC,gBAAM,CAAC,EAAE,CAAC,MAAM,IAAA,8BAAmB,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC;QAC5D,CAAC;KAAA,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts new file mode 100644 index 0000000..7b51aed --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-wallet-mnemonic.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts.map b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts.map new file mode 100644 index 0000000..1bfa675 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet-mnemonic.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet-mnemonic.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js new file mode 100644 index 0000000..ebcfadb --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js @@ -0,0 +1,123 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const utils_js_1 = require("./utils.js"); +const decoder = new TextDecoder(); +function fromHex(hex) { + const data = (0, index_js_1.getBytes)(hex); + return decoder.decode(data); +} +function repeat(text, length) { + const result = []; + while (result.length < length) { + result.push(text); + } + return result; +} +describe("Tests Mnemonics", function () { + const tests = (0, utils_js_1.loadTests)("mnemonics"); + function runTest(phrase, mnemonic, test) { + assert_1.default.ok(index_js_1.Mnemonic.isValidMnemonic(phrase, mnemonic.wordlist), "isValidMnemonic"); + if (test.locale === "en") { + assert_1.default.ok(index_js_1.Mnemonic.isValidMnemonic(phrase), "isValidMnemonic (default)"); + } + assert_1.default.equal(mnemonic.wordlist.locale, test.locale, "locale"); + assert_1.default.equal(mnemonic.entropy, test.entropy, "entropy"); + assert_1.default.equal(mnemonic.computeSeed(), test.seed, "seed"); + assert_1.default.equal((0, index_js_1.sha256)((0, index_js_1.toUtf8Bytes)(phrase)), test.phraseHash, "phraseHash"); + } + for (const test of tests) { + const wordlist = index_js_1.wordlists[test.locale]; + it(`computes mnemonic from phrase: ${test.name}`, function () { + if (wordlist == null) { + this.skip(); + return; + } + const phrase = fromHex(test.phrase); + const password = fromHex(test.password); + const mnemonic = index_js_1.Mnemonic.fromPhrase(phrase, password, wordlist); + runTest(phrase, mnemonic, test); + }); + } + for (const test of tests) { + const wordlist = index_js_1.wordlists[test.locale]; + it(`computes mnemonic from entropy: ${test.name}`, function () { + if (wordlist == null) { + this.skip(); + return; + } + const phrase = fromHex(test.phrase); + const password = fromHex(test.password); + const mnemonic = index_js_1.Mnemonic.fromEntropy(test.entropy, password, wordlist); + runTest(phrase, mnemonic, test); + }); + } +}); +describe("Tests Bad Mnemonics Fail", function () { + const badLengths = [ + repeat("abandon", 9), + repeat("abandon", 16), + repeat("abandon", 27), // 27 words; too long + ]; + for (const _phrase of badLengths) { + const phrase = _phrase.join(" "); + it(`correctly fails on invalid mnemonic length: ${_phrase.length}`, function () { + assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase)); + assert_1.default.throws(function () { + index_js_1.Mnemonic.fromPhrase(phrase); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid mnemonic length/) && + error.argument === "mnemonic" && + error.value === "[ REDACTED ]"); + }); + }); + } + it("correctly fails on invalid mnemonic word", function () { + const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon wagmi"; + assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase)); + assert_1.default.throws(function () { + index_js_1.Mnemonic.fromPhrase(phrase); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid mnemonic word at index 11/) && + error.argument === "mnemonic" && + error.value === "[ REDACTED ]"); + }); + }); + it("correctly fails on invalid mnemonic checksum", function () { + const phrase = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon"; + assert_1.default.ok(!index_js_1.Mnemonic.isValidMnemonic(phrase)); + assert_1.default.throws(function () { + index_js_1.Mnemonic.fromPhrase(phrase); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid mnemonic checksum/) && + error.argument === "mnemonic" && + error.value === "[ REDACTED ]"); + }); + }); + const badEntropyLengths = [ + repeat("42", 12), + repeat("42", 15), + repeat("42", 36), // 36 bytes; too long + ]; + for (const _entropy of badEntropyLengths) { + const entropy = "0x" + _entropy.join(""); + it(`correctly fails on invalid entropy length: ${_entropy.length}`, function () { + assert_1.default.throws(function () { + index_js_1.Mnemonic.fromEntropy(entropy); + }, function (error) { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid entropy size/) && + error.argument === "entropy" && + error.value === "[ REDACTED ]"); + }); + }); + } +}); +//# sourceMappingURL=test-wallet-mnemonic.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js.map b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic.js.map new file mode 100644 index 0000000..f4344b9 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet-mnemonic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MAAM,CAAC;gBACV,mBAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC,EAAE,UAAS,KAAU;gBAClB,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,uBAAuB,CAAC;oBAC5C,KAAK,CAAC,QAAQ,KAAK,SAAS;oBAC5B,KAAK,CAAC,KAAK,KAAK,cAAc,CAAC,CAAC;YACxC,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;KACN;AACL,CAAC,CAAC,CAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet.d.ts b/dist/ethers.js/src.ts/_tests/test-wallet.d.ts new file mode 100644 index 0000000..918eb2f --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-wallet.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet.d.ts.map b/dist/ethers.js/src.ts/_tests/test-wallet.d.ts.map new file mode 100644 index 0000000..45cc1b2 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet.js b/dist/ethers.js/src.ts/_tests/test-wallet.js new file mode 100644 index 0000000..e55fb2d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet.js @@ -0,0 +1,120 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const utils_js_1 = require("./utils.js"); +const index_js_1 = require("../index.js"); +describe("Test Private Key Wallet", function () { + const tests = (0, utils_js_1.loadTests)("accounts"); + tests.forEach(({ name, privateKey, address }) => { + it(`creates wallet: ${name}`, function () { + const wallet = new index_js_1.Wallet(privateKey); + assert_1.default.equal(wallet.privateKey, privateKey); + assert_1.default.equal(wallet.address, address); + }); + }); +}); +describe("Test Transaction Signing", function () { + const tests = (0, utils_js_1.loadTests)("transactions"); + for (const test of tests) { + it(`tests signing a legacy transaction: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const wallet = new index_js_1.Wallet(test.privateKey); + const txData = Object.assign({}, test.transaction, { type: 0, accessList: undefined, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); + // Use the testcase sans the chainId for a legacy test + if (txData.chainId != null && parseInt(txData.chainId) != 0) { + txData.chainId = "0x00"; + } + const signed = yield wallet.signTransaction(txData); + assert_1.default.equal(signed, test.signedLegacy, "signedLegacy"); + }); + }); + } + for (const test of tests) { + if (!test.signedEip155) { + continue; + } + it(`tests signing an EIP-155 transaction: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const wallet = new index_js_1.Wallet(test.privateKey); + const txData = Object.assign({}, test.transaction, { type: 0, accessList: undefined, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); + const signed = yield wallet.signTransaction(txData); + assert_1.default.equal(signed, test.signedEip155, "signedEip155"); + }); + }); + } + for (const test of tests) { + it(`tests signing a Berlin transaction: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const wallet = new index_js_1.Wallet(test.privateKey); + const txData = Object.assign({}, test.transaction, { type: 1, maxFeePerGas: undefined, maxPriorityFeePerGas: undefined }); + const signed = yield wallet.signTransaction(txData); + assert_1.default.equal(signed, test.signedBerlin, "signedBerlin"); + }); + }); + } + for (const test of tests) { + it(`tests signing a London transaction: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const wallet = new index_js_1.Wallet(test.privateKey); + const txData = Object.assign({}, test.transaction, { type: 2 }); + const signed = yield wallet.signTransaction(txData); + assert_1.default.equal(signed, test.signedLondon, "signedLondon"); + }); + }); + } +}); +describe("Test Message Signing (EIP-191)", function () { +}); +describe("Test Typed-Data Signing (EIP-712)", function () { + const tests = (0, utils_js_1.loadTests)("typed-data"); + for (const test of tests) { + const { privateKey, signature } = test; + if (privateKey == null || signature == null) { + continue; + } + it(`tests signing typed-data: ${test.name}`, function () { + return __awaiter(this, void 0, void 0, function* () { + const wallet = new index_js_1.Wallet(privateKey); + const sig = yield wallet.signTypedData(test.domain, test.types, test.data); + assert_1.default.equal(sig, signature, "signature"); + }); + }); + } +}); +describe("Test Wallet Encryption", function () { + const password = "foobar"; + // Loop: + // 1 : random wallet (uses HDNodeWallet under the hood) + // 2 : Wallet using private key (uses Wallet explicitly) + for (let i = 0; i < 2; i++) { + let wallet = index_js_1.Wallet.createRandom(); + it("encrypts a random wallet: sync", function () { + this.timeout(30000); + const json = wallet.encryptSync(password); + const decrypted = index_js_1.Wallet.fromEncryptedJsonSync(json, password); + assert_1.default.equal(decrypted.address, wallet.address, "address"); + }); + it("encrypts a random wallet: async", function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(30000); + const json = yield wallet.encrypt(password); + const decrypted = yield index_js_1.Wallet.fromEncryptedJson(json, password); + assert_1.default.equal(decrypted.address, wallet.address, "address"); + }); + }); + wallet = new index_js_1.Wallet((0, index_js_1.hexlify)((0, index_js_1.randomBytes)(32))); + } +}); +//# sourceMappingURL=test-wallet.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wallet.js.map b/dist/ethers.js/src.ts/_tests/test-wallet.js.map new file mode 100644 index 0000000..99313d3 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wallet.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,oDAA4B;AAE5B,yCAAuC;AAOvC,0CAA2D;AAK3D,QAAQ,CAAC,yBAAyB,EAAE;IAChC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAkB,UAAU,CAAC,CAAC;IAErD,KAAK,CAAC,OAAO,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,EAAE;QAC5C,EAAE,CAAC,mBAAoB,IAAK,EAAE,EAAE;YAC5B,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAC,UAAU,CAAC,CAAC;YACtC,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;YAC5C,gBAAM,CAAC,KAAK,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,0BAA0B,EAAE;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAsB,cAAc,CAAC,CAAC;IAC7D,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACtB,EAAE,CAAC,uCAAwC,IAAI,CAAC,IAAK,EAAE,EAAE;;gBACrD,MAAM,MAAM,GAAG,IAAI,iBAAM,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;gBAC3C,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,EAAG,EAAE,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,oBAAoB,E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BACjE,gBAAM,CAAC,KAAK,CAAC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;YAC/D,CAAC;SAAA,CAAC,CAAC;QAEH,MAAM,GAAG,IAAI,iBAAM,CAAC,IAAA,kBAAO,EAAC,IAAA,sBAAW,EAAC,EAAE,CAAC,CAAC,CAAC,CAAC;KACjD;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts b/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts new file mode 100644 index 0000000..ea3f51d --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=test-wordlists.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts.map b/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts.map new file mode 100644 index 0000000..881367a --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wordlists.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wordlists.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wordlists.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wordlists.js b/dist/ethers.js/src.ts/_tests/test-wordlists.js new file mode 100644 index 0000000..6f21f73 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wordlists.js @@ -0,0 +1,71 @@ +"use strict"; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const assert_1 = __importDefault(require("assert")); +const index_js_1 = require("../index.js"); +const utils_js_1 = require("./utils.js"); +describe('Check Wordlists', function () { + const tests = (0, utils_js_1.loadTests)("wordlists"); + tests.forEach((test) => { + let wordlist = index_js_1.wordlists[test.locale]; + if (wordlist == null) { + return; + } + it(`matches wordlists: ${test.locale}`, function () { + const words = test.content.split('\n'); + let check = ""; + for (let i = 0; i < 2048; i++) { + let word = wordlist.getWord(i); + check += (word + "\n"); + assert_1.default.equal(word, words[i]); + assert_1.default.equal(wordlist.getWordIndex(word), i); + } + assert_1.default.equal(check, test.content); + }); + }); + tests.forEach((test) => { + let wordlist = index_js_1.wordlists[test.locale]; + if (wordlist == null) { + return; + } + it(`splitting and joining are equivalent: ${test.locale}`, function () { + const words = []; + for (let i = 0; i < 12; i++) { + words.push(wordlist.getWord(i)); + } + const phrase = wordlist.join(words); + const words2 = wordlist.split(phrase); + const phrase2 = wordlist.join(words2); + assert_1.default.deepEqual(words2, words, "split words"); + assert_1.default.deepEqual(phrase2, phrase, "re-joined words"); + }); + }); + tests.forEach((test) => { + let wordlist = index_js_1.wordlists[test.locale]; + if (wordlist == null) { + return; + } + it(`handles out-of-range values: ${test.locale}`, function () { + assert_1.default.equal(wordlist.getWordIndex("foobar"), -1); + assert_1.default.throws(() => { + wordlist.getWord(-1); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid word index/) && + error.argument === "index" && + error.value === -1); + }); + assert_1.default.throws(() => { + wordlist.getWord(2048); + }, (error) => { + return (error.code === "INVALID_ARGUMENT" && + error.message.match(/^invalid word index/) && + error.argument === "index" && + error.value === 2048); + }); + }); + }); +}); +//# sourceMappingURL=test-wordlists.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/test-wordlists.js.map b/dist/ethers.js/src.ts/_tests/test-wordlists.js.map new file mode 100644 index 0000000..8a7d3f4 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/test-wordlists.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-wordlists.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/test-wordlists.ts"],"names":[],"mappings":";;;;;AAAA,oDAA4B;AAE5B,0CAAwC;AAExC,yCAAuC;AAKvC,QAAQ,CAAC,iBAAiB,EAAE;IACxB,MAAM,KAAK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H,gBAAM,CAAC,MAAM,CAAC,GAAG,EAAE;gBACf,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAC3B,CAAC,EAAE,CAAC,KAAU,EAAE,EAAE;gBACd,OAAO,CAAC,KAAK,CAAC,IAAI,KAAK,kBAAkB;oBACrC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC;oBAC1C,KAAK,CAAC,QAAQ,KAAK,OAAO;oBAC1B,KAAK,CAAC,KAAK,KAAK,IAAI,CAAC,CAAC;YAC9B,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IAEP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/types.d.ts b/dist/ethers.js/src.ts/_tests/types.d.ts new file mode 100644 index 0000000..ea189c9 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/types.d.ts @@ -0,0 +1,217 @@ +export type TestCaseAbiVerbose = { + type: "address" | "hexstring" | "number" | "string"; + value: string; +} | { + type: "boolean"; + value: boolean; +} | { + type: "array"; + value: Array; +} | { + type: "object"; + value: Array; +}; +export interface TestCaseAbi { + name: string; + type: string; + value: any; + verbose: TestCaseAbiVerbose; + bytecode: string; + encoded: string; +} +export interface TestCaseAccount { + name: string; + privateKey: string; + address: string; + icap: string; +} +export type TestCaseCreate = { + sender: string; + creates: Array<{ + name: string; + nonce: number; + address: string; + }>; +}; +export type TestCaseCreate2 = { + sender: string; + creates: Array<{ + name: string; + salt: string; + initCode: string; + initCodeHash: string; + address: string; + }>; +}; +export interface TestCaseHash { + name: string; + data: string; + sha256: string; + sha512: string; + ripemd160: string; + keccak256: string; +} +export interface TestCasePbkdf { + name: string; + password: string; + salt: string; + dkLen: number; + pbkdf2: { + iterations: number; + algorithm: "sha256" | "sha512"; + key: string; + }; + scrypt: { + N: number; + r: number; + p: number; + key: string; + }; +} +export interface TestCaseHmac { + name: string; + data: string; + key: string; + algorithm: "sha256" | "sha512"; + hmac: string; +} +export interface TestCaseHash { + name: string; + data: string; + sha256: string; + sha512: string; + ripemd160: string; + keccak256: string; +} +export interface TestCaseNamehash { + name: string; + ensName: string; + error?: string; + namehash?: string; +} +export interface TestCaseTypedDataDomain { + name?: string; + version?: string; + chainId?: number; + verifyingContract?: string; + salt?: string; +} +export interface TestCaseTypedDataType { + name: string; + type: string; +} +export interface TestCaseTypedData { + name: string; + domain: TestCaseTypedDataDomain; + primaryType: string; + types: Record>; + data: any; + encoded: string; + digest: string; + privateKey?: string; + signature?: string; +} +export interface TestCaseSolidityHash { + name: string; + types: Array; + keccak256: string; + ripemd160: string; + sha256: string; + values: Array; +} +export interface TestCaseUnit { + name: string; + wei: string; + ethers: string; + ether_format: string; + kwei?: string; + mwei?: string; + gwei?: string; + szabo?: string; + finney?: string; + finney_format?: string; + szabo_format?: string; + gwei_format?: string; + mwei_format?: string; + kwei_format?: string; +} +export type NestedHexString = string | Array; +export interface TestCaseRlp { + name: string; + encoded: string; + decoded: NestedHexString; +} +export interface TestCaseTransactionTx { + to?: string; + nonce?: number; + gasLimit?: string; + gasPrice?: string; + maxFeePerGas?: string; + maxPriorityFeePerGas?: string; + data?: string; + value?: string; + accessList?: Array<{ + address: string; + storageKeys: Array; + }>; + chainId?: string; +} +export interface TestCaseTransactionSig { + r: string; + s: string; + v: string; +} +export interface TestCaseTransaction { + name: string; + transaction: TestCaseTransactionTx; + privateKey: string; + unsignedLegacy: string; + signedLegacy: string; + unsignedEip155: string; + signedEip155: string; + unsignedBerlin: string; + signedBerlin: string; + unsignedLondon: string; + signedLondon: string; + signatureLegacy: TestCaseTransactionSig; + signatureEip155: TestCaseTransactionSig; + signatureBerlin: TestCaseTransactionSig; + signatureLondon: TestCaseTransactionSig; +} +export interface TestCaseMnemonicNode { + path: string; + chainCode: string; + depth: number; + index: number; + parentFingerprint: string; + fingerprint: string; + publicKey: string; + privateKey: string; + xpriv: string; + xpub: string; +} +export interface TestCaseMnemonic { + name: string; + phrase: string; + phraseHash: string; + password: string; + locale: string; + entropy: string; + seed: string; + nodes: Array; +} +export interface TestCaseWallet { + name: string; + filename: string; + type: string; + address: string; + password: string; + content: string; +} +export interface TestCaseWordlist { + name: string; + filename: string; + locale: string; + content: string; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/types.d.ts.map b/dist/ethers.js/src.ts/_tests/types.d.ts.map new file mode 100644 index 0000000..6a44442 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAC;IACpD,KAAK,EAAE,MAAM,CAAA;CAChB,GAAG;IACA,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,EAAE,OAAO,CAAA;CACjB,GAAG;IACA,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;CACnC,GAAG;IACA,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,KAAK,CAAC,kBAAkB,CAAC,CAAA;CACnC,CAAA;AAED,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,GAAG,CAAC;IACX,OAAO,EAAE,kBAAkB,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB;AAKD,MAAM,WAAW,eAAe;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,MAAM,cAAc,GAAG;IACzB,MAAM,EA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KAAK,EAAE,KAAK,CAAC,oBAAoB,CAAC,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB;AAKD,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACnB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/types.js b/dist/ethers.js/src.ts/_tests/types.js new file mode 100644 index 0000000..2004e03 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/types.js @@ -0,0 +1,4 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/types.js.map b/dist/ethers.js/src.ts/_tests/types.js.map new file mode 100644 index 0000000..d73e0b9 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/types.ts"],"names":[],"mappings":";;AA4PC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/utils.d.ts b/dist/ethers.js/src.ts/_tests/utils.d.ts new file mode 100644 index 0000000..4621f77 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/utils.d.ts @@ -0,0 +1,9 @@ +export declare function loadTests(tag: string): Array; +export declare function log(context: any, text: string): void; +export declare function stall(duration: number): Promise; +export interface MochaRunnable { + timeout: (value: number) => void; + skip: () => void; +} +export declare function retryIt(name: string, func: (this: MochaRunnable) => Promise): Promise; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/utils.d.ts.map b/dist/ethers.js/src.ts/_tests/utils.d.ts.map new file mode 100644 index 0000000..7c7b308 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/utils.ts"],"names":[],"mappings":"AAoBA,wBAAgB,SAAS,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,GAAG,KAAK,CAAC,CAAC,CAAC,CAGlD;AAED,wBAAgB,GAAG,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAMpD;AAED,wBAAsB,KAAK,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAE3D;AAED,MAAM,WAAW,aAAa;IAC1B,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,IAAI,EAAE,MAAM,IAAI,CAAC;CACpB;AAGD,wBAAsB,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAoCvG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/utils.js b/dist/ethers.js/src.ts/_tests/utils.js new file mode 100644 index 0000000..797ff85 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/utils.js @@ -0,0 +1,150 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.retryIt = exports.stall = exports.log = exports.loadTests = void 0; +const fs_1 = __importDefault(require("fs")); +const path_1 = __importDefault(require("path")); +const zlib_1 = __importDefault(require("zlib")); +// Find the package root (based on the nyc output/ folder) +const root = (function () { + let root = process.cwd(); + while (true) { + if (fs_1.default.existsSync(path_1.default.join(root, "output"))) { + return root; + } + const parent = path_1.default.join(root, ".."); + if (parent === root) { + break; + } + root = parent; + } + throw new Error("could not find root"); +})(); +// Load the tests +function loadTests(tag) { + const filename = path_1.default.resolve(root, "testcases", tag + ".json.gz"); + return JSON.parse(zlib_1.default.gunzipSync(fs_1.default.readFileSync(filename)).toString()); +} +exports.loadTests = loadTests; +function log(context, text) { + if (context && context.test && typeof (context.test._ethersLog) === "function") { + context.test._ethersLog(text); + } + else { + console.log(text); + } +} +exports.log = log; +function stall(duration) { + return __awaiter(this, void 0, void 0, function* () { + return new Promise((resolve) => { setTimeout(resolve, duration); }); + }); +} +exports.stall = stall; +const ATTEMPTS = 5; +function retryIt(name, func) { + return __awaiter(this, void 0, void 0, function* () { + //const errors: Array = [ ]; + it(name, function () { + return __awaiter(this, void 0, void 0, function* () { + this.timeout(ATTEMPTS * 5000); + for (let i = 0; i < ATTEMPTS; i++) { + try { + yield func.call(this); + return; + } + catch (error) { + if (error.message === "sync skip; aborting execution") { + // Skipping a test; let mocha handle it + throw error; + } + else if (error.code === "ERR_ASSERTION") { + // Assertion error; let mocha scold us + throw error; + } + else { + //errors.push(error); + if (i === ATTEMPTS - 1) { + throw error; + //stats.pushRetry(i, name, error); + } + else { + yield stall(500 * (1 << i)); + //stats.pushRetry(i, name, null); + } + } + } + } + // All hope is lost. + throw new Error(`Failed after ${ATTEMPTS} attempts; ${name}`); + }); + }); + }); +} +exports.retryIt = retryIt; +/* +export interface StatSet { + name: string; + retries: Array<{ message: string, error: null | Error }>; +} + +const _guard = { }; + +export class Stats { +// #stats: Array; + + constructor(guard: any) { + if (guard !== _guard) { throw new Error("private constructor"); } +// this.#stats = [ ]; + } + + #currentStats(): StatSet { + if (this.#stats.length === 0) { throw new Error("no active stats"); } + return this.#stats[this.#stats.length - 1]; + } + + pushRetry(attempt: number, line: string, error: null | Error): void { + const { retries } = this.#currentStats(); + + if (attempt > 0) { retries.pop(); } + if (retries.length < 100) { + retries.push({ + message: `${ attempt + 1 } failures: ${ line }`, + error + }); + } + } + + start(name: string): void { + this.#stats.push({ name, retries: [ ] }); + } + + end(context?: any): void { + let log = console.log.bind(console); + if (context && typeof(context._ethersLog) === "function") { + log = context._ethersLog; + } + const { name, retries } = this.#currentStats(); + if (retries.length === 0) { return; } + log(`Warning: The following tests required retries (${ name })`); + retries.forEach(({ error, message }) => { + log(" " + message); + if (error) { log(error); } + }); + } +} + +export const stats = new Stats(_guard); +*/ +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_tests/utils.js.map b/dist/ethers.js/src.ts/_tests/utils.js.map new file mode 100644 index 0000000..dfa2df3 --- /dev/null +++ b/dist/ethers.js/src.ts/_tests/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/_tests/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,4CAAmB;AACnB,gDAAwB;AACxB,gDAAwB;AAExB,0DAA0D;AAC1D,MAAM,IAAI,GAAG,CAAC;IACV,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAEzB,OAAO,IAAI,EAAE;QACT,IAAI,YAAE,CAAC,UAAU,CAAC,cAAI,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,EAAE;YAAE,OAAO,IAAI,CAAC;SAAE;QAC9D,MAAM,MAAM,GAAG,cAAI,CAAC,IAAI,CAAC,IAAI,EAA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AAE,CAAC,GAAG,QAAQ,EAAE,CAAC,EAAE,EAAE;oBAC/B,IAAI;wBACA,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;wBACtB,OAAO;qBACV;oBAAC,OAAO,KAAU,EAAE;wBACjB,IAAI,KAAK,CAAC,OAAO,KAAK,+BAA+B,EAAE;4BACnD,uCAAuC;4BACvC,MAAM,KAAK,CAAC;yBAEf;6BAAM,IAAI,KAAK,CAAC,IAAI,KAAK,eAAe,EAAE;4BACvC,sCAAsC;4BACtC,MAAM,KAAK,CAAC;yBAEf;6BAAM;4BACH,qBAAqB;4BAErB,IAAI,CAAC,KAAK,QAAQ,GAAG,CAAC,EAAE;gCACpB,MAAM,KAAK,CAAC;gCACZ,kCAAkC;6BACrC;iCAAM;gCACH,MAAM,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gCAC5B,iCAAiC;6BACpC;yBACJ;qBACJ;iBACJ;gBAED,oBAAoB;gBACpB,MAAM,IAAI,KAAK,CAAC,gBAAiB,QAAS,cAAe,IAAK,EAAE,CAAC,CAAC;YACtE,CAAC;SAAA,CAAC,CAAC;IACP,CAAC;CAAA;AApCD,0BAoCC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_version.d.ts b/dist/ethers.js/src.ts/_version.d.ts new file mode 100644 index 0000000..37c501a --- /dev/null +++ b/dist/ethers.js/src.ts/_version.d.ts @@ -0,0 +1,5 @@ +/** + * The current version of Ethers. + */ +export declare const version: string; +//# sourceMappingURL=_version.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_version.d.ts.map b/dist/ethers.js/src.ts/_version.d.ts.map new file mode 100644 index 0000000..04ea860 --- /dev/null +++ b/dist/ethers.js/src.ts/_version.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"_version.d.ts","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/_version.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,MAAgB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_version.js b/dist/ethers.js/src.ts/_version.js new file mode 100644 index 0000000..68cb659 --- /dev/null +++ b/dist/ethers.js/src.ts/_version.js @@ -0,0 +1,9 @@ +"use strict"; +/* Do NOT modify this file; see /src.ts/_admin/update-version.ts */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.version = void 0; +/** + * The current version of Ethers. + */ +exports.version = "6.9.0"; +//# sourceMappingURL=_version.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/_version.js.map b/dist/ethers.js/src.ts/_version.js.map new file mode 100644 index 0000000..df3bb56 --- /dev/null +++ b/dist/ethers.js/src.ts/_version.js.map @@ -0,0 +1 @@ +{"version":3,"file":"_version.js","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/_version.ts"],"names":[],"mappings":";AAAA,mEAAmE;;;AAEnE;;GAEG;AACU,QAAA,OAAO,GAAW,OAAO,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/abi-coder.d.ts b/dist/ethers.js/src.ts/abi/abi-coder.d.ts new file mode 100644 index 0000000..4afe611 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/abi-coder.d.ts @@ -0,0 +1,60 @@ +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +import { Result } from "./coders/abstract-coder.js"; +import { ParamType } from "./fragments.js"; +import type { BytesLike, CallExceptionAction, CallExceptionError } from "../utils/index.js"; +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +export declare class AbiCoder { + #private; + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types: ReadonlyArray): Result; + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types: ReadonlyArray, values: ReadonlyArray): string; + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types: ReadonlyArray, data: BytesLike, loose?: boolean): Result; + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder(): AbiCoder; + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action: CallExceptionAction, tx: { + to?: null | string; + from?: null | string; + data?: string; + }, data: null | BytesLike): CallExceptionError; +} +//# sourceMappingURL=abi-coder.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/abi-coder.d.ts.map b/dist/ethers.js/src.ts/abi/abi-coder.d.ts.map new file mode 100644 index 0000000..43102e2 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/abi-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/abi-coder.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAMH,OAAO,EAAiB,MAAM,EAAU,MAAM,4BAA4B,CAAC;AAU3E,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAK3C,OAAO,KAAK,EACR,SAAS,EACT,mBAAmB,EAAE,kBAAkB,EAC1C,MAAM,mBAAmB,CAAC;AAuF3B;;;GAGG;AACH,qBAAa,QAAQ;;IA4CjB;;;;;OAKG;IACH,eAAe,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,GAAG,MAAM;IAMjE;;;;OAIG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM;IAWpF;;;;;;OAMG;IACH,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAM1F;;;;OAIG;IACH,MAAM,CAAC,eAAe,IAAI,QAAQ;IAOlC;;;;OAIG;IACH,MAAM,CAAC,uBAAuB,CAAC,MAAM,EAAE,mBAAmB,EAAE,EAAE,EAAE;QAAE,EAAE,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAE,EAAE,IAAI,EAAE,IAAI,GAAG,SAAS,GAAG,kBAAkB;CAG3K"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/abi-coder.js b/dist/ethers.js/src.ts/abi/abi-coder.js new file mode 100644 index 0000000..a11155d --- /dev/null +++ b/dist/ethers.js/src.ts/abi/abi-coder.js @@ -0,0 +1,214 @@ +"use strict"; +/** + * When sending values to or receiving values from a [[Contract]], the + * data is generally encoded using the [ABI standard](link-solc-abi). + * + * The AbiCoder provides a utility to encode values to ABI data and + * decode values from ABI data. + * + * Most of the time, developers should favour the [[Contract]] class, + * which further abstracts a lot of the finer details of ABI data. + * + * @_section api/abi/abi-coder:ABI Encoding + */ +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _AbiCoder_instances, _AbiCoder_getCoder; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbiCoder = void 0; +// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI +const index_js_1 = require("../utils/index.js"); +const abstract_coder_js_1 = require("./coders/abstract-coder.js"); +const address_js_1 = require("./coders/address.js"); +const array_js_1 = require("./coders/array.js"); +const boolean_js_1 = require("./coders/boolean.js"); +const bytes_js_1 = require("./coders/bytes.js"); +const fixed_bytes_js_1 = require("./coders/fixed-bytes.js"); +const null_js_1 = require("./coders/null.js"); +const number_js_1 = require("./coders/number.js"); +const string_js_1 = require("./coders/string.js"); +const tuple_js_1 = require("./coders/tuple.js"); +const fragments_js_1 = require("./fragments.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../utils/index.js"); +// https://docs.soliditylang.org/en/v0.8.17/control-structures.html +const PanicReasons = new Map(); +PanicReasons.set(0x00, "GENERIC_PANIC"); +PanicReasons.set(0x01, "ASSERT_FALSE"); +PanicReasons.set(0x11, "OVERFLOW"); +PanicReasons.set(0x12, "DIVIDE_BY_ZERO"); +PanicReasons.set(0x21, "ENUM_RANGE_ERROR"); +PanicReasons.set(0x22, "BAD_STORAGE_DATA"); +PanicReasons.set(0x31, "STACK_UNDERFLOW"); +PanicReasons.set(0x32, "ARRAY_RANGE_ERROR"); +PanicReasons.set(0x41, "OUT_OF_MEMORY"); +PanicReasons.set(0x51, "UNINITIALIZED_FUNCTION_CALL"); +const paramTypeBytes = new RegExp(/^bytes([0-9]*)$/); +const paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/); +let defaultCoder = null; +function getBuiltinCallException(action, tx, data, abiCoder) { + let message = "missing revert data"; + let reason = null; + const invocation = null; + let revert = null; + if (data) { + message = "execution reverted"; + const bytes = (0, index_js_3.getBytes)(data); + data = (0, index_js_3.hexlify)(data); + if (bytes.length === 0) { + message += " (no data present; likely require(false) occurred"; + reason = "require(false)"; + } + else if (bytes.length % 32 !== 4) { + message += " (could not decode reason; invalid data length)"; + } + else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x08c379a0") { + // Error(string) + try { + reason = abiCoder.decode(["string"], bytes.slice(4))[0]; + revert = { + signature: "Error(string)", + name: "Error", + args: [reason] + }; + message += `: ${JSON.stringify(reason)}`; + } + catch (error) { + message += " (could not decode reason; invalid string data)"; + } + } + else if ((0, index_js_3.hexlify)(bytes.slice(0, 4)) === "0x4e487b71") { + // Panic(uint256) + try { + const code = Number(abiCoder.decode(["uint256"], bytes.slice(4))[0]); + revert = { + signature: "Panic(uint256)", + name: "Panic", + args: [code] + }; + reason = `Panic due to ${PanicReasons.get(code) || "UNKNOWN"}(${code})`; + message += `: ${reason}`; + } + catch (error) { + message += " (could not decode panic code)"; + } + } + else { + message += " (unknown custom error)"; + } + } + const transaction = { + to: (tx.to ? (0, index_js_2.getAddress)(tx.to) : null), + data: (tx.data || "0x") + }; + if (tx.from) { + transaction.from = (0, index_js_2.getAddress)(tx.from); + } + return (0, index_js_3.makeError)(message, "CALL_EXCEPTION", { + action, data, reason, transaction, invocation, revert + }); +} +/** + * The **AbiCoder** is a low-level class responsible for encoding JavaScript + * values into binary data and decoding binary data into JavaScript values. + */ +class AbiCoder { + constructor() { + _AbiCoder_instances.add(this); + } + /** + * Get the default values for the given %%types%%. + * + * For example, a ``uint`` is by default ``0`` and ``bool`` + * is by default ``false``. + */ + getDefaultValue(types) { + const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, fragments_js_1.ParamType.from(type))); + const coder = new tuple_js_1.TupleCoder(coders, "_"); + return coder.defaultValue(); + } + /** + * Encode the %%values%% as the %%types%% into ABI data. + * + * @returns DataHexstring + */ + encode(types, values) { + (0, index_js_1.assertArgumentCount)(values.length, types.length, "types/values length mismatch"); + const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, fragments_js_1.ParamType.from(type))); + const coder = (new tuple_js_1.TupleCoder(coders, "_")); + const writer = new abstract_coder_js_1.Writer(); + coder.encode(writer, values); + return writer.data; + } + /** + * Decode the ABI %%data%% as the %%types%% into values. + * + * If %%loose%% decoding is enabled, then strict padding is + * not enforced. Some older versions of Solidity incorrectly + * padded event data emitted from ``external`` functions. + */ + decode(types, data, loose) { + const coders = types.map((type) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, fragments_js_1.ParamType.from(type))); + const coder = new tuple_js_1.TupleCoder(coders, "_"); + return coder.decode(new abstract_coder_js_1.Reader(data, loose)); + } + /** + * Returns the shared singleton instance of a default [[AbiCoder]]. + * + * On the first call, the instance is created internally. + */ + static defaultAbiCoder() { + if (defaultCoder == null) { + defaultCoder = new AbiCoder(); + } + return defaultCoder; + } + /** + * Returns an ethers-compatible [[CallExceptionError]] Error for the given + * result %%data%% for the [[CallExceptionAction]] %%action%% against + * the Transaction %%tx%%. + */ + static getBuiltinCallException(action, tx, data) { + return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder()); + } +} +exports.AbiCoder = AbiCoder; +_AbiCoder_instances = new WeakSet(), _AbiCoder_getCoder = function _AbiCoder_getCoder(param) { + if (param.isArray()) { + return new array_js_1.ArrayCoder(__classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, param.arrayChildren), param.arrayLength, param.name); + } + if (param.isTuple()) { + return new tuple_js_1.TupleCoder(param.components.map((c) => __classPrivateFieldGet(this, _AbiCoder_instances, "m", _AbiCoder_getCoder).call(this, c)), param.name); + } + switch (param.baseType) { + case "address": + return new address_js_1.AddressCoder(param.name); + case "bool": + return new boolean_js_1.BooleanCoder(param.name); + case "string": + return new string_js_1.StringCoder(param.name); + case "bytes": + return new bytes_js_1.BytesCoder(param.name); + case "": + return new null_js_1.NullCoder(param.name); + } + // u?int[0-9]* + let match = param.type.match(paramTypeNumber); + if (match) { + let size = parseInt(match[2] || "256"); + (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && (size % 8) === 0, "invalid " + match[1] + " bit length", "param", param); + return new number_js_1.NumberCoder(size / 8, (match[1] === "int"), param.name); + } + // bytes[0-9]+ + match = param.type.match(paramTypeBytes); + if (match) { + let size = parseInt(match[1]); + (0, index_js_1.assertArgument)(size !== 0 && size <= 32, "invalid bytes length", "param", param); + return new fixed_bytes_js_1.FixedBytesCoder(size, param.name); + } + (0, index_js_1.assertArgument)(false, "invalid type", "type", param.type); +}; +//# sourceMappingURL=abi-coder.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/abi-coder.js.map b/dist/ethers.js/src.ts/abi/abi-coder.js.map new file mode 100644 index 0000000..76e4856 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/abi-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abi-coder.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/abi-coder.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;GAWG;;;;;;;;;AAEH,mEAAmE;AAEnE,gDAAwE;AAExE,kEAA2E;AAC3E,oDAAmD;AACnD,gDAA+C;AAC/C,oDAAmD;AACnD,gDAA+C;AAC/C,4DAA0D;AAC1D,8CAA6C;AAC7C,kDAAiD;AACjD,kDAAiD;AACjD,gDAA+C;AAC/C,iDAA2C;AAE3C,kDAAiD;AACjD,gDAAiE;AAOjE,mEAAmE;AACnE,MAAM,YAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;AACpD,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;AACxC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,cAAc,CAAC,CAAC;AACvC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,UAAU,CAAC,CAAC;AACnC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,gBAAgB,CAAC,CAAC;AACzC,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;AAC3C,YAAY,CAAC,GAAG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AC,CAAC,CAAC;QAC9B,IAAA,yBAAc,EAAC,IAAI,KAAK,CAAC,IAAI,IAAI,IAAI,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACjF,OAAO,IAAI,gCAAe,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;KAChD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;AAC9D,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/bytes32.d.ts b/dist/ethers.js/src.ts/abi/bytes32.d.ts new file mode 100644 index 0000000..73455cb --- /dev/null +++ b/dist/ethers.js/src.ts/abi/bytes32.d.ts @@ -0,0 +1,15 @@ +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Encodes %%text%% as a Bytes32 string. + */ +export declare function encodeBytes32String(text: string): string; +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +export declare function decodeBytes32String(_bytes: BytesLike): string; +//# sourceMappingURL=bytes32.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/bytes32.d.ts.map b/dist/ethers.js/src.ts/abi/bytes32.d.ts.map new file mode 100644 index 0000000..5e2fe73 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/bytes32.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/bytes32.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUxD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAa7D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/bytes32.js b/dist/ethers.js/src.ts/abi/bytes32.js new file mode 100644 index 0000000..e5c22aa --- /dev/null +++ b/dist/ethers.js/src.ts/abi/bytes32.js @@ -0,0 +1,45 @@ +"use strict"; +/** + * About bytes32 strings... + * + * @_docloc: api/utils:Bytes32 Strings + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBytes32String = exports.encodeBytes32String = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * Encodes %%text%% as a Bytes32 string. + */ +function encodeBytes32String(text) { + // Get the bytes + const bytes = (0, index_js_1.toUtf8Bytes)(text); + // Check we have room for null-termination + if (bytes.length > 31) { + throw new Error("bytes32 string must be less than 32 bytes"); + } + // Zero-pad (implicitly null-terminates) + return (0, index_js_1.zeroPadBytes)(bytes, 32); +} +exports.encodeBytes32String = encodeBytes32String; +/** + * Encodes the Bytes32-encoded %%bytes%% into a string. + */ +function decodeBytes32String(_bytes) { + const data = (0, index_js_1.getBytes)(_bytes, "bytes"); + // Must be 32 bytes with a null-termination + if (data.length !== 32) { + throw new Error("invalid bytes32 - not 32 bytes long"); + } + if (data[31] !== 0) { + throw new Error("invalid bytes32 string - no null terminator"); + } + // Find the null termination + let length = 31; + while (data[length - 1] === 0) { + length--; + } + // Determine the string value + return (0, index_js_1.toUtf8String)(data.slice(0, length)); +} +exports.decodeBytes32String = decodeBytes32String; +//# sourceMappingURL=bytes32.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/bytes32.js.map b/dist/ethers.js/src.ts/abi/bytes32.js.map new file mode 100644 index 0000000..9ee375b --- /dev/null +++ b/dist/ethers.js/src.ts/abi/bytes32.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes32.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/bytes32.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAE2B;AAI3B;;GAEG;AACH,SAAgB,mBAAmB,CAAC,IAAY;IAE5C,gBAAgB;IAChB,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC;IAEhC,0CAA0C;IAC1C,IAAI,KAAK,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAAE;IAExF,wCAAwC;IACxC,OAAO,IAAA,uBAAY,EAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACnC,CAAC;AAVD,kDAUC;AAED;;GAEG;AACH,SAAgB,mBAAmB,CAAC,MAAiB;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAEvC,2CAA2C;IAC3C,IAAI,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;KAAE;IACnF,IAAI,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;KAAE;IAEvF,4BAA4B;IAC5B,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,EAAE;QAAE,MAAM,EAAE,CAAC;KAAE;IAE5C,6BAA6B;IAC7B,OAAO,IAAA,uBAAY,EAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;AAC/C,CAAC;AAbD,kDAaC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts b/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts new file mode 100644 index 0000000..674dc6f --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts @@ -0,0 +1,121 @@ +import type { BigNumberish, BytesLike } from "../../utils/index.js"; +/** + * @_ignore: + */ +export declare const WordSize: number; +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +export declare class Result extends Array { + #private; + [K: string | number]: any; + /** + * @private + */ + constructor(...args: Array); + /** + * Returns the Result as a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray(): Array; + /** + * Returns the Result as an Object with each name-value pair. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject(): Record; + /** + * @_ignore + */ + slice(start?: number | undefined, end?: number | undefined): Result; + /** + * @_ignore + */ + filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result; + /** + * @_ignore + */ + map(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array; + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name: string): any; + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items: Array, keys?: Array): Result; +} +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +export declare function checkResultErrors(result: Result): Array<{ + path: Array; + error: Error; +}>; +/** + * @_ignore + */ +export declare abstract class Coder { + readonly name: string; + readonly type: string; + readonly localName: string; + readonly dynamic: boolean; + constructor(name: string, type: string, localName: string, dynamic: boolean); + _throwError(message: string, value: any): never; + abstract encode(writer: Writer, value: any): number; + abstract decode(reader: Reader): any; + abstract defaultValue(): any; +} +/** + * @_ignore + */ +export declare class Writer { + #private; + constructor(); + get data(): string; + get length(): number; + appendWriter(writer: Writer): number; + writeBytes(value: BytesLike): number; + writeValue(value: BigNumberish): number; + writeUpdatableValue(): (value: BigNumberish) => void; +} +/** + * @_ignore + */ +export declare class Reader { + #private; + readonly allowLoose: boolean; + constructor(data: BytesLike, allowLoose?: boolean); + get data(): string; + get dataLength(): number; + get consumed(): number; + get bytes(): Uint8Array; + subReader(offset: number): Reader; + readBytes(length: number, loose?: boolean): Uint8Array; + readValue(): bigint; + readIndex(): number; +} +//# sourceMappingURL=abstract-coder.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts.map b/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts.map new file mode 100644 index 0000000..2178dcb --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/abstract-coder.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-coder.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEpE;;GAEG;AACH,eAAO,MAAM,QAAQ,EAAE,MAAW,CAAC;AAenC;;;;;;GAMG;AACH,qBAAa,MAAO,SAAQ,KAAK,CAAC,GAAG,CAAC;;IAGlC,CAAE,CAAC,EAAE,MAAM,GAAG,MAAM,GAAI,GAAG,CAAA;IAE3B;;OAEG;gBACS,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC;IAyF/B;;;;;OAKG;IACH,OAAO,IAAI,KAAK,CAAC,GAAG,CAAC;IASrB;;;;;OAKG;IACH,QAAQ,IAAI,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC;IAe/B;;OAEG;IACH,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM;IAuBnE;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,OAAO,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,MAAM;IAiB3F;;OAEG;IAC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,MAAM;;;IAUf,IAAI,IAAI,IAAI,MAAM,CAEjB;IACD,IAAI,MAAM,IAAI,MAAM,CAA6B;IAQjD,YAAY,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKpC,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAUpC,UAAU,CAAC,KAAK,EAAE,YAAY,GAAG,MAAM;IAMvC,mBAAmB,IAAI,CAAC,KAAK,EAAE,YAAY,KAAK,IAAI;CAQvD;AAED;;GAEG;AACH,qBAAa,MAAM;;IAKf,QAAQ,CAAC,UAAU,EAAG,OAAO,CAAC;gBAKlB,IAAI,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO;IAQjD,IAAI,IAAI,IAAI,MAAM,CAAgC;IAClD,IAAI,UAAU,IAAI,MAAM,CAA8B;IACtD,IAAI,QAAQ,IAAI,MAAM,CAAyB;IAC/C,IAAI,KAAK,IAAI,UAAU,CAAuC;IAmB9D,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM;IAKjC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU;IAQtD,SAAS,IAAI,MAAM;IAInB,SAAS,IAAI,MAAM;CAGtB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/abstract-coder.js b/dist/ethers.js/src.ts/abi/coders/abstract-coder.js new file mode 100644 index 0000000..bddb331 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/abstract-coder.js @@ -0,0 +1,404 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Result_names, _Writer_instances, _Writer_data, _Writer_dataLength, _Writer_writeData, _Reader_instances, _Reader_data, _Reader_offset, _Reader_peekBytes; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Reader = exports.Writer = exports.Coder = exports.checkResultErrors = exports.Result = exports.WordSize = void 0; +const index_js_1 = require("../../utils/index.js"); +/** + * @_ignore: + */ +exports.WordSize = 32; +const Padding = new Uint8Array(exports.WordSize); +// Properties used to immediate pass through to the underlying object +// - `then` is used to detect if an object is a Promise for await +const passProperties = ["then"]; +const _guard = {}; +function throwError(name, error) { + const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${name}`); + wrapped.error = error; + throw wrapped; +} +/** + * A [[Result]] is a sub-class of Array, which allows accessing any + * of its values either positionally by its index or, if keys are + * provided by its name. + * + * @_docloc: api/abi + */ +class Result extends Array { + /** + * @private + */ + constructor(...args) { + // To properly sub-class Array so the other built-in + // functions work, the constructor has to behave fairly + // well. So, in the event we are created via fromItems() + // we build the read-only Result object we want, but on + // any other input, we use the default constructor + // constructor(guard: any, items: Array, keys?: Array); + const guard = args[0]; + let items = args[1]; + let names = (args[2] || []).slice(); + let wrap = true; + if (guard !== _guard) { + items = args; + names = []; + wrap = false; + } + // Can't just pass in ...items since an array of length 1 + // is a special case in the super. + super(items.length); + _Result_names.set(this, void 0); + items.forEach((item, index) => { this[index] = item; }); + // Find all unique keys + const nameCounts = names.reduce((accum, name) => { + if (typeof (name) === "string") { + accum.set(name, (accum.get(name) || 0) + 1); + } + return accum; + }, (new Map())); + // Remove any key thats not unique + __classPrivateFieldSet(this, _Result_names, Object.freeze(items.map((item, index) => { + const name = names[index]; + if (name != null && nameCounts.get(name) === 1) { + return name; + } + return null; + })), "f"); + if (!wrap) { + return; + } + // A wrapped Result is immutable + Object.freeze(this); + // Proxy indices and names so we can trap deferred errors + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "string") { + // Index accessor + if (prop.match(/^[0-9]+$/)) { + const index = (0, index_js_1.getNumber)(prop, "%index"); + if (index < 0 || index >= this.length) { + throw new RangeError("out of result range"); + } + const item = target[index]; + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + return item; + } + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + const value = target[prop]; + if (value instanceof Function) { + // Make sure functions work with private variables + // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding + return function (...args) { + return value.apply((this === receiver) ? target : this, args); + }; + } + else if (!(prop in target)) { + // Possible name accessor + return target.getValue.apply((this === receiver) ? target : this, [prop]); + } + } + return Reflect.get(target, prop, receiver); + } + }); + } + /** + * Returns the Result as a normal Array. + * + * This will throw if there are any outstanding deferred + * errors. + */ + toArray() { + const result = []; + this.forEach((item, index) => { + if (item instanceof Error) { + throwError(`index ${index}`, item); + } + result.push(item); + }); + return result; + } + /** + * Returns the Result as an Object with each name-value pair. + * + * This will throw if any value is unnamed, or if there are + * any outstanding deferred errors. + */ + toObject() { + return __classPrivateFieldGet(this, _Result_names, "f").reduce((accum, name, index) => { + (0, index_js_1.assert)(name != null, "value at index ${ index } unnamed", "UNSUPPORTED_OPERATION", { + operation: "toObject()" + }); + // Add values for names that don't conflict + if (!(name in accum)) { + accum[name] = this.getValue(name); + } + return accum; + }, {}); + } + /** + * @_ignore + */ + slice(start, end) { + if (start == null) { + start = 0; + } + if (start < 0) { + start += this.length; + if (start < 0) { + start = 0; + } + } + if (end == null) { + end = this.length; + } + if (end < 0) { + end += this.length; + if (end < 0) { + end = 0; + } + } + if (end > this.length) { + end = this.length; + } + const result = [], names = []; + for (let i = start; i < end; i++) { + result.push(this[i]); + names.push(__classPrivateFieldGet(this, _Result_names, "f")[i]); + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + filter(callback, thisArg) { + const result = [], names = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + if (callback.call(thisArg, item, i, this)) { + result.push(item); + names.push(__classPrivateFieldGet(this, _Result_names, "f")[i]); + } + } + return new Result(_guard, result, names); + } + /** + * @_ignore + */ + map(callback, thisArg) { + const result = []; + for (let i = 0; i < this.length; i++) { + const item = this[i]; + if (item instanceof Error) { + throwError(`index ${i}`, item); + } + result.push(callback.call(thisArg, item, i, this)); + } + return result; + } + /** + * Returns the value for %%name%%. + * + * Since it is possible to have a key whose name conflicts with + * a method on a [[Result]] or its superclass Array, or any + * JavaScript keyword, this ensures all named values are still + * accessible by name. + */ + getValue(name) { + const index = __classPrivateFieldGet(this, _Result_names, "f").indexOf(name); + if (index === -1) { + return undefined; + } + const value = this[index]; + if (value instanceof Error) { + throwError(`property ${JSON.stringify(name)}`, value.error); + } + return value; + } + /** + * Creates a new [[Result]] for %%items%% with each entry + * also accessible by its corresponding name in %%keys%%. + */ + static fromItems(items, keys) { + return new Result(_guard, items, keys); + } +} +exports.Result = Result; +_Result_names = new WeakMap(); +/** + * Returns all errors found in a [[Result]]. + * + * Since certain errors encountered when creating a [[Result]] do + * not impact the ability to continue parsing data, they are + * deferred until they are actually accessed. Hence a faulty string + * in an Event that is never used does not impact the program flow. + * + * However, sometimes it may be useful to access, identify or + * validate correctness of a [[Result]]. + * + * @_docloc api/abi + */ +function checkResultErrors(result) { + // Find the first error (if any) + const errors = []; + const checkErrors = function (path, object) { + if (!Array.isArray(object)) { + return; + } + for (let key in object) { + const childPath = path.slice(); + childPath.push(key); + try { + checkErrors(childPath, object[key]); + } + catch (error) { + errors.push({ path: childPath, error: error }); + } + } + }; + checkErrors([], result); + return errors; +} +exports.checkResultErrors = checkResultErrors; +function getValue(value) { + let bytes = (0, index_js_1.toBeArray)(value); + (0, index_js_1.assert)(bytes.length <= exports.WordSize, "value out-of-bounds", "BUFFER_OVERRUN", { buffer: bytes, length: exports.WordSize, offset: bytes.length }); + if (bytes.length !== exports.WordSize) { + bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([Padding.slice(bytes.length % exports.WordSize), bytes])); + } + return bytes; +} +/** + * @_ignore + */ +class Coder { + constructor(name, type, localName, dynamic) { + (0, index_js_1.defineProperties)(this, { name, type, localName, dynamic }, { + name: "string", type: "string", localName: "string", dynamic: "boolean" + }); + } + _throwError(message, value) { + (0, index_js_1.assertArgument)(false, message, this.localName, value); + } +} +exports.Coder = Coder; +/** + * @_ignore + */ +class Writer { + constructor() { + _Writer_instances.add(this); + // An array of WordSize lengthed objects to concatenation + _Writer_data.set(this, void 0); + _Writer_dataLength.set(this, void 0); + __classPrivateFieldSet(this, _Writer_data, [], "f"); + __classPrivateFieldSet(this, _Writer_dataLength, 0, "f"); + } + get data() { + return (0, index_js_1.concat)(__classPrivateFieldGet(this, _Writer_data, "f")); + } + get length() { return __classPrivateFieldGet(this, _Writer_dataLength, "f"); } + appendWriter(writer) { + return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, (0, index_js_1.getBytesCopy)(writer.data)); + } + // Arrayish item; pad on the right to *nearest* WordSize + writeBytes(value) { + let bytes = (0, index_js_1.getBytesCopy)(value); + const paddingOffset = bytes.length % exports.WordSize; + if (paddingOffset) { + bytes = (0, index_js_1.getBytesCopy)((0, index_js_1.concat)([bytes, Padding.slice(paddingOffset)])); + } + return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, bytes); + } + // Numeric item; pad on the left *to* WordSize + writeValue(value) { + return __classPrivateFieldGet(this, _Writer_instances, "m", _Writer_writeData).call(this, getValue(value)); + } + // Inserts a numeric place-holder, returning a callback that can + // be used to asjust the value later + writeUpdatableValue() { + const offset = __classPrivateFieldGet(this, _Writer_data, "f").length; + __classPrivateFieldGet(this, _Writer_data, "f").push(Padding); + __classPrivateFieldSet(this, _Writer_dataLength, __classPrivateFieldGet(this, _Writer_dataLength, "f") + exports.WordSize, "f"); + return (value) => { + __classPrivateFieldGet(this, _Writer_data, "f")[offset] = getValue(value); + }; + } +} +exports.Writer = Writer; +_Writer_data = new WeakMap(), _Writer_dataLength = new WeakMap(), _Writer_instances = new WeakSet(), _Writer_writeData = function _Writer_writeData(data) { + __classPrivateFieldGet(this, _Writer_data, "f").push(data); + __classPrivateFieldSet(this, _Writer_dataLength, __classPrivateFieldGet(this, _Writer_dataLength, "f") + data.length, "f"); + return data.length; +}; +/** + * @_ignore + */ +class Reader { + constructor(data, allowLoose) { + _Reader_instances.add(this); + _Reader_data.set(this, void 0); + _Reader_offset.set(this, void 0); + (0, index_js_1.defineProperties)(this, { allowLoose: !!allowLoose }); + __classPrivateFieldSet(this, _Reader_data, (0, index_js_1.getBytesCopy)(data), "f"); + __classPrivateFieldSet(this, _Reader_offset, 0, "f"); + } + get data() { return (0, index_js_1.hexlify)(__classPrivateFieldGet(this, _Reader_data, "f")); } + get dataLength() { return __classPrivateFieldGet(this, _Reader_data, "f").length; } + get consumed() { return __classPrivateFieldGet(this, _Reader_offset, "f"); } + get bytes() { return new Uint8Array(__classPrivateFieldGet(this, _Reader_data, "f")); } + // Create a sub-reader with the same underlying data, but offset + subReader(offset) { + return new Reader(__classPrivateFieldGet(this, _Reader_data, "f").slice(__classPrivateFieldGet(this, _Reader_offset, "f") + offset), this.allowLoose); + } + // Read bytes + readBytes(length, loose) { + let bytes = __classPrivateFieldGet(this, _Reader_instances, "m", _Reader_peekBytes).call(this, 0, length, !!loose); + __classPrivateFieldSet(this, _Reader_offset, __classPrivateFieldGet(this, _Reader_offset, "f") + bytes.length, "f"); + // @TODO: Make sure the length..end bytes are all 0? + return bytes.slice(0, length); + } + // Read a numeric values + readValue() { + return (0, index_js_1.toBigInt)(this.readBytes(exports.WordSize)); + } + readIndex() { + return (0, index_js_1.toNumber)(this.readBytes(exports.WordSize)); + } +} +exports.Reader = Reader; +_Reader_data = new WeakMap(), _Reader_offset = new WeakMap(), _Reader_instances = new WeakSet(), _Reader_peekBytes = function _Reader_peekBytes(offset, length, loose) { + let alignedLength = Math.ceil(length / exports.WordSize) * exports.WordSize; + if (__classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength > __classPrivateFieldGet(this, _Reader_data, "f").length) { + if (this.allowLoose && loose && __classPrivateFieldGet(this, _Reader_offset, "f") + length <= __classPrivateFieldGet(this, _Reader_data, "f").length) { + alignedLength = length; + } + else { + (0, index_js_1.assert)(false, "data out-of-bounds", "BUFFER_OVERRUN", { + buffer: (0, index_js_1.getBytesCopy)(__classPrivateFieldGet(this, _Reader_data, "f")), + length: __classPrivateFieldGet(this, _Reader_data, "f").length, + offset: __classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength + }); + } + } + return __classPrivateFieldGet(this, _Reader_data, "f").slice(__classPrivateFieldGet(this, _Reader_offset, "f"), __classPrivateFieldGet(this, _Reader_offset, "f") + alignedLength); +}; +//# sourceMappingURL=abstract-coder.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/abstract-coder.js.map b/dist/ethers.js/src.ts/abi/coders/abstract-coder.js.map new file mode 100644 index 0000000..4cb96d1 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/abstract-coder.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-coder.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/abstract-coder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,mDAI8B;AAI9B;;GAEG;AACU,QAAA,QAAQ,GAAW,EAAE,CAAC;AACnC,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,gBAAQ,CAAC,CAAC;AAEzC,qEAAqE;AACrE,iEAAiE;AACjE,MAAM,cAAc,GAAG,CAAE,MAAM,CAAE,CAAC;AAElC,MAAM,MAAM,GAAG,EAAG,CAAC;AAEn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aACvC,CAAC,CAAC;SACN;KACJ;IACD,OAAO,uBAAA,IAAI,oBAAM,CAAC,KAAK,CAAC,uBAAA,IAAI,sBAAQ,EAAE,uBAAA,IAAI,sBAAQ,GAAG,aAAa,CAAC,CAAA;AACvE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/address.d.ts b/dist/ethers.js/src.ts/abi/coders/address.d.ts new file mode 100644 index 0000000..8befac0 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/address.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class AddressCoder extends Coder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/address.d.ts.map b/dist/ethers.js/src.ts/abi/coders/address.d.ts.map new file mode 100644 index 0000000..1dbcb8e --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/address.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAUtD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/address.js b/dist/ethers.js/src.ts/abi/coders/address.js new file mode 100644 index 0000000..6594083 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/address.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AddressCoder = void 0; +const index_js_1 = require("../../address/index.js"); +const maths_js_1 = require("../../utils/maths.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class AddressCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("address", "address", localName, false); + } + defaultValue() { + return "0x0000000000000000000000000000000000000000"; + } + encode(writer, _value) { + let value = typed_js_1.Typed.dereference(_value, "string"); + try { + value = (0, index_js_1.getAddress)(value); + } + catch (error) { + return this._throwError(error.message, _value); + } + return writer.writeValue(value); + } + decode(reader) { + return (0, index_js_1.getAddress)((0, maths_js_1.toBeHex)(reader.readValue(), 20)); + } +} +exports.AddressCoder = AddressCoder; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/address.js.map b/dist/ethers.js/src.ts/abi/coders/address.js.map new file mode 100644 index 0000000..5230de5 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/address.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,mDAA+C;AAE/C,0CAAoC;AACpC,2DAA4C;AAK5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAClD,CAAC;IAED,YAAY;QACR,OAAO,4CAA4C,CAAC;IACxD,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,IAAI,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;QAChD,IAAI;YACA,KAAK,GAAG,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;SAC7B;QAAC,OAAO,KAAU,EAAE;YACjB,OAAO,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;SAClD;QACD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,qBAAU,EAAC,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC;IACvD,CAAC;CACJ;AAvBD,oCAuBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts b/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts new file mode 100644 index 0000000..554bf03 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts @@ -0,0 +1,15 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +export declare class AnonymousCoder extends Coder { + private coder; + constructor(coder: Coder); + defaultValue(): any; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=anonymous.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts.map b/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts.map new file mode 100644 index 0000000..488cdba --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/anonymous.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;;;GAIG;AACH,qBAAa,cAAe,SAAQ,KAAK;IACrC,OAAO,CAAC,KAAK,CAAQ;gBAET,KAAK,EAAE,KAAK;IAKxB,YAAY,IAAI,GAAG;IAInB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAI1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/anonymous.js b/dist/ethers.js/src.ts/abi/coders/anonymous.js new file mode 100644 index 0000000..89edf22 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/anonymous.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnonymousCoder = void 0; +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * Clones the functionality of an existing Coder, but without a localName + * + * @_ignore + */ +class AnonymousCoder extends abstract_coder_js_1.Coder { + constructor(coder) { + super(coder.name, coder.type, "_", coder.dynamic); + this.coder = coder; + } + defaultValue() { + return this.coder.defaultValue(); + } + encode(writer, value) { + return this.coder.encode(writer, value); + } + decode(reader) { + return this.coder.decode(reader); + } +} +exports.AnonymousCoder = AnonymousCoder; +//# sourceMappingURL=anonymous.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/anonymous.js.map b/dist/ethers.js/src.ts/abi/coders/anonymous.js.map new file mode 100644 index 0000000..2836a87 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/anonymous.js.map @@ -0,0 +1 @@ +{"version":3,"file":"anonymous.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/anonymous.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAI5C;;;;GAIG;AACH,MAAa,cAAe,SAAQ,yBAAK;IAGrC,YAAY,KAAY;QACpB,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QAClD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,CAAC;IACrC,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IACrC,CAAC;CACJ;AAnBD,wCAmBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/array.d.ts b/dist/ethers.js/src.ts/abi/coders/array.d.ts new file mode 100644 index 0000000..954c4e1 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/array.d.ts @@ -0,0 +1,25 @@ +import { Typed } from "../typed.js"; +import { Coder, Result, Writer } from "./abstract-coder.js"; +import type { Reader } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare function pack(writer: Writer, coders: ReadonlyArray, values: Array | { + [name: string]: any; +}): number; +/** + * @_ignore + */ +export declare function unpack(reader: Reader, coders: ReadonlyArray): Result; +/** + * @_ignore + */ +export declare class ArrayCoder extends Coder { + readonly coder: Coder; + readonly length: number; + constructor(coder: Coder, length: number, localName: string); + defaultValue(): Array; + encode(writer: Writer, _value: Array | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=array.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/array.d.ts.map b/dist/ethers.js/src.ts/abi/coders/array.d.ts.map new file mode 100644 index 0000000..be62d6f --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/array.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/array.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAY,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAGtE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;IAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;CAAE,GAAG,MAAM,CA2DzH;AAED;;GAEG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,GAAG,MAAM,CAoD3E;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,KAAK,EAAG,KAAK,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAO3D,YAAY,IAAI,KAAK,CAAC,GAAG,CAAC;IAW1B,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,GAAG,MAAM;IAsB1D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAkB9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/array.js b/dist/ethers.js/src.ts/abi/coders/array.js new file mode 100644 index 0000000..8eb50a3 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/array.js @@ -0,0 +1,163 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ArrayCoder = exports.unpack = exports.pack = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const anonymous_js_1 = require("./anonymous.js"); +/** + * @_ignore + */ +function pack(writer, coders, values) { + let arrayValues = []; + if (Array.isArray(values)) { + arrayValues = values; + } + else if (values && typeof (values) === "object") { + let unique = {}; + arrayValues = coders.map((coder) => { + const name = coder.localName; + (0, index_js_1.assert)(name, "cannot encode object for signature with missing names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + (0, index_js_1.assert)(!unique[name], "cannot encode object for signature with duplicate names", "INVALID_ARGUMENT", { argument: "values", info: { coder }, value: values }); + unique[name] = true; + return values[name]; + }); + } + else { + (0, index_js_1.assertArgument)(false, "invalid tuple value", "tuple", values); + } + (0, index_js_1.assertArgument)(coders.length === arrayValues.length, "types/value length mismatch", "tuple", values); + let staticWriter = new abstract_coder_js_1.Writer(); + let dynamicWriter = new abstract_coder_js_1.Writer(); + let updateFuncs = []; + coders.forEach((coder, index) => { + let value = arrayValues[index]; + if (coder.dynamic) { + // Get current dynamic offset (for the future pointer) + let dynamicOffset = dynamicWriter.length; + // Encode the dynamic value into the dynamicWriter + coder.encode(dynamicWriter, value); + // Prepare to populate the correct offset once we are done + let updateFunc = staticWriter.writeUpdatableValue(); + updateFuncs.push((baseOffset) => { + updateFunc(baseOffset + dynamicOffset); + }); + } + else { + coder.encode(staticWriter, value); + } + }); + // Backfill all the dynamic offsets, now that we know the static length + updateFuncs.forEach((func) => { func(staticWriter.length); }); + let length = writer.appendWriter(staticWriter); + length += writer.appendWriter(dynamicWriter); + return length; +} +exports.pack = pack; +/** + * @_ignore + */ +function unpack(reader, coders) { + let values = []; + let keys = []; + // A reader anchored to this base + let baseReader = reader.subReader(0); + coders.forEach((coder) => { + let value = null; + if (coder.dynamic) { + let offset = reader.readIndex(); + let offsetReader = baseReader.subReader(offset); + try { + value = coder.decode(offsetReader); + } + catch (error) { + // Cannot recover from this + if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + else { + try { + value = coder.decode(reader); + } + catch (error) { + // Cannot recover from this + if ((0, index_js_1.isError)(error, "BUFFER_OVERRUN")) { + throw error; + } + value = error; + value.baseType = coder.name; + value.name = coder.localName; + value.type = coder.type; + } + } + if (value == undefined) { + throw new Error("investigate"); + } + values.push(value); + keys.push(coder.localName || null); + }); + return abstract_coder_js_1.Result.fromItems(values, keys); +} +exports.unpack = unpack; +/** + * @_ignore + */ +class ArrayCoder extends abstract_coder_js_1.Coder { + constructor(coder, length, localName) { + const type = (coder.type + "[" + (length >= 0 ? length : "") + "]"); + const dynamic = (length === -1 || coder.dynamic); + super("array", type, localName, dynamic); + (0, index_js_1.defineProperties)(this, { coder, length }); + } + defaultValue() { + // Verifies the child coder is valid (even if the array is dynamic or 0-length) + const defaultChild = this.coder.defaultValue(); + const result = []; + for (let i = 0; i < this.length; i++) { + result.push(defaultChild); + } + return result; + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "array"); + if (!Array.isArray(value)) { + this._throwError("expected array value", value); + } + let count = this.length; + if (count === -1) { + count = value.length; + writer.writeValue(value.length); + } + (0, index_js_1.assertArgumentCount)(value.length, count, "coder array" + (this.localName ? (" " + this.localName) : "")); + let coders = []; + for (let i = 0; i < value.length; i++) { + coders.push(this.coder); + } + return pack(writer, coders, value); + } + decode(reader) { + let count = this.length; + if (count === -1) { + count = reader.readIndex(); + // Check that there is *roughly* enough data to ensure + // stray random data is not being read as a length. Each + // slot requires at least 32 bytes for their value (or 32 + // bytes as a link to the data). This could use a much + // tighter bound, but we are erroring on the side of safety. + (0, index_js_1.assert)(count * abstract_coder_js_1.WordSize <= reader.dataLength, "insufficient data length", "BUFFER_OVERRUN", { buffer: reader.bytes, offset: count * abstract_coder_js_1.WordSize, length: reader.dataLength }); + } + let coders = []; + for (let i = 0; i < count; i++) { + coders.push(new anonymous_js_1.AnonymousCoder(this.coder)); + } + return unpack(reader, coders); + } +} +exports.ArrayCoder = ArrayCoder; +//# sourceMappingURL=array.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/array.js.map b/dist/ethers.js/src.ts/abi/coders/array.js.map new file mode 100644 index 0000000..2369808 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/array.js.map @@ -0,0 +1 @@ +{"version":3,"file":"array.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/array.ts"],"names":[],"mappings":";;;AAAA,mDAE8B;AAE9B,0CAAoC;AAEpC,2DAAsE;AACtE,iDAAgD;AAIhD;;GAEG;AACH,SAAgB,IAAI,CAAC,MAAc,EAAE,MAA4B,EAAE,MAA8C;IAC7G,IAAI,WAAW,GAAe,EAAG,CAAC;IAElC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACxB,WAAW,GAAG,MAAM,CAAC;KAEvB;SAAM,IAAI,MAAM,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;QAC9C,IAAI,MAAM,GAAkC,EAAG,CAAC;QAEhD,WAAW,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;YAC/B,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC;YAC7B,IAAA,iBAAM,EAAC,IAAI,EAAE,uDAAuD,EAChE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YAEhF,IAAA,iBAAM,EAAC,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,yDAAyD,EAC3E,kBAAkB,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YAEhF,MAAM,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;YAEpB,OAAO,MAAM,CAAC,IAAI,CAAC,CAAC;QACxB,CAAC,CAAC,CAAC;KAEN;SAAM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K,GAAG,4BAAQ,IAAI,MAAM,CAAC,UAAU,EAAE,0BAA0B,EACpE,gBAAgB,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,GAAG,4BAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;SACxG;QACD,IAAI,MAAM,GAAiB,EAAE,CAAC;QAC9B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,EAAE,CAAC,EAAE,EAAE;YAAE,MAAM,CAAC,IAAI,CAAC,IAAI,6BAAc,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;SAAE;QAEhF,OAAO,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,CAAC;CACJ;AA9DD,gCA8DC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/boolean.d.ts b/dist/ethers.js/src.ts/abi/coders/boolean.d.ts new file mode 100644 index 0000000..f073e37 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/boolean.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class BooleanCoder extends Coder { + constructor(localName: string); + defaultValue(): boolean; + encode(writer: Writer, _value: boolean | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=boolean.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/boolean.d.ts.map b/dist/ethers.js/src.ts/abi/coders/boolean.d.ts.map new file mode 100644 index 0000000..2c0457d --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/boolean.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/boolean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,YAAa,SAAQ,KAAK;gBAEvB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,OAAO;IAIvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,KAAK,GAAG,MAAM;IAKvD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/boolean.js b/dist/ethers.js/src.ts/abi/coders/boolean.js new file mode 100644 index 0000000..bc8b507 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/boolean.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BooleanCoder = void 0; +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class BooleanCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("bool", "bool", localName, false); + } + defaultValue() { + return false; + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "bool"); + return writer.writeValue(value ? 1 : 0); + } + decode(reader) { + return !!reader.readValue(); + } +} +exports.BooleanCoder = BooleanCoder; +//# sourceMappingURL=boolean.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/boolean.js.map b/dist/ethers.js/src.ts/abi/coders/boolean.js.map new file mode 100644 index 0000000..d4841ff --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/boolean.js.map @@ -0,0 +1 @@ +{"version":3,"file":"boolean.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/boolean.ts"],"names":[],"mappings":";;;AAAA,0CAAoC;AACpC,2DAA4C;AAI5C;;GAEG;AACH,MAAa,YAAa,SAAQ,yBAAK;IAEnC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,YAAY;QACR,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAuB;QAC1C,MAAM,KAAK,GAAG,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChD,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,CAAC,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IAChC,CAAC;CACJ;AAlBD,oCAkBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/bytes.d.ts b/dist/ethers.js/src.ts/abi/coders/bytes.d.ts new file mode 100644 index 0000000..1e55458 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/bytes.d.ts @@ -0,0 +1,19 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class DynamicBytesCoder extends Coder { + constructor(type: string, localName: string); + defaultValue(): string; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +/** + * @_ignore + */ +export declare class BytesCoder extends DynamicBytesCoder { + constructor(localName: string); + decode(reader: Reader): any; +} +//# sourceMappingURL=bytes.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/bytes.d.ts.map b/dist/ethers.js/src.ts/abi/coders/bytes.d.ts.map new file mode 100644 index 0000000..648b308 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/bytes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,iBAAkB,SAAQ,KAAK;gBAC5B,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAI3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAO1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,iBAAiB;gBACjC,SAAS,EAAE,MAAM;IAI7B,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/bytes.js b/dist/ethers.js/src.ts/abi/coders/bytes.js new file mode 100644 index 0000000..0788ed6 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/bytes.js @@ -0,0 +1,39 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BytesCoder = exports.DynamicBytesCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class DynamicBytesCoder extends abstract_coder_js_1.Coder { + constructor(type, localName) { + super(type, type, localName, true); + } + defaultValue() { + return "0x"; + } + encode(writer, value) { + value = (0, index_js_1.getBytesCopy)(value); + let length = writer.writeValue(value.length); + length += writer.writeBytes(value); + return length; + } + decode(reader) { + return reader.readBytes(reader.readIndex(), true); + } +} +exports.DynamicBytesCoder = DynamicBytesCoder; +/** + * @_ignore + */ +class BytesCoder extends DynamicBytesCoder { + constructor(localName) { + super("bytes", localName); + } + decode(reader) { + return (0, index_js_1.hexlify)(super.decode(reader)); + } +} +exports.BytesCoder = BytesCoder; +//# sourceMappingURL=bytes.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/bytes.js.map b/dist/ethers.js/src.ts/abi/coders/bytes.js.map new file mode 100644 index 0000000..699ad70 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bytes.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/bytes.ts"],"names":[],"mappings":";;;AAAA,mDAA6D;AAE7D,2DAA4C;AAK5C;;GAEG;AACH,MAAa,iBAAkB,SAAQ,yBAAK;IACxC,YAAY,IAAY,EAAE,SAAiB;QACxC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,KAAK,GAAG,IAAA,uBAAY,EAAC,KAAK,CAAC,CAAC;QAC5B,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7C,MAAM,IAAI,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;QACnC,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACJ;AAnBD,8CAmBC;AAED;;GAEG;AACH,MAAa,UAAW,SAAQ,iBAAiB;IAC7C,YAAY,SAAiB;QACzB,KAAK,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACzC,CAAC;CACJ;AARD,gCAQC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts new file mode 100644 index 0000000..5c485fe --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts @@ -0,0 +1,15 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BytesLike } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class FixedBytesCoder extends Coder { + readonly size: number; + constructor(size: number, localName: string); + defaultValue(): string; + encode(writer: Writer, _value: BytesLike | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=fixed-bytes.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts.map b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts.map new file mode 100644 index 0000000..bab1583 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;gBAEX,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAM3C,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,KAAK,GAAG,MAAM;IAMzD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js new file mode 100644 index 0000000..13b8403 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FixedBytesCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +/** + * @_ignore + */ +class FixedBytesCoder extends abstract_coder_js_1.Coder { + constructor(size, localName) { + let name = "bytes" + String(size); + super(name, name, localName, false); + (0, index_js_1.defineProperties)(this, { size }, { size: "number" }); + } + defaultValue() { + return ("0x0000000000000000000000000000000000000000000000000000000000000000").substring(0, 2 + this.size * 2); + } + encode(writer, _value) { + let data = (0, index_js_1.getBytesCopy)(typed_js_1.Typed.dereference(_value, this.type)); + if (data.length !== this.size) { + this._throwError("incorrect data length", _value); + } + return writer.writeBytes(data); + } + decode(reader) { + return (0, index_js_1.hexlify)(reader.readBytes(this.size)); + } +} +exports.FixedBytesCoder = FixedBytesCoder; +//# sourceMappingURL=fixed-bytes.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js.map b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js.map new file mode 100644 index 0000000..2b88a00 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/fixed-bytes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixed-bytes.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/fixed-bytes.ts"],"names":[],"mappings":";;;AACA,mDAA+E;AAE/E,0CAAoC;AACpC,2DAA4C;AAO5C;;GAEG;AACH,MAAa,eAAgB,SAAQ,yBAAK;IAGtC,YAAY,IAAY,EAAE,SAAiB;QACvC,IAAI,IAAI,GAAG,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;QAClC,KAAK,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;QACpC,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC1E,CAAC;IAED,YAAY;QACR,OAAO,CAAC,oEAAoE,CAAC,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAyB;QAC5C,IAAI,IAAI,GAAG,IAAA,uBAAY,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QAC9D,IAAI,IAAI,CAAC,MAAM,KAAK,IAAI,CAAC,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,uBAAuB,EAAE,MAAM,CAAC,CAAC;SAAE;QACrF,OAAO,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACnC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAChD,CAAC;CACJ;AAtBD,0CAsBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/null.d.ts b/dist/ethers.js/src.ts/abi/coders/null.d.ts new file mode 100644 index 0000000..5df5da3 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/null.d.ts @@ -0,0 +1,12 @@ +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NullCoder extends Coder { + constructor(localName: string); + defaultValue(): null; + encode(writer: Writer, value: any): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=null.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/null.d.ts.map b/dist/ethers.js/src.ts/abi/coders/null.d.ts.map new file mode 100644 index 0000000..c2af4d9 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/null.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"null.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/null.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAI1D;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBAEpB,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,IAAI;IAIpB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,MAAM;IAK1C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAI9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/null.js b/dist/ethers.js/src.ts/abi/coders/null.js new file mode 100644 index 0000000..e9af005 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/null.js @@ -0,0 +1,28 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NullCoder = void 0; +const abstract_coder_js_1 = require("./abstract-coder.js"); +const Empty = new Uint8Array([]); +/** + * @_ignore + */ +class NullCoder extends abstract_coder_js_1.Coder { + constructor(localName) { + super("null", "", localName, false); + } + defaultValue() { + return null; + } + encode(writer, value) { + if (value != null) { + this._throwError("not null", value); + } + return writer.writeBytes(Empty); + } + decode(reader) { + reader.readBytes(0); + return null; + } +} +exports.NullCoder = NullCoder; +//# sourceMappingURL=null.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/null.js.map b/dist/ethers.js/src.ts/abi/coders/null.js.map new file mode 100644 index 0000000..762f792 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/null.js.map @@ -0,0 +1 @@ +{"version":3,"file":"null.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/null.ts"],"names":[],"mappings":";;;AAAA,2DAA4C;AAG5C,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAG,CAAC,CAAC;AAElC;;GAEG;AACH,MAAa,SAAU,SAAQ,yBAAK;IAEhC,YAAY,SAAiB;QACzB,KAAK,CAAC,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACxC,CAAC;IAED,YAAY;QACR,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,KAAU;QAC7B,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,IAAI,CAAC,WAAW,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;SAAE;QAC3D,OAAO,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC;IACpC,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAnBD,8BAmBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/number.d.ts b/dist/ethers.js/src.ts/abi/coders/number.d.ts new file mode 100644 index 0000000..822cc6d --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/number.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { BigNumberish } from "../../utils/index.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class NumberCoder extends Coder { + readonly size: number; + readonly signed: boolean; + constructor(size: number, signed: boolean, localName: string); + defaultValue(): number; + encode(writer: Writer, _value: BigNumberish | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=number.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/number.d.ts.map b/dist/ethers.js/src.ts/abi/coders/number.d.ts.map new file mode 100644 index 0000000..3a1a9c7 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/number.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/number.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAY,MAAM,qBAAqB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAO1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,KAAK;IAClC,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAG,OAAO,CAAC;gBAEd,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM;IAO5D,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,GAAG,KAAK,GAAG,MAAM;IAkB5D,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAS9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/number.js b/dist/ethers.js/src.ts/abi/coders/number.js new file mode 100644 index 0000000..1f220ef --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/number.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NumberCoder = void 0; +const index_js_1 = require("../../utils/index.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * @_ignore + */ +class NumberCoder extends abstract_coder_js_1.Coder { + constructor(size, signed, localName) { + const name = ((signed ? "int" : "uint") + (size * 8)); + super(name, name, localName, false); + (0, index_js_1.defineProperties)(this, { size, signed }, { size: "number", signed: "boolean" }); + } + defaultValue() { + return 0; + } + encode(writer, _value) { + let value = (0, index_js_1.getBigInt)(typed_js_1.Typed.dereference(_value, this.type)); + // Check bounds are safe for encoding + let maxUintValue = (0, index_js_1.mask)(BN_MAX_UINT256, abstract_coder_js_1.WordSize * 8); + if (this.signed) { + let bounds = (0, index_js_1.mask)(maxUintValue, (this.size * 8) - 1); + if (value > bounds || value < -(bounds + BN_1)) { + this._throwError("value out-of-bounds", _value); + } + value = (0, index_js_1.toTwos)(value, 8 * abstract_coder_js_1.WordSize); + } + else if (value < BN_0 || value > (0, index_js_1.mask)(maxUintValue, this.size * 8)) { + this._throwError("value out-of-bounds", _value); + } + return writer.writeValue(value); + } + decode(reader) { + let value = (0, index_js_1.mask)(reader.readValue(), this.size * 8); + if (this.signed) { + value = (0, index_js_1.fromTwos)(value, this.size * 8); + } + return value; + } +} +exports.NumberCoder = NumberCoder; +//# sourceMappingURL=number.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/number.js.map b/dist/ethers.js/src.ts/abi/coders/number.js.map new file mode 100644 index 0000000..55fc111 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/number.js.map @@ -0,0 +1 @@ +{"version":3,"file":"number.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/number.ts"],"names":[],"mappings":";;;AAAA,mDAE8B;AAE9B,0CAAoC;AACpC,2DAAsD;AAOtD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEpG;;GAEG;AACH,MAAa,WAAY,SAAQ,yBAAK;IAIlC,YAAY,IAAY,EAAE,MAAe,EAAE,SAAiB;QACxD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,I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AAC,MAAc;QACjB,IAAI,KAAK,GAAG,IAAA,eAAI,EAAC,MAAM,CAAC,SAAS,EAAE,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QAEpD,IAAI,IAAI,CAAC,MAAM,EAAE;YACb,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;SAC1C;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA1CD,kCA0CC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/string.d.ts b/dist/ethers.js/src.ts/abi/coders/string.d.ts new file mode 100644 index 0000000..8e1c635 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/string.d.ts @@ -0,0 +1,13 @@ +import { Typed } from "../typed.js"; +import { DynamicBytesCoder } from "./bytes.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class StringCoder extends DynamicBytesCoder { + constructor(localName: string); + defaultValue(): string; + encode(writer: Writer, _value: string | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=string.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/string.d.ts.map b/dist/ethers.js/src.ts/abi/coders/string.d.ts.map new file mode 100644 index 0000000..08d9f86 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/string.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"string.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/string.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAG1D;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAiB;gBAElC,SAAS,EAAE,MAAM;IAI7B,YAAY,IAAI,MAAM;IAItB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,MAAM;IAItD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/string.js b/dist/ethers.js/src.ts/abi/coders/string.js new file mode 100644 index 0000000..7370af0 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/string.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StringCoder = void 0; +const utf8_js_1 = require("../../utils/utf8.js"); +const typed_js_1 = require("../typed.js"); +const bytes_js_1 = require("./bytes.js"); +/** + * @_ignore + */ +class StringCoder extends bytes_js_1.DynamicBytesCoder { + constructor(localName) { + super("string", localName); + } + defaultValue() { + return ""; + } + encode(writer, _value) { + return super.encode(writer, (0, utf8_js_1.toUtf8Bytes)(typed_js_1.Typed.dereference(_value, "string"))); + } + decode(reader) { + return (0, utf8_js_1.toUtf8String)(super.decode(reader)); + } +} +exports.StringCoder = StringCoder; +//# sourceMappingURL=string.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/string.js.map b/dist/ethers.js/src.ts/abi/coders/string.js.map new file mode 100644 index 0000000..b75d7cc --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/string.js.map @@ -0,0 +1 @@ +{"version":3,"file":"string.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/string.ts"],"names":[],"mappings":";;;AAAA,iDAAgE;AAEhE,0CAAoC;AACpC,yCAA+C;AAK/C;;GAEG;AACH,MAAa,WAAY,SAAQ,4BAAiB;IAE9C,YAAY,SAAiB;QACzB,KAAK,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IAC/B,CAAC;IAED,YAAY;QACR,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,CAAC,MAAc,EAAE,MAAsB;QACzC,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,qBAAW,EAAC,gBAAK,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,sBAAY,EAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;CACJ;AAjBD,kCAiBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/tuple.d.ts b/dist/ethers.js/src.ts/abi/coders/tuple.d.ts new file mode 100644 index 0000000..fe3ec03 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/tuple.d.ts @@ -0,0 +1,16 @@ +import { Typed } from "../typed.js"; +import { Coder } from "./abstract-coder.js"; +import type { Reader, Writer } from "./abstract-coder.js"; +/** + * @_ignore + */ +export declare class TupleCoder extends Coder { + readonly coders: ReadonlyArray; + constructor(coders: Array, localName: string); + defaultValue(): any; + encode(writer: Writer, _value: Array | { + [name: string]: any; + } | Typed): number; + decode(reader: Reader): any; +} +//# sourceMappingURL=tuple.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/tuple.d.ts.map b/dist/ethers.js/src.ts/abi/coders/tuple.d.ts.map new file mode 100644 index 0000000..ec4d13f --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/tuple.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/tuple.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAI5C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE1D;;GAEG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACjC,QAAQ,CAAC,MAAM,EAAG,aAAa,CAAC,KAAK,CAAC,CAAC;gBAE3B,MAAM,EAAE,KAAK,CAAC,KAAK,CAAC,EAAE,SAAS,EAAE,MAAM;IAanD,YAAY,IAAI,GAAG;IA+BnB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG;QAAE,CAAE,IAAI,EAAE,MAAM,GAAI,GAAG,CAAA;KAAE,GAAG,KAAK,GAAG,MAAM;IAKtF,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,GAAG;CAG9B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/tuple.js b/dist/ethers.js/src.ts/abi/coders/tuple.js new file mode 100644 index 0000000..641a9d9 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/tuple.js @@ -0,0 +1,66 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TupleCoder = void 0; +const properties_js_1 = require("../../utils/properties.js"); +const typed_js_1 = require("../typed.js"); +const abstract_coder_js_1 = require("./abstract-coder.js"); +const array_js_1 = require("./array.js"); +/** + * @_ignore + */ +class TupleCoder extends abstract_coder_js_1.Coder { + constructor(coders, localName) { + let dynamic = false; + const types = []; + coders.forEach((coder) => { + if (coder.dynamic) { + dynamic = true; + } + types.push(coder.type); + }); + const type = ("tuple(" + types.join(",") + ")"); + super("tuple", type, localName, dynamic); + (0, properties_js_1.defineProperties)(this, { coders: Object.freeze(coders.slice()) }); + } + defaultValue() { + const values = []; + this.coders.forEach((coder) => { + values.push(coder.defaultValue()); + }); + // We only output named properties for uniquely named coders + const uniqueNames = this.coders.reduce((accum, coder) => { + const name = coder.localName; + if (name) { + if (!accum[name]) { + accum[name] = 0; + } + accum[name]++; + } + return accum; + }, {}); + // Add named values + this.coders.forEach((coder, index) => { + let name = coder.localName; + if (!name || uniqueNames[name] !== 1) { + return; + } + if (name === "length") { + name = "_length"; + } + if (values[name] != null) { + return; + } + values[name] = values[index]; + }); + return Object.freeze(values); + } + encode(writer, _value) { + const value = typed_js_1.Typed.dereference(_value, "tuple"); + return (0, array_js_1.pack)(writer, this.coders, value); + } + decode(reader) { + return (0, array_js_1.unpack)(reader, this.coders); + } +} +exports.TupleCoder = TupleCoder; +//# sourceMappingURL=tuple.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/coders/tuple.js.map b/dist/ethers.js/src.ts/abi/coders/tuple.js.map new file mode 100644 index 0000000..f51b31f --- /dev/null +++ b/dist/ethers.js/src.ts/abi/coders/tuple.js.map @@ -0,0 +1 @@ +{"version":3,"file":"tuple.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/abi/coders/tuple.ts"],"names":[],"mappings":";;;AAAA,6DAA6D;AAE7D,0CAAoC;AACpC,2DAA4C;AAE5C,yCAA0C;AAI1C;;GAEG;AACH,MAAa,UAAW,SAAQ,yBAAK;IAGjC,YAAY,MAAoB,EAAE,SAAiB;QAC/C,IAAI,OAAO,GAAG,KAAK,CAAC;QACpB,MAAM,KAAK,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACrB,IAAI,KAAK,CAAC,OAAO,EAAE;gBAAE,OAAO,GAAG,IAAI,CAAC;aAAE;YACtC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,CAAC,CAAC,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,CAAC;QAEhD,KAAK,CAAC,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QACzC,IAAA,gCAAgB,EAAa,IAAI,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,YAAY;QACR,MAAM,MAAM,GAAQ,EAAG,CAAC;QACxB,IAAI,CAAC,MAAM,CAAC,OA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AC,MAAM,EAAE,KAAK,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,CAAC,MAAc;QACjB,OAAO,IAAA,iBAAM,EAAC,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC;IACvC,CAAC;CACJ;AAvDD,gCAuDC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/fragments.d.ts b/dist/ethers.js/src.ts/abi/fragments.d.ts new file mode 100644 index 0000000..2605805 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/fragments.d.ts @@ -0,0 +1,466 @@ +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +/** + * A Type description in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragmentType { + /** + * The parameter name. + */ + readonly name?: string; + /** + * If the parameter is indexed. + */ + readonly indexed?: boolean; + /** + * The type of the parameter. + */ + readonly type?: string; + /** + * The internal Solidity type. + */ + readonly internalType?: string; + /** + * The components for a tuple. + */ + readonly components?: ReadonlyArray; +} +/** + * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi). + */ +export interface JsonFragment { + /** + * The name of the error, event, function, etc. + */ + readonly name?: string; + /** + * The type of the fragment (e.g. ``event``, ``"function"``, etc.) + */ + readonly type?: string; + /** + * If the event is anonymous. + */ + readonly anonymous?: boolean; + /** + * If the function is payable. + */ + readonly payable?: boolean; + /** + * If the function is constant. + */ + readonly constant?: boolean; + /** + * The mutability state of the function. + */ + readonly stateMutability?: string; + /** + * The input parameters. + */ + readonly inputs?: ReadonlyArray; + /** + * The output parameters. + */ + readonly outputs?: ReadonlyArray; + /** + * The gas limit to use when sending a transaction for this function. + */ + readonly gas?: string; +} +/** + * The format to serialize the output as. + * + * **``"sighash"``** - the bare formatting, used to compute the selector + * or topic hash; this format cannot be reversed (as it discards ``indexed``) + * so cannot by used to export an [[Interface]]. + * + * **``"minimal"``** - Human-Readable ABI with minimal spacing and without + * names, so it is compact, but will result in Result objects that cannot + * be accessed by name. + * + * **``"full"``** - Full Human-Readable ABI, with readable spacing and names + * intact; this is generally the recommended format. + * + * **``"json"``** - The [JSON ABI format](link-solc-jsonabi). + */ +export type FormatType = "sighash" | "minimal" | "full" | "json"; +/** + * When [walking](ParamType-walk) a [[ParamType]], this is called + * on each component. + */ +export type ParamTypeWalkFunc = (type: string, value: any) => any; +/** + * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]], + * this is called on each component. + */ +export type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +export declare class ParamType { + #private; + /** + * The local name of the parameter (or ``""`` if unbound) + */ + readonly name: string; + /** + * The fully qualified type (e.g. ``"address"``, ``"tuple(address)"``, + * ``"uint256[3][]"``) + */ + readonly type: string; + /** + * The base type (e.g. ``"address"``, ``"tuple"``, ``"array"``) + */ + readonly baseType: string; + /** + * True if the parameters is indexed. + * + * For non-indexable types this is ``null``. + */ + readonly indexed: null | boolean; + /** + * The components for the tuple. + * + * For non-tuple types this is ``null``. + */ + readonly components: null | ReadonlyArray; + /** + * The array length, or ``-1`` for dynamic-lengthed arrays. + * + * For non-array types this is ``null``. + */ + readonly arrayLength: null | number; + /** + * The type of each child in the array. + * + * For non-array types this is ``null``. + */ + readonly arrayChildren: null | ParamType; + /** + * @private + */ + constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray, arrayLength: null | number, arrayChildren: null | ParamType); + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format?: FormatType): string; + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray(): this is (ParamType & { + arrayChildren: ParamType; + arrayLength: number; + }); + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple(): this is (ParamType & { + components: ReadonlyArray; + }); + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable(): this is (ParamType & { + indexed: boolean; + }); + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value: any, process: ParamTypeWalkFunc): any; + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS naes by walking and resolving each + * ``"address"`` type. + */ + walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise; + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj: any, allowIndexed?: boolean): ParamType; + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value: any): value is ParamType; +} +/** + * The type of a [[Fragment]]. + */ +export type FragmentType = "constructor" | "error" | "event" | "fallback" | "function" | "struct"; +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +export declare abstract class Fragment { + /** + * The type of the fragment. + */ + readonly type: FragmentType; + /** + * The inputs for the fragment. + */ + readonly inputs: ReadonlyArray; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray); + /** + * Returns a string representation of this fragment as %%format%%. + */ + abstract format(format?: FormatType): string; + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj: any): Fragment; + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value: any): value is ConstructorFragment; + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value: any): value is ErrorFragment; + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value: any): value is EventFragment; + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value: any): value is FunctionFragment; + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value: any): value is StructFragment; +} +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +export declare abstract class NamedFragment extends Fragment { + /** + * The name of the fragment. + */ + readonly name: string; + /** + * @private + */ + constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray); +} +/** + * A Fragment which represents a //Custom Error//. + */ +export declare class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * The Custom Error selector. + */ + get selector(): string; + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj: any): ErrorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value: any): value is ErrorFragment; +} +/** + * A Fragment which represents an Event. + */ +export declare class EventFragment extends NamedFragment { + /** + * Whether this event is anonymous. + */ + readonly anonymous: boolean; + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray, anonymous: boolean); + /** + * The Event topic hash. + */ + get topicHash(): string; + /** + * Returns a string representation of this event as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name: string, params?: Array): string; + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj: any): EventFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value: any): value is EventFragment; +} +/** + * A Fragment which represents a constructor. + */ +export declare class ConstructorFragment extends Fragment { + /** + * Whether the constructor can receive an endowment. + */ + readonly payable: boolean; + /** + * The recommended gas limit for deployment or ``null``. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, type: FragmentType, inputs: ReadonlyArray, payable: boolean, gas: null | bigint); + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj: any): ConstructorFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value: any): value is ConstructorFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FallbackFragment extends Fragment { + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + constructor(guard: any, inputs: ReadonlyArray, payable: boolean); + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format?: FormatType): string; + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj: any): FallbackFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value: any): value is FallbackFragment; +} +/** + * A Fragment which represents a method. + */ +export declare class FunctionFragment extends NamedFragment { + /** + * If the function is constant (e.g. ``pure`` or ``view`` functions). + */ + readonly constant: boolean; + /** + * The returned types for the result of calling this function. + */ + readonly outputs: ReadonlyArray; + /** + * The state mutability (e.g. ``payable``, ``nonpayable``, ``view`` + * or ``pure``) + */ + readonly stateMutability: "payable" | "nonpayable" | "view" | "pure"; + /** + * If the function can be sent value during invocation. + */ + readonly payable: boolean; + /** + * The recommended gas limit to send when calling this function. + */ + readonly gas: null | bigint; + /** + * @private + */ + constructor(guard: any, name: string, stateMutability: "payable" | "nonpayable" | "view" | "pure", inputs: ReadonlyArray, outputs: ReadonlyArray, gas: null | bigint); + /** + * The Function selector. + */ + get selector(): string; + /** + * Returns a string representation of this function as %%format%%. + */ + format(format?: FormatType): string; + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name: string, params?: Array): string; + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj: any): FunctionFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +/** + * A Fragment which represents a structure. + */ +export declare class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard: any, name: string, inputs: ReadonlyArray); + /** + * Returns a string representation of this struct as %%format%%. + */ + format(): string; + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj: any): StructFragment; + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value: any): value is FunctionFragment; +} +//# sourceMappingURL=fragments.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/fragments.d.ts.map b/dist/ethers.js/src.ts/abi/fragments.d.ts.map new file mode 100644 index 0000000..22f3024 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/fragments.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/fragments.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAQH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC7B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,aAAa,CAAC,gBAAgB,CAAC,CAAC;CACzD;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAA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,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,EAAE,GAAG,EAAE,IAAI,GAAG,MAAM;IAS1L;;OAEG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,GAAG,MAAM;IAoCnC;;OAEG;IACH,MAAM,CAAC,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM;IAM7D;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,gBAAgB;IAuDvC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAE7C;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,CAAC,SAAS,CAAC;IAKtE;;OAEG;IACH,MAAM,IAAI,MAAM;IAIhB;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,GAAG,cAAc;IAmBrC;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,gBAAgB;CAG3D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/fragments.js b/dist/ethers.js/src.ts/abi/fragments.js new file mode 100644 index 0000000..bf822da --- /dev/null +++ b/dist/ethers.js/src.ts/abi/fragments.js @@ -0,0 +1,1273 @@ +"use strict"; +/** + * A fragment is a single item from an ABI, which may represent any of: + * + * - [Functions](FunctionFragment) + * - [Events](EventFragment) + * - [Constructors](ConstructorFragment) + * - Custom [Errors](ErrorFragment) + * - [Fallback or Receive](FallbackFragment) functions + * + * @_subsection api/abi/abi-coder:Fragments [about-fragments] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _TokenString_instances, _TokenString_offset, _TokenString_tokens, _TokenString_subTokenString, _ParamType_instances, _ParamType_walkAsync; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.StructFragment = exports.FunctionFragment = exports.FallbackFragment = exports.ConstructorFragment = exports.EventFragment = exports.ErrorFragment = exports.NamedFragment = exports.Fragment = exports.ParamType = void 0; +const index_js_1 = require("../utils/index.js"); +const index_js_2 = require("../hash/index.js"); +; +// [ "a", "b" ] => { "a": 1, "b": 1 } +function setify(items) { + const result = new Set(); + items.forEach((k) => result.add(k)); + return Object.freeze(result); +} +const _kwVisibDeploy = "external public payable"; +const KwVisibDeploy = setify(_kwVisibDeploy.split(" ")); +// Visibility Keywords +const _kwVisib = "constant external internal payable private public pure view"; +const KwVisib = setify(_kwVisib.split(" ")); +const _kwTypes = "constructor error event fallback function receive struct"; +const KwTypes = setify(_kwTypes.split(" ")); +const _kwModifiers = "calldata memory storage payable indexed"; +const KwModifiers = setify(_kwModifiers.split(" ")); +const _kwOther = "tuple returns"; +// All Keywords +const _keywords = [_kwTypes, _kwModifiers, _kwOther, _kwVisib].join(" "); +const Keywords = setify(_keywords.split(" ")); +// Single character tokens +const SimpleTokens = { + "(": "OPEN_PAREN", ")": "CLOSE_PAREN", + "[": "OPEN_BRACKET", "]": "CLOSE_BRACKET", + ",": "COMMA", "@": "AT" +}; +// Parser regexes to consume the next token +const regexWhitespacePrefix = new RegExp("^(\\s*)"); +const regexNumberPrefix = new RegExp("^([0-9]+)"); +const regexIdPrefix = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)"); +// Parser regexs to check validity +const regexId = new RegExp("^([a-zA-Z$_][a-zA-Z0-9$_]*)$"); +const regexType = new RegExp("^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$"); +class TokenString { + get offset() { return __classPrivateFieldGet(this, _TokenString_offset, "f"); } + get length() { return __classPrivateFieldGet(this, _TokenString_tokens, "f").length - __classPrivateFieldGet(this, _TokenString_offset, "f"); } + constructor(tokens) { + _TokenString_instances.add(this); + _TokenString_offset.set(this, void 0); + _TokenString_tokens.set(this, void 0); + __classPrivateFieldSet(this, _TokenString_offset, 0, "f"); + __classPrivateFieldSet(this, _TokenString_tokens, tokens.slice(), "f"); + } + clone() { return new TokenString(__classPrivateFieldGet(this, _TokenString_tokens, "f")); } + reset() { __classPrivateFieldSet(this, _TokenString_offset, 0, "f"); } + // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens + popKeyword(allowed) { + const top = this.peek(); + if (top.type !== "KEYWORD" || !allowed.has(top.text)) { + throw new Error(`expected keyword ${top.text}`); + } + return this.pop().text; + } + // Pops and returns the value of the next token if it is `type`; throws if out of tokens + popType(type) { + if (this.peek().type !== type) { + throw new Error(`expected ${type}; got ${JSON.stringify(this.peek())}`); + } + return this.pop().text; + } + // Pops and returns a "(" TOKENS ")" + popParen() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = __classPrivateFieldGet(this, _TokenString_instances, "m", _TokenString_subTokenString).call(this, __classPrivateFieldGet(this, _TokenString_offset, "f") + 1, top.match + 1); + __classPrivateFieldSet(this, _TokenString_offset, top.match + 1, "f"); + return result; + } + // Pops and returns the items within "(" ITEM1 "," ITEM2 "," ... ")" + popParams() { + const top = this.peek(); + if (top.type !== "OPEN_PAREN") { + throw new Error("bad start"); + } + const result = []; + while (__classPrivateFieldGet(this, _TokenString_offset, "f") < top.match - 1) { + const link = this.peek().linkNext; + result.push(__classPrivateFieldGet(this, _TokenString_instances, "m", _TokenString_subTokenString).call(this, __classPrivateFieldGet(this, _TokenString_offset, "f") + 1, link)); + __classPrivateFieldSet(this, _TokenString_offset, link, "f"); + } + __classPrivateFieldSet(this, _TokenString_offset, top.match + 1, "f"); + return result; + } + // Returns the top Token, throwing if out of tokens + peek() { + if (__classPrivateFieldGet(this, _TokenString_offset, "f") >= __classPrivateFieldGet(this, _TokenString_tokens, "f").length) { + throw new Error("out-of-bounds"); + } + return __classPrivateFieldGet(this, _TokenString_tokens, "f")[__classPrivateFieldGet(this, _TokenString_offset, "f")]; + } + // Returns the next value, if it is a keyword in `allowed` + peekKeyword(allowed) { + const top = this.peekType("KEYWORD"); + return (top != null && allowed.has(top)) ? top : null; + } + // Returns the value of the next token if it is `type` + peekType(type) { + if (this.length === 0) { + return null; + } + const top = this.peek(); + return (top.type === type) ? top.text : null; + } + // Returns the next token; throws if out of tokens + pop() { + var _a; + const result = this.peek(); + __classPrivateFieldSet(this, _TokenString_offset, (_a = __classPrivateFieldGet(this, _TokenString_offset, "f"), _a++, _a), "f"); + return result; + } + toString() { + const tokens = []; + for (let i = __classPrivateFieldGet(this, _TokenString_offset, "f"); i < __classPrivateFieldGet(this, _TokenString_tokens, "f").length; i++) { + const token = __classPrivateFieldGet(this, _TokenString_tokens, "f")[i]; + tokens.push(`${token.type}:${token.text}`); + } + return ``; + } +} +_TokenString_offset = new WeakMap(), _TokenString_tokens = new WeakMap(), _TokenString_instances = new WeakSet(), _TokenString_subTokenString = function _TokenString_subTokenString(from = 0, to = 0) { + return new TokenString(__classPrivateFieldGet(this, _TokenString_tokens, "f").slice(from, to).map((t) => { + return Object.freeze(Object.assign({}, t, { + match: (t.match - from), + linkBack: (t.linkBack - from), + linkNext: (t.linkNext - from), + })); + })); +}; +function lex(text) { + const tokens = []; + const throwError = (message) => { + const token = (offset < text.length) ? JSON.stringify(text[offset]) : "$EOI"; + throw new Error(`invalid token ${token} at ${offset}: ${message}`); + }; + let brackets = []; + let commas = []; + let offset = 0; + while (offset < text.length) { + // Strip off any leading whitespace + let cur = text.substring(offset); + let match = cur.match(regexWhitespacePrefix); + if (match) { + offset += match[1].length; + cur = text.substring(offset); + } + const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: "", text: "", offset, value: -1 }; + tokens.push(token); + let type = (SimpleTokens[cur[0]] || ""); + if (type) { + token.type = type; + token.text = cur[0]; + offset++; + if (type === "OPEN_PAREN") { + brackets.push(tokens.length - 1); + commas.push(tokens.length - 1); + } + else if (type == "CLOSE_PAREN") { + if (brackets.length === 0) { + throwError("no matching open bracket"); + } + token.match = brackets.pop(); + (tokens[token.match]).match = tokens.length - 1; + token.depth--; + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + } + else if (type === "COMMA") { + token.linkBack = commas.pop(); + (tokens[token.linkBack]).linkNext = tokens.length - 1; + commas.push(tokens.length - 1); + } + else if (type === "OPEN_BRACKET") { + token.type = "BRACKET"; + } + else if (type === "CLOSE_BRACKET") { + // Remove the CLOSE_BRACKET + let suffix = tokens.pop().text; + if (tokens.length > 0 && tokens[tokens.length - 1].type === "NUMBER") { + const value = tokens.pop().text; + suffix = value + suffix; + (tokens[tokens.length - 1]).value = (0, index_js_1.getNumber)(value); + } + if (tokens.length === 0 || tokens[tokens.length - 1].type !== "BRACKET") { + throw new Error("missing opening bracket"); + } + (tokens[tokens.length - 1]).text += suffix; + } + continue; + } + match = cur.match(regexIdPrefix); + if (match) { + token.text = match[1]; + offset += token.text.length; + if (Keywords.has(token.text)) { + token.type = "KEYWORD"; + continue; + } + if (token.text.match(regexType)) { + token.type = "TYPE"; + continue; + } + token.type = "ID"; + continue; + } + match = cur.match(regexNumberPrefix); + if (match) { + token.text = match[1]; + token.type = "NUMBER"; + offset += token.text.length; + continue; + } + throw new Error(`unexpected token ${JSON.stringify(cur[0])} at position ${offset}`); + } + return new TokenString(tokens.map((t) => Object.freeze(t))); +} +// Check only one of `allowed` is in `set` +function allowSingle(set, allowed) { + let included = []; + for (const key in allowed.keys()) { + if (set.has(key)) { + included.push(key); + } + } + if (included.length > 1) { + throw new Error(`conflicting types: ${included.join(", ")}`); + } +} +// Functions to process a Solidity Signature TokenString from left-to-right for... +// ...the name with an optional type, returning the name +function consumeName(type, tokens) { + if (tokens.peekKeyword(KwTypes)) { + const keyword = tokens.pop().text; + if (keyword !== type) { + throw new Error(`expected ${type}, got ${keyword}`); + } + } + return tokens.popType("ID"); +} +// ...all keywords matching allowed, returning the keywords +function consumeKeywords(tokens, allowed) { + const keywords = new Set(); + while (true) { + const keyword = tokens.peekType("KEYWORD"); + if (keyword == null || (allowed && !allowed.has(keyword))) { + break; + } + tokens.pop(); + if (keywords.has(keyword)) { + throw new Error(`duplicate keywords: ${JSON.stringify(keyword)}`); + } + keywords.add(keyword); + } + return Object.freeze(keywords); +} +// ...all visibility keywords, returning the coalesced mutability +function consumeMutability(tokens) { + let modifiers = consumeKeywords(tokens, KwVisib); + // Detect conflicting modifiers + allowSingle(modifiers, setify("constant payable nonpayable".split(" "))); + allowSingle(modifiers, setify("pure view payable nonpayable".split(" "))); + // Process mutability states + if (modifiers.has("view")) { + return "view"; + } + if (modifiers.has("pure")) { + return "pure"; + } + if (modifiers.has("payable")) { + return "payable"; + } + if (modifiers.has("nonpayable")) { + return "nonpayable"; + } + // Process legacy `constant` last + if (modifiers.has("constant")) { + return "view"; + } + return "nonpayable"; +} +// ...a parameter list, returning the ParamType list +function consumeParams(tokens, allowIndexed) { + return tokens.popParams().map((t) => ParamType.from(t, allowIndexed)); +} +// ...a gas limit, returning a BigNumber or null if none +function consumeGas(tokens) { + if (tokens.peekType("AT")) { + tokens.pop(); + if (tokens.peekType("NUMBER")) { + return (0, index_js_1.getBigInt)(tokens.pop().text); + } + throw new Error("invalid gas"); + } + return null; +} +function consumeEoi(tokens) { + if (tokens.length) { + throw new Error(`unexpected tokens: ${tokens.toString()}`); + } +} +const regexArrayType = new RegExp(/^(.*)\[([0-9]*)\]$/); +function verifyBasicType(type) { + const match = type.match(regexType); + (0, index_js_1.assertArgument)(match, "invalid type", "type", type); + if (type === "uint") { + return "uint256"; + } + if (type === "int") { + return "int256"; + } + if (match[2]) { + // bytesXX + const length = parseInt(match[2]); + (0, index_js_1.assertArgument)(length !== 0 && length <= 32, "invalid bytes length", "type", type); + } + else if (match[3]) { + // intXX or uintXX + const size = parseInt(match[3]); + (0, index_js_1.assertArgument)(size !== 0 && size <= 256 && (size % 8) === 0, "invalid numeric width", "type", type); + } + return type; +} +// Make the Fragment constructors effectively private +const _guard = {}; +const internal = Symbol.for("_ethers_internal"); +const ParamTypeInternal = "_ParamTypeInternal"; +const ErrorFragmentInternal = "_ErrorInternal"; +const EventFragmentInternal = "_EventInternal"; +const ConstructorFragmentInternal = "_ConstructorInternal"; +const FallbackFragmentInternal = "_FallbackInternal"; +const FunctionFragmentInternal = "_FunctionInternal"; +const StructFragmentInternal = "_StructInternal"; +/** + * Each input and output of a [[Fragment]] is an Array of **ParamType**. + */ +class ParamType { + /** + * @private + */ + constructor(guard, name, type, baseType, indexed, components, arrayLength, arrayChildren) { + _ParamType_instances.add(this); + (0, index_js_1.assertPrivate)(guard, _guard, "ParamType"); + Object.defineProperty(this, internal, { value: ParamTypeInternal }); + if (components) { + components = Object.freeze(components.slice()); + } + if (baseType === "array") { + if (arrayLength == null || arrayChildren == null) { + throw new Error(""); + } + } + else if (arrayLength != null || arrayChildren != null) { + throw new Error(""); + } + if (baseType === "tuple") { + if (components == null) { + throw new Error(""); + } + } + else if (components != null) { + throw new Error(""); + } + (0, index_js_1.defineProperties)(this, { + name, type, baseType, indexed, components, arrayLength, arrayChildren + }); + } + /** + * Return a string representation of this type. + * + * For example, + * + * ``sighash" => "(uint256,address)"`` + * + * ``"minimal" => "tuple(uint256,address) indexed"`` + * + * ``"full" => "tuple(uint256 foo, address bar) indexed baz"`` + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + const name = this.name || ""; + if (this.isArray()) { + const result = JSON.parse(this.arrayChildren.format("json")); + result.name = name; + result.type += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + return JSON.stringify(result); + } + const result = { + type: ((this.baseType === "tuple") ? "tuple" : this.type), + name + }; + if (typeof (this.indexed) === "boolean") { + result.indexed = this.indexed; + } + if (this.isTuple()) { + result.components = this.components.map((c) => JSON.parse(c.format(format))); + } + return JSON.stringify(result); + } + let result = ""; + // Array + if (this.isArray()) { + result += this.arrayChildren.format(format); + result += `[${(this.arrayLength < 0 ? "" : String(this.arrayLength))}]`; + } + else { + if (this.isTuple()) { + result += "(" + this.components.map((comp) => comp.format(format)).join((format === "full") ? ", " : ",") + ")"; + } + else { + result += this.type; + } + } + if (format !== "sighash") { + if (this.indexed === true) { + result += " indexed"; + } + if (format === "full" && this.name) { + result += " " + this.name; + } + } + return result; + } + /** + * Returns true if %%this%% is an Array type. + * + * This provides a type gaurd ensuring that [[arrayChildren]] + * and [[arrayLength]] are non-null. + */ + isArray() { + return (this.baseType === "array"); + } + /** + * Returns true if %%this%% is a Tuple type. + * + * This provides a type gaurd ensuring that [[components]] + * is non-null. + */ + isTuple() { + return (this.baseType === "tuple"); + } + /** + * Returns true if %%this%% is an Indexable type. + * + * This provides a type gaurd ensuring that [[indexed]] + * is non-null. + */ + isIndexable() { + return (this.indexed != null); + } + /** + * Walks the **ParamType** with %%value%%, calling %%process%% + * on each type, destructing the %%value%% recursively. + */ + walk(value, process) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v) => (_this.arrayChildren.walk(v, process))); + } + if (this.isTuple()) { + if (!Array.isArray(value)) { + throw new Error("invalid tuple value"); + } + if (value.length !== this.components.length) { + throw new Error("array is wrong length"); + } + const _this = this; + return value.map((v, i) => (_this.components[i].walk(v, process))); + } + return process(this.type, value); + } + /** + * Walks the **ParamType** with %%value%%, asynchronously calling + * %%process%% on each type, destructing the %%value%% recursively. + * + * This can be used to resolve ENS naes by walking and resolving each + * ``"address"`` type. + */ + walkAsync(value, process) { + return __awaiter(this, void 0, void 0, function* () { + const promises = []; + const result = [value]; + __classPrivateFieldGet(this, _ParamType_instances, "m", _ParamType_walkAsync).call(this, promises, value, process, (value) => { + result[0] = value; + }); + if (promises.length) { + yield Promise.all(promises); + } + return result[0]; + }); + } + /** + * Creates a new **ParamType** for %%obj%%. + * + * If %%allowIndexed%% then the ``indexed`` keyword is permitted, + * otherwise the ``indexed`` keyword will throw an error. + */ + static from(obj, allowIndexed) { + if (ParamType.isParamType(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ParamType.from(lex(obj), allowIndexed); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid param type", "obj", obj); + } + } + else if (obj instanceof TokenString) { + let type = "", baseType = ""; + let comps = null; + if (consumeKeywords(obj, setify(["tuple"])).has("tuple") || obj.peekType("OPEN_PAREN")) { + // Tuple + baseType = "tuple"; + comps = obj.popParams().map((t) => ParamType.from(t)); + type = `tuple(${comps.map((c) => c.format()).join(",")})`; + } + else { + // Normal + type = verifyBasicType(obj.popType("TYPE")); + baseType = type; + } + // Check for Array + let arrayChildren = null; + let arrayLength = null; + while (obj.length && obj.peekType("BRACKET")) { + const bracket = obj.pop(); //arrays[i]; + arrayChildren = new ParamType(_guard, "", type, baseType, null, comps, arrayLength, arrayChildren); + arrayLength = bracket.value; + type += bracket.text; + baseType = "array"; + comps = null; + } + let indexed = null; + const keywords = consumeKeywords(obj, KwModifiers); + if (keywords.has("indexed")) { + if (!allowIndexed) { + throw new Error(""); + } + indexed = true; + } + const name = (obj.peekType("ID") ? obj.pop().text : ""); + if (obj.length) { + throw new Error("leftover tokens"); + } + return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren); + } + const name = obj.name; + (0, index_js_1.assertArgument)(!name || (typeof (name) === "string" && name.match(regexId)), "invalid name", "obj.name", name); + let indexed = obj.indexed; + if (indexed != null) { + (0, index_js_1.assertArgument)(allowIndexed, "parameter cannot be indexed", "obj.indexed", obj.indexed); + indexed = !!indexed; + } + let type = obj.type; + let arrayMatch = type.match(regexArrayType); + if (arrayMatch) { + const arrayLength = parseInt(arrayMatch[2] || "-1"); + const arrayChildren = ParamType.from({ + type: arrayMatch[1], + components: obj.components + }); + return new ParamType(_guard, name || "", type, "array", indexed, null, arrayLength, arrayChildren); + } + if (type === "tuple" || type.startsWith("tuple(" /* fix: ) */) || type.startsWith("(" /* fix: ) */)) { + const comps = (obj.components != null) ? obj.components.map((c) => ParamType.from(c)) : null; + const tuple = new ParamType(_guard, name || "", type, "tuple", indexed, comps, null, null); + // @TODO: use lexer to validate and normalize type + return tuple; + } + type = verifyBasicType(obj.type); + return new ParamType(_guard, name || "", type, type, indexed, null, null, null); + } + /** + * Returns true if %%value%% is a **ParamType**. + */ + static isParamType(value) { + return (value && value[internal] === ParamTypeInternal); + } +} +exports.ParamType = ParamType; +_ParamType_instances = new WeakSet(), _ParamType_walkAsync = function _ParamType_walkAsync(promises, value, process, setValue) { + if (this.isArray()) { + if (!Array.isArray(value)) { + throw new Error("invalid array value"); + } + if (this.arrayLength !== -1 && value.length !== this.arrayLength) { + throw new Error("array is wrong length"); + } + const childType = this.arrayChildren; + const result = value.slice(); + result.forEach((value, index) => { + __classPrivateFieldGet(childType, _ParamType_instances, "m", _ParamType_walkAsync).call(childType, promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + if (this.isTuple()) { + const components = this.components; + // Convert the object into an array + let result; + if (Array.isArray(value)) { + result = value.slice(); + } + else { + if (value == null || typeof (value) !== "object") { + throw new Error("invalid tuple value"); + } + result = components.map((param) => { + if (!param.name) { + throw new Error("cannot use object value with unnamed components"); + } + if (!(param.name in value)) { + throw new Error(`missing value for component ${param.name}`); + } + return value[param.name]; + }); + } + if (result.length !== this.components.length) { + throw new Error("array is wrong length"); + } + result.forEach((value, index) => { + var _a; + __classPrivateFieldGet((_a = components[index]), _ParamType_instances, "m", _ParamType_walkAsync).call(_a, promises, value, process, (value) => { + result[index] = value; + }); + }); + setValue(result); + return; + } + const result = process(this.type, value); + if (result.then) { + promises.push((function () { + return __awaiter(this, void 0, void 0, function* () { setValue(yield result); }); + })()); + } + else { + setValue(result); + } +}; +/** + * An abstract class to represent An individual fragment from a parse ABI. + */ +class Fragment { + /** + * @private + */ + constructor(guard, type, inputs) { + (0, index_js_1.assertPrivate)(guard, _guard, "Fragment"); + inputs = Object.freeze(inputs.slice()); + (0, index_js_1.defineProperties)(this, { type, inputs }); + } + /** + * Creates a new **Fragment** for %%obj%%, wich can be any supported + * ABI frgament type. + */ + static from(obj) { + if (typeof (obj) === "string") { + // Try parsing JSON... + try { + Fragment.from(JSON.parse(obj)); + } + catch (e) { } + // ...otherwise, use the human-readable lexer + return Fragment.from(lex(obj)); + } + if (obj instanceof TokenString) { + // Human-readable ABI (already lexed) + const type = obj.peekKeyword(KwTypes); + switch (type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + } + else if (typeof (obj) === "object") { + // JSON ABI + switch (obj.type) { + case "constructor": return ConstructorFragment.from(obj); + case "error": return ErrorFragment.from(obj); + case "event": return EventFragment.from(obj); + case "fallback": + case "receive": + return FallbackFragment.from(obj); + case "function": return FunctionFragment.from(obj); + case "struct": return StructFragment.from(obj); + } + (0, index_js_1.assert)(false, `unsupported type: ${obj.type}`, "UNSUPPORTED_OPERATION", { + operation: "Fragment.from" + }); + } + (0, index_js_1.assertArgument)(false, "unsupported frgament object", "obj", obj); + } + /** + * Returns true if %%value%% is a [[ConstructorFragment]]. + */ + static isConstructor(value) { + return ConstructorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[ErrorFragment]]. + */ + static isError(value) { + return ErrorFragment.isFragment(value); + } + /** + * Returns true if %%value%% is an [[EventFragment]]. + */ + static isEvent(value) { + return EventFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[FunctionFragment]]. + */ + static isFunction(value) { + return FunctionFragment.isFragment(value); + } + /** + * Returns true if %%value%% is a [[StructFragment]]. + */ + static isStruct(value) { + return StructFragment.isFragment(value); + } +} +exports.Fragment = Fragment; +/** + * An abstract class to represent An individual fragment + * which has a name from a parse ABI. + */ +class NamedFragment extends Fragment { + /** + * @private + */ + constructor(guard, type, name, inputs) { + super(guard, type, inputs); + (0, index_js_1.assertArgument)(typeof (name) === "string" && name.match(regexId), "invalid identifier", "name", name); + inputs = Object.freeze(inputs.slice()); + (0, index_js_1.defineProperties)(this, { name }); + } +} +exports.NamedFragment = NamedFragment; +function joinParams(format, params) { + return "(" + params.map((p) => p.format(format)).join((format === "full") ? ", " : ",") + ")"; +} +/** + * A Fragment which represents a //Custom Error//. + */ +class ErrorFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "error", name, inputs); + Object.defineProperty(this, internal, { value: ErrorFragmentInternal }); + } + /** + * The Custom Error selector. + */ + get selector() { + return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this fragment as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "error", + name: this.name, + inputs: this.inputs.map((input) => JSON.parse(input.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("error"); + } + result.push(this.name + joinParams(format, this.inputs)); + return result.join(" "); + } + /** + * Returns a new **ErrorFragment** for %%obj%%. + */ + static from(obj) { + if (ErrorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + return ErrorFragment.from(lex(obj)); + } + else if (obj instanceof TokenString) { + const name = consumeName("error", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new ErrorFragment(_guard, name, inputs); + } + return new ErrorFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **ErrorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ErrorFragmentInternal); + } +} +exports.ErrorFragment = ErrorFragment; +/** + * A Fragment which represents an Event. + */ +class EventFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs, anonymous) { + super(guard, "event", name, inputs); + Object.defineProperty(this, internal, { value: EventFragmentInternal }); + (0, index_js_1.defineProperties)(this, { anonymous }); + } + /** + * The Event topic hash. + */ + get topicHash() { + return (0, index_js_2.id)(this.format("sighash")); + } + /** + * Returns a string representation of this event as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "event", + anonymous: this.anonymous, + name: this.name, + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = []; + if (format !== "sighash") { + result.push("event"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash" && this.anonymous) { + result.push("anonymous"); + } + return result.join(" "); + } + /** + * Return the topic hash for an event with %%name%% and %%params%%. + */ + static getTopicHash(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new EventFragment(_guard, name, params, false); + return fragment.topicHash; + } + /** + * Returns a new **EventFragment** for %%obj%%. + */ + static from(obj) { + if (EventFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return EventFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid event fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("event", obj); + const inputs = consumeParams(obj, true); + const anonymous = !!consumeKeywords(obj, setify(["anonymous"])).has("anonymous"); + consumeEoi(obj); + return new EventFragment(_guard, name, inputs, anonymous); + } + return new EventFragment(_guard, obj.name, obj.inputs ? obj.inputs.map((p) => ParamType.from(p, true)) : [], !!obj.anonymous); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is an + * **EventFragment**. + */ + static isFragment(value) { + return (value && value[internal] === EventFragmentInternal); + } +} +exports.EventFragment = EventFragment; +/** + * A Fragment which represents a constructor. + */ +class ConstructorFragment extends Fragment { + /** + * @private + */ + constructor(guard, type, inputs, payable, gas) { + super(guard, type, inputs); + Object.defineProperty(this, internal, { value: ConstructorFragmentInternal }); + (0, index_js_1.defineProperties)(this, { payable, gas }); + } + /** + * Returns a string representation of this constructor as %%format%%. + */ + format(format) { + (0, index_js_1.assert)(format != null && format !== "sighash", "cannot format a constructor for sighash", "UNSUPPORTED_OPERATION", { operation: "format(sighash)" }); + if (format === "json") { + return JSON.stringify({ + type: "constructor", + stateMutability: (this.payable ? "payable" : "undefined"), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))) + }); + } + const result = [`constructor${joinParams(format, this.inputs)}`]; + if (this.payable) { + result.push("payable"); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + return result.join(" "); + } + /** + * Returns a new **ConstructorFragment** for %%obj%%. + */ + static from(obj) { + if (ConstructorFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return ConstructorFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid constuctor fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + consumeKeywords(obj, setify(["constructor"])); + const inputs = consumeParams(obj); + const payable = !!consumeKeywords(obj, KwVisibDeploy).has("payable"); + const gas = consumeGas(obj); + consumeEoi(obj); + return new ConstructorFragment(_guard, "constructor", inputs, payable, gas); + } + return new ConstructorFragment(_guard, "constructor", obj.inputs ? obj.inputs.map(ParamType.from) : [], !!obj.payable, (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **ConstructorFragment**. + */ + static isFragment(value) { + return (value && value[internal] === ConstructorFragmentInternal); + } +} +exports.ConstructorFragment = ConstructorFragment; +/** + * A Fragment which represents a method. + */ +class FallbackFragment extends Fragment { + constructor(guard, inputs, payable) { + super(guard, "fallback", inputs); + Object.defineProperty(this, internal, { value: FallbackFragmentInternal }); + (0, index_js_1.defineProperties)(this, { payable }); + } + /** + * Returns a string representation of this fallback as %%format%%. + */ + format(format) { + const type = ((this.inputs.length === 0) ? "receive" : "fallback"); + if (format === "json") { + const stateMutability = (this.payable ? "payable" : "nonpayable"); + return JSON.stringify({ type, stateMutability }); + } + return `${type}()${this.payable ? " payable" : ""}`; + } + /** + * Returns a new **FallbackFragment** for %%obj%%. + */ + static from(obj) { + if (FallbackFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FallbackFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid fallback fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const errorObj = obj.toString(); + const topIsValid = obj.peekKeyword(setify(["fallback", "receive"])); + (0, index_js_1.assertArgument)(topIsValid, "type must be fallback or receive", "obj", errorObj); + const type = obj.popKeyword(setify(["fallback", "receive"])); + // receive() + if (type === "receive") { + const inputs = consumeParams(obj); + (0, index_js_1.assertArgument)(inputs.length === 0, `receive cannot have arguments`, "obj.inputs", inputs); + consumeKeywords(obj, setify(["payable"])); + consumeEoi(obj); + return new FallbackFragment(_guard, [], true); + } + // fallback() [payable] + // fallback(bytes) [payable] returns (bytes) + let inputs = consumeParams(obj); + if (inputs.length) { + (0, index_js_1.assertArgument)(inputs.length === 1 && inputs[0].type === "bytes", "invalid fallback inputs", "obj.inputs", inputs.map((i) => i.format("minimal")).join(", ")); + } + else { + inputs = [ParamType.from("bytes")]; + } + const mutability = consumeMutability(obj); + (0, index_js_1.assertArgument)(mutability === "nonpayable" || mutability === "payable", "fallback cannot be constants", "obj.stateMutability", mutability); + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + const outputs = consumeParams(obj); + (0, index_js_1.assertArgument)(outputs.length === 1 && outputs[0].type === "bytes", "invalid fallback outputs", "obj.outputs", outputs.map((i) => i.format("minimal")).join(", ")); + } + consumeEoi(obj); + return new FallbackFragment(_guard, inputs, mutability === "payable"); + } + if (obj.type === "receive") { + return new FallbackFragment(_guard, [], true); + } + if (obj.type === "fallback") { + const inputs = [ParamType.from("bytes")]; + const payable = (obj.stateMutability === "payable"); + return new FallbackFragment(_guard, inputs, payable); + } + (0, index_js_1.assertArgument)(false, "invalid fallback description", "obj", obj); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FallbackFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FallbackFragmentInternal); + } +} +exports.FallbackFragment = FallbackFragment; +/** + * A Fragment which represents a method. + */ +class FunctionFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, stateMutability, inputs, outputs, gas) { + super(guard, "function", name, inputs); + Object.defineProperty(this, internal, { value: FunctionFragmentInternal }); + outputs = Object.freeze(outputs.slice()); + const constant = (stateMutability === "view" || stateMutability === "pure"); + const payable = (stateMutability === "payable"); + (0, index_js_1.defineProperties)(this, { constant, gas, outputs, payable, stateMutability }); + } + /** + * The Function selector. + */ + get selector() { + return (0, index_js_2.id)(this.format("sighash")).substring(0, 10); + } + /** + * Returns a string representation of this function as %%format%%. + */ + format(format) { + if (format == null) { + format = "sighash"; + } + if (format === "json") { + return JSON.stringify({ + type: "function", + name: this.name, + constant: this.constant, + stateMutability: ((this.stateMutability !== "nonpayable") ? this.stateMutability : undefined), + payable: this.payable, + gas: ((this.gas != null) ? this.gas : undefined), + inputs: this.inputs.map((i) => JSON.parse(i.format(format))), + outputs: this.outputs.map((o) => JSON.parse(o.format(format))), + }); + } + const result = []; + if (format !== "sighash") { + result.push("function"); + } + result.push(this.name + joinParams(format, this.inputs)); + if (format !== "sighash") { + if (this.stateMutability !== "nonpayable") { + result.push(this.stateMutability); + } + if (this.outputs && this.outputs.length) { + result.push("returns"); + result.push(joinParams(format, this.outputs)); + } + if (this.gas != null) { + result.push(`@${this.gas.toString()}`); + } + } + return result.join(" "); + } + /** + * Return the selector for a function with %%name%% and %%params%%. + */ + static getSelector(name, params) { + params = (params || []).map((p) => ParamType.from(p)); + const fragment = new FunctionFragment(_guard, name, "view", params, [], null); + return fragment.selector; + } + /** + * Returns a new **FunctionFragment** for %%obj%%. + */ + static from(obj) { + if (FunctionFragment.isFragment(obj)) { + return obj; + } + if (typeof (obj) === "string") { + try { + return FunctionFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid function fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("function", obj); + const inputs = consumeParams(obj); + const mutability = consumeMutability(obj); + let outputs = []; + if (consumeKeywords(obj, setify(["returns"])).has("returns")) { + outputs = consumeParams(obj); + } + const gas = consumeGas(obj); + consumeEoi(obj); + return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas); + } + let stateMutability = obj.stateMutability; + // Use legacy Solidity ABI logic if stateMutability is missing + if (stateMutability == null) { + stateMutability = "payable"; + if (typeof (obj.constant) === "boolean") { + stateMutability = "view"; + if (!obj.constant) { + stateMutability = "payable"; + if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + } + else if (typeof (obj.payable) === "boolean" && !obj.payable) { + stateMutability = "nonpayable"; + } + } + // @TODO: verifyState for stateMutability (e.g. throw if + // payable: false but stateMutability is "nonpayable") + return new FunctionFragment(_guard, obj.name, stateMutability, obj.inputs ? obj.inputs.map(ParamType.from) : [], obj.outputs ? obj.outputs.map(ParamType.from) : [], (obj.gas != null) ? obj.gas : null); + } + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **FunctionFragment**. + */ + static isFragment(value) { + return (value && value[internal] === FunctionFragmentInternal); + } +} +exports.FunctionFragment = FunctionFragment; +/** + * A Fragment which represents a structure. + */ +class StructFragment extends NamedFragment { + /** + * @private + */ + constructor(guard, name, inputs) { + super(guard, "struct", name, inputs); + Object.defineProperty(this, internal, { value: StructFragmentInternal }); + } + /** + * Returns a string representation of this struct as %%format%%. + */ + format() { + throw new Error("@TODO"); + } + /** + * Returns a new **StructFragment** for %%obj%%. + */ + static from(obj) { + if (typeof (obj) === "string") { + try { + return StructFragment.from(lex(obj)); + } + catch (error) { + (0, index_js_1.assertArgument)(false, "invalid struct fragment", "obj", obj); + } + } + else if (obj instanceof TokenString) { + const name = consumeName("struct", obj); + const inputs = consumeParams(obj); + consumeEoi(obj); + return new StructFragment(_guard, name, inputs); + } + return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from) : []); + } + // @TODO: fix this return type + /** + * Returns ``true`` and provides a type guard if %%value%% is a + * **StructFragment**. + */ + static isFragment(value) { + return (value && value[internal] === StructFragmentInternal); + } +} +exports.StructFragment = StructFragment; +//# sourceMappingURL=fragments.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/fragments.js.map b/dist/ethers.js/src.ts/abi/fragments.js.map new file mode 100644 index 0000000..80c1c9c --- /dev/null +++ b/dist/ethers.js/src.ts/abi/fragments.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fragments.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/fragments.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,gDAG2B;AAC3B,+CAAsC;AAgFrC,CAAC;AAoBF,qCAAqC;AACrC,SAAS,MAAM,CAA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I,GAAG,YAAY,WAAW,EAAE;YACnC,MAAM,IAAI,GAAG,WAAW,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;YACxC,MAAM,MAAM,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;YAClC,UAAU,CAAC,GAAG,CAAC,CAAC;YAChB,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;SACnD;QAED,OAAO,IAAI,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA,CAAC,CAAC,EAAG,CAAC,CAAC;IAClG,CAAC;IAEL,8BAA8B;IAC1B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,KAAU;QACxB,OAAO,CAAC,KAAK,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,sBAAsB,CAAC,CAAC;IACjE,CAAC;CACJ;AA9CD,wCA8CC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/index.d.ts b/dist/ethers.js/src.ts/abi/index.d.ts new file mode 100644 index 0000000..2bf3993 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/index.d.ts @@ -0,0 +1,18 @@ +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +export { AbiCoder } from "./abi-coder.js"; +export { decodeBytes32String, encodeBytes32String } from "./bytes32.js"; +export { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, NamedFragment, ParamType, StructFragment, } from "./fragments.js"; +export { checkResultErrors, Indexed, Interface, ErrorDescription, LogDescription, TransactionDescription, Result } from "./interface.js"; +export { Typed } from "./typed.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, ParamTypeWalkAsyncFunc, ParamTypeWalkFunc } from "./fragments.js"; +export type { InterfaceAbi, } from "./interface.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/index.d.ts.map b/dist/ethers.js/src.ts/abi/index.d.ts.map new file mode 100644 index 0000000..4937120 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAExE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,GACvE,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,iBAAiB,EACjB,OAAO,EACP,SAAS,EACT,gBAAgB,EAAE,cAAc,EAAE,sBAAsB,EACxD,MAAM,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,YAAY,EACR,YAAY,EAAE,gBAAgB,EAC9B,UAAU,EAAE,YAAY,EAAE,sBAAsB,EAAE,iBAAiB,EACtE,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACR,YAAY,GACf,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/index.js b/dist/ethers.js/src.ts/abi/index.js new file mode 100644 index 0000000..b7bb84a --- /dev/null +++ b/dist/ethers.js/src.ts/abi/index.js @@ -0,0 +1,40 @@ +"use strict"; +/** + * The Application Binary Interface (ABI) describes how method input + * parameters should be encoded, their results decoded, and how to + * decode events and errors. + * + * See [About ABIs](docs-abi) for more details how they are used. + * + * @_section api/abi:Application Binary Interface [about-abi] + * @_navTitle: ABI + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Typed = exports.Result = exports.TransactionDescription = exports.LogDescription = exports.ErrorDescription = exports.Interface = exports.Indexed = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.Fragment = exports.FallbackFragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.encodeBytes32String = exports.decodeBytes32String = exports.AbiCoder = void 0; +////// +var abi_coder_js_1 = require("./abi-coder.js"); +Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return abi_coder_js_1.AbiCoder; } }); +var bytes32_js_1 = require("./bytes32.js"); +Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.decodeBytes32String; } }); +Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return bytes32_js_1.encodeBytes32String; } }); +var fragments_js_1 = require("./fragments.js"); +Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return fragments_js_1.ConstructorFragment; } }); +Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return fragments_js_1.ErrorFragment; } }); +Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return fragments_js_1.EventFragment; } }); +Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return fragments_js_1.FallbackFragment; } }); +Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return fragments_js_1.Fragment; } }); +Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return fragments_js_1.FunctionFragment; } }); +Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return fragments_js_1.NamedFragment; } }); +Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return fragments_js_1.ParamType; } }); +Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return fragments_js_1.StructFragment; } }); +var interface_js_1 = require("./interface.js"); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return interface_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return interface_js_1.Indexed; } }); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return interface_js_1.Interface; } }); +Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return interface_js_1.ErrorDescription; } }); +Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return interface_js_1.LogDescription; } }); +Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return interface_js_1.TransactionDescription; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return interface_js_1.Result; } }); +var typed_js_1 = require("./typed.js"); +Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return typed_js_1.Typed; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/index.js.map b/dist/ethers.js/src.ts/abi/index.js.map new file mode 100644 index 0000000..1edcd89 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAGH,MAAM;AACN,+CAA0C;AAAjC,wGAAA,QAAQ,OAAA;AAEjB,2CAAwE;AAA/D,iHAAA,mBAAmB,OAAA;AAAE,iHAAA,mBAAmB,OAAA;AAEjD,+CAGwB;AAFpB,mHAAA,mBAAmB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AACnE,wGAAA,QAAQ,OAAA;AAAE,gHAAA,gBAAgB,OAAA;AAAE,6GAAA,aAAa,OAAA;AAAE,yGAAA,SAAS,OAAA;AAAE,8GAAA,cAAc,OAAA;AAGxE,+CAMwB;AALpB,iHAAA,iBAAiB,OAAA;AACjB,uGAAA,OAAO,OAAA;AACP,yGAAA,SAAS,OAAA;AACT,gHAAA,gBAAgB,OAAA;AAAE,8GAAA,cAAc,OAAA;AAAE,sHAAA,sBAAsB,OAAA;AACxD,sGAAA,MAAM,OAAA;AAGV,uCAAmC;AAA1B,iGAAA,KAAK,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/interface.d.ts b/dist/ethers.js/src.ts/abi/interface.d.ts new file mode 100644 index 0000000..0801fe4 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/interface.d.ts @@ -0,0 +1,382 @@ +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +import { AbiCoder } from "./abi-coder.js"; +import { checkResultErrors, Result } from "./coders/abstract-coder.js"; +import { ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment, Fragment, FunctionFragment, ParamType } from "./fragments.js"; +import { Typed } from "./typed.js"; +import type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from "../utils/index.js"; +import type { JsonFragment } from "./fragments.js"; +export { checkResultErrors, Result }; +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +export declare class LogDescription { + /** + * The matching fragment for the ``topic0``. + */ + readonly fragment: EventFragment; + /** + * The name of the Event. + */ + readonly name: string; + /** + * The full Event signature. + */ + readonly signature: string; + /** + * The topic hash for the Event. + */ + readonly topic: string; + /** + * The arguments passed into the Event with ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(fragment: EventFragment, topic: string, args: Result); +} +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +export declare class TransactionDescription { + /** + * The matching fragment from the transaction ``data``. + */ + readonly fragment: FunctionFragment; + /** + * The name of the Function from the transaction ``data``. + */ + readonly name: string; + /** + * The arguments passed to the Function from the transaction ``data``. + */ + readonly args: Result; + /** + * The full Function signature from the transaction ``data``. + */ + readonly signature: string; + /** + * The selector for the Function from the transaction ``data``. + */ + readonly selector: string; + /** + * The ``value`` (in wei) from the transaction. + */ + readonly value: bigint; + /** + * @_ignore: + */ + constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint); +} +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +export declare class ErrorDescription { + /** + * The matching fragment. + */ + readonly fragment: ErrorFragment; + /** + * The name of the Error. + */ + readonly name: string; + /** + * The arguments passed to the Error with ``revert``. + */ + readonly args: Result; + /** + * The full Error signature. + */ + readonly signature: string; + /** + * The selector for the Error. + */ + readonly selector: string; + /** + * @_ignore: + */ + constructor(fragment: ErrorFragment, selector: string, args: Result); +} +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +export declare class Indexed { + /** + * The ``keccak256`` of the value logged. + */ + readonly hash: null | string; + /** + * @_ignore: + */ + readonly _isIndexed: boolean; + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value: any): value is Indexed; + /** + * @_ignore: + */ + constructor(hash: null | string); +} +/** + * An **InterfaceAbi** may be any supported ABI format. + * + * A string is expected to be a JSON string, which will be parsed + * using ``JSON.parse``. This means that the value **must** be a valid + * JSON string, with no stray commas, etc. + * + * An array may contain any combination of: + * - Human-Readable fragments + * - Parsed JSON fragment + * - [[Fragment]] instances + * + * A **Human-Readable Fragment** is a string which resembles a Solidity + * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi). + * For example, ``function balanceOf(address) view returns (uint)``. + * + * A **Parsed JSON Fragment** is a JavaScript Object desribed in the + * [Solidity documentation](link-solc-jsonabi). + */ +export type InterfaceAbi = string | ReadonlyArray; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +export declare class Interface { + #private; + /** + * All the Contract ABI members (i.e. methods, events, errors, etc). + */ + readonly fragments: ReadonlyArray; + /** + * The Contract constructor. + */ + readonly deploy: ConstructorFragment; + /** + * The Fallback method, if any. + */ + readonly fallback: null | FallbackFragment; + /** + * If receiving ether is supported. + */ + readonly receive: boolean; + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments: InterfaceAbi); + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal?: boolean): Array; + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson(): string; + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder(): AbiCoder; + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key: string): string; + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key: string): boolean; + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key: string, values?: Array): null | FunctionFragment; + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback: (func: FunctionFragment, index: number) => void): void; + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key: string): string; + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key: string): boolean; + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key: string, values?: Array): null | EventFragment; + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback: (func: EventFragment, index: number) => void): void; + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key: string, values?: Array): null | ErrorFragment; + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback: (func: ErrorFragment, index: number) => void): void; + _decodeParams(params: ReadonlyArray, data: BytesLike): Result; + _encodeParams(params: ReadonlyArray, values: ReadonlyArray): string; + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result; + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result; + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result; + makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError; + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray): string; + encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray): Array>; + encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray): { + data: string; + topics: Array; + }; + decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray): Result; + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx: { + data: string; + value?: BigNumberish; + }): null | TransactionDescription; + parseCallResult(data: BytesLike): Result; + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log: { + topics: Array; + data: string; + }): null | LogDescription; + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data: BytesLike): null | ErrorDescription; + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value: InterfaceAbi | Interface): Interface; +} +//# sourceMappingURL=interface.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/interface.d.ts.map b/dist/ethers.js/src.ts/abi/interface.d.ts.map new file mode 100644 index 0000000..6954244 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/interface.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/interface.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAUH,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EACH,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,gBAAgB,EACnE,QAAQ,EAAE,gBAAgB,EAAE,SAAS,EACxC,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AAEnC,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AAE/G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,EAAE,CAAC;AAErC;;;GAGG;AACH,qBAAa,cAAc;IACvB;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,aAAa,CAAC;IAElC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,MAAM,CAAC;IAE5B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAG,MAAM,CAAA;IAEtB;;OAEG;gBACS,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM;CAMnE;AAED;;;;GAIG;AACH,qBAAa,sBAAsB;IAC/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,gBAAgB,CAAC;IAErC;;OAEG;IAC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ts/abi/interface.js b/dist/ethers.js/src.ts/abi/interface.js new file mode 100644 index 0000000..23036a3 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/interface.js @@ -0,0 +1,1028 @@ +"use strict"; +/** + * The Interface class is a low-level class that accepts an + * ABI and provides all the necessary functionality to encode + * and decode paramaters to and results from methods, events + * and errors. + * + * It also provides several convenience methods to automatically + * search and find matching transactions and events to parse them. + * + * @_subsection api/abi:Interfaces [interfaces] + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Interface_instances, _Interface_errors, _Interface_events, _Interface_functions, _Interface_abiCoder, _Interface_getFunction, _Interface_getEvent; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Interface = exports.Indexed = exports.ErrorDescription = exports.TransactionDescription = exports.LogDescription = exports.Result = exports.checkResultErrors = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../hash/index.js"); +const index_js_3 = require("../utils/index.js"); +const abi_coder_js_1 = require("./abi-coder.js"); +const abstract_coder_js_1 = require("./coders/abstract-coder.js"); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return abstract_coder_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return abstract_coder_js_1.Result; } }); +const fragments_js_1 = require("./fragments.js"); +const typed_js_1 = require("./typed.js"); +/** + * When using the [[Interface-parseLog]] to automatically match a Log to its event + * for parsing, a **LogDescription** is returned. + */ +class LogDescription { + /** + * @_ignore: + */ + constructor(fragment, topic, args) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, signature, topic, args + }); + } +} +exports.LogDescription = LogDescription; +/** + * When using the [[Interface-parseTransaction]] to automatically match + * a transaction data to its function for parsing, + * a **TransactionDescription** is returned. + */ +class TransactionDescription { + /** + * @_ignore: + */ + constructor(fragment, selector, args, value) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, args, signature, selector, value + }); + } +} +exports.TransactionDescription = TransactionDescription; +/** + * When using the [[Interface-parseError]] to automatically match an + * error for a call result for parsing, an **ErrorDescription** is returned. + */ +class ErrorDescription { + /** + * @_ignore: + */ + constructor(fragment, selector, args) { + const name = fragment.name, signature = fragment.format(); + (0, index_js_3.defineProperties)(this, { + fragment, name, args, signature, selector + }); + } +} +exports.ErrorDescription = ErrorDescription; +/** + * An **Indexed** is used as a value when a value that does not + * fit within a topic (i.e. not a fixed-length, 32-byte type). It + * is the ``keccak256`` of the value, and used for types such as + * arrays, tuples, bytes and strings. + */ +class Indexed { + /** + * Returns ``true`` if %%value%% is an **Indexed**. + * + * This provides a Type Guard for property access. + */ + static isIndexed(value) { + return !!(value && value._isIndexed); + } + /** + * @_ignore: + */ + constructor(hash) { + (0, index_js_3.defineProperties)(this, { hash, _isIndexed: true }); + } +} +exports.Indexed = Indexed; +// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require +const PanicReasons = { + "0": "generic panic", + "1": "assert(false)", + "17": "arithmetic overflow", + "18": "division or modulo by zero", + "33": "enum overflow", + "34": "invalid encoded storage byte array accessed", + "49": "out-of-bounds array access; popping on an empty array", + "50": "out-of-bounds access of an array or bytesN", + "65": "out of memory", + "81": "uninitialized function", +}; +const BuiltinErrors = { + "0x08c379a0": { + signature: "Error(string)", + name: "Error", + inputs: ["string"], + reason: (message) => { + return `reverted with reason string ${JSON.stringify(message)}`; + } + }, + "0x4e487b71": { + signature: "Panic(uint256)", + name: "Panic", + inputs: ["uint256"], + reason: (code) => { + let reason = "unknown panic code"; + if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) { + reason = PanicReasons[code.toString()]; + } + return `reverted with panic code 0x${code.toString(16)} (${reason})`; + } + } +}; +/** + * An Interface abstracts many of the low-level details for + * encoding and decoding the data on the blockchain. + * + * An ABI provides information on how to encode data to send to + * a Contract, how to decode the results and events and how to + * interpret revert errors. + * + * The ABI can be specified by [any supported format](InterfaceAbi). + */ +class Interface { + /** + * Create a new Interface for the %%fragments%%. + */ + constructor(fragments) { + _Interface_instances.add(this); + _Interface_errors.set(this, void 0); + _Interface_events.set(this, void 0); + _Interface_functions.set(this, void 0); + // #structs: Map; + _Interface_abiCoder.set(this, void 0); + let abi = []; + if (typeof (fragments) === "string") { + abi = JSON.parse(fragments); + } + else { + abi = fragments; + } + __classPrivateFieldSet(this, _Interface_functions, new Map(), "f"); + __classPrivateFieldSet(this, _Interface_errors, new Map(), "f"); + __classPrivateFieldSet(this, _Interface_events, new Map(), "f"); + // this.#structs = new Map(); + const frags = []; + for (const a of abi) { + try { + frags.push(fragments_js_1.Fragment.from(a)); + } + catch (error) { + console.log("EE", error); + } + } + (0, index_js_3.defineProperties)(this, { + fragments: Object.freeze(frags) + }); + let fallback = null; + let receive = false; + __classPrivateFieldSet(this, _Interface_abiCoder, this.getAbiCoder(), "f"); + // Add all fragments by their signature + this.fragments.forEach((fragment, index) => { + let bucket; + switch (fragment.type) { + case "constructor": + if (this.deploy) { + console.log("duplicate definition - constructor"); + return; + } + //checkNames(fragment, "input", fragment.inputs); + (0, index_js_3.defineProperties)(this, { deploy: fragment }); + return; + case "fallback": + if (fragment.inputs.length === 0) { + receive = true; + } + else { + (0, index_js_3.assertArgument)(!fallback || fragment.payable !== fallback.payable, "conflicting fallback fragments", `fragments[${index}]`, fragment); + fallback = fragment; + receive = fallback.payable; + } + return; + case "function": + //checkNames(fragment, "input", fragment.inputs); + //checkNames(fragment, "output", (fragment).outputs); + bucket = __classPrivateFieldGet(this, _Interface_functions, "f"); + break; + case "event": + //checkNames(fragment, "input", fragment.inputs); + bucket = __classPrivateFieldGet(this, _Interface_events, "f"); + break; + case "error": + bucket = __classPrivateFieldGet(this, _Interface_errors, "f"); + break; + default: + return; + } + // Two identical entries; ignore it + const signature = fragment.format(); + if (bucket.has(signature)) { + return; + } + bucket.set(signature, fragment); + }); + // If we do not have a constructor add a default + if (!this.deploy) { + (0, index_js_3.defineProperties)(this, { + deploy: fragments_js_1.ConstructorFragment.from("constructor()") + }); + } + (0, index_js_3.defineProperties)(this, { fallback, receive }); + } + /** + * Returns the entire Human-Readable ABI, as an array of + * signatures, optionally as %%minimal%% strings, which + * removes parameter names and unneceesary spaces. + */ + format(minimal) { + const format = (minimal ? "minimal" : "full"); + const abi = this.fragments.map((f) => f.format(format)); + return abi; + } + /** + * Return the JSON-encoded ABI. This is the format Solidiy + * returns. + */ + formatJson() { + const abi = this.fragments.map((f) => f.format("json")); + // We need to re-bundle the JSON fragments a bit + return JSON.stringify(abi.map((j) => JSON.parse(j))); + } + /** + * The ABI coder that will be used to encode and decode binary + * data. + */ + getAbiCoder() { + return abi_coder_js_1.AbiCoder.defaultAbiCoder(); + } + /** + * Get the function name for %%key%%, which may be a function selector, + * function name or function signature that belongs to the ABI. + */ + getFunctionName(key) { + const fragment = __classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getFunction).call(this, key, null, false); + (0, index_js_3.assertArgument)(fragment, "no matching function", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (a function selector, function name or + * function signature) is present in the ABI. + * + * In the case of a function name, the name may be ambiguous, so + * accessing the [[FunctionFragment]] may require refinement. + */ + hasFunction(key) { + return !!__classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getFunction).call(this, key, null, false); + } + /** + * Get the [[FunctionFragment]] for %%key%%, which may be a function + * selector, function name or function signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple functions match by name. + * + * If the %%key%% and %%values%% do not refine to a single function in + * the ABI, this will throw. + */ + getFunction(key, values) { + return __classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getFunction).call(this, key, values || null, true); + } + /** + * Iterate over all functions, calling %%callback%%, sorted by their name. + */ + forEachFunction(callback) { + const names = Array.from(__classPrivateFieldGet(this, _Interface_functions, "f").keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((__classPrivateFieldGet(this, _Interface_functions, "f").get(name)), i); + } + } + /** + * Get the event name for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + */ + getEventName(key) { + const fragment = __classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getEvent).call(this, key, null, false); + (0, index_js_3.assertArgument)(fragment, "no matching event", "key", key); + return fragment.name; + } + /** + * Returns true if %%key%% (an event topic hash, event name or + * event signature) is present in the ABI. + * + * In the case of an event name, the name may be ambiguous, so + * accessing the [[EventFragment]] may require refinement. + */ + hasEvent(key) { + return !!__classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getEvent).call(this, key, null, false); + } + /** + * Get the [[EventFragment]] for %%key%%, which may be a topic hash, + * event name or event signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple events match by name. + * + * If the %%key%% and %%values%% do not refine to a single event in + * the ABI, this will throw. + */ + getEvent(key, values) { + return __classPrivateFieldGet(this, _Interface_instances, "m", _Interface_getEvent).call(this, key, values || null, true); + } + /** + * Iterate over all events, calling %%callback%%, sorted by their name. + */ + forEachEvent(callback) { + const names = Array.from(__classPrivateFieldGet(this, _Interface_events, "f").keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((__classPrivateFieldGet(this, _Interface_events, "f").get(name)), i); + } + } + /** + * Get the [[ErrorFragment]] for %%key%%, which may be an error + * selector, error name or error signature that belongs to the ABI. + * + * If %%values%% is provided, it will use the Typed API to handle + * ambiguous cases where multiple errors match by name. + * + * If the %%key%% and %%values%% do not refine to a single error in + * the ABI, this will throw. + */ + getError(key, values) { + if ((0, index_js_3.isHexString)(key)) { + const selector = key.toLowerCase(); + if (BuiltinErrors[selector]) { + return fragments_js_1.ErrorFragment.from(BuiltinErrors[selector].signature); + } + for (const fragment of __classPrivateFieldGet(this, _Interface_errors, "f").values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of __classPrivateFieldGet(this, _Interface_errors, "f")) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (matching.length === 0) { + if (key === "Error") { + return fragments_js_1.ErrorFragment.from("error Error(string)"); + } + if (key === "Panic") { + return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); + } + return null; + } + else if (matching.length > 1) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous error description (i.e. ${matchStr})`, "name", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + key = fragments_js_1.ErrorFragment.from(key).format(); + if (key === "Error(string)") { + return fragments_js_1.ErrorFragment.from("error Error(string)"); + } + if (key === "Panic(uint256)") { + return fragments_js_1.ErrorFragment.from("error Panic(uint256)"); + } + const result = __classPrivateFieldGet(this, _Interface_errors, "f").get(key); + if (result) { + return result; + } + return null; + } + /** + * Iterate over all errors, calling %%callback%%, sorted by their name. + */ + forEachError(callback) { + const names = Array.from(__classPrivateFieldGet(this, _Interface_errors, "f").keys()); + names.sort((a, b) => a.localeCompare(b)); + for (let i = 0; i < names.length; i++) { + const name = names[i]; + callback((__classPrivateFieldGet(this, _Interface_errors, "f").get(name)), i); + } + } + // Get the 4-byte selector used by Solidity to identify a function + /* +getSelector(fragment: ErrorFragment | FunctionFragment): string { + if (typeof(fragment) === "string") { + const matches: Array = [ ]; + + try { matches.push(this.getFunction(fragment)); } catch (error) { } + try { matches.push(this.getError(fragment)); } catch (_) { } + + if (matches.length === 0) { + logger.throwArgumentError("unknown fragment", "key", fragment); + } else if (matches.length > 1) { + logger.throwArgumentError("ambiguous fragment matches function and error", "key", fragment); + } + + fragment = matches[0]; + } + + return dataSlice(id(fragment.format()), 0, 4); +} + */ + // Get the 32-byte topic hash used by Solidity to identify an event + /* + getEventTopic(fragment: EventFragment): string { + //if (typeof(fragment) === "string") { fragment = this.getEvent(eventFragment); } + return id(fragment.format()); + } + */ + _decodeParams(params, data) { + return __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(params, data); + } + _encodeParams(params, values) { + return __classPrivateFieldGet(this, _Interface_abiCoder, "f").encode(params, values); + } + /** + * Encodes a ``tx.data`` object for deploying the Contract with + * the %%values%% as the constructor arguments. + */ + encodeDeploy(values) { + return this._encodeParams(this.deploy.inputs, values || []); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified error (see [[getError]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeErrorResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + (0, index_js_3.assertArgument)(f, "unknown error", "fragment", fragment); + fragment = f; + } + (0, index_js_3.assertArgument)((0, index_js_3.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match error ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, (0, index_js_3.dataSlice)(data, 4)); + } + /** + * Encodes the transaction revert data for a call result that + * reverted from the the Contract with the sepcified %%error%% + * (see [[getError]] for valid values for %%fragment%%) with the %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeErrorResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getError(fragment); + (0, index_js_3.assertArgument)(f, "unknown error", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.concat)([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the %%data%% from a transaction ``tx.data`` for + * the function specified (see [[getFunction]] for valid values + * for %%fragment%%). + * + * Most developers should prefer the [[parseTransaction]] method + * instead, which will automatically detect the fragment. + */ + decodeFunctionData(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + (0, index_js_3.assertArgument)((0, index_js_3.dataSlice)(data, 0, 4) === fragment.selector, `data signature does not match function ${fragment.name}.`, "data", data); + return this._decodeParams(fragment.inputs, (0, index_js_3.dataSlice)(data, 4)); + } + /** + * Encodes the ``tx.data`` for a transaction that calls the function + * specified (see [[getFunction]] for valid values for %%fragment%%) with + * the %%values%%. + */ + encodeFunctionData(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.concat)([ + fragment.selector, + this._encodeParams(fragment.inputs, values || []) + ]); + } + /** + * Decodes the result %%data%% (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values for + * %%key%%). + * + * Most developers should prefer the [[parseCallResult]] method instead, + * which will automatically detect a ``CALL_EXCEPTION`` and throw the + * corresponding error. + */ + decodeFunctionResult(fragment, data) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + let message = "invalid length for result data"; + const bytes = (0, index_js_3.getBytesCopy)(data); + if ((bytes.length % 32) === 0) { + try { + return __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(fragment.outputs, bytes); + } + catch (error) { + message = "could not decode result data"; + } + } + // Call returned data with no error, but the data is junk + (0, index_js_3.assert)(false, message, "BAD_DATA", { + value: (0, index_js_3.hexlify)(bytes), + info: { method: fragment.name, signature: fragment.format() } + }); + } + makeError(_data, tx) { + const data = (0, index_js_3.getBytes)(_data, "data"); + const error = abi_coder_js_1.AbiCoder.getBuiltinCallException("call", tx, data); + // Not a built-in error; try finding a custom error + const customPrefix = "execution reverted (unknown custom error)"; + if (error.message.startsWith(customPrefix)) { + const selector = (0, index_js_3.hexlify)(data.slice(0, 4)); + const ef = this.getError(selector); + if (ef) { + try { + const args = __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(ef.inputs, data.slice(4)); + error.revert = { + name: ef.name, signature: ef.format(), args + }; + error.reason = error.revert.signature; + error.message = `execution reverted: ${error.reason}`; + } + catch (e) { + error.message = `execution reverted (coult not decode custom error)`; + } + } + } + // Add the invocation, if available + const parsed = this.parseTransaction(tx); + if (parsed) { + error.invocation = { + method: parsed.name, + signature: parsed.signature, + args: parsed.args + }; + } + return error; + } + /** + * Encodes the result data (e.g. from an ``eth_call``) for the + * specified function (see [[getFunction]] for valid values + * for %%fragment%%) with %%values%%. + * + * This is generally not used by most developers, unless trying to mock + * a result from a Contract. + */ + encodeFunctionResult(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getFunction(fragment); + (0, index_js_3.assertArgument)(f, "unknown function", "fragment", fragment); + fragment = f; + } + return (0, index_js_3.hexlify)(__classPrivateFieldGet(this, _Interface_abiCoder, "f").encode(fragment.outputs, values || [])); + } + /* + spelunk(inputs: Array, values: ReadonlyArray, processfunc: (type: string, value: any) => Promise): Promise> { + const promises: Array> = [ ]; + const process = function(type: ParamType, value: any): any { + if (type.baseType === "array") { + return descend(type.child + } + if (type. === "address") { + } + }; + + const descend = function (inputs: Array, values: ReadonlyArray) { + if (inputs.length !== values.length) { throw new Error("length mismatch"); } + + }; + + const result: Array = [ ]; + values.forEach((value, index) => { + if (value == null) { + topics.push(null); + } else if (param.baseType === "array" || param.baseType === "tuple") { + logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value); + } else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } else { + topics.push(encodeTopic(param, value)); + } + }); + } + */ + // Create the filter for the event with search criteria (e.g. for eth_filterLog) + encodeFilterTopics(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + (0, index_js_3.assert)(values.length <= fragment.inputs.length, `too many arguments for ${fragment.format()}`, "UNEXPECTED_ARGUMENT", { count: values.length, expectedCount: fragment.inputs.length }); + const topics = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + // @TODO: Use the coders for this; to properly support tuples, etc. + const encodeTopic = (param, value) => { + if (param.type === "string") { + return (0, index_js_2.id)(value); + } + else if (param.type === "bytes") { + return (0, index_js_1.keccak256)((0, index_js_3.hexlify)(value)); + } + if (param.type === "bool" && typeof (value) === "boolean") { + value = (value ? "0x01" : "0x00"); + } + else if (param.type.match(/^u?int/)) { + value = (0, index_js_3.toBeHex)(value); // @TODO: Should this toTwos?? + } + else if (param.type.match(/^bytes/)) { + value = (0, index_js_3.zeroPadBytes)(value, 32); + } + else if (param.type === "address") { + // Check addresses are valid + __classPrivateFieldGet(this, _Interface_abiCoder, "f").encode(["address"], [value]); + } + return (0, index_js_3.zeroPadValue)((0, index_js_3.hexlify)(value), 32); + }; + values.forEach((value, index) => { + const param = fragment.inputs[index]; + if (!param.indexed) { + (0, index_js_3.assertArgument)(value == null, "cannot filter non-indexed parameters; must be null", ("contract." + param.name), value); + return; + } + if (value == null) { + topics.push(null); + } + else if (param.baseType === "array" || param.baseType === "tuple") { + (0, index_js_3.assertArgument)(false, "filtering with tuples or arrays not supported", ("contract." + param.name), value); + } + else if (Array.isArray(value)) { + topics.push(value.map((value) => encodeTopic(param, value))); + } + else { + topics.push(encodeTopic(param, value)); + } + }); + // Trim off trailing nulls + while (topics.length && topics[topics.length - 1] === null) { + topics.pop(); + } + return topics; + } + encodeEventLog(fragment, values) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + const topics = []; + const dataTypes = []; + const dataValues = []; + if (!fragment.anonymous) { + topics.push(fragment.topicHash); + } + (0, index_js_3.assertArgument)(values.length === fragment.inputs.length, "event arguments/values mismatch", "values", values); + fragment.inputs.forEach((param, index) => { + const value = values[index]; + if (param.indexed) { + if (param.type === "string") { + topics.push((0, index_js_2.id)(value)); + } + else if (param.type === "bytes") { + topics.push((0, index_js_1.keccak256)(value)); + } + else if (param.baseType === "tuple" || param.baseType === "array") { + // @TODO + throw new Error("not implemented"); + } + else { + topics.push(__classPrivateFieldGet(this, _Interface_abiCoder, "f").encode([param.type], [value])); + } + } + else { + dataTypes.push(param); + dataValues.push(value); + } + }); + return { + data: __classPrivateFieldGet(this, _Interface_abiCoder, "f").encode(dataTypes, dataValues), + topics: topics + }; + } + // Decode a filter for the event and the search criteria + decodeEventLog(fragment, data, topics) { + if (typeof (fragment) === "string") { + const f = this.getEvent(fragment); + (0, index_js_3.assertArgument)(f, "unknown event", "eventFragment", fragment); + fragment = f; + } + if (topics != null && !fragment.anonymous) { + const eventTopic = fragment.topicHash; + (0, index_js_3.assertArgument)((0, index_js_3.isHexString)(topics[0], 32) && topics[0].toLowerCase() === eventTopic, "fragment/topic mismatch", "topics[0]", topics[0]); + topics = topics.slice(1); + } + const indexed = []; + const nonIndexed = []; + const dynamic = []; + fragment.inputs.forEach((param, index) => { + if (param.indexed) { + if (param.type === "string" || param.type === "bytes" || param.baseType === "tuple" || param.baseType === "array") { + indexed.push(fragments_js_1.ParamType.from({ type: "bytes32", name: param.name })); + dynamic.push(true); + } + else { + indexed.push(param); + dynamic.push(false); + } + } + else { + nonIndexed.push(param); + dynamic.push(false); + } + }); + const resultIndexed = (topics != null) ? __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(indexed, (0, index_js_3.concat)(topics)) : null; + const resultNonIndexed = __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(nonIndexed, data, true); + //const result: (Array & { [ key: string ]: any }) = [ ]; + const values = []; + const keys = []; + let nonIndexedIndex = 0, indexedIndex = 0; + fragment.inputs.forEach((param, index) => { + let value = null; + if (param.indexed) { + if (resultIndexed == null) { + value = new Indexed(null); + } + else if (dynamic[index]) { + value = new Indexed(resultIndexed[indexedIndex++]); + } + else { + try { + value = resultIndexed[indexedIndex++]; + } + catch (error) { + value = error; + } + } + } + else { + try { + value = resultNonIndexed[nonIndexedIndex++]; + } + catch (error) { + value = error; + } + } + values.push(value); + keys.push(param.name || null); + }); + return abstract_coder_js_1.Result.fromItems(values, keys); + } + /** + * Parses a transaction, finding the matching function and extracts + * the parameter values along with other useful function details. + * + * If the matching function cannot be found, return null. + */ + parseTransaction(tx) { + const data = (0, index_js_3.getBytes)(tx.data, "tx.data"); + const value = (0, index_js_3.getBigInt)((tx.value != null) ? tx.value : 0, "tx.value"); + const fragment = this.getFunction((0, index_js_3.hexlify)(data.slice(0, 4))); + if (!fragment) { + return null; + } + const args = __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(fragment.inputs, data.slice(4)); + return new TransactionDescription(fragment, fragment.selector, args, value); + } + parseCallResult(data) { + throw new Error("@TODO"); + } + /** + * Parses a receipt log, finding the matching event and extracts + * the parameter values along with other useful event details. + * + * If the matching event cannot be found, returns null. + */ + parseLog(log) { + const fragment = this.getEvent(log.topics[0]); + if (!fragment || fragment.anonymous) { + return null; + } + // @TODO: If anonymous, and the only method, and the input count matches, should we parse? + // Probably not, because just because it is the only event in the ABI does + // not mean we have the full ABI; maybe just a fragment? + return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics)); + } + /** + * Parses a revert data, finding the matching error and extracts + * the parameter values along with other useful error details. + * + * If the matching error cannot be found, returns null. + */ + parseError(data) { + const hexData = (0, index_js_3.hexlify)(data); + const fragment = this.getError((0, index_js_3.dataSlice)(hexData, 0, 4)); + if (!fragment) { + return null; + } + const args = __classPrivateFieldGet(this, _Interface_abiCoder, "f").decode(fragment.inputs, (0, index_js_3.dataSlice)(hexData, 4)); + return new ErrorDescription(fragment, fragment.selector, args); + } + /** + * Creates a new [[Interface]] from the ABI %%value%%. + * + * The %%value%% may be provided as an existing [[Interface]] object, + * a JSON-encoded ABI or any Human-Readable ABI format. + */ + static from(value) { + // Already an Interface, which is immutable + if (value instanceof Interface) { + return value; + } + // JSON + if (typeof (value) === "string") { + return new Interface(JSON.parse(value)); + } + // Maybe an interface from an older version, or from a symlinked copy + if (typeof (value.format) === "function") { + return new Interface(value.format("json")); + } + // Array of fragments + return new Interface(value); + } +} +exports.Interface = Interface; +_Interface_errors = new WeakMap(), _Interface_events = new WeakMap(), _Interface_functions = new WeakMap(), _Interface_abiCoder = new WeakMap(), _Interface_instances = new WeakSet(), _Interface_getFunction = function _Interface_getFunction(key, values, forceUnique) { + // Selector + if ((0, index_js_3.isHexString)(key)) { + const selector = key.toLowerCase(); + for (const fragment of __classPrivateFieldGet(this, _Interface_functions, "f").values()) { + if (selector === fragment.selector) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of __classPrivateFieldGet(this, _Interface_functions, "f")) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + const lastValue = (values.length > 0) ? values[values.length - 1] : null; + let valueLength = values.length; + let allowOptions = true; + if (typed_js_1.Typed.isTyped(lastValue) && lastValue.type === "overrides") { + allowOptions = false; + valueLength--; + } + // Remove all matches that don't have a compatible length. The args + // may contain an overrides, so the match may have n or n - 1 parameters + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs.length; + if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!typed_js_1.Typed.isTyped(values[j])) { + continue; + } + // We are past the inputs + if (j >= inputs.length) { + if (values[j].type === "overrides") { + continue; + } + matching.splice(i, 1); + break; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + // We found a single matching signature with an overrides, but the + // last value is something that cannot possibly be an options + if (matching.length === 1 && values && values.length !== matching[0].inputs.length) { + const lastArg = values[values.length - 1]; + if (lastArg == null || Array.isArray(lastArg) || typeof (lastArg) !== "object") { + matching.splice(0, 1); + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous function description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = __classPrivateFieldGet(this, _Interface_functions, "f").get(fragments_js_1.FunctionFragment.from(key).format()); + if (result) { + return result; + } + return null; +}, _Interface_getEvent = function _Interface_getEvent(key, values, forceUnique) { + // EventTopic + if ((0, index_js_3.isHexString)(key)) { + const eventTopic = key.toLowerCase(); + for (const fragment of __classPrivateFieldGet(this, _Interface_events, "f").values()) { + if (eventTopic === fragment.topicHash) { + return fragment; + } + } + return null; + } + // It is a bare name, look up the function (will return null if ambiguous) + if (key.indexOf("(") === -1) { + const matching = []; + for (const [name, fragment] of __classPrivateFieldGet(this, _Interface_events, "f")) { + if (name.split("(" /* fix:) */)[0] === key) { + matching.push(fragment); + } + } + if (values) { + // Remove all matches that don't have a compatible length. + for (let i = matching.length - 1; i >= 0; i--) { + if (matching[i].inputs.length < values.length) { + matching.splice(i, 1); + } + } + // Remove all matches that don't match the Typed signature + for (let i = matching.length - 1; i >= 0; i--) { + const inputs = matching[i].inputs; + for (let j = 0; j < values.length; j++) { + // Not a typed value + if (!typed_js_1.Typed.isTyped(values[j])) { + continue; + } + // Make sure the value type matches the input type + if (values[j].type !== inputs[j].baseType) { + matching.splice(i, 1); + break; + } + } + } + } + if (matching.length === 0) { + return null; + } + if (matching.length > 1 && forceUnique) { + const matchStr = matching.map((m) => JSON.stringify(m.format())).join(", "); + (0, index_js_3.assertArgument)(false, `ambiguous event description (i.e. matches ${matchStr})`, "key", key); + } + return matching[0]; + } + // Normalize the signature and lookup the function + const result = __classPrivateFieldGet(this, _Interface_events, "f").get(fragments_js_1.EventFragment.from(key).format()); + if (result) { + return result; + } + return null; +}; +//# sourceMappingURL=interface.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/interface.js.map b/dist/ethers.js/src.ts/abi/interface.js.map new file mode 100644 index 0000000..840d11e --- /dev/null +++ b/dist/ethers.js/src.ts/abi/interface.js.map @@ -0,0 +1 @@ +{"version":3,"file":"interface.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/interface.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;AAEH,iDAA8C;AAC9C,+CAAqC;AACrC,gDAI2B;AAE3B,iDAA0C;AAC1C,kEAAuE;AAY9D,kGAZA,qCAAiB,OAYA;AAAE,uFAZA,0BAAM,OAYA;AAXlC,iDAGwB;AACxB,yCAAmC;AASnC;;;GAGG;AACH,MAAa,cAAc;IA0BvB;;OAEG;IACH,YAAY,QAAuB,EAAE,KAAa,EAAE,IAAY;QAC5D,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC;QAC1D,IAAA,2BAAgB,EAAiB,IAAI,EAAE;YACnC,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI;SACzC,CAAC,CAAC;IACP,CAAC;CACJ;AAnCD,wCAmCC;AAED;;;;GAIG;AACH,MAAa,sBAAsB;IA+B/B;;OAEG;IACH,YAAY,QAA0B,EAAE,QAAgB,EAAE,IAAY,EAAE,KAAa;QACjF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,QAAQ,CA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E,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAC5E,IAAA,yBAAc,EAAC,KAAK,EAAE,6CAA8C,QAAS,GAAG,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;SACjG;QAED,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC;KACtB;IAED,kDAAkD;IAClD,MAAM,MAAM,GAAG,uBAAA,IAAI,yBAAQ,CAAC,GAAG,CAAC,4BAAa,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC;IAClE,IAAI,MAAM,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IAE9B,OAAO,IAAI,CAAC;AAChB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/typed.d.ts b/dist/ethers.js/src.ts/abi/typed.d.ts new file mode 100644 index 0000000..8707a62 --- /dev/null +++ b/dist/ethers.js/src.ts/abi/typed.d.ts @@ -0,0 +1,570 @@ +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +import type { Addressable } from "../address/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { Result } from "./coders/abstract-coder.js"; +/** + * @_ignore: + */ +export interface TypedNumber extends Typed { + value: number; + defaultValue(): number; + minValue(): number; + maxValue(): number; +} +/** + * A **Typed** that represents a numeric value. + */ +export interface TypedBigInt extends Typed { + /** + * The value. + */ + value: bigint; + /** + * The default value for all numeric types is ``0``. + */ + defaultValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width and signed-ness. + */ + minValue(): bigint; + /** + * The minimum value for this type, accounting for bit-width. + */ + maxValue(): bigint; +} +/** + * A **Typed** that represents a binary sequence of data as bytes. + */ +export interface TypedData extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for this type. + */ + defaultValue(): string; +} +/** + * A **Typed** that represents a UTF-8 sequence of bytes. + */ +export interface TypedString extends Typed { + /** + * The value. + */ + value: string; + /** + * The default value for the string type is the empty string (i.e. ``""``). + */ + defaultValue(): string; +} +/** + * The **Typed** class to wrap values providing explicit type information. + */ +export declare class Typed { + #private; + /** + * The type, as a Solidity-compatible type. + */ + readonly type: string; + /** + * The actual value. + */ + readonly value: any; + /** + * @_ignore: + */ + readonly _typedSymbol: Symbol; + /** + * @_ignore: + */ + constructor(gaurd: any, type: string, value: any, options?: any); + /** + * Format the type as a Human-Readable type. + */ + format(): string; + /** + * The default value returned by this type. + */ + defaultValue(): string | number | bigint | Result; + /** + * The minimum value for numeric types. + */ + minValue(): string | number | bigint; + /** + * The maximum value for numeric types. + */ + maxValue(): string | number | bigint; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt(): this is TypedBigInt; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData(): this is TypedData; + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString(): this is TypedString; + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName(): null | string; + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength(): null | number; + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type: string, value: any): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v: BigNumberish): Typed; + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v: BigNumberish): Typed; + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v: BigNumberish): Typed; + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v: BigNumberish): Typed; + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v: BigNumberish): Typed; + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v: BigNumberish): Typed; + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v: BigNumberish): Typed; + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v: BigNumberish): Typed; + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v: BigNumberish): Typed; + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v: BigNumberish): Typed; + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v: BigNumberish): Typed; + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v: BigNumberish): Typed; + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v: BigNumberish): Typed; + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v: BigNumberish): Typed; + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v: BigNumberish): Typed; + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v: BigNumberish): Typed; + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v: BigNumberish): Typed; + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v: BigNumberish): Typed; + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v: BigNumberish): Typed; + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v: BigNumberish): Typed; + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v: BigNumberish): Typed; + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v: BigNumberish): Typed; + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v: BigNumberish): Typed; + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v: BigNumberish): Typed; + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v: BigNumberish): Typed; + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v: BigNumberish): Typed; + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v: BigNumberish): Typed; + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v: BigNumberish): Typed; + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v: BigNumberish): Typed; + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v: BigNumberish): Typed; + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v: BigNumberish): Typed; + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v: BigNumberish): Typed; + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v: BigNumberish): Typed; + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v: BigNumberish): Typed; + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v: BigNumberish): Typed; + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v: BigNumberish): Typed; + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v: BigNumberish): Typed; + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v: BigNumberish): Typed; + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v: BigNumberish): Typed; + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v: BigNumberish): Typed; + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v: BigNumberish): Typed; + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v: BigNumberish): Typed; + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v: BigNumberish): Typed; + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v: BigNumberish): Typed; + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v: BigNumberish): Typed; + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v: BigNumberish): Typed; + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v: BigNumberish): Typed; + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v: BigNumberish): Typed; + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v: BigNumberish): Typed; + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v: BigNumberish): Typed; + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v: BigNumberish): Typed; + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v: BigNumberish): Typed; + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v: BigNumberish): Typed; + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v: BigNumberish): Typed; + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v: BigNumberish): Typed; + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v: BigNumberish): Typed; + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v: BigNumberish): Typed; + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v: BigNumberish): Typed; + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v: BigNumberish): Typed; + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v: BigNumberish): Typed; + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v: BigNumberish): Typed; + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v: BigNumberish): Typed; + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v: BigNumberish): Typed; + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v: BigNumberish): Typed; + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v: BytesLike): Typed; + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v: BytesLike): Typed; + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v: BytesLike): Typed; + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v: BytesLike): Typed; + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v: BytesLike): Typed; + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v: BytesLike): Typed; + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v: BytesLike): Typed; + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v: BytesLike): Typed; + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v: BytesLike): Typed; + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v: BytesLike): Typed; + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v: BytesLike): Typed; + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v: BytesLike): Typed; + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v: BytesLike): Typed; + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v: BytesLike): Typed; + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v: BytesLike): Typed; + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v: BytesLike): Typed; + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v: BytesLike): Typed; + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v: BytesLike): Typed; + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v: BytesLike): Typed; + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v: BytesLike): Typed; + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v: BytesLike): Typed; + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v: BytesLike): Typed; + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v: BytesLike): Typed; + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v: BytesLike): Typed; + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v: BytesLike): Typed; + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v: BytesLike): Typed; + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v: BytesLike): Typed; + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v: BytesLike): Typed; + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v: BytesLike): Typed; + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v: BytesLike): Typed; + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v: BytesLike): Typed; + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v: BytesLike): Typed; + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v: string | Addressable): Typed; + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v: any): Typed; + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v: BytesLike): Typed; + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v: string): Typed; + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v: Array, dynamic?: null | boolean): Typed; + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v: Array | Record, name?: string): Typed; + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v: Record): Typed; + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value: any): value is Typed; + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value: Typed | T, type: string): T; +} +//# sourceMappingURL=typed.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/typed.d.ts.map b/dist/ethers.js/src.ts/abi/typed.d.ts.map new file mode 100644 index 0000000..cf2310d --- /dev/null +++ b/dist/ethers.js/src.ts/abi/typed.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/abi/typed.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEjE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,4BAA4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AEG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK;IAEnC;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK;IAGnC;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,KAAK;IAE9C;;OAEG;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,GAAG,KAAK;IAE1B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,SAAS,GAAG,KAAK;IAEjC;;OAEG;IACH,MAAM,CAAC,MAAM,CAAC,CAAC,EAAE,MAAM,GAAG,KAAK;IAG/B;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,EAAE,IAAI,GAAG,OAAO,GAAG,KAAK;IAMpE;;OAEG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,KAAK;IAMvF;;OAEG;IACH,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,KAAK;IAI/C;;OAEG;IACH,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,KAAK;IAO1C;;;;;;OAMG;IACH,MAAM,CAAC,WAAW,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,GAAG,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC;CAS3D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/typed.js b/dist/ethers.js/src.ts/abi/typed.js new file mode 100644 index 0000000..89b90fc --- /dev/null +++ b/dist/ethers.js/src.ts/abi/typed.js @@ -0,0 +1,607 @@ +"use strict"; +/** + * A Typed object allows a value to have its type explicitly + * specified. + * + * For example, in Solidity, the value ``45`` could represent a + * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent + * a ``bytes2`` or ``bytes``. + * + * Since JavaScript has no meaningful way to explicitly inform any + * APIs which what the type is, this allows transparent interoperation + * with Soldity. + * + * @_subsection: api/abi:Typed Values + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Typed_options; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Typed = void 0; +const index_js_1 = require("../utils/index.js"); +const _gaurd = {}; +function n(value, width) { + let signed = false; + if (width < 0) { + signed = true; + width *= -1; + } + // @TODO: Check range is valid for value + return new Typed(_gaurd, `${signed ? "" : "u"}int${width}`, value, { signed, width }); +} +function b(value, size) { + // @TODO: Check range is valid for value + return new Typed(_gaurd, `bytes${(size) ? size : ""}`, value, { size }); +} +const _typedSymbol = Symbol.for("_ethers_typed"); +/** + * The **Typed** class to wrap values providing explicit type information. + */ +class Typed { + /** + * @_ignore: + */ + constructor(gaurd, type, value, options) { + _Typed_options.set(this, void 0); + if (options == null) { + options = null; + } + (0, index_js_1.assertPrivate)(_gaurd, gaurd, "Typed"); + (0, index_js_1.defineProperties)(this, { _typedSymbol, type, value }); + __classPrivateFieldSet(this, _Typed_options, options, "f"); + // Check the value is valid + this.format(); + } + /** + * Format the type as a Human-Readable type. + */ + format() { + if (this.type === "array") { + throw new Error(""); + } + else if (this.type === "dynamicArray") { + throw new Error(""); + } + else if (this.type === "tuple") { + return `tuple(${this.value.map((v) => v.format()).join(",")})`; + } + return this.type; + } + /** + * The default value returned by this type. + */ + defaultValue() { + return 0; + } + /** + * The minimum value for numeric types. + */ + minValue() { + return 0; + } + /** + * The maximum value for numeric types. + */ + maxValue() { + return 0; + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]]. + */ + isBigInt() { + return !!(this.type.match(/^u?int[0-9]+$/)); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedData]]. + */ + isData() { + return this.type.startsWith("bytes"); + } + /** + * Returns ``true`` and provides a type guard is this is a [[TypedString]]. + */ + isString() { + return (this.type === "string"); + } + /** + * Returns the tuple name, if this is a tuple. Throws otherwise. + */ + get tupleName() { + if (this.type !== "tuple") { + throw TypeError("not a tuple"); + } + return __classPrivateFieldGet(this, _Typed_options, "f"); + } + // Returns the length of this type as an array + // - `null` indicates the length is unforced, it could be dynamic + // - `-1` indicates the length is dynamic + // - any other value indicates it is a static array and is its length + /** + * Returns the length of the array type or ``-1`` if it is dynamic. + * + * Throws if the type is not an array. + */ + get arrayLength() { + if (this.type !== "array") { + throw TypeError("not an array"); + } + if (__classPrivateFieldGet(this, _Typed_options, "f") === true) { + return -1; + } + if (__classPrivateFieldGet(this, _Typed_options, "f") === false) { + return (this.value).length; + } + return null; + } + /** + * Returns a new **Typed** of %%type%% with the %%value%%. + */ + static from(type, value) { + return new Typed(_gaurd, type, value); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static uint8(v) { return n(v, 8); } + /** + * Return a new ``uint16`` type for %%v%%. + */ + static uint16(v) { return n(v, 16); } + /** + * Return a new ``uint24`` type for %%v%%. + */ + static uint24(v) { return n(v, 24); } + /** + * Return a new ``uint32`` type for %%v%%. + */ + static uint32(v) { return n(v, 32); } + /** + * Return a new ``uint40`` type for %%v%%. + */ + static uint40(v) { return n(v, 40); } + /** + * Return a new ``uint48`` type for %%v%%. + */ + static uint48(v) { return n(v, 48); } + /** + * Return a new ``uint56`` type for %%v%%. + */ + static uint56(v) { return n(v, 56); } + /** + * Return a new ``uint64`` type for %%v%%. + */ + static uint64(v) { return n(v, 64); } + /** + * Return a new ``uint72`` type for %%v%%. + */ + static uint72(v) { return n(v, 72); } + /** + * Return a new ``uint80`` type for %%v%%. + */ + static uint80(v) { return n(v, 80); } + /** + * Return a new ``uint88`` type for %%v%%. + */ + static uint88(v) { return n(v, 88); } + /** + * Return a new ``uint96`` type for %%v%%. + */ + static uint96(v) { return n(v, 96); } + /** + * Return a new ``uint104`` type for %%v%%. + */ + static uint104(v) { return n(v, 104); } + /** + * Return a new ``uint112`` type for %%v%%. + */ + static uint112(v) { return n(v, 112); } + /** + * Return a new ``uint120`` type for %%v%%. + */ + static uint120(v) { return n(v, 120); } + /** + * Return a new ``uint128`` type for %%v%%. + */ + static uint128(v) { return n(v, 128); } + /** + * Return a new ``uint136`` type for %%v%%. + */ + static uint136(v) { return n(v, 136); } + /** + * Return a new ``uint144`` type for %%v%%. + */ + static uint144(v) { return n(v, 144); } + /** + * Return a new ``uint152`` type for %%v%%. + */ + static uint152(v) { return n(v, 152); } + /** + * Return a new ``uint160`` type for %%v%%. + */ + static uint160(v) { return n(v, 160); } + /** + * Return a new ``uint168`` type for %%v%%. + */ + static uint168(v) { return n(v, 168); } + /** + * Return a new ``uint176`` type for %%v%%. + */ + static uint176(v) { return n(v, 176); } + /** + * Return a new ``uint184`` type for %%v%%. + */ + static uint184(v) { return n(v, 184); } + /** + * Return a new ``uint192`` type for %%v%%. + */ + static uint192(v) { return n(v, 192); } + /** + * Return a new ``uint200`` type for %%v%%. + */ + static uint200(v) { return n(v, 200); } + /** + * Return a new ``uint208`` type for %%v%%. + */ + static uint208(v) { return n(v, 208); } + /** + * Return a new ``uint216`` type for %%v%%. + */ + static uint216(v) { return n(v, 216); } + /** + * Return a new ``uint224`` type for %%v%%. + */ + static uint224(v) { return n(v, 224); } + /** + * Return a new ``uint232`` type for %%v%%. + */ + static uint232(v) { return n(v, 232); } + /** + * Return a new ``uint240`` type for %%v%%. + */ + static uint240(v) { return n(v, 240); } + /** + * Return a new ``uint248`` type for %%v%%. + */ + static uint248(v) { return n(v, 248); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint256(v) { return n(v, 256); } + /** + * Return a new ``uint256`` type for %%v%%. + */ + static uint(v) { return n(v, 256); } + /** + * Return a new ``int8`` type for %%v%%. + */ + static int8(v) { return n(v, -8); } + /** + * Return a new ``int16`` type for %%v%%. + */ + static int16(v) { return n(v, -16); } + /** + * Return a new ``int24`` type for %%v%%. + */ + static int24(v) { return n(v, -24); } + /** + * Return a new ``int32`` type for %%v%%. + */ + static int32(v) { return n(v, -32); } + /** + * Return a new ``int40`` type for %%v%%. + */ + static int40(v) { return n(v, -40); } + /** + * Return a new ``int48`` type for %%v%%. + */ + static int48(v) { return n(v, -48); } + /** + * Return a new ``int56`` type for %%v%%. + */ + static int56(v) { return n(v, -56); } + /** + * Return a new ``int64`` type for %%v%%. + */ + static int64(v) { return n(v, -64); } + /** + * Return a new ``int72`` type for %%v%%. + */ + static int72(v) { return n(v, -72); } + /** + * Return a new ``int80`` type for %%v%%. + */ + static int80(v) { return n(v, -80); } + /** + * Return a new ``int88`` type for %%v%%. + */ + static int88(v) { return n(v, -88); } + /** + * Return a new ``int96`` type for %%v%%. + */ + static int96(v) { return n(v, -96); } + /** + * Return a new ``int104`` type for %%v%%. + */ + static int104(v) { return n(v, -104); } + /** + * Return a new ``int112`` type for %%v%%. + */ + static int112(v) { return n(v, -112); } + /** + * Return a new ``int120`` type for %%v%%. + */ + static int120(v) { return n(v, -120); } + /** + * Return a new ``int128`` type for %%v%%. + */ + static int128(v) { return n(v, -128); } + /** + * Return a new ``int136`` type for %%v%%. + */ + static int136(v) { return n(v, -136); } + /** + * Return a new ``int144`` type for %%v%%. + */ + static int144(v) { return n(v, -144); } + /** + * Return a new ``int52`` type for %%v%%. + */ + static int152(v) { return n(v, -152); } + /** + * Return a new ``int160`` type for %%v%%. + */ + static int160(v) { return n(v, -160); } + /** + * Return a new ``int168`` type for %%v%%. + */ + static int168(v) { return n(v, -168); } + /** + * Return a new ``int176`` type for %%v%%. + */ + static int176(v) { return n(v, -176); } + /** + * Return a new ``int184`` type for %%v%%. + */ + static int184(v) { return n(v, -184); } + /** + * Return a new ``int92`` type for %%v%%. + */ + static int192(v) { return n(v, -192); } + /** + * Return a new ``int200`` type for %%v%%. + */ + static int200(v) { return n(v, -200); } + /** + * Return a new ``int208`` type for %%v%%. + */ + static int208(v) { return n(v, -208); } + /** + * Return a new ``int216`` type for %%v%%. + */ + static int216(v) { return n(v, -216); } + /** + * Return a new ``int224`` type for %%v%%. + */ + static int224(v) { return n(v, -224); } + /** + * Return a new ``int232`` type for %%v%%. + */ + static int232(v) { return n(v, -232); } + /** + * Return a new ``int240`` type for %%v%%. + */ + static int240(v) { return n(v, -240); } + /** + * Return a new ``int248`` type for %%v%%. + */ + static int248(v) { return n(v, -248); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int256(v) { return n(v, -256); } + /** + * Return a new ``int256`` type for %%v%%. + */ + static int(v) { return n(v, -256); } + /** + * Return a new ``bytes1`` type for %%v%%. + */ + static bytes1(v) { return b(v, 1); } + /** + * Return a new ``bytes2`` type for %%v%%. + */ + static bytes2(v) { return b(v, 2); } + /** + * Return a new ``bytes3`` type for %%v%%. + */ + static bytes3(v) { return b(v, 3); } + /** + * Return a new ``bytes4`` type for %%v%%. + */ + static bytes4(v) { return b(v, 4); } + /** + * Return a new ``bytes5`` type for %%v%%. + */ + static bytes5(v) { return b(v, 5); } + /** + * Return a new ``bytes6`` type for %%v%%. + */ + static bytes6(v) { return b(v, 6); } + /** + * Return a new ``bytes7`` type for %%v%%. + */ + static bytes7(v) { return b(v, 7); } + /** + * Return a new ``bytes8`` type for %%v%%. + */ + static bytes8(v) { return b(v, 8); } + /** + * Return a new ``bytes9`` type for %%v%%. + */ + static bytes9(v) { return b(v, 9); } + /** + * Return a new ``bytes10`` type for %%v%%. + */ + static bytes10(v) { return b(v, 10); } + /** + * Return a new ``bytes11`` type for %%v%%. + */ + static bytes11(v) { return b(v, 11); } + /** + * Return a new ``bytes12`` type for %%v%%. + */ + static bytes12(v) { return b(v, 12); } + /** + * Return a new ``bytes13`` type for %%v%%. + */ + static bytes13(v) { return b(v, 13); } + /** + * Return a new ``bytes14`` type for %%v%%. + */ + static bytes14(v) { return b(v, 14); } + /** + * Return a new ``bytes15`` type for %%v%%. + */ + static bytes15(v) { return b(v, 15); } + /** + * Return a new ``bytes16`` type for %%v%%. + */ + static bytes16(v) { return b(v, 16); } + /** + * Return a new ``bytes17`` type for %%v%%. + */ + static bytes17(v) { return b(v, 17); } + /** + * Return a new ``bytes18`` type for %%v%%. + */ + static bytes18(v) { return b(v, 18); } + /** + * Return a new ``bytes19`` type for %%v%%. + */ + static bytes19(v) { return b(v, 19); } + /** + * Return a new ``bytes20`` type for %%v%%. + */ + static bytes20(v) { return b(v, 20); } + /** + * Return a new ``bytes21`` type for %%v%%. + */ + static bytes21(v) { return b(v, 21); } + /** + * Return a new ``bytes22`` type for %%v%%. + */ + static bytes22(v) { return b(v, 22); } + /** + * Return a new ``bytes23`` type for %%v%%. + */ + static bytes23(v) { return b(v, 23); } + /** + * Return a new ``bytes24`` type for %%v%%. + */ + static bytes24(v) { return b(v, 24); } + /** + * Return a new ``bytes25`` type for %%v%%. + */ + static bytes25(v) { return b(v, 25); } + /** + * Return a new ``bytes26`` type for %%v%%. + */ + static bytes26(v) { return b(v, 26); } + /** + * Return a new ``bytes27`` type for %%v%%. + */ + static bytes27(v) { return b(v, 27); } + /** + * Return a new ``bytes28`` type for %%v%%. + */ + static bytes28(v) { return b(v, 28); } + /** + * Return a new ``bytes29`` type for %%v%%. + */ + static bytes29(v) { return b(v, 29); } + /** + * Return a new ``bytes30`` type for %%v%%. + */ + static bytes30(v) { return b(v, 30); } + /** + * Return a new ``bytes31`` type for %%v%%. + */ + static bytes31(v) { return b(v, 31); } + /** + * Return a new ``bytes32`` type for %%v%%. + */ + static bytes32(v) { return b(v, 32); } + /** + * Return a new ``address`` type for %%v%%. + */ + static address(v) { return new Typed(_gaurd, "address", v); } + /** + * Return a new ``bool`` type for %%v%%. + */ + static bool(v) { return new Typed(_gaurd, "bool", !!v); } + /** + * Return a new ``bytes`` type for %%v%%. + */ + static bytes(v) { return new Typed(_gaurd, "bytes", v); } + /** + * Return a new ``string`` type for %%v%%. + */ + static string(v) { return new Typed(_gaurd, "string", v); } + /** + * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length. + */ + static array(v, dynamic) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "array", v, dynamic); + } + /** + * Return a new ``tuple`` type for %%v%%, with the optional %%name%%. + */ + static tuple(v, name) { + throw new Error("not implemented yet"); + return new Typed(_gaurd, "tuple", v, name); + } + /** + * Return a new ``uint8`` type for %%v%%. + */ + static overrides(v) { + return new Typed(_gaurd, "overrides", Object.assign({}, v)); + } + /** + * Returns true only if %%value%% is a [[Typed]] instance. + */ + static isTyped(value) { + return (value + && typeof (value) === "object" + && "_typedSymbol" in value + && value._typedSymbol === _typedSymbol); + } + /** + * If the value is a [[Typed]] instance, validates the underlying value + * and returns it, otherwise returns value directly. + * + * This is useful for functions that with to accept either a [[Typed]] + * object or values. + */ + static dereference(value, type) { + if (Typed.isTyped(value)) { + if (value.type !== type) { + throw new Error(`invalid type: expecetd ${type}, got ${value.type}`); + } + return value.value; + } + return value; + } +} +exports.Typed = Typed; +_Typed_options = new WeakMap(); +//# sourceMappingURL=typed.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/abi/typed.js.map b/dist/ethers.js/src.ts/abi/typed.js.map new file mode 100644 index 0000000..22e0629 --- /dev/null +++ b/dist/ethers.js/src.ts/ab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AAC,KAAK,CAAC,EAAE;YACtB,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE;gBACrB,MAAM,IAAI,KAAK,CAAC,0BAA2B,IAAK,SAAU,KAAK,CAAC,IAAK,EAAE,CAAC,CAAC;aAC5E;YACD,OAAO,KAAK,CAAC,KAAK,CAAC;SACtB;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA5qBD,sBA4qBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/address.d.ts b/dist/ethers.js/src.ts/address/address.d.ts new file mode 100644 index 0000000..581be4f --- /dev/null +++ b/dist/ethers.js/src.ts/address/address.d.ts @@ -0,0 +1,56 @@ +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +export declare function getAddress(address: string): string; +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +export declare function getIcapAddress(address: string): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/address.d.ts.map b/dist/ethers.js/src.ts/address/address.d.ts.map new file mode 100644 index 0000000..0c26a5a --- /dev/null +++ b/dist/ethers.js/src.ts/address/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/address.ts"],"names":[],"mappings":"AAmFA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CA6BlD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAKtD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/address.js b/dist/ethers.js/src.ts/address/address.js new file mode 100644 index 0000000..991c5dd --- /dev/null +++ b/dist/ethers.js/src.ts/address/address.js @@ -0,0 +1,161 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIcapAddress = exports.getAddress = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const BN_0 = BigInt(0); +const BN_36 = BigInt(36); +function getChecksumAddress(address) { + // if (!isHexString(address, 20)) { + // logger.throwArgumentError("invalid address", "address", address); + // } + address = address.toLowerCase(); + const chars = address.substring(2).split(""); + const expanded = new Uint8Array(40); + for (let i = 0; i < 40; i++) { + expanded[i] = chars[i].charCodeAt(0); + } + const hashed = (0, index_js_2.getBytes)((0, index_js_1.keccak256)(expanded)); + for (let i = 0; i < 40; i += 2) { + if ((hashed[i >> 1] >> 4) >= 8) { + chars[i] = chars[i].toUpperCase(); + } + if ((hashed[i >> 1] & 0x0f) >= 8) { + chars[i + 1] = chars[i + 1].toUpperCase(); + } + } + return "0x" + chars.join(""); +} +// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number +// Create lookup table +const ibanLookup = {}; +for (let i = 0; i < 10; i++) { + ibanLookup[String(i)] = String(i); +} +for (let i = 0; i < 26; i++) { + ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); +} +// How many decimal digits can we process? (for 64-bit float, this is 15) +// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER)); +const safeDigits = 15; +function ibanChecksum(address) { + address = address.toUpperCase(); + address = address.substring(4) + address.substring(0, 2) + "00"; + let expanded = address.split("").map((c) => { return ibanLookup[c]; }).join(""); + // Javascript can handle integers safely up to 15 (decimal) digits + while (expanded.length >= safeDigits) { + let block = expanded.substring(0, safeDigits); + expanded = parseInt(block, 10) % 97 + expanded.substring(block.length); + } + let checksum = String(98 - (parseInt(expanded, 10) % 97)); + while (checksum.length < 2) { + checksum = "0" + checksum; + } + return checksum; +} +; +const Base36 = (function () { + ; + const result = {}; + for (let i = 0; i < 36; i++) { + const key = "0123456789abcdefghijklmnopqrstuvwxyz"[i]; + result[key] = BigInt(i); + } + return result; +})(); +function fromBase36(value) { + value = value.toLowerCase(); + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result = result * BN_36 + Base36[value[i]]; + } + return result; +} +/** + * Returns a normalized and checksumed address for %%address%%. + * This accepts non-checksum addresses, checksum addresses and + * [[getIcapAddress]] formats. + * + * The checksum in Ethereum uses the capitalization (upper-case + * vs lower-case) of the characters within an address to encode + * its checksum, which offers, on average, a checksum of 15-bits. + * + * If %%address%% contains both upper-case and lower-case, it is + * assumed to already be a checksum address and its checksum is + * validated, and if the address fails its expected checksum an + * error is thrown. + * + * If you wish the checksum of %%address%% to be ignore, it should + * be converted to lower-case (i.e. ``.toLowercase()``) before + * being passed in. This should be a very rare situation though, + * that you wish to bypass the safegaurds in place to protect + * against an address that has been incorrectly copied from another + * source. + * + * @example: + * // Adds the checksum (via upper-casing specific letters) + * getAddress("0x8ba1f109551bd432803012645ac136ddd64dba72") + * //_result: + * + * // Converts ICAP address and adds checksum + * getAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if an address contains mixed case, + * // but the checksum fails + * getAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_error: + */ +function getAddress(address) { + (0, index_js_2.assertArgument)(typeof (address) === "string", "invalid address", "address", address); + if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) { + // Missing the 0x prefix + if (!address.startsWith("0x")) { + address = "0x" + address; + } + const result = getChecksumAddress(address); + // It is a checksummed address with a bad checksum + (0, index_js_2.assertArgument)(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address, "bad address checksum", "address", address); + return result; + } + // Maybe ICAP? (we only support direct mode) + if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) { + // It is an ICAP address with a bad checksum + (0, index_js_2.assertArgument)(address.substring(2, 4) === ibanChecksum(address), "bad icap checksum", "address", address); + let result = fromBase36(address.substring(4)).toString(16); + while (result.length < 40) { + result = "0" + result; + } + return getChecksumAddress("0x" + result); + } + (0, index_js_2.assertArgument)(false, "invalid address", "address", address); +} +exports.getAddress = getAddress; +/** + * The [ICAP Address format](link-icap) format is an early checksum + * format which attempts to be compatible with the banking + * industry [IBAN format](link-wiki-iban) for bank accounts. + * + * It is no longer common or a recommended format. + * + * @example: + * getIcapAddress("0x8ba1f109551bd432803012645ac136ddd64dba72"); + * //_result: + * + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36"); + * //_result: + * + * // Throws an error if the ICAP checksum is wrong + * getIcapAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37"); + * //_error: + */ +function getIcapAddress(address) { + //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase(); + let base36 = BigInt(getAddress(address)).toString(36).toUpperCase(); + while (base36.length < 30) { + base36 = "0" + base36; + } + return "XE" + ibanChecksum("XE00" + base36) + base36; +} +exports.getIcapAddress = getIcapAddress; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/address.js.map b/dist/ethers.js/src.ts/address/address.js.map new file mode 100644 index 0000000..236d5ca --- /dev/null +++ b/dist/ethers.js/src.ts/address/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAA6D;AAG7D,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB,SAAS,kBAAkB,CAAC,OAAe;IAC3C,sCAAsC;IACtC,2EAA2E;IAC3E,OAAO;IAEH,OAAO,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC;IAEhC,MAAM,KAAK,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAE7C,MAAM,QAAQ,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACpC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,EAAE,EAAE;QACzB,QAAQ,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACxC;IAED,MAAM,MAAM,GAAG,IAAA,mBAAQ,EAAC,IAAA,oBAAS,EAAC,QAAQ,CAAC,CAAC,CAAC;IAE7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC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AAG,MAAM,CAAC,CAAC;KAC7C;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AA7BD,gCA6BC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,cAAc,CAAC,OAAe;IAC1C,2EAA2E;IAC3E,IAAI,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACpE,OAAO,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACrD,OAAO,IAAI,GAAG,YAAY,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,MAAM,CAAC;AACzD,CAAC;AALD,wCAKC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/checks.d.ts b/dist/ethers.js/src.ts/address/checks.d.ts new file mode 100644 index 0000000..24e781f --- /dev/null +++ b/dist/ethers.js/src.ts/address/checks.d.ts @@ -0,0 +1,81 @@ +import type { Addressable, AddressLike, NameResolver } from "./index.js"; +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +export declare function isAddressable(value: any): value is Addressable; +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +export declare function isAddress(value: any): value is string; +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +export declare function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise; +//# sourceMappingURL=checks.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/checks.d.ts.map b/dist/ethers.js/src.ts/address/checks.d.ts.map new file mode 100644 index 0000000..d7d9416 --- /dev/null +++ b/dist/ethers.js/src.ts/address/checks.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/checks.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAGzE;;;;;;;;;;;;;GAaG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,WAAW,CAE9D;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,MAAM,CAMrD;AAWD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAkB5G"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/checks.js b/dist/ethers.js/src.ts/address/checks.js new file mode 100644 index 0000000..ae224c4 --- /dev/null +++ b/dist/ethers.js/src.ts/address/checks.js @@ -0,0 +1,131 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveAddress = exports.isAddress = exports.isAddressable = void 0; +const index_js_1 = require("../utils/index.js"); +const address_js_1 = require("./address.js"); +/** + * Returns true if %%value%% is an object which implements the + * [[Addressable]] interface. + * + * @example: + * // Wallets and AbstractSigner sub-classes + * isAddressable(Wallet.createRandom()) + * //_result: + * + * // Contracts + * contract = new Contract("dai.tokens.ethers.eth", [ ], provider) + * isAddressable(contract) + * //_result: + */ +function isAddressable(value) { + return (value && typeof (value.getAddress) === "function"); +} +exports.isAddressable = isAddressable; +/** + * Returns true if %%value%% is a valid address. + * + * @example: + * // Valid address + * isAddress("0x8ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Valid ICAP address + * isAddress("XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36") + * //_result: + * + * // Invalid checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBa72") + * //_result: + * + * // Invalid ICAP checksum + * isAddress("0x8Ba1f109551bD432803012645Ac136ddd64DBA72") + * //_result: + * + * // Not an address (an ENS name requires a provided and an + * // asynchronous API to access) + * isAddress("ricmoo.eth") + * //_result: + */ +function isAddress(value) { + try { + (0, address_js_1.getAddress)(value); + return true; + } + catch (error) { } + return false; +} +exports.isAddress = isAddress; +function checkAddress(target, promise) { + return __awaiter(this, void 0, void 0, function* () { + const result = yield promise; + if (result == null || result === "0x0000000000000000000000000000000000000000") { + (0, index_js_1.assert)(typeof (target) !== "string", "unconfigured name", "UNCONFIGURED_NAME", { value: target }); + (0, index_js_1.assertArgument)(false, "invalid AddressLike value; did not resolve to a value address", "target", target); + } + return (0, address_js_1.getAddress)(result); + }); +} +/** + * Resolves to an address for the %%target%%, which may be any + * supported address type, an [[Addressable]] or a Promise which + * resolves to an address. + * + * If an ENS name is provided, but that name has not been correctly + * configured a [[UnconfiguredNameError]] is thrown. + * + * @example: + * addr = "0x6B175474E89094C44Da98b954EedeAC495271d0F" + * + * // Addresses are return synchronously + * resolveAddress(addr, provider) + * //_result: + * + * // Address promises are resolved asynchronously + * resolveAddress(Promise.resolve(addr)) + * //_result: + * + * // ENS names are resolved asynchronously + * resolveAddress("dai.tokens.ethers.eth", provider) + * //_result: + * + * // Addressable objects are resolved asynchronously + * contract = new Contract(addr, [ ]) + * resolveAddress(contract, provider) + * //_result: + * + * // Unconfigured ENS names reject + * resolveAddress("nothing-here.ricmoo.eth", provider) + * //_error: + * + * // ENS names require a NameResolver object passed in + * // (notice the provider was omitted) + * resolveAddress("nothing-here.ricmoo.eth") + * //_error: + */ +function resolveAddress(target, resolver) { + if (typeof (target) === "string") { + if (target.match(/^0x[0-9a-f]{40}$/i)) { + return (0, address_js_1.getAddress)(target); + } + (0, index_js_1.assert)(resolver != null, "ENS resolution requires a provider", "UNSUPPORTED_OPERATION", { operation: "resolveName" }); + return checkAddress(target, resolver.resolveName(target)); + } + else if (isAddressable(target)) { + return checkAddress(target, target.getAddress()); + } + else if (target && typeof (target.then) === "function") { + return checkAddress(target, target); + } + (0, index_js_1.assertArgument)(false, "unsupported addressable value", "target", target); +} +exports.resolveAddress = resolveAddress; +//# sourceMappingURL=checks.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/checks.js.map b/dist/ethers.js/src.ts/address/checks.js.map new file mode 100644 index 0000000..d6ab947 --- /dev/null +++ b/dist/ethers.js/src.ts/address/checks.js.map @@ -0,0 +1 @@ +{"version":3,"file":"checks.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/checks.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gDAA2D;AAE3D,6CAA0C;AAK1C;;;;;;;;;;;;;GAaG;AACH,SAAgB,aAAa,CAAC,KAAU;IACpC,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,UAAU,CAAC,CAAC;AAC9D,CAAC;AAFD,sCAEC;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,SAAgB,SAAS,CAAC,KAAU;IAChC,IAAI;QACA,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;QAClB,OAAO,IAAI,CAAC;KACf;IAAC,OAAO,KAAK,EAAE,GAAG;IACnB,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,8BAMC;AAED,SAAe,YAAY,CAAC,MAAW,EAAE,OAA+B;;QACpE,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC;QAC7B,IAAI,MAAM,IAAI,IAAI,IAAI,MAAM,KAAK,4CAA4C,EAAE;YAC3E,IAAA,iBAAM,EAAC,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;YACjG,IAAA,yBAAc,EAAC,KAAK,EAAE,+DAA+D,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;SAC5G;QACD,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;IAC9B,CAAC;CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAgB,cAAc,CAAC,MAAmB,EAAE,QAA8B;IAE9E,IAAI,OAAM,CAAC,MAAM,CAAC,KAAK,QAAQ,EAAE;QAC7B,IAAI,MAAM,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;YAAE,OAAO,IAAA,uBAAU,EAAC,MAAM,CAAC,CAAC;SAAE;QAErE,IAAA,iBAAM,EAAC,QAAQ,IAAI,IAAI,EAAE,oCAAoC,EACzD,uBAAuB,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC,CAAC;QAE3D,OAAO,YAAY,CAAC,MAAM,EAAE,QAAQ,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;KAE7D;SAAM,IAAI,aAAa,CAAC,MAAM,CAAC,EAAE;QAC9B,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;KAEpD;SAAM,IAAI,MAAM,IAAI,OAAM,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE;QACrD,OAAO,YAAY,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACvC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,+BAA+B,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;AAC7E,CAAC;AAlBD,wCAkBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/contract-address.d.ts b/dist/ethers.js/src.ts/address/contract-address.d.ts new file mode 100644 index 0000000..42b36f7 --- /dev/null +++ b/dist/ethers.js/src.ts/address/contract-address.d.ts @@ -0,0 +1,48 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +export declare function getCreateAddress(tx: { + from: string; + nonce: BigNumberish; +}): string; +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +export declare function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string; +//# sourceMappingURL=contract-address.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/contract-address.d.ts.map b/dist/ethers.js/src.ts/address/contract-address.d.ts.map new file mode 100644 index 0000000..0881e7a --- /dev/null +++ b/dist/ethers.js/src.ts/address/contract-address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/contract-address.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAKjE;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,GAAG,MAAM,CAclF;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,GAAG,MAAM,CAUnG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/contract-address.js b/dist/ethers.js/src.ts/address/contract-address.js new file mode 100644 index 0000000..6c545bb --- /dev/null +++ b/dist/ethers.js/src.ts/address/contract-address.js @@ -0,0 +1,74 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getCreate2Address = exports.getCreateAddress = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const address_js_1 = require("./address.js"); +// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed +/** + * Returns the address that would result from a ``CREATE`` for %%tx%%. + * + * This can be used to compute the address a contract will be + * deployed to by an EOA when sending a deployment transaction (i.e. + * when the ``to`` address is ``null``). + * + * This can also be used to compute the address a contract will be + * deployed to by a contract, by using the contract's address as the + * ``to`` and the contract's nonce. + * + * @example + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72"; + * nonce = 5; + * + * getCreateAddress({ from, nonce }); + * //_result: + */ +function getCreateAddress(tx) { + const from = (0, address_js_1.getAddress)(tx.from); + const nonce = (0, index_js_2.getBigInt)(tx.nonce, "tx.nonce"); + let nonceHex = nonce.toString(16); + if (nonceHex === "0") { + nonceHex = "0x"; + } + else if (nonceHex.length % 2) { + nonceHex = "0x0" + nonceHex; + } + else { + nonceHex = "0x" + nonceHex; + } + return (0, address_js_1.getAddress)((0, index_js_2.dataSlice)((0, index_js_1.keccak256)((0, index_js_2.encodeRlp)([from, nonceHex])), 12)); +} +exports.getCreateAddress = getCreateAddress; +/** + * Returns the address that would result from a ``CREATE2`` operation + * with the given %%from%%, %%salt%% and %%initCodeHash%%. + * + * To compute the %%initCodeHash%% from a contract's init code, use + * the [[keccak256]] function. + * + * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]]. + * + * @example + * // The address of the contract + * from = "0x8ba1f109551bD432803012645Ac136ddd64DBA72" + * + * // The salt + * salt = id("HelloWorld") + * + * // The hash of the initCode + * initCode = "0x6394198df16000526103ff60206004601c335afa6040516060f3"; + * initCodeHash = keccak256(initCode) + * + * getCreate2Address(from, salt, initCodeHash) + * //_result: + */ +function getCreate2Address(_from, _salt, _initCodeHash) { + const from = (0, address_js_1.getAddress)(_from); + const salt = (0, index_js_2.getBytes)(_salt, "salt"); + const initCodeHash = (0, index_js_2.getBytes)(_initCodeHash, "initCodeHash"); + (0, index_js_2.assertArgument)(salt.length === 32, "salt must be 32 bytes", "salt", _salt); + (0, index_js_2.assertArgument)(initCodeHash.length === 32, "initCodeHash must be 32 bytes", "initCodeHash", _initCodeHash); + return (0, address_js_1.getAddress)((0, index_js_2.dataSlice)((0, index_js_1.keccak256)((0, index_js_2.concat)(["0xff", from, salt, initCodeHash])), 12)); +} +exports.getCreate2Address = getCreate2Address; +//# sourceMappingURL=contract-address.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/contract-address.js.map b/dist/ethers.js/src.ts/address/contract-address.js.map new file mode 100644 index 0000000..ace9769 --- /dev/null +++ b/dist/ethers.js/src.ts/address/contract-address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract-address.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/contract-address.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAE2B;AAE3B,6CAA0C;AAK1C,sGAAsG;AAEtG;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,gBAAgB,CAAC,EAAyC;IACtE,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,EAAE,CAAC,IAAI,CAAC,CAAC;IACjC,MAAM,KAAK,GAAG,IAAA,oBAAS,EAAC,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,CAAC;IAE9C,IAAI,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAClC,IAAI,QAAQ,KAAK,GAAG,EAAE;QAClB,QAAQ,GAAG,IAAI,CAAC;KACnB;SAAM,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE;QAC5B,QAAQ,GAAG,KAAK,GAAG,QAAQ,CAAC;KAC/B;SAAM;QACH,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAC;KAC9B;IAED,OAAO,IAAA,uBAAU,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,CAAE,IAAI,EAAE,QAAQ,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/E,CAAC;AAdD,4CAcC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,SAAgB,iBAAiB,CAAC,KAAa,EAAE,KAAgB,EAAE,aAAwB;IACvF,MAAM,IAAI,GAAG,IAAA,uBAAU,EAAC,KAAK,CAAC,CAAC;IAC/B,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,YAAY,GAAG,IAAA,mBAAQ,EAAC,aAAa,EAAE,cAAc,CAAC,CAAC;IAE7D,IAAA,yBAAc,EAAC,IAAI,CAAC,MAAM,KAAK,EAAE,EAAE,uBAAuB,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IAE3E,IAAA,yBAAc,EAAC,YAAY,CAAC,MAAM,KAAK,EAAE,EAAE,+BAA+B,EAAE,cAAc,EAAE,aAAa,CAAC,CAAC;IAE3G,OAAO,IAAA,uBAAU,EAAC,IAAA,oBAAS,EAAC,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC,CAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,YAAY,CAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAC7F,CAAC;AAVD,8CAUC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/index.d.ts b/dist/ethers.js/src.ts/address/index.d.ts new file mode 100644 index 0000000..744a8e0 --- /dev/null +++ b/dist/ethers.js/src.ts/address/index.d.ts @@ -0,0 +1,49 @@ +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the gloabal identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +/** + * An interface for objects which have an address, and can + * resolve it asyncronously. + * + * This allows objects such as [[Signer]] or [[Contract]] to + * be used most places an address can be, for example getting + * the [balance](Provider-getBalance). + */ +export interface Addressable { + /** + * Get the object address. + */ + getAddress(): Promise; +} +/** + * Anything that can be used to return or resolve an address. + */ +export type AddressLike = string | Promise | Addressable; +/** + * An interface for any object which can resolve an ENS name. + */ +export interface NameResolver { + /** + * Resolve to the address for the ENS %%name%%. + * + * Resolves to ``null`` if the name is unconfigued. Use + * [[resolveAddress]] (passing this object as %%resolver%%) to + * throw for names that are unconfigured. + */ + resolveName(name: string): Promise; +} +export { getAddress, getIcapAddress } from "./address.js"; +export { getCreateAddress, getCreate2Address } from "./contract-address.js"; +export { isAddressable, isAddress, resolveAddress } from "./checks.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/index.d.ts.map b/dist/ethers.js/src.ts/address/index.d.ts.map new file mode 100644 index 0000000..d99c700 --- /dev/null +++ b/dist/ethers.js/src.ts/address/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH;;;;;;;GAOG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,WAAW,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;;;;;OAMG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;CACrD;AAED,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG5E,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/index.js b/dist/ethers.js/src.ts/address/index.js new file mode 100644 index 0000000..c9bbb74 --- /dev/null +++ b/dist/ethers.js/src.ts/address/index.js @@ -0,0 +1,29 @@ +"use strict"; +/** + * Addresses are a fundamental part of interacting with Ethereum. They + * represent the gloabal identity of Externally Owned Accounts (accounts + * backed by a private key) and contracts. + * + * The Ethereum Naming Service (ENS) provides an interconnected ecosystem + * of contracts, standards and libraries which enable looking up an + * address for an ENS name. + * + * These functions help convert between various formats, validate + * addresses and safely resolve ENS names. + * + * @_section: api/address:Addresses [about-addresses] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = void 0; +null; +var address_js_1 = require("./address.js"); +Object.defineProperty(exports, "getAddress", { enumerable: true, get: function () { return address_js_1.getAddress; } }); +Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function () { return address_js_1.getIcapAddress; } }); +var contract_address_js_1 = require("./contract-address.js"); +Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return contract_address_js_1.getCreateAddress; } }); +Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return contract_address_js_1.getCreate2Address; } }); +var checks_js_1 = require("./checks.js"); +Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return checks_js_1.isAddressable; } }); +Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return checks_js_1.isAddress; } }); +Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return checks_js_1.resolveAddress; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/address/index.js.map b/dist/ethers.js/src.ts/address/index.js.map new file mode 100644 index 0000000..4c7d997 --- /dev/null +++ b/dist/ethers.js/src.ts/address/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/address/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;AAEH,IAAI,CAAC;AAoCL,2CAA0D;AAAjD,wGAAA,UAAU,OAAA;AAAE,4GAAA,cAAc,OAAA;AAEnC,6DAA4E;AAAnE,uHAAA,gBAAgB,OAAA;AAAE,wHAAA,iBAAiB,OAAA;AAG5C,yCAAuE;AAA9D,0GAAA,aAAa,OAAA;AAAE,sGAAA,SAAS,OAAA;AAAE,2GAAA,cAAc,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/addresses.d.ts b/dist/ethers.js/src.ts/constants/addresses.d.ts new file mode 100644 index 0000000..a32d6be --- /dev/null +++ b/dist/ethers.js/src.ts/constants/addresses.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +export declare const ZeroAddress: string; +//# sourceMappingURL=addresses.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/addresses.d.ts.map b/dist/ethers.js/src.ts/constants/addresses.d.ts.map new file mode 100644 index 0000000..285ea7f --- /dev/null +++ b/dist/ethers.js/src.ts/constants/addresses.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/addresses.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAqD,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/addresses.js b/dist/ethers.js/src.ts/constants/addresses.js new file mode 100644 index 0000000..ff4fb40 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/addresses.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ZeroAddress = void 0; +/** + * A constant for the zero address. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000"``) + */ +exports.ZeroAddress = "0x0000000000000000000000000000000000000000"; +//# sourceMappingURL=addresses.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/addresses.js.map b/dist/ethers.js/src.ts/constants/addresses.js.map new file mode 100644 index 0000000..4edfd17 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/addresses.js.map @@ -0,0 +1 @@ +{"version":3,"file":"addresses.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/addresses.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,WAAW,GAAW,4CAA4C,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/hashes.d.ts b/dist/ethers.js/src.ts/constants/hashes.d.ts new file mode 100644 index 0000000..784df71 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/hashes.d.ts @@ -0,0 +1,7 @@ +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +export declare const ZeroHash: string; +//# sourceMappingURL=hashes.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/hashes.d.ts.map b/dist/ethers.js/src.ts/constants/hashes.d.ts.map new file mode 100644 index 0000000..5aea905 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/hashes.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/hashes.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,MAA6E,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/hashes.js b/dist/ethers.js/src.ts/constants/hashes.js new file mode 100644 index 0000000..fbcd74c --- /dev/null +++ b/dist/ethers.js/src.ts/constants/hashes.js @@ -0,0 +1,10 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ZeroHash = void 0; +/** + * A constant for the zero hash. + * + * (**i.e.** ``"0x0000000000000000000000000000000000000000000000000000000000000000"``) + */ +exports.ZeroHash = "0x0000000000000000000000000000000000000000000000000000000000000000"; +//# sourceMappingURL=hashes.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/hashes.js.map b/dist/ethers.js/src.ts/constants/hashes.js.map new file mode 100644 index 0000000..2ec9b1b --- /dev/null +++ b/dist/ethers.js/src.ts/constants/hashes.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hashes.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/hashes.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACU,QAAA,QAAQ,GAAW,oEAAoE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/index.d.ts b/dist/ethers.js/src.ts/constants/index.d.ts new file mode 100644 index 0000000..fa4e9e7 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/index.d.ts @@ -0,0 +1,10 @@ +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +export { ZeroAddress } from "./addresses.js"; +export { ZeroHash } from "./hashes.js"; +export { N, WeiPerEther, MaxUint256, MinInt256, MaxInt256 } from "./numbers.js"; +export { EtherSymbol, MessagePrefix } from "./strings.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/index.d.ts.map b/dist/ethers.js/src.ts/constants/index.d.ts.map new file mode 100644 index 0000000..b845468 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EACH,CAAC,EACD,WAAW,EACX,UAAU,EACV,SAAS,EACT,SAAS,EACZ,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/index.js b/dist/ethers.js/src.ts/constants/index.js new file mode 100644 index 0000000..6be74a7 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/index.js @@ -0,0 +1,22 @@ +"use strict"; +/** + * Some common constants useful for Ethereum. + * + * @_section: api/constants: Constants [about-constants] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessagePrefix = exports.EtherSymbol = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = exports.ZeroHash = exports.ZeroAddress = void 0; +var addresses_js_1 = require("./addresses.js"); +Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return addresses_js_1.ZeroAddress; } }); +var hashes_js_1 = require("./hashes.js"); +Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return hashes_js_1.ZeroHash; } }); +var numbers_js_1 = require("./numbers.js"); +Object.defineProperty(exports, "N", { enumerable: true, get: function () { return numbers_js_1.N; } }); +Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return numbers_js_1.WeiPerEther; } }); +Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return numbers_js_1.MaxUint256; } }); +Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return numbers_js_1.MinInt256; } }); +Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return numbers_js_1.MaxInt256; } }); +var strings_js_1 = require("./strings.js"); +Object.defineProperty(exports, "EtherSymbol", { enumerable: true, get: function () { return strings_js_1.EtherSymbol; } }); +Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return strings_js_1.MessagePrefix; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/index.js.map b/dist/ethers.js/src.ts/constants/index.js.map new file mode 100644 index 0000000..f0d286f --- /dev/null +++ b/dist/ethers.js/src.ts/constants/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,+CAA6C;AAApC,2GAAA,WAAW,OAAA;AACpB,yCAAuC;AAA9B,qGAAA,QAAQ,OAAA;AACjB,2CAMsB;AALlB,+FAAA,CAAC,OAAA;AACD,yGAAA,WAAW,OAAA;AACX,wGAAA,UAAU,OAAA;AACV,uGAAA,SAAS,OAAA;AACT,uGAAA,SAAS,OAAA;AAEb,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/numbers.d.ts b/dist/ethers.js/src.ts/constants/numbers.d.ts new file mode 100644 index 0000000..7c84eaa --- /dev/null +++ b/dist/ethers.js/src.ts/constants/numbers.d.ts @@ -0,0 +1,31 @@ +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +export declare const N: bigint; +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +export declare const WeiPerEther: bigint; +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxUint256: bigint; +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +export declare const MinInt256: bigint; +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +export declare const MaxInt256: bigint; +//# sourceMappingURL=numbers.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/numbers.d.ts.map b/dist/ethers.js/src.ts/constants/numbers.d.ts.map new file mode 100644 index 0000000..a5f2d0e --- /dev/null +++ b/dist/ethers.js/src.ts/constants/numbers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/numbers.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,eAAO,MAAM,CAAC,EAAE,MAAqF,CAAC;AAEtG;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAsC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,UAAU,EAAE,MAAqF,CAAC;AAE/G;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAkG,CAAC;AAE3H;;;;GAIG;AACH,eAAO,MAAM,SAAS,EAAE,MAAqF,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/numbers.js b/dist/ethers.js/src.ts/constants/numbers.js new file mode 100644 index 0000000..2ab9150 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/numbers.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.N = void 0; +/** + * A constant for the order N for the secp256k1 curve. + * + * (**i.e.** ``0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n``) + */ +exports.N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +/** + * A constant for the number of wei in a single ether. + * + * (**i.e.** ``1000000000000000000n``) + */ +exports.WeiPerEther = BigInt("1000000000000000000"); +/** + * A constant for the maximum value for a ``uint256``. + * + * (**i.e.** ``0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +exports.MaxUint256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +/** + * A constant for the minimum value for an ``int256``. + * + * (**i.e.** ``-8000000000000000000000000000000000000000000000000000000000000000n``) + */ +exports.MinInt256 = BigInt("0x8000000000000000000000000000000000000000000000000000000000000000") * BigInt(-1); +/** + * A constant for the maximum value for an ``int256``. + * + * (**i.e.** ``0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffn``) + */ +exports.MaxInt256 = BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +//# sourceMappingURL=numbers.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/numbers.js.map b/dist/ethers.js/src.ts/constants/numbers.js.map new file mode 100644 index 0000000..5aad474 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/numbers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"numbers.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/numbers.ts"],"names":[],"mappings":";;;AACA;;;;GAIG;AACU,QAAA,CAAC,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAEtG;;;;GAIG;AACU,QAAA,WAAW,GAAW,MAAM,CAAC,qBAAqB,CAAC,CAAC;AAEjE;;;;GAIG;AACU,QAAA,UAAU,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAE/G;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3H;;;;GAIG;AACU,QAAA,SAAS,GAAW,MAAM,CAAC,oEAAoE,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/strings.d.ts b/dist/ethers.js/src.ts/constants/strings.d.ts new file mode 100644 index 0000000..0ad1c86 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/strings.d.ts @@ -0,0 +1,13 @@ +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +export declare const EtherSymbol: string; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +export declare const MessagePrefix: string; +//# sourceMappingURL=strings.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/strings.d.ts.map b/dist/ethers.js/src.ts/constants/strings.d.ts.map new file mode 100644 index 0000000..ccc532d --- /dev/null +++ b/dist/ethers.js/src.ts/constants/strings.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/strings.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,WAAW,EAAE,MAAiB,CAAC;AAG5C;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,MAAyC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/strings.js b/dist/ethers.js/src.ts/constants/strings.js new file mode 100644 index 0000000..78ebe30 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/strings.js @@ -0,0 +1,17 @@ +"use strict"; +// NFKC (composed) // (decomposed) +Object.defineProperty(exports, "__esModule", { value: true }); +exports.MessagePrefix = exports.EtherSymbol = void 0; +/** + * A constant for the ether symbol (normalized using NFKC). + * + * (**i.e.** ``"\\u039e"``) + */ +exports.EtherSymbol = "\u039e"; // "\uD835\uDF63"; +/** + * A constant for the [[link-eip-191]] personal message prefix. + * + * (**i.e.** ``"\\x19Ethereum Signed Message:\\n"``) + */ +exports.MessagePrefix = "\x19Ethereum Signed Message:\n"; +//# sourceMappingURL=strings.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/constants/strings.js.map b/dist/ethers.js/src.ts/constants/strings.js.map new file mode 100644 index 0000000..33cb433 --- /dev/null +++ b/dist/ethers.js/src.ts/constants/strings.js.map @@ -0,0 +1 @@ +{"version":3,"file":"strings.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/constants/strings.ts"],"names":[],"mappings":";AAAA,8CAA8C;;;AAE9C;;;;GAIG;AACU,QAAA,WAAW,GAAW,QAAQ,CAAC,CAAE,kBAAkB;AAGhE;;;;GAIG;AACU,QAAA,aAAa,GAAW,gCAAgC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/contract.d.ts b/dist/ethers.js/src.ts/contract/contract.d.ts new file mode 100644 index 0000000..53ad50c --- /dev/null +++ b/dist/ethers.js/src.ts/contract/contract.d.ts @@ -0,0 +1,168 @@ +import { Interface } from "../abi/index.js"; +import { Log, TransactionResponse } from "../providers/provider.js"; +import { ContractTransactionResponse, EventLog } from "./wrappers.js"; +import type { EventFragment, FunctionFragment, InterfaceAbi, ParamType } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { EventEmitterable, Listener } from "../utils/index.js"; +import type { BlockTag, ContractRunner } from "../providers/index.js"; +import type { ContractEventName, ContractInterface, ContractMethod, ContractEvent, ContractTransaction, WrappedFallback } from "./types.js"; +/** + * @_ignore: + */ +export declare function copyOverrides(arg: any, allowed?: Array): Promise>; +/** + * @_ignore: + */ +export declare function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray, args: Array): Promise>; +declare const internal: unique symbol; +export declare class BaseContract implements Addressable, EventEmitterable { + /** + * The target to connect to. + * + * This can be an address, ENS name or any [[Addressable]], such as + * another contract. To get the resovled address, use the ``getAddress`` + * method. + */ + readonly target: string | Addressable; + /** + * The contract Interface. + */ + readonly interface: Interface; + /** + * The connected runner. This is generally a [[Provider]] or a + * [[Signer]], which dictates what operations are supported. + * + * For example, a **Contract** connected to a [[Provider]] may + * only execute read-only operations. + */ + readonly runner: null | ContractRunner; + /** + * All the Events available on this contract. + */ + readonly filters: Record; + /** + * @_ignore: + */ + readonly [internal]: any; + /** + * The fallback or receive function if any. + */ + readonly fallback: null | WrappedFallback; + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse); + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner: null | ContractRunner): BaseContract; + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target: string | Addressable): BaseContract; + /** + * Return the resolved address of this Contract. + */ + getAddress(): Promise; + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + getDeployedCode(): Promise; + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + waitForDeployment(): Promise; + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction(): null | ContractTransactionResponse; + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key: string | FunctionFragment): T; + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key: string | EventFragment): ContractEvent; + /** + * @_ignore: + */ + queryTransaction(hash: string): Promise>; + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise>; + /** + * Add an event %%listener%% for the %%event%%. + */ + on(event: ContractEventName, listener: Listener): Promise; + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + once(event: ContractEventName, listener: Listener): Promise; + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + emit(event: ContractEventName, ...args: Array): Promise; + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + listenerCount(event?: ContractEventName): Promise; + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + listeners(event?: ContractEventName): Promise>; + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + off(event: ContractEventName, listener?: Listener): Promise; + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + removeAllListeners(event?: ContractEventName): Promise; + /** + * Alias for [on]. + */ + addListener(event: ContractEventName, listener: Listener): Promise; + /** + * Alias for [off]. + */ + removeListener(event: ContractEventName, listener: Listener): Promise; + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit; +} +declare const Contract_base: new (target: string, abi: Interface | InterfaceAbi, runner?: ContractRunner | null | undefined) => BaseContract & Omit; +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +export declare class Contract extends Contract_base { +} +export {}; +//# sourceMappingURL=contract.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/contract.d.ts.map b/dist/ethers.js/src.ts/contract/contract.d.ts.map new file mode 100644 index 0000000..dde5ee4 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/contract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contract.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/contract.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAS,MAAM,iBAAiB,CAAC;AAInD,OAAO,EAAe,GAAG,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAMjF,OAAO,EAEH,2BAA2B,EAC3B,QAAQ,EACX,MAAM,eAAe,CAAC;AAEvB,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,YAAY,EAAE,SAAS,EAAU,MAAM,iBAAiB,CAAC;AACxG,OAAO,KAAK,EAAE,WAAW,EAAgB,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,gB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GAEG;AACH,qBAAa,QAAS,SAAQ,aAAe;CAAI"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/contract.js b/dist/ethers.js/src.ts/contract/contract.js new file mode 100644 index 0000000..fa8bd8c --- /dev/null +++ b/dist/ethers.js/src.ts/contract/contract.js @@ -0,0 +1,1011 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _PreparedTopicFilter_filter; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Contract = exports.BaseContract = exports.resolveArgs = exports.copyOverrides = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +const provider_js_1 = require("../providers/provider.js"); +const index_js_3 = require("../utils/index.js"); +const wrappers_js_1 = require("./wrappers.js"); +const BN_0 = BigInt(0); +function canCall(value) { + return (value && typeof (value.call) === "function"); +} +function canEstimate(value) { + return (value && typeof (value.estimateGas) === "function"); +} +function canResolve(value) { + return (value && typeof (value.resolveName) === "function"); +} +function canSend(value) { + return (value && typeof (value.sendTransaction) === "function"); +} +function getResolver(value) { + if (value != null) { + if (canResolve(value)) { + return value; + } + if (value.provider) { + return value.provider; + } + } + return undefined; +} +class PreparedTopicFilter { + constructor(contract, fragment, args) { + _PreparedTopicFilter_filter.set(this, void 0); + (0, index_js_3.defineProperties)(this, { fragment }); + if (fragment.inputs.length < args.length) { + throw new Error("too many arguments"); + } + // Recursively descend into args and resolve any addresses + const runner = getRunner(contract.runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + __classPrivateFieldSet(this, _PreparedTopicFilter_filter, (function () { + return __awaiter(this, void 0, void 0, function* () { + const resolvedArgs = yield Promise.all(fragment.inputs.map((param, index) => { + const arg = args[index]; + if (arg == null) { + return null; + } + return param.walkAsync(args[index], (type, value) => { + if (type === "address") { + if (Array.isArray(value)) { + return Promise.all(value.map((v) => (0, index_js_2.resolveAddress)(v, resolver))); + } + return (0, index_js_2.resolveAddress)(value, resolver); + } + return value; + }); + })); + return contract.interface.encodeFilterTopics(fragment, resolvedArgs); + }); + })(), "f"); + } + getTopicFilter() { + return __classPrivateFieldGet(this, _PreparedTopicFilter_filter, "f"); + } +} +_PreparedTopicFilter_filter = new WeakMap(); +// A = Arguments passed in as a tuple +// R = The result type of the call (i.e. if only one return type, +// the qualified type, otherwise Result) +// D = The type the default call will return (i.e. R for view/pure, +// TransactionResponse otherwise) +//export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> { +function getRunner(value, feature) { + if (value == null) { + return null; + } + if (typeof (value[feature]) === "function") { + return value; + } + if (value.provider && typeof (value.provider[feature]) === "function") { + return value.provider; + } + return null; +} +function getProvider(value) { + if (value == null) { + return null; + } + return value.provider || null; +} +/** + * @_ignore: + */ +function copyOverrides(arg, allowed) { + return __awaiter(this, void 0, void 0, function* () { + // Make sure the overrides passed in are a valid overrides object + const _overrides = index_js_1.Typed.dereference(arg, "overrides"); + (0, index_js_3.assertArgument)(typeof (_overrides) === "object", "invalid overrides parameter", "overrides", arg); + // Create a shallow copy (we'll deep-ify anything needed during normalizing) + const overrides = (0, provider_js_1.copyRequest)(_overrides); + (0, index_js_3.assertArgument)(overrides.to == null || (allowed || []).indexOf("to") >= 0, "cannot override to", "overrides.to", overrides.to); + (0, index_js_3.assertArgument)(overrides.data == null || (allowed || []).indexOf("data") >= 0, "cannot override data", "overrides.data", overrides.data); + // Resolve any from + if (overrides.from) { + overrides.from = overrides.from; + } + return overrides; + }); +} +exports.copyOverrides = copyOverrides; +/** + * @_ignore: + */ +function resolveArgs(_runner, inputs, args) { + return __awaiter(this, void 0, void 0, function* () { + // Recursively descend into args and resolve any addresses + const runner = getRunner(_runner, "resolveName"); + const resolver = canResolve(runner) ? runner : null; + return yield Promise.all(inputs.map((param, index) => { + return param.walkAsync(args[index], (type, value) => { + value = index_js_1.Typed.dereference(value, type); + if (type === "address") { + return (0, index_js_2.resolveAddress)(value, resolver); + } + return value; + }); + })); + }); +} +exports.resolveArgs = resolveArgs; +function buildWrappedFallback(contract) { + const populateTransaction = function (overrides) { + return __awaiter(this, void 0, void 0, function* () { + // If an overrides was passed in, copy it and normalize the values + const tx = (yield copyOverrides(overrides, ["data"])); + tx.to = yield contract.getAddress(); + if (tx.from) { + tx.from = yield (0, index_js_2.resolveAddress)(tx.from, getResolver(contract.runner)); + } + const iface = contract.interface; + const noValue = ((0, index_js_3.getBigInt)((tx.value || BN_0), "overrides.value") === BN_0); + const noData = ((tx.data || "0x") === "0x"); + if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) { + (0, index_js_3.assertArgument)(false, "cannot send data to receive or send value to non-payable fallback", "overrides", overrides); + } + (0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + // Only allow payable contracts to set non-zero value + const payable = iface.receive || (iface.fallback && iface.fallback.payable); + (0, index_js_3.assertArgument)(payable || noValue, "cannot send value to non-payable fallback", "overrides.value", tx.value); + // Only allow fallback contracts to set non-empty data + (0, index_js_3.assertArgument)(iface.fallback || noData, "cannot send data to receive-only contract", "overrides.data", tx.data); + return tx; + }); + }; + const staticCall = function (overrides) { + return __awaiter(this, void 0, void 0, function* () { + const runner = getRunner(contract.runner, "call"); + (0, index_js_3.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = yield populateTransaction(overrides); + try { + return yield runner.call(tx); + } + catch (error) { + if ((0, index_js_3.isCallException)(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + }); + }; + const send = function (overrides) { + return __awaiter(this, void 0, void 0, function* () { + const runner = contract.runner; + (0, index_js_3.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = yield runner.sendTransaction(yield populateTransaction(overrides)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); + }); + }; + const estimateGas = function (overrides) { + return __awaiter(this, void 0, void 0, function* () { + const runner = getRunner(contract.runner, "estimateGas"); + (0, index_js_3.assert)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return yield runner.estimateGas(yield populateTransaction(overrides)); + }); + }; + const method = (overrides) => __awaiter(this, void 0, void 0, function* () { + return yield send(overrides); + }); + (0, index_js_3.defineProperties)(method, { + _contract: contract, + estimateGas, + populateTransaction, + send, staticCall + }); + return method; +} +function buildWrappedMethod(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getFunction(key, args); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const populateTransaction = function (...args) { + return __awaiter(this, void 0, void 0, function* () { + const fragment = getFragment(...args); + // If an overrides was passed in, copy it and normalize the values + let overrides = {}; + if (fragment.inputs.length + 1 === args.length) { + overrides = yield copyOverrides(args.pop()); + if (overrides.from) { + overrides.from = yield (0, index_js_2.resolveAddress)(overrides.from, getResolver(contract.runner)); + } + } + if (fragment.inputs.length !== args.length) { + throw new Error("internal error: fragment inputs doesn't match arguments; should not happen"); + } + const resolvedArgs = yield resolveArgs(contract.runner, fragment.inputs, args); + return Object.assign({}, overrides, yield (0, index_js_3.resolveProperties)({ + to: contract.getAddress(), + data: contract.interface.encodeFunctionData(fragment, resolvedArgs) + })); + }); + }; + const staticCall = function (...args) { + return __awaiter(this, void 0, void 0, function* () { + const result = yield staticCallResult(...args); + if (result.length === 1) { + return result[0]; + } + return result; + }); + }; + const send = function (...args) { + return __awaiter(this, void 0, void 0, function* () { + const runner = contract.runner; + (0, index_js_3.assert)(canSend(runner), "contract runner does not support sending transactions", "UNSUPPORTED_OPERATION", { operation: "sendTransaction" }); + const tx = yield runner.sendTransaction(yield populateTransaction(...args)); + const provider = getProvider(contract.runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + return new wrappers_js_1.ContractTransactionResponse(contract.interface, provider, tx); + }); + }; + const estimateGas = function (...args) { + return __awaiter(this, void 0, void 0, function* () { + const runner = getRunner(contract.runner, "estimateGas"); + (0, index_js_3.assert)(canEstimate(runner), "contract runner does not support gas estimation", "UNSUPPORTED_OPERATION", { operation: "estimateGas" }); + return yield runner.estimateGas(yield populateTransaction(...args)); + }); + }; + const staticCallResult = function (...args) { + return __awaiter(this, void 0, void 0, function* () { + const runner = getRunner(contract.runner, "call"); + (0, index_js_3.assert)(canCall(runner), "contract runner does not support calling", "UNSUPPORTED_OPERATION", { operation: "call" }); + const tx = yield populateTransaction(...args); + let result = "0x"; + try { + result = yield runner.call(tx); + } + catch (error) { + if ((0, index_js_3.isCallException)(error) && error.data) { + throw contract.interface.makeError(error.data, tx); + } + throw error; + } + const fragment = getFragment(...args); + return contract.interface.decodeFunctionResult(fragment, result); + }); + }; + const method = (...args) => __awaiter(this, void 0, void 0, function* () { + const fragment = getFragment(...args); + if (fragment.constant) { + return yield staticCall(...args); + } + return yield send(...args); + }); + (0, index_js_3.defineProperties)(method, { + name: contract.interface.getFunctionName(key), + _contract: contract, _key: key, + getFragment, + estimateGas, + populateTransaction, + send, staticCall, staticCallResult, + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getFunction(key); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +function buildWrappedEvent(contract, key) { + const getFragment = function (...args) { + const fragment = contract.interface.getEvent(key, args); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key, args } + }); + return fragment; + }; + const method = function (...args) { + return new PreparedTopicFilter(contract, getFragment(...args), args); + }; + (0, index_js_3.defineProperties)(method, { + name: contract.interface.getEventName(key), + _contract: contract, _key: key, + getFragment + }); + // Only works on non-ambiguous keys (refined fragment is always non-ambiguous) + Object.defineProperty(method, "fragment", { + configurable: false, + enumerable: true, + get: () => { + const fragment = contract.interface.getEvent(key); + (0, index_js_3.assert)(fragment, "no matching fragment", "UNSUPPORTED_OPERATION", { + operation: "fragment", + info: { key } + }); + return fragment; + } + }); + return method; +} +// The combination of TypeScrype, Private Fields and Proxies makes +// the world go boom; so we hide variables with some trickery keeping +// a symbol attached to each BaseContract which its sub-class (even +// via a Proxy) can reach and use to look up its internal values. +const internal = Symbol.for("_ethersInternal_contract"); +const internalValues = new WeakMap(); +function setInternal(contract, values) { + internalValues.set(contract[internal], values); +} +function getInternal(contract) { + return internalValues.get(contract[internal]); +} +function isDeferred(value) { + return (value && typeof (value) === "object" && ("getTopicFilter" in value) && + (typeof (value.getTopicFilter) === "function") && value.fragment); +} +function getSubInfo(contract, event) { + return __awaiter(this, void 0, void 0, function* () { + let topics; + let fragment = null; + // Convert named events to topicHash and get the fragment for + // events which need deconstructing. + if (Array.isArray(event)) { + const topicHashify = function (name) { + if ((0, index_js_3.isHexString)(name, 32)) { + return name; + } + const fragment = contract.interface.getEvent(name); + (0, index_js_3.assertArgument)(fragment, "unknown fragment", "name", name); + return fragment.topicHash; + }; + // Array of Topics and Names; e.g. `[ "0x1234...89ab", "Transfer(address)" ]` + topics = event.map((e) => { + if (e == null) { + return null; + } + if (Array.isArray(e)) { + return e.map(topicHashify); + } + return topicHashify(e); + }); + } + else if (event === "*") { + topics = [null]; + } + else if (typeof (event) === "string") { + if ((0, index_js_3.isHexString)(event, 32)) { + // Topic Hash + topics = [event]; + } + else { + // Name or Signature; e.g. `"Transfer", `"Transfer(address)"` + fragment = contract.interface.getEvent(event); + (0, index_js_3.assertArgument)(fragment, "unknown fragment", "event", event); + topics = [fragment.topicHash]; + } + } + else if (isDeferred(event)) { + // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)` + topics = yield event.getTopicFilter(); + } + else if ("fragment" in event) { + // ContractEvent; e.g. `contract.filter.Transfer` + fragment = event.fragment; + topics = [fragment.topicHash]; + } + else { + (0, index_js_3.assertArgument)(false, "unknown event name", "event", event); + } + // Normalize topics and sort TopicSets + topics = topics.map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values()); + if (items.length === 1) { + return items[0]; + } + items.sort(); + return items; + } + return t.toLowerCase(); + }); + const tag = topics.map((t) => { + if (t == null) { + return "null"; + } + if (Array.isArray(t)) { + return t.join("|"); + } + return t; + }).join("&"); + return { fragment, tag, topics }; + }); +} +function hasSub(contract, event) { + return __awaiter(this, void 0, void 0, function* () { + const { subs } = getInternal(contract); + return subs.get((yield getSubInfo(contract, event)).tag) || null; + }); +} +function getSub(contract, operation, event) { + return __awaiter(this, void 0, void 0, function* () { + // Make sure our runner can actually subscribe to events + const provider = getProvider(contract.runner); + (0, index_js_3.assert)(provider, "contract runner does not support subscribing", "UNSUPPORTED_OPERATION", { operation }); + const { fragment, tag, topics } = yield getSubInfo(contract, event); + const { addr, subs } = getInternal(contract); + let sub = subs.get(tag); + if (!sub) { + const address = (addr ? addr : contract); + const filter = { address, topics }; + const listener = (log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = contract.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + // If fragment is null, we do not deconstruct the args to emit + if (foundFragment) { + const _foundFragment = foundFragment; + const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics) : []; + emit(contract, event, args, (listener) => { + return new wrappers_js_1.ContractEventPayload(contract, listener, event, _foundFragment, log); + }); + } + else { + emit(contract, event, [], (listener) => { + return new wrappers_js_1.ContractUnknownEventPayload(contract, listener, event, log); + }); + } + }; + let starting = []; + const start = () => { + if (starting.length) { + return; + } + starting.push(provider.on(filter, listener)); + }; + const stop = () => __awaiter(this, void 0, void 0, function* () { + if (starting.length == 0) { + return; + } + let started = starting; + starting = []; + yield Promise.all(started); + provider.off(filter, listener); + }); + sub = { tag, listeners: [], start, stop }; + subs.set(tag, sub); + } + return sub; + }); +} +// We use this to ensure one emit resolves before firing the next to +// ensure correct ordering (note this cannot throw and just adds the +// notice to the event queu using setTimeout). +let lastEmit = Promise.resolve(); +function _emit(contract, event, args, payloadFunc) { + return __awaiter(this, void 0, void 0, function* () { + yield lastEmit; + const sub = yield hasSub(contract, event); + if (!sub) { + return false; + } + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const passArgs = Array.from(args); + if (payloadFunc) { + passArgs.push(payloadFunc(once ? null : listener)); + } + try { + listener.call(contract, ...passArgs); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + sub.stop(); + getInternal(contract).subs.delete(sub.tag); + } + return (count > 0); + }); +} +function emit(contract, event, args, payloadFunc) { + return __awaiter(this, void 0, void 0, function* () { + try { + yield lastEmit; + } + catch (error) { } + const resultPromise = _emit(contract, event, args, payloadFunc); + lastEmit = resultPromise; + return yield resultPromise; + }); +} +const passProperties = ["then"]; +class BaseContract { + /** + * Creates a new contract connected to %%target%% with the %%abi%% and + * optionally connected to a %%runner%% to perform operations on behalf + * of. + */ + constructor(target, abi, runner, _deployTx) { + (0, index_js_3.assertArgument)(typeof (target) === "string" || (0, index_js_2.isAddressable)(target), "invalid value for Contract target", "target", target); + if (runner == null) { + runner = null; + } + const iface = index_js_1.Interface.from(abi); + (0, index_js_3.defineProperties)(this, { target, runner, interface: iface }); + Object.defineProperty(this, internal, { value: {} }); + let addrPromise; + let addr = null; + let deployTx = null; + if (_deployTx) { + const provider = getProvider(runner); + // @TODO: the provider can be null; make a custom dummy provider that will throw a + // meaningful error + deployTx = new wrappers_js_1.ContractTransactionResponse(this.interface, provider, _deployTx); + } + let subs = new Map(); + // Resolve the target as the address + if (typeof (target) === "string") { + if ((0, index_js_3.isHexString)(target)) { + addr = target; + addrPromise = Promise.resolve(target); + } + else { + const resolver = getRunner(runner, "resolveName"); + if (!canResolve(resolver)) { + throw (0, index_js_3.makeError)("contract runner does not support name resolution", "UNSUPPORTED_OPERATION", { + operation: "resolveName" + }); + } + addrPromise = resolver.resolveName(target).then((addr) => { + if (addr == null) { + throw (0, index_js_3.makeError)("an ENS name used for a contract target must be correctly configured", "UNCONFIGURED_NAME", { + value: target + }); + } + getInternal(this).addr = addr; + return addr; + }); + } + } + else { + addrPromise = target.getAddress().then((addr) => { + if (addr == null) { + throw new Error("TODO"); + } + getInternal(this).addr = addr; + return addr; + }); + } + // Set our private values + setInternal(this, { addrPromise, addr, deployTx, subs }); + // Add the event filters + const filters = new Proxy({}, { + get: (target, prop, receiver) => { + // Pass important checks (like `then` for Promise) through + if (typeof (prop) === "symbol" || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + try { + return this.getEvent(prop); + } + catch (error) { + if (!(0, index_js_3.isError)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + // Pass important checks (like `then` for Promise) through + if (passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return Reflect.has(target, prop) || this.interface.hasEvent(String(prop)); + } + }); + (0, index_js_3.defineProperties)(this, { filters }); + (0, index_js_3.defineProperties)(this, { + fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)) : null) + }); + // Return a Proxy that will respond to functions + return new Proxy(this, { + get: (target, prop, receiver) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.get(target, prop, receiver); + } + // Undefined properties should return undefined + try { + return target.getFunction(prop); + } + catch (error) { + if (!(0, index_js_3.isError)(error, "INVALID_ARGUMENT") || error.argument !== "key") { + throw error; + } + } + return undefined; + }, + has: (target, prop) => { + if (typeof (prop) === "symbol" || prop in target || passProperties.indexOf(prop) >= 0) { + return Reflect.has(target, prop); + } + return target.interface.hasFunction(prop); + } + }); + } + /** + * Return a new Contract instance with the same target and ABI, but + * a different %%runner%%. + */ + connect(runner) { + return new BaseContract(this.target, this.interface, runner); + } + /** + * Return a new Contract instance with the same ABI and runner, but + * a different %%target%%. + */ + attach(target) { + return new BaseContract(target, this.interface, this.runner); + } + /** + * Return the resolved address of this Contract. + */ + getAddress() { + return __awaiter(this, void 0, void 0, function* () { return yield getInternal(this).addrPromise; }); + } + /** + * Return the deployed bytecode or null if no bytecode is found. + */ + getDeployedCode() { + return __awaiter(this, void 0, void 0, function* () { + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider, "runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "getDeployedCode" }); + const code = yield provider.getCode(yield this.getAddress()); + if (code === "0x") { + return null; + } + return code; + }); + } + /** + * Resolve to this Contract once the bytecode has been deployed, or + * resolve immediately if already deployed. + */ + waitForDeployment() { + return __awaiter(this, void 0, void 0, function* () { + // We have the deployement transaction; just use that (throws if deployement fails) + const deployTx = this.deploymentTransaction(); + if (deployTx) { + yield deployTx.wait(); + return this; + } + // Check for code + const code = yield this.getDeployedCode(); + if (code != null) { + return this; + } + // Make sure we can subscribe to a provider event + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider != null, "contract runner does not support .provider", "UNSUPPORTED_OPERATION", { operation: "waitForDeployment" }); + return new Promise((resolve, reject) => { + const checkCode = () => __awaiter(this, void 0, void 0, function* () { + try { + const code = yield this.getDeployedCode(); + if (code != null) { + return resolve(this); + } + provider.once("block", checkCode); + } + catch (error) { + reject(error); + } + }); + checkCode(); + }); + }); + } + /** + * Return the transaction used to deploy this contract. + * + * This is only available if this instance was returned from a + * [[ContractFactory]]. + */ + deploymentTransaction() { + return getInternal(this).deployTx; + } + /** + * Return the function for a given name. This is useful when a contract + * method name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getFunction(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + const func = buildWrappedMethod(this, key); + return func; + } + /** + * Return the event for a given name. This is useful when a contract + * event name conflicts with a JavaScript name such as ``prototype`` or + * when using a Contract programatically. + */ + getEvent(key) { + if (typeof (key) !== "string") { + key = key.format(); + } + return buildWrappedEvent(this, key); + } + /** + * @_ignore: + */ + queryTransaction(hash) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("@TODO"); + }); + } + /* + // @TODO: this is a non-backwards compatible change, but will be added + // in v7 and in a potential SmartContract class in an upcoming + // v6 release + async getTransactionReceipt(hash: string): Promise { + const provider = getProvider(this.runner); + assert(provider, "contract runner does not have a provider", + "UNSUPPORTED_OPERATION", { operation: "queryTransaction" }); + + const receipt = await provider.getTransactionReceipt(hash); + if (receipt == null) { return null; } + + return new ContractTransactionReceipt(this.interface, provider, receipt); + } + */ + /** + * Provide historic access to event data for %%event%% in the range + * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``"latest"``) + * inclusive. + */ + queryFilter(event, fromBlock, toBlock) { + return __awaiter(this, void 0, void 0, function* () { + if (fromBlock == null) { + fromBlock = 0; + } + if (toBlock == null) { + toBlock = "latest"; + } + const { addr, addrPromise } = getInternal(this); + const address = (addr ? addr : (yield addrPromise)); + const { fragment, topics } = yield getSubInfo(this, event); + const filter = { address, topics, fromBlock, toBlock }; + const provider = getProvider(this.runner); + (0, index_js_3.assert)(provider, "contract runner does not have a provider", "UNSUPPORTED_OPERATION", { operation: "queryFilter" }); + return (yield provider.getLogs(filter)).map((log) => { + let foundFragment = fragment; + if (foundFragment == null) { + try { + foundFragment = this.interface.getEvent(log.topics[0]); + } + catch (error) { } + } + if (foundFragment) { + try { + return new wrappers_js_1.EventLog(log, this.interface, foundFragment); + } + catch (error) { + return new wrappers_js_1.UndecodedEventLog(log, error); + } + } + return new provider_js_1.Log(log, provider); + }); + }); + } + /** + * Add an event %%listener%% for the %%event%%. + */ + on(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield getSub(this, "on", event); + sub.listeners.push({ listener, once: false }); + sub.start(); + return this; + }); + } + /** + * Add an event %%listener%% for the %%event%%, but remove the listener + * after it is fired once. + */ + once(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield getSub(this, "once", event); + sub.listeners.push({ listener, once: true }); + sub.start(); + return this; + }); + } + /** + * Emit an %%event%% calling all listeners with %%args%%. + * + * Resolves to ``true`` if any listeners were called. + */ + emit(event, ...args) { + return __awaiter(this, void 0, void 0, function* () { + return yield emit(this, event, args, null); + }); + } + /** + * Resolves to the number of listeners of %%event%% or the total number + * of listeners if unspecified. + */ + listenerCount(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const sub = yield hasSub(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + const { subs } = getInternal(this); + let total = 0; + for (const { listeners } of subs.values()) { + total += listeners.length; + } + return total; + }); + } + /** + * Resolves to the listeners subscribed to %%event%% or all listeners + * if unspecified. + */ + listeners(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const sub = yield hasSub(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + const { subs } = getInternal(this); + let result = []; + for (const { listeners } of subs.values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + }); + } + /** + * Remove the %%listener%% from the listeners for %%event%% or remove + * all listeners if unspecified. + */ + off(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield hasSub(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (listener == null || sub.listeners.length === 0) { + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + return this; + }); + } + /** + * Remove all the listeners for %%event%% or remove all listeners if + * unspecified. + */ + removeAllListeners(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const sub = yield hasSub(this, event); + if (!sub) { + return this; + } + sub.stop(); + getInternal(this).subs.delete(sub.tag); + } + else { + const { subs } = getInternal(this); + for (const { tag, stop } of subs.values()) { + stop(); + subs.delete(tag); + } + } + return this; + }); + } + /** + * Alias for [on]. + */ + addListener(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.on(event, listener); + }); + } + /** + * Alias for [off]. + */ + removeListener(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.off(event, listener); + }); + } + /** + * Create a new Class for the %%abi%%. + */ + static buildClass(abi) { + class CustomContract extends BaseContract { + constructor(address, runner = null) { + super(address, abi, runner); + } + } + return CustomContract; + } + ; + /** + * Create a new BaseContract with a specified Interface. + */ + static from(target, abi, runner) { + if (runner == null) { + runner = null; + } + const contract = new this(target, abi, runner); + return contract; + } +} +exports.BaseContract = BaseContract; +function _ContractBase() { + return BaseContract; +} +/** + * A [[BaseContract]] with no type guards on its methods or events. + */ +class Contract extends _ContractBase() { +} +exports.Contract = Contract; +//# sourceMappingURL=contract.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/contract.js.map b/dist/ethers.js/src.ts/contract/contract.js.map new file mode 100644 index 0000000..308bf41 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/contract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/contract.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,8CAAmD;AACnD,kDAAoE;AACpE,sEAAsE;AACtE,yBAAyB;AACzB,0DAAiF;AACjF,gDAG2B;AAE3B,+CAIuB;AAsBvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAkBvB,SAAS,OAAO,CAAC,KAAU;IACvB,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AACxD,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC3B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,UAAU,CAAC,KAAU;IAC1B,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,WAAW,CAAC,KAAK,UAAU,CAAC,CAAC;AAC/D,CAAC;AAED,SAAS,OAAO,CAAC,KAAU;IACvB,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,eAAe,CAAC,KAAK,UAAU,CAAC,CAAC;AACnE,CAAC;AAED,SAAS,WAAW,CAAC,KAAU;IAC3B,IAAI,KAAK,IAAI,IAAI,EAAE;QACf,IAAI,UAAU,CAAC,KAAK,CAAC,EAAE;YAAE,OAAO,KAAK,CAAC;SAAE;QACxC,IAAI,KAAK,CAAC,QAAQ,EAAE;YAAE,OAAO,KAAK,CAAC,QAAQ,CAAC;SAAE;KACjD;IACD,OAAO,SAAS,CAAC;AACrB,CAAC;AAED,MAAM,mBAAmB;IAIrB,YAAY,QAAsB,EAAE,QAAuB,EAAE,IAAgB;QAH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AiD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/factory.d.ts b/dist/ethers.js/src.ts/contract/factory.d.ts new file mode 100644 index 0000000..4de0ccc --- /dev/null +++ b/dist/ethers.js/src.ts/contract/factory.d.ts @@ -0,0 +1,62 @@ +import { Interface } from "../abi/index.js"; +import { BaseContract } from "./contract.js"; +import type { InterfaceAbi } from "../abi/index.js"; +import type { Addressable } from "../address/index.js"; +import type { ContractRunner } from "../providers/index.js"; +import type { BytesLike } from "../utils/index.js"; +import type { ContractInterface, ContractMethodArgs, ContractDeployTransaction } from "./types.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +export declare class ContractFactory = Array, I = BaseContract> { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The Contract deployment bytecode. Often called the initcode. + */ + readonly bytecode: string; + /** + * The ContractRunner to deploy the Contract as. + */ + readonly runner: null | ContractRunner; + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi: Interface | InterfaceAbi, bytecode: BytesLike | { + object: string; + }, runner?: null | ContractRunner); + attach(target: string | Addressable): BaseContract & Omit; + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + getDeployTransaction(...args: ContractMethodArgs): Promise; + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resovle to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + deploy(...args: ContractMethodArgs): Promise>; + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner: null | ContractRunner): ContractFactory; + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity = Array, I = ContractInterface>(output: any, runner?: ContractRunner): ContractFactory; +} +//# sourceMappingURL=factory.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/factory.d.ts.map b/dist/ethers.js/src.ts/contract/factory.d.ts.map new file mode 100644 index 0000000..087f082 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/factory.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/factory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAO5C,OAAO,EAAE,YAAY,EAA8B,MAAM,eAAe,CAAC;AAEzE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EACR,iBAAiB,EAAE,kBAAkB,EAAE,yBAAyB,EACnE,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAMjE;;GAEG;AACH,qBAAa,eAAe,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,YAAY;IAE5E;;OAEG;IACH,QAAQ,CAAC,SAAS,EAAG,SAAS,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,IAAI,GAAG,cAAc,CAAC;IAExC;;;;;;OAMG;gBACS,GAAG,EAAE,SAAS,GAAG,YAAY,EAAE,QAAQ,EAAE,SAAS,GAAG;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,cAAc;IAiBnH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,WAAW,GAAG,YAAY,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC;IAIhF;;;OAGG;IACG,oBAAoB,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,yBAAyB,CAAC;IAmB9F;;;;;;;OAOG;IACG,MAAM,CAAC,GAAG,IAAI,EAAE,kBAAkB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,YAAY,GAAG;QAAE,qBAAqB,IAAI,2BAA2B,CAAA;KAAE,GAAG,IAAI,CAAC,CAAC,EAAE,MAAM,YAAY,CAAC,CAAC;IAY5J;;;OAGG;IACH,OAAO,CAAC,MAAM,EAAE,IAAI,GAAG,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;IAI7D;;OAEG;IACH,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,KAAK,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,iBAAiB,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,cAAc,GAAG,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CAgB7I"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/factory.js b/dist/ethers.js/src.ts/contract/factory.js new file mode 100644 index 0000000..764659c --- /dev/null +++ b/dist/ethers.js/src.ts/contract/factory.js @@ -0,0 +1,117 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ContractFactory = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../utils/index.js"); +const contract_js_1 = require("./contract.js"); +// A = Arguments to the constructor +// I = Interface of deployed contracts +/** + * A **ContractFactory** is used to deploy a Contract to the blockchain. + */ +class ContractFactory { + /** + * Create a new **ContractFactory** with %%abi%% and %%bytecode%%, + * optionally connected to %%runner%%. + * + * The %%bytecode%% may be the ``bytecode`` property within the + * standard Solidity JSON output. + */ + constructor(abi, bytecode, runner) { + const iface = index_js_1.Interface.from(abi); + // Dereference Solidity bytecode objects and allow a missing `0x`-prefix + if (bytecode instanceof Uint8Array) { + bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode)); + } + else { + if (typeof (bytecode) === "object") { + bytecode = bytecode.object; + } + if (!bytecode.startsWith("0x")) { + bytecode = "0x" + bytecode; + } + bytecode = (0, index_js_3.hexlify)((0, index_js_3.getBytes)(bytecode)); + } + (0, index_js_3.defineProperties)(this, { + bytecode, interface: iface, runner: (runner || null) + }); + } + attach(target) { + return new contract_js_1.BaseContract(target, this.interface, this.runner); + } + /** + * Resolves to the transaction to deploy the contract, passing %%args%% + * into the constructor. + */ + getDeployTransaction(...args) { + return __awaiter(this, void 0, void 0, function* () { + let overrides = {}; + const fragment = this.interface.deploy; + if (fragment.inputs.length + 1 === args.length) { + overrides = yield (0, contract_js_1.copyOverrides)(args.pop()); + } + if (fragment.inputs.length !== args.length) { + throw new Error("incorrect number of arguments to constructor"); + } + const resolvedArgs = yield (0, contract_js_1.resolveArgs)(this.runner, fragment.inputs, args); + const data = (0, index_js_3.concat)([this.bytecode, this.interface.encodeDeploy(resolvedArgs)]); + return Object.assign({}, overrides, { data }); + }); + } + /** + * Resolves to the Contract deployed by passing %%args%% into the + * constructor. + * + * This will resovle to the Contract before it has been deployed to the + * network, so the [[BaseContract-waitForDeployment]] should be used before + * sending any transactions to it. + */ + deploy(...args) { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield this.getDeployTransaction(...args); + (0, index_js_3.assert)(this.runner && typeof (this.runner.sendTransaction) === "function", "factory runner does not support sending transactions", "UNSUPPORTED_OPERATION", { + operation: "sendTransaction" + }); + const sentTx = yield this.runner.sendTransaction(tx); + const address = (0, index_js_2.getCreateAddress)(sentTx); + return new contract_js_1.BaseContract(address, this.interface, this.runner, sentTx); + }); + } + /** + * Return a new **ContractFactory** with the same ABI and bytecode, + * but connected to %%runner%%. + */ + connect(runner) { + return new ContractFactory(this.interface, this.bytecode, runner); + } + /** + * Create a new **ContractFactory** from the standard Solidity JSON output. + */ + static fromSolidity(output, runner) { + (0, index_js_3.assertArgument)(output != null, "bad compiler output", "output", output); + if (typeof (output) === "string") { + output = JSON.parse(output); + } + const abi = output.abi; + let bytecode = ""; + if (output.bytecode) { + bytecode = output.bytecode; + } + else if (output.evm && output.evm.bytecode) { + bytecode = output.evm.bytecode; + } + return new this(abi, bytecode, runner); + } +} +exports.ContractFactory = ContractFactory; +//# sourceMappingURL=factory.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/factory.js.map b/dist/ethers.js/src.ts/contract/factory.js.map new file mode 100644 index 0000000..4dd7760 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/factory.js.map @@ -0,0 +1 @@ +{"version":3,"file":"factory.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/factory.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,8CAA4C;AAC5C,kDAAuD;AACvD,gDAG2B;AAE3B,+CAAyE;AAazE,mCAAmC;AACnC,sCAAsC;AAEtC;;GAEG;AACH,MAAa,eAAe;IAiBxB;;;;;;OAMG;IACH,YAAY,GAA6B,EAAE,QAAwC,EAAE,MAA8B;QAC/G,MAAM,KAAK,GAAG,oBAAS,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAElC,wEAAwE;QACxE,IAAI,QAAQ,YAAY,UAAU,EAAE;YAChC,QAAQ,GAAG,IAAA,kBAAO,EAAC,IAAA,mBA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C,MAAM,CAAC,CAAC;SAAE;QAEjE,MAAM,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QAEvB,IAAI,QAAQ,GAAG,EAAE,CAAC;QAClB,IAAI,MAAM,CAAC,QAAQ,EAAE;YACjB,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;SAC9B;aAAM,IAAI,MAAM,CAAC,GAAG,IAAI,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE;YAC1C,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;SAClC;QAED,OAAO,IAAI,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC3C,CAAC;CACJ;AAnHD,0CAmHC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/index.d.ts b/dist/ethers.js/src.ts/contract/index.d.ts new file mode 100644 index 0000000..b7f2c81 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/index.d.ts @@ -0,0 +1,13 @@ +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +export { BaseContract, Contract } from "./contract.js"; +export { ContractFactory } from "./factory.js"; +export { ContractEventPayload, ContractUnknownEventPayload, ContractTransactionReceipt, ContractTransactionResponse, EventLog, UndecodedEventLog } from "./wrappers.js"; +export type { BaseContractMethod, ConstantContractMethod, PostfixOverrides, ContractEvent, ContractEventArgs, ContractEventName, ContractDeployTransaction, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, WrappedFallback } from "./types.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/index.d.ts.map b/dist/ethers.js/src.ts/contract/index.d.ts.map new file mode 100644 index 0000000..953a24b --- /dev/null +++ b/dist/ethers.js/src.ts/contract/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EACH,YAAY,EAAE,QAAQ,EACzB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACH,eAAe,EAClB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACH,oBAAoB,EAAE,2BAA2B,EACjD,0BAA0B,EAAE,2BAA2B,EACvD,QAAQ,EAAE,iBAAiB,EAC9B,MAAM,eAAe,CAAC;AAEvB,YAAY,EACR,kBAAkB,EAAE,sBAAsB,EAC1C,gBAAgB,EAChB,aAAa,EAAE,iBAAiB,EAAE,iBAAiB,EACnD,yBAAyB,EACzB,iBAAiB,EAAE,cAAc,EAAE,kBAAkB,EAAE,mBAAmB,EAC1E,mBAAmB,EAAE,SAAS,EAC9B,eAAe,EAClB,MAAM,YAAY,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/index.js b/dist/ethers.js/src.ts/contract/index.js new file mode 100644 index 0000000..331b92f --- /dev/null +++ b/dist/ethers.js/src.ts/contract/index.js @@ -0,0 +1,24 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.UndecodedEventLog = exports.EventLog = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractUnknownEventPayload = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = void 0; +/** + * A **Contract** object is a meta-class (a class whose definition is + * defined at runtime), which communicates with a deployed smart contract + * on the blockchain and provides a simple JavaScript interface to call + * methods, send transaction, query historic logs and listen for its events. + * + * @_section: api/contract:Contracts [about-contracts] + */ +var contract_js_1 = require("./contract.js"); +Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return contract_js_1.BaseContract; } }); +Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return contract_js_1.Contract; } }); +var factory_js_1 = require("./factory.js"); +Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return factory_js_1.ContractFactory; } }); +var wrappers_js_1 = require("./wrappers.js"); +Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractEventPayload; } }); +Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return wrappers_js_1.ContractUnknownEventPayload; } }); +Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionReceipt; } }); +Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return wrappers_js_1.ContractTransactionResponse; } }); +Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return wrappers_js_1.EventLog; } }); +Object.defineProperty(exports, "UndecodedEventLog", { enumerable: true, get: function () { return wrappers_js_1.UndecodedEventLog; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/index.js.map b/dist/ethers.js/src.ts/contract/index.js.map new file mode 100644 index 0000000..4172730 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,6CAEuB;AADnB,2GAAA,YAAY,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAG1B,2CAEsB;AADlB,6GAAA,eAAe,OAAA;AAGnB,6CAIuB;AAHnB,mHAAA,oBAAoB,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACjD,yHAAA,0BAA0B,OAAA;AAAE,0HAAA,2BAA2B,OAAA;AACvD,uGAAA,QAAQ,OAAA;AAAE,gHAAA,iBAAiB,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/types.d.ts b/dist/ethers.js/src.ts/contract/types.d.ts new file mode 100644 index 0000000..79d0f21 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/types.d.ts @@ -0,0 +1,193 @@ +import type { EventFragment, FunctionFragment, Result, Typed } from "../abi/index.js"; +import type { TransactionRequest, PreparedTransactionRequest, TopicFilter } from "../providers/index.js"; +import type { ContractTransactionResponse } from "./wrappers.js"; +/** + * The name for an event used for subscribing to Contract events. + * + * **``string``** - An event by name. The event must be non-ambiguous. + * The parameters will be dereferenced when passed into the listener. + * + * [[ContractEvent]] - A filter from the ``contract.filters``, which will + * pass only the EventPayload as a single parameter, which includes a + * ``.signature`` property that can be used to further filter the event. + * + * [[TopicFilter]] - A filter defined using the standard Ethereum API + * which provides the specific topic hash or topic hashes to watch for along + * with any additional values to filter by. This will only pass a single + * parameter to the listener, the EventPayload which will include additional + * details to refine by, such as the event name and signature. + * + * [[DeferredTopicFilter]] - A filter created by calling a [[ContractEvent]] + * with parameters, which will create a filter for a specific event + * signautre and dereference each parameter when calling the listener. + */ +export type ContractEventName = string | ContractEvent | TopicFilter | DeferredTopicFilter; +/** + * A Contract with no method constraints. + */ +export interface ContractInterface { + [name: string]: BaseContractMethod; +} +/** + * When creating a filter using the ``contract.filters``, this is returned. + */ +export interface DeferredTopicFilter { + getTopicFilter(): Promise; + fragment: EventFragment; +} +/** + * When populating a transaction this type is returned. + */ +export interface ContractTransaction extends PreparedTransactionRequest { + /** + * The target address. + */ + to: string; + /** + * The transaction data. + */ + data: string; + /** + * The from address, if any. + */ + from?: string; +} +/** + * A deployment transaction for a contract. + */ +export interface ContractDeployTransaction extends Omit { +} +/** + * The overrides for a contract transaction. + */ +export interface Overrides extends Omit { +} +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter. + * + * @_ignore: + */ +export type PostfixOverrides> = A | [...A, Overrides]; +/** + * Arguments to a Contract method can always include an additional and + * optional overrides parameter, and each parameter can optionally be + * [[Typed]]. + * + * @_ignore: + */ +export type ContractMethodArgs> = PostfixOverrides<{ + [I in keyof A]-?: A[I] | Typed; +}>; +/** + * A Contract method can be called directly, or used in various ways. + */ +export interface BaseContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> { + (...args: ContractMethodArgs): Promise; + /** + * The name of the Contract method. + */ + name: string; + /** + * The fragment of the Contract method. This will throw on ambiguous + * method names. + */ + fragment: FunctionFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous method names. + */ + getFragment(...args: ContractMethodArgs): FunctionFragment; + /** + * Returns a populated transaction that can be used to perform the + * contract method with %%args%%. + */ + populateTransaction(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the value. + * + * If the return value is a single type, it will be dereferenced and + * returned directly, otherwise the full Result will be returned. + */ + staticCall(...args: ContractMethodArgs): Promise; + /** + * Send a transaction for the contract method with %%args%%. + */ + send(...args: ContractMethodArgs): Promise; + /** + * Estimate the gas to send the contract method with %%args%%. + */ + estimateGas(...args: ContractMethodArgs): Promise; + /** + * Call the contract method with %%args%% and return the Result + * without any dereferencing. + */ + staticCallResult(...args: ContractMethodArgs): Promise; +} +/** + * A contract method on a Contract. + */ +export interface ContractMethod = Array, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> extends BaseContractMethod { +} +/** + * A pure of view method on a Contract. + */ +export interface ConstantContractMethod, R = any> extends ContractMethod { +} +/** + * Each argument of an event is nullable (to indicate matching //any//. + * + * @_ignore: + */ +export type ContractEventArgs> = { + [I in keyof A]?: A[I] | Typed | null; +}; +export interface ContractEvent = Array> { + (...args: ContractEventArgs): DeferredTopicFilter; + /** + * The name of the Contract event. + */ + name: string; + /** + * The fragment of the Contract event. This will throw on ambiguous + * method names. + */ + fragment: EventFragment; + /** + * Returns the fragment constrained by %%args%%. This can be used to + * resolve ambiguous event names. + */ + getFragment(...args: ContractEventArgs): EventFragment; +} +/** + * A Fallback or Receive function on a Contract. + */ +export interface WrappedFallback { + (overrides?: Omit): Promise; + /** + * Returns a populated transaction that can be used to perform the + * fallback method. + * + * For non-receive fallback, ``data`` may be overridden. + */ + populateTransaction(overrides?: Omit): Promise; + /** + * Call the contract fallback and return the result. + * + * For non-receive fallback, ``data`` may be overridden. + */ + staticCall(overrides?: Omit): Promise; + /** + * Send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + send(overrides?: Omit): Promise; + /** + * Estimate the gas to send a transaction to the contract fallback. + * + * For non-receive fallback, ``data`` may be overridden. + */ + estimateGas(overrides?: Omit): Promise; +} +//# sourceMappingURL=types.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/types.d.ts.map b/dist/ethers.js/src.ts/contract/types.d.ts.map new file mode 100644 index 0000000..672259d --- /dev/null +++ b/dist/ethers.js/src.ts/contract/types.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,aAAa,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,EACjD,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EACR,kBAAkB,EAAE,0BAA0B,EAAE,WAAW,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,eAAe,CAAC;AAGjE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,aAAa,GAAG,WAAW,GAAG,mBAAmB,CAAC;AAE3F;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAC9B,CAAE,IAAI,EAAE,MAAM,GAAI,kBAAkB,CAAC;CACxC;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAChC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC,CAAC;IACvC,QAAQ,EAAE,aAAa,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,mBAAoB,SAAQ,0BAA0B;IACnE;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;A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;IACH,QAAQ,EAAE,aAAa,CAAC;IAExB;;;OAGG;IACH,WAAW,CAAC,GAAG,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC;CAC7D;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEnF;;;;;OAKG;IACH,mBAAmB,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAE9F;;;;OAIG;IACH,UAAU,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAExE;;;;OAIG;IACH,IAAI,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,2BAA2B,CAAC,CAAC;IAEvF;;;;OAIG;IACH,WAAW,CAAC,SAAS,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CAC5E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/types.js b/dist/ethers.js/src.ts/contract/types.js new file mode 100644 index 0000000..c132526 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/types.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +; +; +; +//# sourceMappingURL=types.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/types.js.map b/dist/ethers.js/src.ts/contract/types.js.map new file mode 100644 index 0000000..5790e2d --- /dev/null +++ b/dist/ethers.js/src.ts/contract/types.js.map @@ -0,0 +1 @@ +{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/types.ts"],"names":[],"mappings":";;AAqCC,CAAC;AAsC4E,CAAC;AA4H9E,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/wrappers.d.ts b/dist/ethers.js/src.ts/contract/wrappers.d.ts new file mode 100644 index 0000000..4eab8cf --- /dev/null +++ b/dist/ethers.js/src.ts/contract/wrappers.d.ts @@ -0,0 +1,143 @@ +import { Block, Log, TransactionReceipt, TransactionResponse } from "../providers/provider.js"; +import { EventPayload } from "../utils/index.js"; +import type { EventFragment, Interface, Result } from "../abi/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BaseContract } from "./contract.js"; +import type { ContractEventName } from "./types.js"; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class EventLog extends Log { + /** + * The Contract Interface. + */ + readonly interface: Interface; + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(log: Log, iface: Interface, fragment: EventFragment); + /** + * The name of the event. + */ + get eventName(): string; + /** + * The signature of the event. + */ + get eventSignature(): string; +} +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +export declare class UndecodedEventLog extends Log { + /** + * The error encounted when trying to decode the log. + */ + readonly error: Error; + /** + * @_ignore: + */ + constructor(log: Log, error: Error); +} +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +export declare class ContractTransactionReceipt extends TransactionReceipt { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionReceipt); + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs(): Array; +} +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +export declare class ContractTransactionResponse extends TransactionResponse { + #private; + /** + * @_ignore: + */ + constructor(iface: Interface, provider: Provider, tx: TransactionResponse); + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(confirms?: number): Promise; +} +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +export declare class ContractUnknownEventPayload extends EventPayload { + /** + * The log with no matching events. + */ + readonly log: Log; + /** + * @_event: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log); + /** + * Resolves to the block the event occured in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction the event occured in. + */ + getTransaction(): Promise; + /** + * Resolves to the transaction receipt the event occured in. + */ + getTransactionReceipt(): Promise; +} +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +export declare class ContractEventPayload extends ContractUnknownEventPayload { + /** + * The matching event. + */ + readonly fragment: EventFragment; + /** + * The log, with parsed properties. + */ + readonly log: EventLog; + /** + * The parsed arguments passed to the event by ``emit``. + */ + readonly args: Result; + /** + * @_ignore: + */ + constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log); + /** + * The event name. + */ + get eventName(): string; + /** + * The event signature. + */ + get eventSignature(): string; +} +//# sourceMappingURL=wrappers.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/wrappers.d.ts.map b/dist/ethers.js/src.ts/contract/wrappers.d.ts.map new file mode 100644 index 0000000..7e36684 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/wrappers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/contract/wrappers.ts"],"names":[],"mappings":"AAEA,OAAO,EACH,KAAK,EAAE,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EACtD,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAoB,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,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AKzE;;;;;;;;OAQG;IACG,IAAI,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,0BAA0B,CAAC;CAK5E;AAED;;;GAGG;AACH,qBAAc,2BAA4B,SAAQ,YAAY,CAAC,iBAAiB,CAAC;IAC7E;;OAEG;IACH,QAAQ,CAAC,GAAG,EAAG,GAAG,CAAC;IAEnB;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,GAAG,EAAE,GAAG;IAKlG;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,KAAK,CAAC;IAIhC;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAIpD;;OAEG;IACG,qBAAqB,IAAI,OAAO,CAAC,kBAAkB,CAAC;CAG7D;AAED;;;GAGG;AACH,qBAAa,oBAAqB,SAAQ,2BAA2B;IAEjE;;OAEG;IACH,SAAiB,QAAQ,EAAE,aAAa,CAAC;IAEzC;;OAEG;IACH,SAAiB,GAAG,EAAE,QAAQ,CAAC;IAE/B;;OAEG;IACH,SAAiB,IAAI,EAAE,MAAM,CAAC;IAE9B;;OAEG;gBACS,QAAQ,EAAE,YAAY,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,iBAAiB,EAAE,QAAQ,EAAE,aAAa,EAAE,IAAI,EAAE,GAAG;IAM5H;;OAEG;IACH,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED;;OAEG;IACH,IAAI,cAAc,IAAI,MAAM,CAE3B;CACJ"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/wrappers.js b/dist/ethers.js/src.ts/contract/wrappers.js new file mode 100644 index 0000000..3555308 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/wrappers.js @@ -0,0 +1,200 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _ContractTransactionReceipt_iface, _ContractTransactionResponse_iface; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ContractEventPayload = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.UndecodedEventLog = exports.EventLog = void 0; +// import from provider.ts instead of index.ts to prevent circular dep +// from EtherscanProvider +const provider_js_1 = require("../providers/provider.js"); +const index_js_1 = require("../utils/index.js"); +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class EventLog extends provider_js_1.Log { + /** + * @_ignore: + */ + constructor(log, iface, fragment) { + super(log, log.provider); + const args = iface.decodeEventLog(fragment, log.data, log.topics); + (0, index_js_1.defineProperties)(this, { args, fragment, interface: iface }); + } + /** + * The name of the event. + */ + get eventName() { return this.fragment.name; } + /** + * The signature of the event. + */ + get eventSignature() { return this.fragment.format(); } +} +exports.EventLog = EventLog; +/** + * An **EventLog** contains additional properties parsed from the [[Log]]. + */ +class UndecodedEventLog extends provider_js_1.Log { + /** + * @_ignore: + */ + constructor(log, error) { + super(log, log.provider); + (0, index_js_1.defineProperties)(this, { error }); + } +} +exports.UndecodedEventLog = UndecodedEventLog; +/** + * A **ContractTransactionReceipt** includes the parsed logs from a + * [[TransactionReceipt]]. + */ +class ContractTransactionReceipt extends provider_js_1.TransactionReceipt { + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + _ContractTransactionReceipt_iface.set(this, void 0); + __classPrivateFieldSet(this, _ContractTransactionReceipt_iface, iface, "f"); + } + /** + * The parsed logs for any [[Log]] which has a matching event in the + * Contract ABI. + */ + get logs() { + return super.logs.map((log) => { + const fragment = log.topics.length ? __classPrivateFieldGet(this, _ContractTransactionReceipt_iface, "f").getEvent(log.topics[0]) : null; + if (fragment) { + try { + return new EventLog(log, __classPrivateFieldGet(this, _ContractTransactionReceipt_iface, "f"), fragment); + } + catch (error) { + return new UndecodedEventLog(log, error); + } + } + return log; + }); + } +} +exports.ContractTransactionReceipt = ContractTransactionReceipt; +_ContractTransactionReceipt_iface = new WeakMap(); +/** + * A **ContractTransactionResponse** will return a + * [[ContractTransactionReceipt]] when waited on. + */ +class ContractTransactionResponse extends provider_js_1.TransactionResponse { + /** + * @_ignore: + */ + constructor(iface, provider, tx) { + super(tx, provider); + _ContractTransactionResponse_iface.set(this, void 0); + __classPrivateFieldSet(this, _ContractTransactionResponse_iface, iface, "f"); + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(confirms) { + const _super = Object.create(null, { + wait: { get: () => super.wait } + }); + return __awaiter(this, void 0, void 0, function* () { + const receipt = yield _super.wait.call(this, confirms); + if (receipt == null) { + return null; + } + return new ContractTransactionReceipt(__classPrivateFieldGet(this, _ContractTransactionResponse_iface, "f"), this.provider, receipt); + }); + } +} +exports.ContractTransactionResponse = ContractTransactionResponse; +_ContractTransactionResponse_iface = new WeakMap(); +/** + * A **ContractUnknownEventPayload** is included as the last parameter to + * Contract Events when the event does not match any events in the ABI. + */ +class ContractUnknownEventPayload extends index_js_1.EventPayload { + /** + * @_event: + */ + constructor(contract, listener, filter, log) { + super(contract, listener, filter); + (0, index_js_1.defineProperties)(this, { log }); + } + /** + * Resolves to the block the event occured in. + */ + getBlock() { + return __awaiter(this, void 0, void 0, function* () { + return yield this.log.getBlock(); + }); + } + /** + * Resolves to the transaction the event occured in. + */ + getTransaction() { + return __awaiter(this, void 0, void 0, function* () { + return yield this.log.getTransaction(); + }); + } + /** + * Resolves to the transaction receipt the event occured in. + */ + getTransactionReceipt() { + return __awaiter(this, void 0, void 0, function* () { + return yield this.log.getTransactionReceipt(); + }); + } +} +exports.ContractUnknownEventPayload = ContractUnknownEventPayload; +/** + * A **ContractEventPayload** is included as the last parameter to + * Contract Events when the event is known. + */ +class ContractEventPayload extends ContractUnknownEventPayload { + /** + * @_ignore: + */ + constructor(contract, listener, filter, fragment, _log) { + super(contract, listener, filter, new EventLog(_log, contract.interface, fragment)); + const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics); + (0, index_js_1.defineProperties)(this, { args, fragment }); + } + /** + * The event name. + */ + get eventName() { + return this.fragment.name; + } + /** + * The event signature. + */ + get eventSignature() { + return this.fragment.format(); + } +} +exports.ContractEventPayload = ContractEventPayload; +//# sourceMappingURL=wrappers.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/contract/wrappers.js.map b/dist/ethers.js/src.ts/contract/wrappers.js.map new file mode 100644 index 0000000..ca096f1 --- /dev/null +++ b/dist/ethers.js/src.ts/contract/wrappers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wrappers.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts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uCC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts b/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts new file mode 100644 index 0000000..ba0bbf1 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts @@ -0,0 +1,15 @@ +declare global { + interface Window { + } + const window: Window; + const self: Window; +} +export interface CryptoHasher { + update(data: Uint8Array): CryptoHasher; + digest(): Uint8Array; +} +export declare function createHash(algo: string): CryptoHasher; +export declare function createHmac(_algo: string, key: Uint8Array): CryptoHasher; +export declare function pbkdf2Sync(password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, _algo: "sha256" | "sha512"): Uint8Array; +export declare function randomBytes(length: number): Uint8Array; +//# sourceMappingURL=crypto-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts.map b/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts.map new file mode 100644 index 0000000..774294c --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":"AAUA,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;KAAI;IAEpB,MAAM,MAAM,EAAE,MAAM,CAAC;IACrB,MAAM,IAAI,EAAE,MAAM,CAAC;CACtB;AAcD,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,IAAI,EAAE,UAAU,GAAG,YAAY,CAAC;IACvC,MAAM,IAAI,UAAU,CAAC;CACxB;AAED,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAMrD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,UAAU,GAAG,YAAY,CAIvE;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAI7I;AAED,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAStD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto-browser.js b/dist/ethers.js/src.ts/crypto/crypto-browser.js new file mode 100644 index 0000000..69e20e6 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto-browser.js @@ -0,0 +1,55 @@ +"use strict"; +/* Browser Crypto Shims */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = void 0; +const hmac_1 = require("@noble/hashes/hmac"); +const pbkdf2_1 = require("@noble/hashes/pbkdf2"); +const sha256_1 = require("@noble/hashes/sha256"); +const sha512_1 = require("@noble/hashes/sha512"); +const index_js_1 = require("../utils/index.js"); +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const anyGlobal = getGlobal(); +const crypto = anyGlobal.crypto || anyGlobal.msCrypto; +function createHash(algo) { + switch (algo) { + case "sha256": return sha256_1.sha256.create(); + case "sha512": return sha512_1.sha512.create(); + } + (0, index_js_1.assertArgument)(false, "invalid hashing algorithm name", "algorithm", algo); +} +exports.createHash = createHash; +function createHmac(_algo, key) { + const algo = ({ sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]); + (0, index_js_1.assertArgument)(algo != null, "invalid hmac algorithm", "algorithm", _algo); + return hmac_1.hmac.create(algo, key); +} +exports.createHmac = createHmac; +function pbkdf2Sync(password, salt, iterations, keylen, _algo) { + const algo = ({ sha256: sha256_1.sha256, sha512: sha512_1.sha512 }[_algo]); + (0, index_js_1.assertArgument)(algo != null, "invalid pbkdf2 algorithm", "algorithm", _algo); + return (0, pbkdf2_1.pbkdf2)(algo, password, salt, { c: iterations, dkLen: keylen }); +} +exports.pbkdf2Sync = pbkdf2Sync; +function randomBytes(length) { + (0, index_js_1.assert)(crypto != null, "platform does not support secure random numbers", "UNSUPPORTED_OPERATION", { + operation: "randomBytes" + }); + (0, index_js_1.assertArgument)(Number.isInteger(length) && length > 0 && length <= 1024, "invalid length", "length", length); + const result = new Uint8Array(length); + crypto.getRandomValues(result); + return result; +} +exports.randomBytes = randomBytes; +//# sourceMappingURL=crypto-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto-browser.js.map b/dist/ethers.js/src.ts/crypto/crypto-browser.js.map new file mode 100644 index 0000000..89332cc --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/crypto-browser.ts"],"names":[],"mappings":";AAAA,0BAA0B;;;AAE1B,6CAA0C;AAC1C,iDAA8C;AAC9C,iDAA8C;AAC9C,iDAA8C;AAE9C,gDAA2D;AAW3D,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAAA,CAAC;AAEF,MAAM,SAAS,GAAG,SAAS,EAAE,CAAC;AAC9B,MAAM,MAAM,GAAQ,SAAS,CAAC,MAAM,IAAI,SAAS,CAAC,QAAQ,CAAC;AAQ3D,SAAgB,UAAU,CAAC,IAAY;IACnC,QAAQ,IAAI,EAAE;QACV,KAAK,QAAQ,CAAC,CAAC,OAAO,eAAM,CAAC,MAAM,EAAE,CAAC;QACtC,KA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AE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IAE7G,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC;AATD,kCASC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto.d.ts b/dist/ethers.js/src.ts/crypto/crypto.d.ts new file mode 100644 index 0000000..e9c555d --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto.d.ts @@ -0,0 +1,2 @@ +export { createHash, createHmac, pbkdf2Sync, randomBytes } from "crypto"; +//# sourceMappingURL=crypto.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto.d.ts.map b/dist/ethers.js/src.ts/crypto/crypto.d.ts.map new file mode 100644 index 0000000..cc222e0 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/crypto.ts"],"names":[],"mappings":"AACA,OAAO,EACH,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAClD,MAAM,QAAQ,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto.js b/dist/ethers.js/src.ts/crypto/crypto.js new file mode 100644 index 0000000..31e54d5 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = exports.pbkdf2Sync = exports.createHmac = exports.createHash = void 0; +var crypto_1 = require("crypto"); +Object.defineProperty(exports, "createHash", { enumerable: true, get: function () { return crypto_1.createHash; } }); +Object.defineProperty(exports, "createHmac", { enumerable: true, get: function () { return crypto_1.createHmac; } }); +Object.defineProperty(exports, "pbkdf2Sync", { enumerable: true, get: function () { return crypto_1.pbkdf2Sync; } }); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return crypto_1.randomBytes; } }); +//# sourceMappingURL=crypto.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/crypto.js.map b/dist/ethers.js/src.ts/crypto/crypto.js.map new file mode 100644 index 0000000..c20843e --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/crypto.js.map @@ -0,0 +1 @@ +{"version":3,"file":"crypto.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/crypto.ts"],"names":[],"mappings":";;;AACA,iCAEgB;AADZ,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,oGAAA,UAAU,OAAA;AAAE,qGAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/hmac.d.ts b/dist/ethers.js/src.ts/crypto/hmac.d.ts new file mode 100644 index 0000000..4c5e322 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/hmac.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +export declare function computeHmac(algorithm: "sha256" | "sha512", _key: BytesLike, _data: BytesLike): string; +export declare namespace computeHmac { + var _: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike; + var lock: () => void; + var register: (func: (algorithm: "sha256" | "sha512", key: Uint8Array, data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=hmac.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/hmac.d.ts.map b/dist/ethers.js/src.ts/crypto/hmac.d.ts.map new file mode 100644 index 0000000..01c6d1d --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/hmac.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/hmac.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,QAAQ,GAAG,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,GAAG,MAAM,CAIrG;yBAJe,WAAW"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/hmac.js b/dist/ethers.js/src.ts/crypto/hmac.js new file mode 100644 index 0000000..a13ef91 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/hmac.js @@ -0,0 +1,51 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.computeHmac = void 0; +/** + * An **HMAC** enables verification that a given key was used + * to authenticate a payload. + * + * See: [[link-wiki-hmac]] + * + * @_subsection: api/crypto:HMAC [about-hmac] + */ +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _computeHmac = function (algorithm, key, data) { + return (0, crypto_js_1.createHmac)(algorithm, key).update(data).digest(); +}; +let __computeHmac = _computeHmac; +/** + * Return the HMAC for %%data%% using the %%key%% key with the underlying + * %%algo%% used for compression. + * + * @example: + * key = id("some-secret") + * + * // Compute the HMAC + * computeHmac("sha256", key, "0x1337") + * //_result: + * + * // To compute the HMAC of UTF-8 data, the data must be + * // converted to UTF-8 bytes + * computeHmac("sha256", key, toUtf8Bytes("Hello World")) + * //_result: + * + */ +function computeHmac(algorithm, _key, _data) { + const key = (0, index_js_1.getBytes)(_key, "key"); + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__computeHmac(algorithm, key, data)); +} +exports.computeHmac = computeHmac; +computeHmac._ = _computeHmac; +computeHmac.lock = function () { locked = true; }; +computeHmac.register = function (func) { + if (locked) { + throw new Error("computeHmac is locked"); + } + __computeHmac = func; +}; +Object.freeze(computeHmac); +//# sourceMappingURL=hmac.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/hmac.js.map b/dist/ethers.js/src.ts/crypto/hmac.js.map new file mode 100644 index 0000000..53431bf --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/hmac.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hmac.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/hmac.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAAyC;AACzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,SAA8B,EAAE,GAAe,EAAE,IAAgB;IAC3F,OAAO,IAAA,sBAAU,EAAC,SAAS,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AAC5D,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,WAAW,CAAC,SAA8B,EAAE,IAAe,EAAE,KAAgB;IACzF,MAAM,GAAG,GAAG,IAAA,mBAAQ,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAClC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,aAAa,CAAC,SAAS,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;AACxD,CAAC;AAJD,kCAIC;AACD,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAI,cAAa,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAsF;IAClH,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/index.d.ts b/dist/ethers.js/src.ts/crypto/index.d.ts new file mode 100644 index 0000000..8d6bc56 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/index.d.ts @@ -0,0 +1,25 @@ +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +import { computeHmac } from "./hmac.js"; +import { keccak256 } from "./keccak.js"; +import { ripemd160 } from "./ripemd160.js"; +import { pbkdf2 } from "./pbkdf2.js"; +import { randomBytes } from "./random.js"; +import { scrypt, scryptSync } from "./scrypt.js"; +import { sha256, sha512 } from "./sha2.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync }; +export { SigningKey } from "./signing-key.js"; +export { Signature } from "./signature.js"; +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +declare function lock(): void; +export { lock }; +export type { ProgressCallback } from "./scrypt.js"; +export type { SignatureLike } from "./signature.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/index.d.ts.map b/dist/ethers.js/src.ts/crypto/index.d.ts.map new file mode 100644 index 0000000..87fdba4 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,EACH,WAAW,EAEX,WAAW,EAEX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EAEd,MAAM,EACN,MAAM,EAAE,UAAU,EACrB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C;;;GAGG;AACH,iBAAS,IAAI,IAAI,IAAI,CAWpB;AAED,OAAO,EAAE,IAAI,EAAE,CAAC;AAKhB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,YAAY,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/index.js b/dist/ethers.js/src.ts/crypto/index.js new file mode 100644 index 0000000..39a4b35 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/index.js @@ -0,0 +1,49 @@ +"use strict"; +/** + * A fundamental building block of Ethereum is the underlying + * cryptographic primitives. + * + * @_section: api/crypto:Cryptographic Functions [about-crypto] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.lock = exports.Signature = exports.SigningKey = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = void 0; +null; +// We import all these so we can export lock() +const hmac_js_1 = require("./hmac.js"); +Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return hmac_js_1.computeHmac; } }); +const keccak_js_1 = require("./keccak.js"); +Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return keccak_js_1.keccak256; } }); +const ripemd160_js_1 = require("./ripemd160.js"); +Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return ripemd160_js_1.ripemd160; } }); +const pbkdf2_js_1 = require("./pbkdf2.js"); +Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return pbkdf2_js_1.pbkdf2; } }); +const random_js_1 = require("./random.js"); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return random_js_1.randomBytes; } }); +const scrypt_js_1 = require("./scrypt.js"); +Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return scrypt_js_1.scrypt; } }); +Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return scrypt_js_1.scryptSync; } }); +const sha2_js_1 = require("./sha2.js"); +Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return sha2_js_1.sha256; } }); +Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return sha2_js_1.sha512; } }); +var signing_key_js_1 = require("./signing-key.js"); +Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return signing_key_js_1.SigningKey; } }); +var signature_js_1 = require("./signature.js"); +Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return signature_js_1.Signature; } }); +/** + * Once called, prevents any future change to the underlying cryptographic + * primitives using the ``.register`` feature for hooks. + */ +function lock() { + hmac_js_1.computeHmac.lock(); + keccak_js_1.keccak256.lock(); + pbkdf2_js_1.pbkdf2.lock(); + random_js_1.randomBytes.lock(); + ripemd160_js_1.ripemd160.lock(); + scrypt_js_1.scrypt.lock(); + scrypt_js_1.scryptSync.lock(); + sha2_js_1.sha256.lock(); + sha2_js_1.sha512.lock(); + random_js_1.randomBytes.lock(); +} +exports.lock = lock; +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/index.js.map b/dist/ethers.js/src.ts/crypto/index.js.map new file mode 100644 index 0000000..243bae9 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,IAAI,CAAA;AAEJ,8CAA8C;AAC9C,uCAAwC;AASpC,4FATK,qBAAW,OASL;AARf,2CAAwC;AAYpC,0FAZK,qBAAS,OAYL;AAXb,iDAA2C;AAYvC,0FAZK,wBAAS,OAYL;AAXb,2CAAqC;AAcjC,uFAdK,kBAAM,OAcL;AAbV,2CAA0C;AAOtC,4FAPK,uBAAW,OAOL;AANf,2CAAiD;AAa7C,uFAbK,kBAAM,OAaL;AAAE,2FAbK,sBAAU,OAaL;AAZtB,uCAA2C;AASvC,uFATK,gBAAM,OASL;AAAE,uFATK,gBAAM,OASL;AAMlB,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AACnB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA;AAElB;;;GAGG;AACH,SAAS,IAAI;IACT,qBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,qBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;IACnB,wBAAS,CAAC,IAAI,EAAE,CAAC;IACjB,kBAAM,CAAC,IAAI,EAAE,CAAC;IACd,sBAAU,CAAC,IAAI,EAAE,CAAC;IAClB,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,gBAAM,CAAC,IAAI,EAAE,CAAC;IACd,uBAAW,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC;AAEQ,oBAAI"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/keccak.d.ts b/dist/ethers.js/src.ts/crypto/keccak.d.ts new file mode 100644 index 0000000..533f46d --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/keccak.d.ts @@ -0,0 +1,35 @@ +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +export declare function keccak256(_data: BytesLike): string; +export declare namespace keccak256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=keccak.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/keccak.d.ts.map b/dist/ethers.js/src.ts/crypto/keccak.d.ts.map new file mode 100644 index 0000000..989b19c --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/keccak.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/keccak.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/keccak.js b/dist/ethers.js/src.ts/crypto/keccak.js new file mode 100644 index 0000000..ea51d66 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/keccak.js @@ -0,0 +1,52 @@ +"use strict"; +/** + * Cryptographic hashing functions + * + * @_subsection: api/crypto:Hash Functions [about-crypto-hashing] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.keccak256 = void 0; +const sha3_1 = require("@noble/hashes/sha3"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _keccak256 = function (data) { + return (0, sha3_1.keccak_256)(data); +}; +let __keccak256 = _keccak256; +/** + * Compute the cryptographic KECCAK256 hash of %%data%%. + * + * The %%data%% **must** be a data representation, to compute the + * hash of UTF-8 data use the [[id]] function. + * + * @returns DataHexstring + * @example: + * keccak256("0x") + * //_result: + * + * keccak256("0x1337") + * //_result: + * + * keccak256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + * // Strings are assumed to be DataHexString, otherwise it will + * // throw. To hash UTF-8 data, see the note above. + * keccak256("Hello World") + * //_error: + */ +function keccak256(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__keccak256(data)); +} +exports.keccak256 = keccak256; +keccak256._ = _keccak256; +keccak256.lock = function () { locked = true; }; +keccak256.register = function (func) { + if (locked) { + throw new TypeError("keccak256 is locked"); + } + __keccak256 = func; +}; +Object.freeze(keccak256); +//# sourceMappingURL=keccak.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/keccak.js.map b/dist/ethers.js/src.ts/crypto/keccak.js.map new file mode 100644 index 0000000..71944ea --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/keccak.js.map @@ -0,0 +1 @@ +{"version":3,"file":"keccak.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/keccak.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,6CAAgD;AAEhD,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,iBAAU,EAAC,IAAI,CAAC,CAAC;AAC5B,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts b/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts new file mode 100644 index 0000000..400e974 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts @@ -0,0 +1,35 @@ +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +import type { BytesLike } from "../utils/index.js"; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +export declare function pbkdf2(_password: BytesLike, _salt: BytesLike, iterations: number, keylen: number, algo: "sha256" | "sha512"): string; +export declare namespace pbkdf2 { + var _: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike; + var lock: () => void; + var register: (func: (password: Uint8Array, salt: Uint8Array, iterations: number, keylen: number, algo: "sha256" | "sha512") => BytesLike) => void; +} +//# sourceMappingURL=pbkdf2.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts.map b/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts.map new file mode 100644 index 0000000..d8c7b12 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/pbkdf2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAIpI;yBAJe,MAAM"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/pbkdf2.js b/dist/ethers.js/src.ts/crypto/pbkdf2.js new file mode 100644 index 0000000..b771a19 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/pbkdf2.js @@ -0,0 +1,53 @@ +"use strict"; +/** + * A **Password-Based Key-Derivation Function** is designed to create + * a sequence of bytes suitible as a **key** from a human-rememberable + * password. + * + * @_subsection: api/crypto:Passwords [about-pbkdf] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.pbkdf2 = void 0; +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _pbkdf2 = function (password, salt, iterations, keylen, algo) { + return (0, crypto_js_1.pbkdf2Sync)(password, salt, iterations, keylen, algo); +}; +let __pbkdf2 = _pbkdf2; +/** + * Return the [[link-pbkdf2]] for %%keylen%% bytes for %%password%% using + * the %%salt%% and using %%iterations%% of %%algo%%. + * + * This PBKDF is outdated and should not be used in new projects, but is + * required to decrypt older files. + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the PBKDF2 + * pbkdf2(passwordBytes, salt, 1024, 16, "sha256") + * //_result: + */ +function pbkdf2(_password, _salt, iterations, keylen, algo) { + const password = (0, index_js_1.getBytes)(_password, "password"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(__pbkdf2(password, salt, iterations, keylen, algo)); +} +exports.pbkdf2 = pbkdf2; +pbkdf2._ = _pbkdf2; +pbkdf2.lock = function () { locked = true; }; +pbkdf2.register = function (func) { + if (locked) { + throw new Error("pbkdf2 is locked"); + } + __pbkdf2 = func; +}; +Object.freeze(pbkdf2); +//# sourceMappingURL=pbkdf2.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/pbkdf2.js.map b/dist/ethers.js/src.ts/crypto/pbkdf2.js.map new file mode 100644 index 0000000..c7d04e4 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/pbkdf2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pbkdf2.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/pbkdf2.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,2CAAyC;AAEzC,gDAAsD;AAKtD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,OAAO,GAAG,UAAS,QAAoB,EAAE,IAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IAC1H,OAAO,IAAA,sBAAU,EAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AAChE,CAAC,CAAA;AAED,IAAI,QAAQ,GAAG,OAAO,CAAC;AAEvB;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,MAAM,CAAC,SAAoB,EAAE,KAAgB,EAAE,UAAkB,EAAE,MAAc,EAAE,IAAyB;IACxH,MAAM,QAAQ,GAAG,IAAA,mBAAQ,EAAC,SAAS,EAAE,UAAU,CAAC,CAAC;IACjD,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC,CAAC;AACvE,CAAC;AAJD,wBAIC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACjD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAA0H;IACjJ,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACpD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/random.d.ts b/dist/ethers.js/src.ts/crypto/random.d.ts new file mode 100644 index 0000000..fd93780 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/random.d.ts @@ -0,0 +1,14 @@ +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +export declare function randomBytes(length: number): Uint8Array; +export declare namespace randomBytes { + var _: (length: number) => Uint8Array; + var lock: () => void; + var register: (func: (length: number) => Uint8Array) => void; +} +//# sourceMappingURL=random.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/random.d.ts.map b/dist/ethers.js/src.ts/crypto/random.d.ts.map new file mode 100644 index 0000000..45e1d99 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/random.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/random.ts"],"names":[],"mappings":"AAkBA;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,UAAU,CAEtD;yBAFe,WAAW"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/random.js b/dist/ethers.js/src.ts/crypto/random.js new file mode 100644 index 0000000..b8e4aca --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/random.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.randomBytes = void 0; +/** + * A **Cryptographically Secure Random Value** is one that has been + * generated with additional care take to prevent side-channels + * from allowing others to detect it and prevent others from through + * coincidence generate the same values. + * + * @_subsection: api/crypto:Random Values [about-crypto-random] + */ +const crypto_js_1 = require("./crypto.js"); +let locked = false; +const _randomBytes = function (length) { + return new Uint8Array((0, crypto_js_1.randomBytes)(length)); +}; +let __randomBytes = _randomBytes; +/** + * Return %%length%% bytes of cryptographically secure random data. + * + * @example: + * randomBytes(8) + * //_result: + */ +function randomBytes(length) { + return __randomBytes(length); +} +exports.randomBytes = randomBytes; +randomBytes._ = _randomBytes; +randomBytes.lock = function () { locked = true; }; +randomBytes.register = function (func) { + if (locked) { + throw new Error("randomBytes is locked"); + } + __randomBytes = func; +}; +Object.freeze(randomBytes); +//# sourceMappingURL=random.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/random.js.map b/dist/ethers.js/src.ts/crypto/random.js.map new file mode 100644 index 0000000..7ec6934 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/random.js.map @@ -0,0 +1 @@ +{"version":3,"file":"random.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/random.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,2CAA2D;AAE3D,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,YAAY,GAAG,UAAS,MAAc;IACxC,OAAO,IAAI,UAAU,CAAC,IAAA,uBAAa,EAAC,MAAM,CAAC,CAAC,CAAC;AACjD,CAAC,CAAA;AAED,IAAI,aAAa,GAAG,YAAY,CAAC;AAEjC;;;;;;GAMG;AACH,SAAgB,WAAW,CAAC,MAAc;IACtC,OAAO,aAAa,CAAC,MAAM,CAAC,CAAC;AACjC,CAAC;AAFD,kCAEC;AAED,WAAW,CAAC,CAAC,GAAG,YAAY,CAAC;AAC7B,WAAW,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACtD,WAAW,CAAC,QAAQ,GAAG,UAAS,IAAoC;IAChE,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;KAAE;IACzD,aAAa,GAAG,IAAI,CAAC;AACzB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/ripemd160.d.ts b/dist/ethers.js/src.ts/crypto/ripemd160.d.ts new file mode 100644 index 0000000..27b7b4a --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/ripemd160.d.ts @@ -0,0 +1,25 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function ripemd160(_data: BytesLike): string; +export declare namespace ripemd160 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=ripemd160.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/ripemd160.d.ts.map b/dist/ethers.js/src.ts/crypto/ripemd160.d.ts.map new file mode 100644 index 0000000..853e968 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/ripemd160.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/ripemd160.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAWnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAGlD;yBAHe,SAAS"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/ripemd160.js b/dist/ethers.js/src.ts/crypto/ripemd160.js new file mode 100644 index 0000000..ac69f3a --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/ripemd160.js @@ -0,0 +1,42 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = void 0; +const ripemd160_1 = require("@noble/hashes/ripemd160"); +const index_js_1 = require("../utils/index.js"); +let locked = false; +const _ripemd160 = function (data) { + return (0, ripemd160_1.ripemd160)(data); +}; +let __ripemd160 = _ripemd160; +/** + * Compute the cryptographic RIPEMD-160 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * ripemd160("0x") + * //_result: + * + * ripemd160("0x1337") + * //_result: + * + * ripemd160(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function ripemd160(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__ripemd160(data)); +} +exports.ripemd160 = ripemd160; +ripemd160._ = _ripemd160; +ripemd160.lock = function () { locked = true; }; +ripemd160.register = function (func) { + if (locked) { + throw new TypeError("ripemd160 is locked"); + } + __ripemd160 = func; +}; +Object.freeze(ripemd160); +//# sourceMappingURL=ripemd160.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/ripemd160.js.map b/dist/ethers.js/src.ts/crypto/ripemd160.js.map new file mode 100644 index 0000000..4b04bc5 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/ripemd160.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ripemd160.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/ripemd160.ts"],"names":[],"mappings":";;;AAAA,uDAAuE;AAEvE,gDAAuD;AAKvD,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,MAAM,UAAU,GAAG,UAAS,IAAgB;IACxC,OAAO,IAAA,qBAAe,EAAC,IAAI,CAAC,CAAC;AACjC,CAAC,CAAA;AAED,IAAI,WAAW,GAAoC,UAAU,CAAC;AAE9D;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,SAAS,CAAC,KAAgB;IACtC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAHD,8BAGC;AACD,SAAS,CAAC,CAAC,GAAG,UAAU,CAAC;AACzB,SAAS,CAAC,IAAI,GAAG,cAAmB,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,SAAS,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC/D,IAAI,MAAM,EAAE;QAAE,MAAM,IAAI,SAAS,CAAC,qBAAqB,CAAC,CAAC;KAAE;IAC3D,WAAW,GAAG,IAAI,CAAC;AACvB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/scrypt.d.ts b/dist/ethers.js/src.ts/crypto/scrypt.d.ts new file mode 100644 index 0000000..b0e678f --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/scrypt.d.ts @@ -0,0 +1,82 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * A callback during long-running operations to update any + * UI or provide programatic access to the progress. + * + * The %%percent%% is a value between ``0`` and ``1``. + * + * @_docloc: api/crypto:Passwords + */ +export type ProgressCallback = (percent: number) => void; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scrypt(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback): Promise; +export declare namespace scrypt { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, onProgress?: ProgressCallback | undefined) => Promise; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number, progress?: ProgressCallback | undefined) => Promise) => void; +} +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +export declare function scryptSync(_passwd: BytesLike, _salt: BytesLike, N: number, r: number, p: number, dkLen: number): string; +export declare namespace scryptSync { + var _: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => Uint8Array; + var lock: () => void; + var register: (func: (passwd: Uint8Array, salt: Uint8Array, N: number, r: number, p: number, dkLen: number) => BytesLike) => void; +} +//# sourceMappingURL=scrypt.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/scrypt.d.ts.map b/dist/ethers.js/src.ts/crypto/scrypt.d.ts.map new file mode 100644 index 0000000..6ab76e4 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/scrypt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/scrypt.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;AAgBzD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAsB,MAAM,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAI/J;yBAJqB,MAAM;;;;;AAa5B;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAIvH;yBAJe,UAAU"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/scrypt.js b/dist/ethers.js/src.ts/crypto/scrypt.js new file mode 100644 index 0000000..1a37c19 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/scrypt.js @@ -0,0 +1,117 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.scryptSync = exports.scrypt = void 0; +const scrypt_1 = require("@noble/hashes/scrypt"); +const index_js_1 = require("../utils/index.js"); +let lockedSync = false, lockedAsync = false; +const _scryptAsync = function (passwd, salt, N, r, p, dkLen, onProgress) { + return __awaiter(this, void 0, void 0, function* () { + return yield (0, scrypt_1.scryptAsync)(passwd, salt, { N, r, p, dkLen, onProgress }); + }); +}; +const _scryptSync = function (passwd, salt, N, r, p, dkLen) { + return (0, scrypt_1.scrypt)(passwd, salt, { N, r, p, dkLen }); +}; +let __scryptAsync = _scryptAsync; +let __scryptSync = _scryptSync; +/** + * The [[link-wiki-scrypt]] uses a memory and cpu hard method of + * derivation to increase the resource cost to brute-force a password + * for a given key. + * + * This means this algorithm is intentionally slow, and can be tuned to + * become slower. As computation and memory speed improve over time, + * increasing the difficulty maintains the cost of an attacker. + * + * For example, if a target time of 5 seconds is used, a legitimate user + * which knows their password requires only 5 seconds to unlock their + * account. A 6 character password has 68 billion possibilities, which + * would require an attacker to invest over 10,000 years of CPU time. This + * is of course a crude example (as password generally aren't random), + * but demonstrates to value of imposing large costs to decryption. + * + * For this reason, if building a UI which involved decrypting or + * encrypting datsa using scrypt, it is recommended to use a + * [[ProgressCallback]] (as event short periods can seem lik an eternity + * if the UI freezes). Including the phrase //"decrypting"// in the UI + * can also help, assuring the user their waiting is for a good reason. + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scrypt(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +function scrypt(_passwd, _salt, N, r, p, dkLen, progress) { + return __awaiter(this, void 0, void 0, function* () { + const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(yield __scryptAsync(passwd, salt, N, r, p, dkLen, progress)); + }); +} +exports.scrypt = scrypt; +scrypt._ = _scryptAsync; +scrypt.lock = function () { lockedAsync = true; }; +scrypt.register = function (func) { + if (lockedAsync) { + throw new Error("scrypt is locked"); + } + __scryptAsync = func; +}; +Object.freeze(scrypt); +/** + * Provides a synchronous variant of [[scrypt]]. + * + * This will completely lock up and freeze the UI in a browser and will + * prevent any event loop from progressing. For this reason, it is + * preferred to use the [async variant](scrypt). + * + * @_docloc: api/crypto:Passwords + * + * @example: + * // The password must be converted to bytes, and it is generally + * // best practices to ensure the string has been normalized. Many + * // formats explicitly indicate the normalization form to use. + * password = "hello" + * passwordBytes = toUtf8Bytes(password, "NFKC") + * + * salt = id("some-salt") + * + * // Compute the scrypt + * scryptSync(passwordBytes, salt, 1024, 8, 1, 16) + * //_result: + */ +function scryptSync(_passwd, _salt, N, r, p, dkLen) { + const passwd = (0, index_js_1.getBytes)(_passwd, "passwd"); + const salt = (0, index_js_1.getBytes)(_salt, "salt"); + return (0, index_js_1.hexlify)(__scryptSync(passwd, salt, N, r, p, dkLen)); +} +exports.scryptSync = scryptSync; +scryptSync._ = _scryptSync; +scryptSync.lock = function () { lockedSync = true; }; +scryptSync.register = function (func) { + if (lockedSync) { + throw new Error("scryptSync is locked"); + } + __scryptSync = func; +}; +Object.freeze(scryptSync); +//# sourceMappingURL=scrypt.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/scrypt.js.map b/dist/ethers.js/src.ts/crypto/scrypt.js.map new file mode 100644 index 0000000..00a22fa --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/scrypt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"scrypt.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/scrypt.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iDAAwF;AAExF,gDAA2D;AAe3D,IAAI,UAAU,GAAG,KAAK,EAAE,WAAW,GAAG,KAAK,CAAC;AAE5C,MAAM,YAAY,GAAG,UAAe,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa,EAAE,UAA6B;;QACnJ,OAAO,MAAM,IAAA,oBAAW,EAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,CAAC,CAAC;IAC3E,CAAC;CAAA,CAAA;AACD,MAAM,WAAW,GAAG,UAAS,MAAkB,EAAE,IAAgB,EAAE,CAAS,EAAE,CAAS,EAAE,CAAS,EAAE,KAAa;IAC7G,OAAO,IAAA,eAAU,EAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;AACxD,CAAC,CAAA;AAED,IAAI,aAAa,GAAgJ,YAAY,CAAC;AAC9K,IAAI,YAAY,GAAwG,WAAW,CAAA;AAGnI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,SAAsB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G,WAAW,CAAC;AAC3B,UAAU,CAAC,IAAI,GAAG,cAAmB,UAAU,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACzD,UAAU,CAAC,QAAQ,GAAG,UAAS,IAAyG;IACpI,IAAI,UAAU,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;KAAE;IAC5D,YAAY,GAAG,IAAI,CAAC;AACxB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/sha2.d.ts b/dist/ethers.js/src.ts/crypto/sha2.d.ts new file mode 100644 index 0000000..348ccdc --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/sha2.d.ts @@ -0,0 +1,47 @@ +import type { BytesLike } from "../utils/index.js"; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +export declare function sha256(_data: BytesLike): string; +export declare namespace sha256 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +export declare function sha512(_data: BytesLike): string; +export declare namespace sha512 { + var _: (data: Uint8Array) => Uint8Array; + var lock: () => void; + var register: (func: (data: Uint8Array) => BytesLike) => void; +} +//# sourceMappingURL=sha2.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/sha2.d.ts.map b/dist/ethers.js/src.ts/crypto/sha2.d.ts.map new file mode 100644 index 0000000..770b98f --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/sha2.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/sha2.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAiBnD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM;;;;;AAatB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAG/C;yBAHe,MAAM"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/sha2.js b/dist/ethers.js/src.ts/crypto/sha2.js new file mode 100644 index 0000000..c5ed991 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/sha2.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.sha512 = exports.sha256 = void 0; +const crypto_js_1 = require("./crypto.js"); +const index_js_1 = require("../utils/index.js"); +const _sha256 = function (data) { + return (0, crypto_js_1.createHash)("sha256").update(data).digest(); +}; +const _sha512 = function (data) { + return (0, crypto_js_1.createHash)("sha512").update(data).digest(); +}; +let __sha256 = _sha256; +let __sha512 = _sha512; +let locked256 = false, locked512 = false; +/** + * Compute the cryptographic SHA2-256 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha256("0x") + * //_result: + * + * sha256("0x1337") + * //_result: + * + * sha256(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + * + */ +function sha256(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__sha256(data)); +} +exports.sha256 = sha256; +sha256._ = _sha256; +sha256.lock = function () { locked256 = true; }; +sha256.register = function (func) { + if (locked256) { + throw new Error("sha256 is locked"); + } + __sha256 = func; +}; +Object.freeze(sha256); +/** + * Compute the cryptographic SHA2-512 hash of %%data%%. + * + * @_docloc: api/crypto:Hash Functions + * @returns DataHexstring + * + * @example: + * sha512("0x") + * //_result: + * + * sha512("0x1337") + * //_result: + * + * sha512(new Uint8Array([ 0x13, 0x37 ])) + * //_result: + */ +function sha512(_data) { + const data = (0, index_js_1.getBytes)(_data, "data"); + return (0, index_js_1.hexlify)(__sha512(data)); +} +exports.sha512 = sha512; +sha512._ = _sha512; +sha512.lock = function () { locked512 = true; }; +sha512.register = function (func) { + if (locked512) { + throw new Error("sha512 is locked"); + } + __sha512 = func; +}; +Object.freeze(sha256); +//# sourceMappingURL=sha2.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/sha2.js.map b/dist/ethers.js/src.ts/crypto/sha2.js.map new file mode 100644 index 0000000..33dcb7b --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/sha2.js.map @@ -0,0 +1 @@ +{"version":3,"file":"sha2.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/sha2.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AAEzC,gDAAsD;AAKtD,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,GAAG,UAAS,IAAgB;IACrC,OAAO,IAAA,sBAAU,EAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;AACtD,CAAC,CAAA;AAED,IAAI,QAAQ,GAAoC,OAAO,CAAC;AACxD,IAAI,QAAQ,GAAoC,OAAO,CAAC;AAExD,IAAI,SAAS,GAAG,KAAK,EAAE,SAAS,GAAG,KAAK,CAAC;AAGzC;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,MAAM,CAAC,KAAgB;IACnC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC;AAHD,wBAGC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AAGtB;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,MAAM,CAAC,KAAgB;IACnC,MAAM,IAAI,GAAG,IAAA,mBAAQ,EAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IACrC,OAAO,IAAA,kBAAO,EAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AACnC,CAAC;AAHD,wBAGC;AACD,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;AACnB,MAAM,CAAC,IAAI,GAAG,cAAmB,SAAS,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA;AACpD,MAAM,CAAC,QAAQ,GAAG,UAAS,IAAqC;IAC5D,IAAI,SAAS,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;KAAE;IACvD,QAAQ,GAAG,IAAI,CAAC;AACpB,CAAC,CAAA;AACD,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signature.d.ts b/dist/ethers.js/src.ts/crypto/signature.d.ts new file mode 100644 index 0000000..8cfe966 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signature.d.ts @@ -0,0 +1,158 @@ +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * A SignatureLike + * + * @_docloc: api/crypto:Signing + */ +export type SignatureLike = Signature | string | { + r: string; + s: string; + v: BigNumberish; + yParity?: 0 | 1; + yParityAndS?: string; +} | { + r: string; + yParityAndS: string; + yParity?: 0 | 1; + s?: string; + v?: number; +} | { + r: string; + s: string; + yParity: 0 | 1; + v?: BigNumberish; + yParityAndS?: string; +}; +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +export declare class Signature { + #private; + /** + * The ``r`` value for a signautre. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r(): string; + set r(value: BytesLike); + /** + * The ``s`` value for a signature. + */ + get s(): string; + set s(_value: BytesLike); + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v(): 27 | 28; + set v(value: BigNumberish); + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV(): null | bigint; + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId(): null | bigint; + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity(): 0 | 1; + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS(): string; + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized(): string; + /** + * The serialized representation. + */ + get serialized(): string; + /** + * @private + */ + constructor(guard: any, r: string, s: string, v: 27 | 28); + /** + * Returns a new identical [[Signature]]. + */ + clone(): Signature; + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON(): any; + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v: BigNumberish): bigint; + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint; + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v: BigNumberish): 27 | 28; + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig?: SignatureLike): Signature; +} +//# sourceMappingURL=signature.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signature.d.ts.map b/dist/ethers.js/src.ts/crypto/signature.d.ts.map new file mode 100644 index 0000000..de26411 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signature.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/signature.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,YAAY,EAAE,SAAS,EAC1B,MAAM,mBAAmB,CAAC;AAgB3B;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG;IAC7C,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,YAAY,CAAC;IAChB,OAAO,CAAC,EAAE,CAAC,GAAG,CAAC,CA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AYxD;;OAEG;IACH,KAAK,IAAI,SAAS;IAMlB;;OAEG;IACH,MAAM,IAAI,GAAG;IASb;;;;;;;;;OASG;IACH,MAAM,CAAC,UAAU,CAAC,CAAC,EAAE,YAAY,GAAG,MAAM;IAY1C;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,MAAM;IAI7D;;;;;;;;;;;;;;;;;;;;OAoBG;IACH,MAAM,CAAC,cAAc,CAAC,CAAC,EAAE,YAAY,GAAG,EAAE,GAAG,EAAE;IAY/C;;;;;;;OAOG;IACH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,aAAa,GAAG,SAAS;CAuF9C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signature.js b/dist/ethers.js/src.ts/crypto/signature.js new file mode 100644 index 0000000..cd7dfe8 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signature.js @@ -0,0 +1,317 @@ +"use strict"; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _Signature_r, _Signature_s, _Signature_v, _Signature_networkV; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Signature = void 0; +const index_js_1 = require("../constants/index.js"); +const index_js_2 = require("../utils/index.js"); +// Constants +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const _guard = {}; +function toUint256(value) { + return (0, index_js_2.zeroPadValue)((0, index_js_2.toBeArray)(value), 32); +} +/** + * A Signature @TODO + * + * + * @_docloc: api/crypto:Signing + */ +class Signature { + /** + * The ``r`` value for a signautre. + * + * This represents the ``x`` coordinate of a "reference" or + * challenge point, from which the ``y`` can be computed. + */ + get r() { return __classPrivateFieldGet(this, _Signature_r, "f"); } + set r(value) { + (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(value) === 32, "invalid r", "value", value); + __classPrivateFieldSet(this, _Signature_r, (0, index_js_2.hexlify)(value), "f"); + } + /** + * The ``s`` value for a signature. + */ + get s() { return __classPrivateFieldGet(this, _Signature_s, "f"); } + set s(_value) { + (0, index_js_2.assertArgument)((0, index_js_2.dataLength)(_value) === 32, "invalid s", "value", _value); + const value = (0, index_js_2.hexlify)(_value); + (0, index_js_2.assertArgument)(parseInt(value.substring(0, 3)) < 8, "non-canonical s", "value", value); + __classPrivateFieldSet(this, _Signature_s, value, "f"); + } + /** + * The ``v`` value for a signature. + * + * Since a given ``x`` value for ``r`` has two possible values for + * its correspondin ``y``, the ``v`` indicates which of the two ``y`` + * values to use. + * + * It is normalized to the values ``27`` or ``28`` for legacy + * purposes. + */ + get v() { return __classPrivateFieldGet(this, _Signature_v, "f"); } + set v(value) { + const v = (0, index_js_2.getNumber)(value, "value"); + (0, index_js_2.assertArgument)(v === 27 || v === 28, "invalid v", "v", value); + __classPrivateFieldSet(this, _Signature_v, v, "f"); + } + /** + * The EIP-155 ``v`` for legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get networkV() { return __classPrivateFieldGet(this, _Signature_networkV, "f"); } + /** + * The chain ID for EIP-155 legacy transactions. For non-legacy + * transactions, this value is ``null``. + */ + get legacyChainId() { + const v = this.networkV; + if (v == null) { + return null; + } + return Signature.getChainId(v); + } + /** + * The ``yParity`` for the signature. + * + * See ``v`` for more details on how this value is used. + */ + get yParity() { + return (this.v === 27) ? 0 : 1; + } + /** + * The [[link-eip-2098]] compact representation of the ``yParity`` + * and ``s`` compacted into a single ``bytes32``. + */ + get yParityAndS() { + // The EIP-2098 compact representation + const yParityAndS = (0, index_js_2.getBytes)(this.s); + if (this.yParity) { + yParityAndS[0] |= 0x80; + } + return (0, index_js_2.hexlify)(yParityAndS); + } + /** + * The [[link-eip-2098]] compact representation. + */ + get compactSerialized() { + return (0, index_js_2.concat)([this.r, this.yParityAndS]); + } + /** + * The serialized representation. + */ + get serialized() { + return (0, index_js_2.concat)([this.r, this.s, (this.yParity ? "0x1c" : "0x1b")]); + } + /** + * @private + */ + constructor(guard, r, s, v) { + _Signature_r.set(this, void 0); + _Signature_s.set(this, void 0); + _Signature_v.set(this, void 0); + _Signature_networkV.set(this, void 0); + (0, index_js_2.assertPrivate)(guard, _guard, "Signature"); + __classPrivateFieldSet(this, _Signature_r, r, "f"); + __classPrivateFieldSet(this, _Signature_s, s, "f"); + __classPrivateFieldSet(this, _Signature_v, v, "f"); + __classPrivateFieldSet(this, _Signature_networkV, null, "f"); + } + [(_Signature_r = new WeakMap(), _Signature_s = new WeakMap(), _Signature_v = new WeakMap(), _Signature_networkV = new WeakMap(), Symbol.for('nodejs.util.inspect.custom'))]() { + return `Signature { r: "${this.r}", s: "${this.s}", yParity: ${this.yParity}, networkV: ${this.networkV} }`; + } + /** + * Returns a new identical [[Signature]]. + */ + clone() { + const clone = new Signature(_guard, this.r, this.s, this.v); + if (this.networkV) { + __classPrivateFieldSet(clone, _Signature_networkV, this.networkV, "f"); + } + return clone; + } + /** + * Returns a representation that is compatible with ``JSON.stringify``. + */ + toJSON() { + const networkV = this.networkV; + return { + _type: "signature", + networkV: ((networkV != null) ? networkV.toString() : null), + r: this.r, s: this.s, v: this.v, + }; + } + /** + * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions. + * + * @example: + * Signature.getChainId(45) + * //_result: + * + * Signature.getChainId(46) + * //_result: + */ + static getChainId(v) { + const bv = (0, index_js_2.getBigInt)(v, "v"); + // The v is not an EIP-155 v, so it is the unspecified chain ID + if ((bv == BN_27) || (bv == BN_28)) { + return BN_0; + } + // Bad value for an EIP-155 v + (0, index_js_2.assertArgument)(bv >= BN_35, "invalid EIP-155 v", "v", v); + return (bv - BN_35) / BN_2; + } + /** + * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions. + * + * Legacy transactions which use [[link-eip-155]] hijack the ``v`` + * property to include the chain ID. + * + * @example: + * Signature.getChainIdV(5, 27) + * //_result: + * + * Signature.getChainIdV(5, 28) + * //_result: + * + */ + static getChainIdV(chainId, v) { + return ((0, index_js_2.getBigInt)(chainId) * BN_2) + BigInt(35 + v - 27); + } + /** + * Compute the normalized legacy transaction ``v`` from a ``yParirty``, + * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction. + * + * @example: + * // The values 0 and 1 imply v is actually yParity + * Signature.getNormalizedV(0) + * //_result: + * + * // Legacy non-EIP-1559 transaction (i.e. 27 or 28) + * Signature.getNormalizedV(27) + * //_result: + * + * // Legacy EIP-155 transaction (i.e. >= 35) + * Signature.getNormalizedV(46) + * //_result: + * + * // Invalid values throw + * Signature.getNormalizedV(5) + * //_error: + */ + static getNormalizedV(v) { + const bv = (0, index_js_2.getBigInt)(v); + if (bv === BN_0 || bv === BN_27) { + return 27; + } + if (bv === BN_1 || bv === BN_28) { + return 28; + } + (0, index_js_2.assertArgument)(bv >= BN_35, "invalid v", "v", v); + // Otherwise, EIP-155 v means odd is 27 and even is 28 + return (bv & BN_1) ? 27 : 28; + } + /** + * Creates a new [[Signature]]. + * + * If no %%sig%% is provided, a new [[Signature]] is created + * with default values. + * + * If %%sig%% is a string, it is parsed. + */ + static from(sig) { + function assertError(check, message) { + (0, index_js_2.assertArgument)(check, message, "signature", sig); + } + ; + if (sig == null) { + return new Signature(_guard, index_js_1.ZeroHash, index_js_1.ZeroHash, 27); + } + if (typeof (sig) === "string") { + const bytes = (0, index_js_2.getBytes)(sig, "signature"); + if (bytes.length === 64) { + const r = (0, index_js_2.hexlify)(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + const v = (s[0] & 0x80) ? 28 : 27; + s[0] &= 0x7f; + return new Signature(_guard, r, (0, index_js_2.hexlify)(s), v); + } + if (bytes.length === 65) { + const r = (0, index_js_2.hexlify)(bytes.slice(0, 32)); + const s = bytes.slice(32, 64); + assertError((s[0] & 0x80) === 0, "non-canonical s"); + const v = Signature.getNormalizedV(bytes[64]); + return new Signature(_guard, r, (0, index_js_2.hexlify)(s), v); + } + assertError(false, "invalid raw signature length"); + } + if (sig instanceof Signature) { + return sig.clone(); + } + // Get r + const _r = sig.r; + assertError(_r != null, "missing r"); + const r = toUint256(_r); + // Get s; by any means necessary (we check consistency below) + const s = (function (s, yParityAndS) { + if (s != null) { + return toUint256(s); + } + if (yParityAndS != null) { + assertError((0, index_js_2.isHexString)(yParityAndS, 32), "invalid yParityAndS"); + const bytes = (0, index_js_2.getBytes)(yParityAndS); + bytes[0] &= 0x7f; + return (0, index_js_2.hexlify)(bytes); + } + assertError(false, "missing s"); + })(sig.s, sig.yParityAndS); + assertError(((0, index_js_2.getBytes)(s)[0] & 0x80) == 0, "non-canonical s"); + // Get v; by any means necessary (we check consistency below) + const { networkV, v } = (function (_v, yParityAndS, yParity) { + if (_v != null) { + const v = (0, index_js_2.getBigInt)(_v); + return { + networkV: ((v >= BN_35) ? v : undefined), + v: Signature.getNormalizedV(v) + }; + } + if (yParityAndS != null) { + assertError((0, index_js_2.isHexString)(yParityAndS, 32), "invalid yParityAndS"); + return { v: (((0, index_js_2.getBytes)(yParityAndS)[0] & 0x80) ? 28 : 27) }; + } + if (yParity != null) { + switch ((0, index_js_2.getNumber)(yParity, "sig.yParity")) { + case 0: return { v: 27 }; + case 1: return { v: 28 }; + } + assertError(false, "invalid yParity"); + } + assertError(false, "missing v"); + })(sig.v, sig.yParityAndS, sig.yParity); + const result = new Signature(_guard, r, s, v); + if (networkV) { + __classPrivateFieldSet(result, _Signature_networkV, networkV, "f"); + } + // If multiple of v, yParity, yParityAndS we given, check they match + assertError(sig.yParity == null || (0, index_js_2.getNumber)(sig.yParity, "sig.yParity") === result.yParity, "yParity mismatch"); + assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, "yParityAndS mismatch"); + return result; + } +} +exports.Signature = Signature; +//# sourceMappingURL=signature.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signature.js.map b/dist/ethers.js/src.ts/crypto/signature.js.map new file mode 100644 index 0000000..1dc86ff --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signature.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signature.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/signature.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,oDAAiD;AACjD,gDAI2B;AAO3B,YAAY;AACZ,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAGzB,MAAM,MAAM,GAAG,EAAG,CAAC;AA6BnB,SAAS,SAAS,CAAC,KAAmB;IAClC,OAAO,IAAA,uBAAY,EAAC,IAAA,oBAAS,EAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC;AAC9C,CAAC;AAED;;;;;GAKG;AACH,MAAa,SAAS;IAMlB;;;;;OAKG;IACH,IAAI,CAAC,KAAa,OAAO,uBAAA,IAAI,oBAAG,CAAC,CAAC,C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aAAa,CAAC,KAAK,MAAM,CAAC,OAAO,EAAE,kBAAkB,CAAC,CAAC;QACjH,WAAW,CAAC,GAAG,CAAC,WAAW,IAAI,IAAI,IAAI,GAAG,CAAC,WAAW,KAAK,MAAM,CAAC,WAAW,EAAE,sBAAsB,CAAC,CAAC;QAEvG,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA5SD,8BA4SC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signing-key.d.ts b/dist/ethers.js/src.ts/crypto/signing-key.d.ts new file mode 100644 index 0000000..0864d3b --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signing-key.d.ts @@ -0,0 +1,122 @@ +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +import { Signature } from "./signature.js"; +import type { BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "./index.js"; +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +export declare class SigningKey { + #private; + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey: BytesLike); + /** + * The private key. + */ + get privateKey(): string; + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey(): string; + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey(): string; + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest: BytesLike): Signature; + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other: BytesLike): string; + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key: BytesLike, compressed?: boolean): string; + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest: BytesLike, signature: SignatureLike): string; + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0: BytesLike, p1: BytesLike, compressed?: boolean): string; +} +//# sourceMappingURL=signing-key.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signing-key.d.ts.map b/dist/ethers.js/src.ts/crypto/signing-key.d.ts.map new file mode 100644 index 0000000..0670d24 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signing-key.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/signing-key.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AASH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAGhD;;;GAGG;AACH,qBAAa,UAAU;;IAGnB;;OAEG;gBACS,UAAU,EAAE,SAAS;IAKjC;;OAEG;IACH,IAAI,UAAU,IAAI,MAAM,CAA6B;IAErD;;;;;OAKG;IACH,IAAI,SAAS,IAAI,MAAM,CAA0D;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,IAAI,MAAM,CAAgE;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS;IAclC;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,mBAAmB,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM;IAK7C;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,MAAM,CAAC,gBAAgB,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;IAqBrE;;;;;;;;;;;;;;;;;OAiBG;IACH,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM;IAc5E;;;;;;;;;OASG;IACH,MAAM,CAAC,SAAS,CAAC,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,CAAC,EAAE,OAAO,GAAG,MAAM;CAK/E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signing-key.js b/dist/ethers.js/src.ts/crypto/signing-key.js new file mode 100644 index 0000000..c7bc5ce --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signing-key.js @@ -0,0 +1,183 @@ +"use strict"; +/** + * Add details about signing here. + * + * @_subsection: api/crypto:Signing [about-signing] + */ +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _SigningKey_privateKey; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SigningKey = void 0; +const secp256k1_1 = require("@noble/curves/secp256k1"); +const index_js_1 = require("../utils/index.js"); +const signature_js_1 = require("./signature.js"); +/** + * A **SigningKey** provides high-level access to the elliptic curve + * cryptography (ECC) operations and key management. + */ +class SigningKey { + /** + * Creates a new **SigningKey** for %%privateKey%%. + */ + constructor(privateKey) { + _SigningKey_privateKey.set(this, void 0); + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(privateKey) === 32, "invalid private key", "privateKey", "[REDACTED]"); + __classPrivateFieldSet(this, _SigningKey_privateKey, (0, index_js_1.hexlify)(privateKey), "f"); + } + /** + * The private key. + */ + get privateKey() { return __classPrivateFieldGet(this, _SigningKey_privateKey, "f"); } + /** + * The uncompressed public key. + * + * This will always begin with the prefix ``0x04`` and be 132 + * characters long (the ``0x`` prefix and 130 hexadecimal nibbles). + */ + get publicKey() { return SigningKey.computePublicKey(__classPrivateFieldGet(this, _SigningKey_privateKey, "f")); } + /** + * The compressed public key. + * + * This will always begin with either the prefix ``0x02`` or ``0x03`` + * and be 68 characters long (the ``0x`` prefix and 33 hexadecimal + * nibbles) + */ + get compressedPublicKey() { return SigningKey.computePublicKey(__classPrivateFieldGet(this, _SigningKey_privateKey, "f"), true); } + /** + * Return the signature of the signed %%digest%%. + */ + sign(digest) { + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); + const sig = secp256k1_1.secp256k1.sign((0, index_js_1.getBytesCopy)(digest), (0, index_js_1.getBytesCopy)(__classPrivateFieldGet(this, _SigningKey_privateKey, "f")), { + lowS: true + }); + return signature_js_1.Signature.from({ + r: (0, index_js_1.toBeHex)(sig.r, 32), + s: (0, index_js_1.toBeHex)(sig.s, 32), + v: (sig.recovery ? 0x1c : 0x1b) + }); + } + /** + * Returns the [[link-wiki-ecdh]] shared secret between this + * private key and the %%other%% key. + * + * The %%other%% key may be any type of key, a raw public key, + * a compressed/uncompressed pubic key or aprivate key. + * + * Best practice is usually to use a cryptographic hash on the + * returned value before using it as a symetric secret. + * + * @example: + * sign1 = new SigningKey(id("some-secret-1")) + * sign2 = new SigningKey(id("some-secret-2")) + * + * // Notice that privA.computeSharedSecret(pubB)... + * sign1.computeSharedSecret(sign2.publicKey) + * //_result: + * + * // ...is equal to privB.computeSharedSecret(pubA). + * sign2.computeSharedSecret(sign1.publicKey) + * //_result: + */ + computeSharedSecret(other) { + const pubKey = SigningKey.computePublicKey(other); + return (0, index_js_1.hexlify)(secp256k1_1.secp256k1.getSharedSecret((0, index_js_1.getBytesCopy)(__classPrivateFieldGet(this, _SigningKey_privateKey, "f")), (0, index_js_1.getBytes)(pubKey), false)); + } + /** + * Compute the public key for %%key%%, optionally %%compressed%%. + * + * The %%key%% may be any type of key, a raw public key, a + * compressed/uncompressed public key or private key. + * + * @example: + * sign = new SigningKey(id("some-secret")); + * + * // Compute the uncompressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey) + * //_result: + * + * // Compute the compressed public key for a private key + * SigningKey.computePublicKey(sign.privateKey, true) + * //_result: + * + * // Compute the uncompressed public key + * SigningKey.computePublicKey(sign.publicKey, false); + * //_result: + * + * // Compute the Compressed a public key + * SigningKey.computePublicKey(sign.publicKey, true); + * //_result: + */ + static computePublicKey(key, compressed) { + let bytes = (0, index_js_1.getBytes)(key, "key"); + // private key + if (bytes.length === 32) { + const pubKey = secp256k1_1.secp256k1.getPublicKey(bytes, !!compressed); + return (0, index_js_1.hexlify)(pubKey); + } + // raw public key; use uncompressed key with 0x04 prefix + if (bytes.length === 64) { + const pub = new Uint8Array(65); + pub[0] = 0x04; + pub.set(bytes, 1); + bytes = pub; + } + const point = secp256k1_1.secp256k1.ProjectivePoint.fromHex(bytes); + return (0, index_js_1.hexlify)(point.toRawBytes(compressed)); + } + /** + * Returns the public key for the private key which produced the + * %%signature%% for the given %%digest%%. + * + * @example: + * key = new SigningKey(id("some-secret")) + * digest = id("hello world") + * sig = key.sign(digest) + * + * // Notice the signer public key... + * key.publicKey + * //_result: + * + * // ...is equal to the recovered public key + * SigningKey.recoverPublicKey(digest, sig) + * //_result: + * + */ + static recoverPublicKey(digest, signature) { + (0, index_js_1.assertArgument)((0, index_js_1.dataLength)(digest) === 32, "invalid digest length", "digest", digest); + const sig = signature_js_1.Signature.from(signature); + let secpSig = secp256k1_1.secp256k1.Signature.fromCompact((0, index_js_1.getBytesCopy)((0, index_js_1.concat)([sig.r, sig.s]))); + secpSig = secpSig.addRecoveryBit(sig.yParity); + const pubKey = secpSig.recoverPublicKey((0, index_js_1.getBytesCopy)(digest)); + (0, index_js_1.assertArgument)(pubKey != null, "invalid signautre for digest", "signature", signature); + return "0x" + pubKey.toHex(false); + } + /** + * Returns the point resulting from adding the ellipic curve points + * %%p0%% and %%p1%%. + * + * This is not a common function most developers should require, but + * can be useful for certain privacy-specific techniques. + * + * For example, it is used by [[HDNodeWallet]] to compute child + * addresses from parent public keys and chain codes. + */ + static addPoints(p0, p1, compressed) { + const pub0 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p0).substring(2)); + const pub1 = secp256k1_1.secp256k1.ProjectivePoint.fromHex(SigningKey.computePublicKey(p1).substring(2)); + return "0x" + pub0.add(pub1).toHex(!!compressed); + } +} +exports.SigningKey = SigningKey; +_SigningKey_privateKey = new WeakMap(); +//# sourceMappingURL=signing-key.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/crypto/signing-key.js.map b/dist/ethers.js/src.ts/crypto/signing-key.js.map new file mode 100644 index 0000000..0f22cd2 --- /dev/null +++ b/dist/ethers.js/src.ts/crypto/signing-key.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signing-key.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/crypto/signing-key.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;;;;AAEH,uDAAoD;AAEpD,gDAG2B;AAE3B,iDAA2C;AAO3C;;;GAGG;AACH,MAAa,UAAU;IAGnB;;OAEG;IACH,YAAY,UAAqB;QALjC,yCAAoB;QAMhB,IAAA,yBAAc,EAAC,IAAA,qBAAU,EAAC,UAAU,CAAC,KAAK,EAAE,EAAE,qBAAqB,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QACjG,uBAAA,IAAI,0BAAe,IAAA,kBAAO,EAAC,UAAU,CAAC,MAAA,CAAC;IAC3C,CAAC;IAED;;OAEG;IACH,IAAI,UAAU,KAAa,OAAO,uBAAA,IAAI,8BAAY,CAAC,CAAC,CAAC;IAErD;;;;;OAKG;IACH,IAAI,SAAS,KAAa,OAAO,UAAU,CAAC,gBAAgB,CAAC,uBAAA,IAAI,8BAAY,CAAC,CAAC,CAAC,CAAC;IAEjF;;;;;;OAMG;IACH,IAAI,mBAAmB,KAAa,OAAO,UAAU,CAAC,gBAAgB,CAAC,uBAAA,IAAI,8BAAY,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC;IAEjG;;OAEG;IACH,IAAI,CAAC,MAAiB;QAClB,IAAA,yBAAc,EAAC,IAAA,qBAAU,EAAC,MAAM,CAAC,KAAK,EAAE,EAAE,uBAAuB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAErF,MAAM,GAAG,GAAG,qBAAS,CAAC,IAAI,CAAC,I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AS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,MAAM,IAAI,GAAG,qBAAS,CAAC,eAAe,CAAC,OAAO,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;QAC7F,OAAO,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC,CAAA;IACpD,CAAC;CACJ;AA1KD,gCA0KC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/ethers.d.ts b/dist/ethers.js/src.ts/ethers.d.ts new file mode 100644 index 0000000..c5225fa --- /dev/null +++ b/dist/ethers.js/src.ts/ethers.d.ts @@ -0,0 +1,22 @@ +export { version } from "./_version.js"; +export { decodeBytes32String, encodeBytes32String, AbiCoder, ConstructorFragment, ErrorFragment, EventFragment, Fragment, FallbackFragment, FunctionFragment, NamedFragment, ParamType, StructFragment, checkResultErrors, ErrorDescription, Indexed, Interface, LogDescription, Result, TransactionDescription, Typed, } from "./abi/index.js"; +export { getAddress, getIcapAddress, getCreateAddress, getCreate2Address, isAddressable, isAddress, resolveAddress } from "./address/index.js"; +export { ZeroAddress, WeiPerEther, MaxUint256, MinInt256, MaxInt256, N, ZeroHash, EtherSymbol, MessagePrefix } from "./constants/index.js"; +export { BaseContract, Contract, ContractFactory, ContractEventPayload, ContractTransactionReceipt, ContractTransactionResponse, ContractUnknownEventPayload, EventLog, UndecodedEventLog } from "./contract/index.js"; +export { computeHmac, randomBytes, keccak256, ripemd160, sha256, sha512, pbkdf2, scrypt, scryptSync, lock, Signature, SigningKey } from "./crypto/index.js"; +export { id, ensNormalize, isValidName, namehash, dnsEncode, hashMessage, verifyMessage, solidityPacked, solidityPackedKeccak256, solidityPackedSha256, TypedDataEncoder, verifyTypedData } from "./hash/index.js"; +export { getDefaultProvider, Block, FeeData, Log, TransactionReceipt, TransactionResponse, AbstractSigner, NonceManager, VoidSigner, AbstractProvider, FallbackProvider, JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner, BrowserProvider, AlchemyProvider, AnkrProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, PocketProvider, QuickNodeProvider, IpcSocketProvider, SocketProvider, WebSocketProvider, EnsResolver, Network, EnsPlugin, EtherscanPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, GasCostPlugin, NetworkPlugin, MulticoinProviderPlugin, SocketBlockSubscriber, SocketEventSubscriber, SocketPendingSubscriber, SocketSubscriber, UnmanagedSubscriber, copyRequest, showThrottleMessage } from "./providers/index.js"; +export { accessListify, computeAddress, recoverAddress, Transaction } from "./transaction/index.js"; +export { decodeBase58, encodeBase58, decodeBase64, encodeBase64, concat, dataLength, dataSlice, getBytes, getBytesCopy, hexlify, isHexString, isBytesLike, stripZerosLeft, zeroPadBytes, zeroPadValue, defineProperties, resolveProperties, assert, assertArgument, assertArgumentCount, assertNormalize, assertPrivate, makeError, isCallException, isError, EventPayload, FetchRequest, FetchResponse, FetchCancelSignal, FixedNumber, getBigInt, getNumber, getUint, toBeArray, toBigInt, toBeHex, toNumber, toQuantity, fromTwos, toTwos, mask, formatEther, parseEther, formatUnits, parseUnits, toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, decodeRlp, encodeRlp, uuidV4, } from "./utils/index.js"; +export { Mnemonic, BaseWallet, HDNodeWallet, HDNodeVoidWallet, Wallet, defaultPath, getAccountPath, getIndexedAccountPath, isCrowdsaleJson, isKeystoreJson, decryptCrowdsaleJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync, } from "./wallet/index.js"; +export { Wordlist, LangEn, WordlistOwl, WordlistOwlA, wordlists } from "./wordlists/index.js"; +export type { JsonFragment, JsonFragmentType, FormatType, FragmentType, InterfaceAbi, ParamTypeWalkFunc, ParamTypeWalkAsyncFunc } from "./abi/index.js"; +export type { Addressable, AddressLike, NameResolver } from "./address/index.js"; +export type { ConstantContractMethod, ContractEvent, ContractEventArgs, ContractEventName, ContractInterface, ContractMethod, ContractMethodArgs, ContractTransaction, DeferredTopicFilter, Overrides, BaseContractMethod, ContractDeployTransaction, PostfixOverrides, WrappedFallback } from "./contract/index.js"; +export type { ProgressCallback, SignatureLike } from "./crypto/index.js"; +export type { TypedDataDomain, TypedDataField } from "./hash/index.js"; +export type { Provider, Signer, AbstractProviderOptions, FallbackProviderOptions, AbstractProviderPlugin, BlockParams, BlockTag, ContractRunner, DebugEventBrowserProvider, Eip1193Provider, EventFilter, Filter, FilterByBlockHash, GasCostParameters, JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcTransactionRequest, LogParams, MinedBlock, MinedTransactionResponse, Networkish, OrphanFilter, PerformActionFilter, PerformActionRequest, PerformActionTransaction, PreparedTransactionRequest, ProviderEvent, Subscriber, Subscription, TopicFilter, TransactionReceiptParams, TransactionRequest, TransactionResponseParams, WebSocketCreator, WebSocketLike } from "./providers/index.js"; +export type { AccessList, AccessListish, AccessListEntry, TransactionLike } from "./transaction/index.js"; +export type { BytesLike, BigNumberish, Numeric, ErrorCode, FixedFormat, Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason, RlpStructuredData, RlpStructuredDataish, GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CodedEthersError, CallExceptionAction, CallExceptionTransaction, EventEmitterable, Listener } from "./utils/index.js"; +export type { CrowdsaleAccount, KeystoreAccount, EncryptOptions } from "./wallet/index.js"; +//# sourceMappingURL=ethers.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/ethers.d.ts.map b/dist/ethers.js/src.ts/ethers.d.ts.map new file mode 100644 index 0000000..18e31b2 --- /dev/null +++ b/dist/ethers.js/src.ts/ethers.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.d.ts","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/ethers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AAExC,OAAO,EACH,mBAAmB,EAAE,mBAAmB,EAExC,QAAQ,EACR,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE,QAAQ,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,aAAa,EAAE,SAAS,EAAE,cAAc,EAEzI,iBAAiB,EAAE,gBAAgB,EAAE,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,EAAE,sBAAsB,EACvG,KAAK,GACR,MAAM,gBAAgB,CAAC;AAExB,OAAO,EACH,UAAU,EAAE,cAAc,EAC1B,gBAAgB,EAAE,iBAAiB,EACnC,aAAa,EAAE,SAAS,EAAE,cAAc,EAC3C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACH,WAAW,EACX,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,EAChD,QAAQ,EACR,WAAW,EAAE,aAAa,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,YAAY,EAAE,QAAQ,EACtB,eAAe,EACf,oBAAoB,EAAE,0BAA0B,EAAE,2BAA2B,EAAE,2BAA2B,EAAE,QAAQ,EAAE,iBAAiB,EAC1I,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACH,WAAW,EACX,WAAW,EACX,SAAS,EACT,SAAS,EACT,MAAM,EAAE,MAAM,EACd,MAAM,EACN,MAAM,EAA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EAEhB,mBAAmB,EAAE,wBAAwB,EAC7C,gBAAgB,EAAE,QAAQ,EAC7B,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EACR,gBAAgB,EAAE,eAAe,EAAE,cAAc,EACpD,MAAM,mBAAmB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/ethers.js b/dist/ethers.js/src.ts/ethers.js new file mode 100644 index 0000000..47b3e70 --- /dev/null +++ b/dist/ethers.js/src.ts/ethers.js @@ -0,0 +1,209 @@ +"use strict"; +///////////////////////////// +// +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ripemd160 = exports.keccak256 = exports.randomBytes = exports.computeHmac = exports.UndecodedEventLog = exports.EventLog = exports.ContractUnknownEventPayload = exports.ContractTransactionResponse = exports.ContractTransactionReceipt = exports.ContractEventPayload = exports.ContractFactory = exports.Contract = exports.BaseContract = exports.MessagePrefix = exports.EtherSymbol = exports.ZeroHash = exports.N = exports.MaxInt256 = exports.MinInt256 = exports.MaxUint256 = exports.WeiPerEther = exports.ZeroAddress = exports.resolveAddress = exports.isAddress = exports.isAddressable = exports.getCreate2Address = exports.getCreateAddress = exports.getIcapAddress = exports.getAddress = exports.Typed = exports.TransactionDescription = exports.Result = exports.LogDescription = exports.Interface = exports.Indexed = exports.ErrorDescription = exports.checkResultErrors = exports.StructFragment = exports.ParamType = exports.NamedFragment = exports.FunctionFragment = exports.FallbackFragment = exports.Fragment = exports.EventFragment = exports.ErrorFragment = exports.ConstructorFragment = exports.AbiCoder = exports.encodeBytes32String = exports.decodeBytes32String = exports.version = void 0; +exports.EtherscanPlugin = exports.EnsPlugin = exports.Network = exports.EnsResolver = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.AbstractProvider = exports.VoidSigner = exports.NonceManager = exports.AbstractSigner = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.getDefaultProvider = exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = exports.SigningKey = exports.Signature = exports.lock = exports.scryptSync = exports.scrypt = exports.pbkdf2 = exports.sha512 = exports.sha256 = void 0; +exports.toBeArray = exports.getUint = exports.getNumber = exports.getBigInt = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.isError = exports.isCallException = exports.makeError = exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.resolveProperties = exports.defineProperties = exports.zeroPadValue = exports.zeroPadBytes = exports.stripZerosLeft = exports.isBytesLike = exports.isHexString = exports.hexlify = exports.getBytesCopy = exports.getBytes = exports.dataSlice = exports.dataLength = exports.concat = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = exports.showThrottleMessage = exports.copyRequest = exports.UnmanagedSubscriber = exports.SocketSubscriber = exports.SocketPendingSubscriber = exports.SocketEventSubscriber = exports.SocketBlockSubscriber = exports.MulticoinProviderPlugin = exports.NetworkPlugin = exports.GasCostPlugin = exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = void 0; +exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.decryptCrowdsaleJson = exports.isKeystoreJson = exports.isCrowdsaleJson = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.Wallet = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.BaseWallet = exports.Mnemonic = exports.uuidV4 = exports.encodeRlp = exports.decodeRlp = exports.Utf8ErrorFuncs = exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.mask = exports.toTwos = exports.fromTwos = exports.toQuantity = exports.toNumber = exports.toBeHex = exports.toBigInt = void 0; +var _version_js_1 = require("./_version.js"); +Object.defineProperty(exports, "version", { enumerable: true, get: function () { return _version_js_1.version; } }); +var index_js_1 = require("./abi/index.js"); +Object.defineProperty(exports, "decodeBytes32String", { enumerable: true, get: function () { return index_js_1.decodeBytes32String; } }); +Object.defineProperty(exports, "encodeBytes32String", { enumerable: true, get: function () { return index_js_1.encodeBytes32String; } }); +Object.defineProperty(exports, "AbiCoder", { enumerable: true, get: function () { return index_js_1.AbiCoder; } }); +Object.defineProperty(exports, "ConstructorFragment", { enumerable: true, get: function () { return index_js_1.ConstructorFragment; } }); +Object.defineProperty(exports, "ErrorFragment", { enumerable: true, get: function () { return index_js_1.ErrorFragment; } }); +Object.defineProperty(exports, "EventFragment", { enumerable: true, get: function () { return index_js_1.EventFragment; } }); +Object.defineProperty(exports, "Fragment", { enumerable: true, get: function () { return index_js_1.Fragment; } }); +Object.defineProperty(exports, "FallbackFragment", { enumerable: true, get: function () { return index_js_1.FallbackFragment; } }); +Object.defineProperty(exports, "FunctionFragment", { enumerable: true, get: function () { return index_js_1.FunctionFragment; } }); +Object.defineProperty(exports, "NamedFragment", { enumerable: true, get: function () { return index_js_1.NamedFragment; } }); +Object.defineProperty(exports, "ParamType", { enumerable: true, get: function () { return index_js_1.ParamType; } }); +Object.defineProperty(exports, "StructFragment", { enumerable: true, get: function () { return index_js_1.StructFragment; } }); +Object.defineProperty(exports, "checkResultErrors", { enumerable: true, get: function () { return index_js_1.checkResultErrors; } }); +Object.defineProperty(exports, "ErrorDescription", { enumerable: true, get: function () { return index_js_1.ErrorDescription; } }); +Object.defineProperty(exports, "Indexed", { enumerable: true, get: function () { return index_js_1.Indexed; } }); +Object.defineProperty(exports, "Interface", { enumerable: true, get: function () { return index_js_1.Interface; } }); +Object.defineProperty(exports, "LogDescription", { enumerable: true, get: function () { return index_js_1.LogDescription; } }); +Object.defineProperty(exports, "Result", { enumerable: true, get: function () { return index_js_1.Result; } }); +Object.defineProperty(exports, "TransactionDescription", { enumerable: true, get: function () { return index_js_1.TransactionDescription; } }); +Object.defineProperty(exports, "Typed", { enumerable: true, get: function () { return index_js_1.Typed; } }); +var index_js_2 = require("./address/index.js"); +Object.defineProperty(exports, "getAddress", { enumerable: true, get: function () { return index_js_2.getAddress; } }); +Object.defineProperty(exports, "getIcapAddress", { enumerable: true, get: function () { return index_js_2.getIcapAddress; } }); +Object.defineProperty(exports, "getCreateAddress", { enumerable: true, get: function () { return index_js_2.getCreateAddress; } }); +Object.defineProperty(exports, "getCreate2Address", { enumerable: true, get: function () { return index_js_2.getCreate2Address; } }); +Object.defineProperty(exports, "isAddressable", { enumerable: true, get: function () { return index_js_2.isAddressable; } }); +Object.defineProperty(exports, "isAddress", { enumerable: true, get: function () { return index_js_2.isAddress; } }); +Object.defineProperty(exports, "resolveAddress", { enumerable: true, get: function () { return index_js_2.resolveAddress; } }); +var index_js_3 = require("./constants/index.js"); +Object.defineProperty(exports, "ZeroAddress", { enumerable: true, get: function () { return index_js_3.ZeroAddress; } }); +Object.defineProperty(exports, "WeiPerEther", { enumerable: true, get: function () { return index_js_3.WeiPerEther; } }); +Object.defineProperty(exports, "MaxUint256", { enumerable: true, get: function () { return index_js_3.MaxUint256; } }); +Object.defineProperty(exports, "MinInt256", { enumerable: true, get: function () { return index_js_3.MinInt256; } }); +Object.defineProperty(exports, "MaxInt256", { enumerable: true, get: function () { return index_js_3.MaxInt256; } }); +Object.defineProperty(exports, "N", { enumerable: true, get: function () { return index_js_3.N; } }); +Object.defineProperty(exports, "ZeroHash", { enumerable: true, get: function () { return index_js_3.ZeroHash; } }); +Object.defineProperty(exports, "EtherSymbol", { enumerable: true, get: function () { return index_js_3.EtherSymbol; } }); +Object.defineProperty(exports, "MessagePrefix", { enumerable: true, get: function () { return index_js_3.MessagePrefix; } }); +var index_js_4 = require("./contract/index.js"); +Object.defineProperty(exports, "BaseContract", { enumerable: true, get: function () { return index_js_4.BaseContract; } }); +Object.defineProperty(exports, "Contract", { enumerable: true, get: function () { return index_js_4.Contract; } }); +Object.defineProperty(exports, "ContractFactory", { enumerable: true, get: function () { return index_js_4.ContractFactory; } }); +Object.defineProperty(exports, "ContractEventPayload", { enumerable: true, get: function () { return index_js_4.ContractEventPayload; } }); +Object.defineProperty(exports, "ContractTransactionReceipt", { enumerable: true, get: function () { return index_js_4.ContractTransactionReceipt; } }); +Object.defineProperty(exports, "ContractTransactionResponse", { enumerable: true, get: function () { return index_js_4.ContractTransactionResponse; } }); +Object.defineProperty(exports, "ContractUnknownEventPayload", { enumerable: true, get: function () { return index_js_4.ContractUnknownEventPayload; } }); +Object.defineProperty(exports, "EventLog", { enumerable: true, get: function () { return index_js_4.EventLog; } }); +Object.defineProperty(exports, "UndecodedEventLog", { enumerable: true, get: function () { return index_js_4.UndecodedEventLog; } }); +var index_js_5 = require("./crypto/index.js"); +Object.defineProperty(exports, "computeHmac", { enumerable: true, get: function () { return index_js_5.computeHmac; } }); +Object.defineProperty(exports, "randomBytes", { enumerable: true, get: function () { return index_js_5.randomBytes; } }); +Object.defineProperty(exports, "keccak256", { enumerable: true, get: function () { return index_js_5.keccak256; } }); +Object.defineProperty(exports, "ripemd160", { enumerable: true, get: function () { return index_js_5.ripemd160; } }); +Object.defineProperty(exports, "sha256", { enumerable: true, get: function () { return index_js_5.sha256; } }); +Object.defineProperty(exports, "sha512", { enumerable: true, get: function () { return index_js_5.sha512; } }); +Object.defineProperty(exports, "pbkdf2", { enumerable: true, get: function () { return index_js_5.pbkdf2; } }); +Object.defineProperty(exports, "scrypt", { enumerable: true, get: function () { return index_js_5.scrypt; } }); +Object.defineProperty(exports, "scryptSync", { enumerable: true, get: function () { return index_js_5.scryptSync; } }); +Object.defineProperty(exports, "lock", { enumerable: true, get: function () { return index_js_5.lock; } }); +Object.defineProperty(exports, "Signature", { enumerable: true, get: function () { return index_js_5.Signature; } }); +Object.defineProperty(exports, "SigningKey", { enumerable: true, get: function () { return index_js_5.SigningKey; } }); +var index_js_6 = require("./hash/index.js"); +Object.defineProperty(exports, "id", { enumerable: true, get: function () { return index_js_6.id; } }); +Object.defineProperty(exports, "ensNormalize", { enumerable: true, get: function () { return index_js_6.ensNormalize; } }); +Object.defineProperty(exports, "isValidName", { enumerable: true, get: function () { return index_js_6.isValidName; } }); +Object.defineProperty(exports, "namehash", { enumerable: true, get: function () { return index_js_6.namehash; } }); +Object.defineProperty(exports, "dnsEncode", { enumerable: true, get: function () { return index_js_6.dnsEncode; } }); +Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return index_js_6.hashMessage; } }); +Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return index_js_6.verifyMessage; } }); +Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return index_js_6.solidityPacked; } }); +Object.defineProperty(exports, "solidityPackedKeccak256", { enumerable: true, get: function () { return index_js_6.solidityPackedKeccak256; } }); +Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return index_js_6.solidityPackedSha256; } }); +Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return index_js_6.TypedDataEncoder; } }); +Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return index_js_6.verifyTypedData; } }); +var index_js_7 = require("./providers/index.js"); +Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return index_js_7.getDefaultProvider; } }); +Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return index_js_7.Block; } }); +Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return index_js_7.FeeData; } }); +Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return index_js_7.Log; } }); +Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return index_js_7.TransactionReceipt; } }); +Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return index_js_7.TransactionResponse; } }); +Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return index_js_7.AbstractSigner; } }); +Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return index_js_7.NonceManager; } }); +Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return index_js_7.VoidSigner; } }); +Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return index_js_7.AbstractProvider; } }); +Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return index_js_7.FallbackProvider; } }); +Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcApiProvider; } }); +Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return index_js_7.JsonRpcProvider; } }); +Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return index_js_7.JsonRpcSigner; } }); +Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return index_js_7.BrowserProvider; } }); +Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return index_js_7.AlchemyProvider; } }); +Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return index_js_7.AnkrProvider; } }); +Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return index_js_7.CloudflareProvider; } }); +Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return index_js_7.EtherscanProvider; } }); +Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return index_js_7.InfuraProvider; } }); +Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return index_js_7.InfuraWebSocketProvider; } }); +Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return index_js_7.PocketProvider; } }); +Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return index_js_7.QuickNodeProvider; } }); +Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return index_js_7.IpcSocketProvider; } }); +Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return index_js_7.SocketProvider; } }); +Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return index_js_7.WebSocketProvider; } }); +Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return index_js_7.EnsResolver; } }); +Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return index_js_7.Network; } }); +Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return index_js_7.EnsPlugin; } }); +Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return index_js_7.EtherscanPlugin; } }); +Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return index_js_7.FeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "FetchUrlFeeDataNetworkPlugin", { enumerable: true, get: function () { return index_js_7.FetchUrlFeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return index_js_7.GasCostPlugin; } }); +Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return index_js_7.NetworkPlugin; } }); +Object.defineProperty(exports, "MulticoinProviderPlugin", { enumerable: true, get: function () { return index_js_7.MulticoinProviderPlugin; } }); +Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return index_js_7.SocketBlockSubscriber; } }); +Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return index_js_7.SocketEventSubscriber; } }); +Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return index_js_7.SocketPendingSubscriber; } }); +Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return index_js_7.SocketSubscriber; } }); +Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return index_js_7.UnmanagedSubscriber; } }); +Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return index_js_7.copyRequest; } }); +Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return index_js_7.showThrottleMessage; } }); +var index_js_8 = require("./transaction/index.js"); +Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return index_js_8.accessListify; } }); +Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return index_js_8.computeAddress; } }); +Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return index_js_8.recoverAddress; } }); +Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return index_js_8.Transaction; } }); +var index_js_9 = require("./utils/index.js"); +Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return index_js_9.decodeBase58; } }); +Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return index_js_9.encodeBase58; } }); +Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return index_js_9.decodeBase64; } }); +Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return index_js_9.encodeBase64; } }); +Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return index_js_9.concat; } }); +Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return index_js_9.dataLength; } }); +Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return index_js_9.dataSlice; } }); +Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return index_js_9.getBytes; } }); +Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return index_js_9.getBytesCopy; } }); +Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return index_js_9.hexlify; } }); +Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return index_js_9.isHexString; } }); +Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return index_js_9.isBytesLike; } }); +Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return index_js_9.stripZerosLeft; } }); +Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return index_js_9.zeroPadBytes; } }); +Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return index_js_9.zeroPadValue; } }); +Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return index_js_9.defineProperties; } }); +Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return index_js_9.resolveProperties; } }); +Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return index_js_9.assert; } }); +Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return index_js_9.assertArgument; } }); +Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return index_js_9.assertArgumentCount; } }); +Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return index_js_9.assertNormalize; } }); +Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return index_js_9.assertPrivate; } }); +Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return index_js_9.makeError; } }); +Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return index_js_9.isCallException; } }); +Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return index_js_9.isError; } }); +Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return index_js_9.EventPayload; } }); +Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return index_js_9.FetchRequest; } }); +Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return index_js_9.FetchResponse; } }); +Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return index_js_9.FetchCancelSignal; } }); +Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return index_js_9.FixedNumber; } }); +Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return index_js_9.getBigInt; } }); +Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return index_js_9.getNumber; } }); +Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return index_js_9.getUint; } }); +Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return index_js_9.toBeArray; } }); +Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return index_js_9.toBigInt; } }); +Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return index_js_9.toBeHex; } }); +Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return index_js_9.toNumber; } }); +Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return index_js_9.toQuantity; } }); +Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return index_js_9.fromTwos; } }); +Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return index_js_9.toTwos; } }); +Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return index_js_9.mask; } }); +Object.defineProperty(exports, "formatEther", { enumerable: true, get: function () { return index_js_9.formatEther; } }); +Object.defineProperty(exports, "parseEther", { enumerable: true, get: function () { return index_js_9.parseEther; } }); +Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return index_js_9.formatUnits; } }); +Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return index_js_9.parseUnits; } }); +Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return index_js_9.toUtf8Bytes; } }); +Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return index_js_9.toUtf8CodePoints; } }); +Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return index_js_9.toUtf8String; } }); +Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return index_js_9.Utf8ErrorFuncs; } }); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return index_js_9.decodeRlp; } }); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return index_js_9.encodeRlp; } }); +Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return index_js_9.uuidV4; } }); +var index_js_10 = require("./wallet/index.js"); +Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return index_js_10.Mnemonic; } }); +Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return index_js_10.BaseWallet; } }); +Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return index_js_10.HDNodeWallet; } }); +Object.defineProperty(exports, "HDNodeVoidWallet", { enumerable: true, get: function () { return index_js_10.HDNodeVoidWallet; } }); +Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return index_js_10.Wallet; } }); +Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return index_js_10.defaultPath; } }); +Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return index_js_10.getAccountPath; } }); +Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return index_js_10.getIndexedAccountPath; } }); +Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.isCrowdsaleJson; } }); +Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return index_js_10.isKeystoreJson; } }); +Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return index_js_10.decryptCrowdsaleJson; } }); +Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJsonSync; } }); +Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.decryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return index_js_10.encryptKeystoreJsonSync; } }); +var index_js_11 = require("./wordlists/index.js"); +Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return index_js_11.Wordlist; } }); +Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return index_js_11.LangEn; } }); +Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return index_js_11.WordlistOwl; } }); +Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return index_js_11.WordlistOwlA; } }); +Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return index_js_11.wordlists; } }); +//# sourceMappingURL=ethers.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/ethers.js.map b/dist/ethers.js/src.ts/ethers.js.map new file mode 100644 index 0000000..b9f2516 --- /dev/null +++ b/dist/ethers.js/src.ts/ethers.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ethers.js","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/ethers.ts"],"names":[],"mappings":";AAEA,6BAA6B;AAC7B,EAAE;;;;;;AAEF,6CAAwC;AAA/B,sGAAA,OAAO,OAAA;AAEhB,2CAQwB;AAPpB,+GAAA,mBAAmB,OAAA;AAAE,+GAAA,mBAAmB,OAAA;AAExC,oGAAA,QAAQ,OAAA;AACR,+GAAA,mBAAmB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,oGAAA,QAAQ,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAEzI,6GAAA,iBAAiB,OAAA;AAAE,4GAAA,gBAAgB,OAAA;AAAE,mGAAA,OAAO,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAAE,kGAAA,MAAM,OAAA;AAAE,kHAAA,sBAAsB,OAAA;AACvG,iGAAA,KAAK,OAAA;AAGT,+CAI4B;AAHxB,sGAAA,UAAU,OAAA;AAAE,0GAAA,cAAc,OAAA;AAC1B,4GAAA,gBAAgB,OAAA;AAAE,6GAAA,iBAAiB,OAAA;AACnC,yGAAA,aAAa,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,0GAAA,cAAc,OAAA;AAG5C,iDAK8B;AAJ1B,uGAAA,WAAW,OAAA;AACX,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,qGAAA,SAAS,OAAA;AAAE,6FAAA,CAAC,OAAA;AAChD,oGAAA,QAAQ,OAAA;AACR,uGAAA,WAAW,OAAA;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AAA;AAEX,2GAAA,cAAc,OAAA;AAAE,kHAAA,qBAAqB,OAAA;AACrC,4GAAA,eAAe,OAAA;AAAE,2GAAA,cAAc,OAAA;AAE/B,iHAAA,oBAAoB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAClE,gHAAA,mBAAmB,OAAA;AAAE,oHAAA,uBAAuB,OAAA;AAGhD,kDAE8B;AAD1B,qGAAA,QAAQ,OAAA;AAAE,mGAAA,MAAM,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,sGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/id.d.ts b/dist/ethers.js/src.ts/hash/id.d.ts new file mode 100644 index 0000000..8d5e057 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/id.d.ts @@ -0,0 +1,13 @@ +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +export declare function id(value: string): string; +//# sourceMappingURL=id.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/id.d.ts.map b/dist/ethers.js/src.ts/hash/id.d.ts.map new file mode 100644 index 0000000..0386835 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/id.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/id.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,wBAAgB,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAExC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/id.js b/dist/ethers.js/src.ts/hash/id.js new file mode 100644 index 0000000..47dc591 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/id.js @@ -0,0 +1,21 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.id = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +/** + * A simple hashing function which operates on UTF-8 strings to + * compute an 32-byte identifier. + * + * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes + * the [[keccak256]]. + * + * @example: + * id("hello world") + * //_result: + */ +function id(value) { + return (0, index_js_1.keccak256)((0, index_js_2.toUtf8Bytes)(value)); +} +exports.id = id; +//# sourceMappingURL=id.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/id.js.map b/dist/ethers.js/src.ts/hash/id.js.map new file mode 100644 index 0000000..60ef238 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/id.js.map @@ -0,0 +1 @@ +{"version":3,"file":"id.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/id.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,gDAAgD;AAEhD;;;;;;;;;;GAUG;AACH,SAAgB,EAAE,CAAC,KAAa;IAC5B,OAAO,IAAA,oBAAS,EAAC,IAAA,sBAAW,EAAC,KAAK,CAAC,CAAC,CAAC;AACzC,CAAC;AAFD,gBAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/index.d.ts b/dist/ethers.js/src.ts/hash/index.d.ts new file mode 100644 index 0000000..0b165fd --- /dev/null +++ b/dist/ethers.js/src.ts/hash/index.d.ts @@ -0,0 +1,13 @@ +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +export { id } from "./id.js"; +export { ensNormalize, isValidName, namehash, dnsEncode } from "./namehash.js"; +export { hashMessage, verifyMessage } from "./message.js"; +export { solidityPacked, solidityPackedKeccak256, solidityPackedSha256 } from "./solidity.js"; +export { TypedDataEncoder, verifyTypedData } from "./typed-data.js"; +export type { TypedDataDomain, TypedDataField } from "./typed-data.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/index.d.ts.map b/dist/ethers.js/src.ts/hash/index.d.ts.map new file mode 100644 index 0000000..833b1d6 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAC5B,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC1D,OAAO,EACH,cAAc,EAAE,uBAAuB,EAAE,oBAAoB,EAChE,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,YAAY,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/index.js b/dist/ethers.js/src.ts/hash/index.js new file mode 100644 index 0000000..e2253a4 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/index.js @@ -0,0 +1,27 @@ +"use strict"; +/** + * Utilities for common tasks involving hashing. Also see + * [cryptographic hashing](about-crypto-hashing). + * + * @_section: api/hashing:Hashing Utilities [about-hashing] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTypedData = exports.TypedDataEncoder = exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = exports.verifyMessage = exports.hashMessage = exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = exports.id = void 0; +var id_js_1 = require("./id.js"); +Object.defineProperty(exports, "id", { enumerable: true, get: function () { return id_js_1.id; } }); +var namehash_js_1 = require("./namehash.js"); +Object.defineProperty(exports, "ensNormalize", { enumerable: true, get: function () { return namehash_js_1.ensNormalize; } }); +Object.defineProperty(exports, "isValidName", { enumerable: true, get: function () { return namehash_js_1.isValidName; } }); +Object.defineProperty(exports, "namehash", { enumerable: true, get: function () { return namehash_js_1.namehash; } }); +Object.defineProperty(exports, "dnsEncode", { enumerable: true, get: function () { return namehash_js_1.dnsEncode; } }); +var message_js_1 = require("./message.js"); +Object.defineProperty(exports, "hashMessage", { enumerable: true, get: function () { return message_js_1.hashMessage; } }); +Object.defineProperty(exports, "verifyMessage", { enumerable: true, get: function () { return message_js_1.verifyMessage; } }); +var solidity_js_1 = require("./solidity.js"); +Object.defineProperty(exports, "solidityPacked", { enumerable: true, get: function () { return solidity_js_1.solidityPacked; } }); +Object.defineProperty(exports, "solidityPackedKeccak256", { enumerable: true, get: function () { return solidity_js_1.solidityPackedKeccak256; } }); +Object.defineProperty(exports, "solidityPackedSha256", { enumerable: true, get: function () { return solidity_js_1.solidityPackedSha256; } }); +var typed_data_js_1 = require("./typed-data.js"); +Object.defineProperty(exports, "TypedDataEncoder", { enumerable: true, get: function () { return typed_data_js_1.TypedDataEncoder; } }); +Object.defineProperty(exports, "verifyTypedData", { enumerable: true, get: function () { return typed_data_js_1.verifyTypedData; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/index.js.map b/dist/ethers.js/src.ts/hash/index.js.map new file mode 100644 index 0000000..a6656d2 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iCAA4B;AAAnB,2FAAA,EAAE,OAAA;AACX,6CAA+E;AAAtE,2GAAA,YAAY,OAAA;AAAE,0GAAA,WAAW,OAAA;AAAE,uGAAA,QAAQ,OAAA;AAAE,wGAAA,SAAS,OAAA;AACvD,2CAA0D;AAAjD,yGAAA,WAAW,OAAA;AAAE,2GAAA,aAAa,OAAA;AACnC,6CAEuB;AADnB,6GAAA,cAAc,OAAA;AAAE,sHAAA,uBAAuB,OAAA;AAAE,mHAAA,oBAAoB,OAAA;AAEjE,iDAAoE;AAA3D,iHAAA,gBAAgB,OAAA;AAAE,gHAAA,eAAe,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/message.d.ts b/dist/ethers.js/src.ts/hash/message.d.ts new file mode 100644 index 0000000..9e088be --- /dev/null +++ b/dist/ethers.js/src.ts/hash/message.d.ts @@ -0,0 +1,36 @@ +import type { SignatureLike } from "../crypto/index.js"; +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +export declare function hashMessage(message: Uint8Array | string): string; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +export declare function verifyMessage(message: Uint8Array | string, sig: SignatureLike): string; +//# sourceMappingURL=message.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/message.d.ts.map b/dist/ethers.js/src.ts/hash/message.d.ts.map new file mode 100644 index 0000000..b6b5db0 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/message.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/message.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM,CAOhE;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,MAAM,EAAE,GAAG,EAAE,aAAa,GAAG,MAAM,CAGtF"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/message.js b/dist/ethers.js/src.ts/hash/message.js new file mode 100644 index 0000000..cc5da95 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/message.js @@ -0,0 +1,56 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyMessage = exports.hashMessage = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +/** + * Computes the [[link-eip-191]] personal-sign message digest to sign. + * + * This prefixes the message with [[MessagePrefix]] and the decimal length + * of %%message%% and computes the [[keccak256]] digest. + * + * If %%message%% is a string, it is converted to its UTF-8 bytes + * first. To compute the digest of a [[DataHexString]], it must be converted + * to [bytes](getBytes). + * + * @example: + * hashMessage("Hello World") + * //_result: + * + * // Hashes the SIX (6) string characters, i.e. + * // [ "0", "x", "4", "2", "4", "3" ] + * hashMessage("0x4243") + * //_result: + * + * // Hashes the TWO (2) bytes [ 0x42, 0x43 ]... + * hashMessage(getBytes("0x4243")) + * //_result: + * + * // ...which is equal to using data + * hashMessage(new Uint8Array([ 0x42, 0x43 ])) + * //_result: + * + */ +function hashMessage(message) { + if (typeof (message) === "string") { + message = (0, index_js_4.toUtf8Bytes)(message); + } + return (0, index_js_1.keccak256)((0, index_js_4.concat)([ + (0, index_js_4.toUtf8Bytes)(index_js_2.MessagePrefix), + (0, index_js_4.toUtf8Bytes)(String(message.length)), + message + ])); +} +exports.hashMessage = hashMessage; +/** + * Return the address of the private key that produced + * the signature %%sig%% during signing for %%message%%. + */ +function verifyMessage(message, sig) { + const digest = hashMessage(message); + return (0, index_js_3.recoverAddress)(digest, sig); +} +exports.verifyMessage = verifyMessage; +//# sourceMappingURL=message.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/message.js.map b/dist/ethers.js/src.ts/hash/message.js.map new file mode 100644 index 0000000..1eb402f --- /dev/null +++ b/dist/ethers.js/src.ts/hash/message.js.map @@ -0,0 +1 @@ +{"version":3,"file":"message.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/message.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAC/C,oDAAsD;AACtD,sDAAyD;AACzD,gDAAwD;AAGxD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,SAAgB,WAAW,CAAC,OAA4B;IACpD,IAAI,OAAM,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QAAE,OAAO,GAAG,IAAA,sBAAW,EAAC,OAAO,CAAC,CAAC;KAAE;IACrE,OAAO,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC;QACpB,IAAA,sBAAW,EAAC,wBAAa,CAAC;QAC1B,IAAA,sBAAW,EAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACnC,OAAO;KACV,CAAC,CAAC,CAAC;AACR,CAAC;AAPD,kCAOC;AAED;;;GAGG;AACH,SAAgB,aAAa,CAAC,OAA4B,EAAE,GAAkB;IAC1E,MAAM,MAAM,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;IACpC,OAAO,IAAA,yBAAc,EAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AACvC,CAAC;AAHD,sCAGC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/namehash.d.ts b/dist/ethers.js/src.ts/hash/namehash.d.ts new file mode 100644 index 0000000..1f3937b --- /dev/null +++ b/dist/ethers.js/src.ts/hash/namehash.d.ts @@ -0,0 +1,20 @@ +/** + * Returns the ENS %%name%% normalized. + */ +export declare function ensNormalize(name: string): string; +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +export declare function isValidName(name: string): name is string; +/** + * Returns the [[link-namehash]] for %%name%%. + */ +export declare function namehash(name: string): string; +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +export declare function dnsEncode(name: string): string; +//# sourceMappingURL=namehash.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/namehash.d.ts.map b/dist/ethers.js/src.ts/hash/namehash.d.ts.map new file mode 100644 index 0000000..5f1aa76 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/namehash.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/namehash.ts"],"names":[],"mappings":"AAyCA;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOjD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,IAAI,MAAM,CAKxD;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa7C;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAa9C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/namehash.js b/dist/ethers.js/src.ts/hash/namehash.js new file mode 100644 index 0000000..60838b9 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/namehash.js @@ -0,0 +1,92 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.dnsEncode = exports.namehash = exports.isValidName = exports.ensNormalize = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const ens_normalize_1 = require("@adraffy/ens-normalize"); +const Zeros = new Uint8Array(32); +Zeros.fill(0); +function checkComponent(comp) { + (0, index_js_2.assertArgument)(comp.length !== 0, "invalid ENS name; empty component", "comp", comp); + return comp; +} +function ensNameSplit(name) { + const bytes = (0, index_js_2.toUtf8Bytes)(ensNormalize(name)); + const comps = []; + if (name.length === 0) { + return comps; + } + let last = 0; + for (let i = 0; i < bytes.length; i++) { + const d = bytes[i]; + // A separator (i.e. "."); copy this component + if (d === 0x2e) { + comps.push(checkComponent(bytes.slice(last, i))); + last = i + 1; + } + } + // There was a stray separator at the end of the name + (0, index_js_2.assertArgument)(last < bytes.length, "invalid ENS name; empty component", "name", name); + comps.push(checkComponent(bytes.slice(last))); + return comps; +} +/** + * Returns the ENS %%name%% normalized. + */ +function ensNormalize(name) { + try { + if (name.length === 0) { + throw new Error("empty label"); + } + return (0, ens_normalize_1.ens_normalize)(name); + } + catch (error) { + (0, index_js_2.assertArgument)(false, `invalid ENS name (${error.message})`, "name", name); + } +} +exports.ensNormalize = ensNormalize; +/** + * Returns ``true`` if %%name%% is a valid ENS name. + */ +function isValidName(name) { + try { + return (ensNameSplit(name).length !== 0); + } + catch (error) { } + return false; +} +exports.isValidName = isValidName; +/** + * Returns the [[link-namehash]] for %%name%%. + */ +function namehash(name) { + (0, index_js_2.assertArgument)(typeof (name) === "string", "invalid ENS name; not a string", "name", name); + (0, index_js_2.assertArgument)(name.length, `invalid ENS name (empty label)`, "name", name); + let result = Zeros; + const comps = ensNameSplit(name); + while (comps.length) { + result = (0, index_js_1.keccak256)((0, index_js_2.concat)([result, (0, index_js_1.keccak256)((comps.pop()))])); + } + return (0, index_js_2.hexlify)(result); +} +exports.namehash = namehash; +/** + * Returns the DNS encoded %%name%%. + * + * This is used for various parts of ENS name resolution, such + * as the wildcard resolution. + */ +function dnsEncode(name) { + return (0, index_js_2.hexlify)((0, index_js_2.concat)(ensNameSplit(name).map((comp) => { + // DNS does not allow components over 63 bytes in length + if (comp.length > 63) { + throw new Error("invalid DNS encoded entry; length exceeds 63 bytes"); + } + const bytes = new Uint8Array(comp.length + 1); + bytes.set(comp, 1); + bytes[0] = bytes.length - 1; + return bytes; + }))) + "00"; +} +exports.dnsEncode = dnsEncode; +//# sourceMappingURL=namehash.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/namehash.js.map b/dist/ethers.js/src.ts/hash/namehash.js.map new file mode 100644 index 0000000..2c81f0f --- /dev/null +++ b/dist/ethers.js/src.ts/hash/namehash.js.map @@ -0,0 +1 @@ +{"version":3,"file":"namehash.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/namehash.ts"],"names":[],"mappings":";;;AACA,iDAA+C;AAC/C,gDAE2B;AAG3B,0DAAuD;AAEvD,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACjC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEd,SAAS,cAAc,CAAC,IAAgB;IACpC,IAAA,yBAAc,EAAC,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,mCAAmC,EAAE,MAAM,EAAE,IAAI,CAAC,CAAA;IACpF,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,YAAY,CAAC,IAAY;IAC9B,MAAM,KAAK,GAAG,IAAA,sBAAW,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAsB,EAAG,CAAC;IAErC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC;KAAE;IAExC,IAAI,IAAI,GAAG,CAAC,CAAC;IACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QAEnB,8CAA8C;QAC9C,IAAI,CAAC,KAAK,IAAI,EAAE;YACZ,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;YACjD,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;SAChB;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ACjB,MAAM,GAAG,IAAA,oBAAS,EAAC,IAAA,iBAAM,EAAC,CAAE,MAAM,EAAE,IAAA,oBAAS,EAAa,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;KAChF;IAED,OAAO,IAAA,kBAAO,EAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAbD,4BAaC;AAED;;;;;GAKG;AACH,SAAgB,SAAS,CAAC,IAAY;IAClC,OAAO,IAAA,kBAAO,EAAC,IAAA,iBAAM,EAAC,YAAY,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QAClD,wDAAwD;QACxD,IAAI,IAAI,CAAC,MAAM,GAAG,EAAE,EAAE;YAClB,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;SACzE;QAED,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;QAC9C,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC;QACnB,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;QAC5B,OAAO,KAAK,CAAC;IAEjB,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;AAChB,CAAC;AAbD,8BAaC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/solidity.d.ts b/dist/ethers.js/src.ts/hash/solidity.d.ts new file mode 100644 index 0000000..9b8035e --- /dev/null +++ b/dist/ethers.js/src.ts/hash/solidity.d.ts @@ -0,0 +1,31 @@ +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPacked(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedKeccak256(types: ReadonlyArray, values: ReadonlyArray): string; +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +export declare function solidityPackedSha256(types: ReadonlyArray, values: ReadonlyArray): string; +//# sourceMappingURL=solidity.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/solidity.d.ts.map b/dist/ethers.js/src.ts/hash/solidity.d.ts.map new file mode 100644 index 0000000..e719d3f --- /dev/null +++ b/dist/ethers.js/src.ts/hash/solidity.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/solidity.ts"],"names":[],"mappings":"AAyEA;;;;;;;;GAQG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAQ/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAExG;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,aAAa,CAAC,MAAM,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,GAAG,CAAC,GAAG,MAAM,CAErG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/solidity.js b/dist/ethers.js/src.ts/hash/solidity.js new file mode 100644 index 0000000..c828e27 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/solidity.js @@ -0,0 +1,109 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.solidityPackedSha256 = exports.solidityPackedKeccak256 = exports.solidityPacked = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../utils/index.js"); +const regexBytes = new RegExp("^bytes([0-9]+)$"); +const regexNumber = new RegExp("^(u?int)([0-9]*)$"); +const regexArray = new RegExp("^(.*)\\[([0-9]*)\\]$"); +function _pack(type, value, isArray) { + switch (type) { + case "address": + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); + } + return (0, index_js_3.getBytes)((0, index_js_1.getAddress)(value)); + case "string": + return (0, index_js_3.toUtf8Bytes)(value); + case "bytes": + return (0, index_js_3.getBytes)(value); + case "bool": + value = (!!value ? "0x01" : "0x00"); + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)(value, 32)); + } + return (0, index_js_3.getBytes)(value); + } + let match = type.match(regexNumber); + if (match) { + let signed = (match[1] === "int"); + let size = parseInt(match[2] || "256"); + (0, index_js_3.assertArgument)((!match[2] || match[2] === String(size)) && (size % 8 === 0) && size !== 0 && size <= 256, "invalid number type", "type", type); + if (isArray) { + size = 256; + } + if (signed) { + value = (0, index_js_3.toTwos)(value, size); + } + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadValue)((0, index_js_3.toBeArray)(value), size / 8)); + } + match = type.match(regexBytes); + if (match) { + const size = parseInt(match[1]); + (0, index_js_3.assertArgument)(String(size) === match[1] && size !== 0 && size <= 32, "invalid bytes type", "type", type); + (0, index_js_3.assertArgument)((0, index_js_3.dataLength)(value) === size, `invalid value for ${type}`, "value", value); + if (isArray) { + return (0, index_js_3.getBytes)((0, index_js_3.zeroPadBytes)(value, 32)); + } + return value; + } + match = type.match(regexArray); + if (match && Array.isArray(value)) { + const baseType = match[1]; + const count = parseInt(match[2] || String(value.length)); + (0, index_js_3.assertArgument)(count === value.length, `invalid array length for ${type}`, "value", value); + const result = []; + value.forEach(function (value) { + result.push(_pack(baseType, value, true)); + }); + return (0, index_js_3.getBytes)((0, index_js_3.concat)(result)); + } + (0, index_js_3.assertArgument)(false, "invalid type", "type", type); +} +// @TODO: Array Enum +/** + * Computes the [[link-solc-packed]] representation of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPacked([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPacked(types, values) { + (0, index_js_3.assertArgument)(types.length === values.length, "wrong number of values; expected ${ types.length }", "values", values); + const tight = []; + types.forEach(function (type, index) { + tight.push(_pack(type, values[index])); + }); + return (0, index_js_3.hexlify)((0, index_js_3.concat)(tight)); +} +exports.solidityPacked = solidityPacked; +/** + * Computes the [[link-solc-packed]] [[keccak256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedKeccak256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedKeccak256(types, values) { + return (0, index_js_2.keccak256)(solidityPacked(types, values)); +} +exports.solidityPackedKeccak256 = solidityPackedKeccak256; +/** + * Computes the [[link-solc-packed]] [[sha256]] hash of %%values%% + * respectively to their %%types%%. + * + * @example: + * addr = "0x8ba1f109551bd432803012645ac136ddd64dba72" + * solidityPackedSha256([ "address", "uint" ], [ addr, 45 ]); + * //_result: + */ +function solidityPackedSha256(types, values) { + return (0, index_js_2.sha256)(solidityPacked(types, values)); +} +exports.solidityPackedSha256 = solidityPackedSha256; +//# sourceMappingURL=solidity.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/solidity.js.map b/dist/ethers.js/src.ts/hash/solidity.js.map new file mode 100644 index 0000000..f0232c0 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/solidity.js.map @@ -0,0 +1 @@ +{"version":3,"file":"solidity.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/solidity.ts"],"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C;AARD,wCAQC;AAED;;;;;;;;GAQG;AACH,SAAgB,uBAAuB,CAAC,KAA4B,EAAE,MAA0B;IAC5F,OAAO,IAAA,oBAAU,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AACrD,CAAC;AAFD,0DAEC;AAED;;;;;;;;GAQG;AACH,SAAgB,oBAAoB,CAAC,KAA4B,EAAE,MAA0B;IACzF,OAAO,IAAA,iBAAO,EAAC,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC;AAClD,CAAC;AAFD,oDAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/typed-data.d.ts b/dist/ethers.js/src.ts/hash/typed-data.d.ts new file mode 100644 index 0000000..e827817 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/typed-data.d.ts @@ -0,0 +1,150 @@ +import type { SignatureLike } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +/** + * The domain for an [[link-eip-712]] payload. + */ +export interface TypedDataDomain { + /** + * The human-readable name of the signing domain. + */ + name?: null | string; + /** + * The major version of the signing domain. + */ + version?: null | string; + /** + * The chain ID of the signing domain. + */ + chainId?: null | BigNumberish; + /** + * The the address of the contract that will verify the signature. + */ + verifyingContract?: null | string; + /** + * A salt used for purposes decided by the specific domain. + */ + salt?: null | BytesLike; +} +/** + * A specific field of a structured [[link-eip-712]] type. + */ +export interface TypedDataField { + /** + * The field name. + */ + name: string; + /** + * The type of the field. + */ + type: string; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +export declare class TypedDataEncoder { + #private; + /** + * The primary type for the structured [[types]]. + * + * This is derived automatically from the [[types]], since no + * recursion is possible, once the DAG for the types is consturcted + * internally, the primary type must be the only remaining type with + * no parent nodes. + */ + readonly primaryType: string; + /** + * The types. + */ + get types(): Record>; + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(types: Record>); + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type: string): (value: any) => string; + /** + * Return the full type for %%name%%. + */ + encodeType(name: string): string; + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type: string, value: any): string; + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name: string, value: Record): string; + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value: Record): string; + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value: Record): string; + /** + * @_ignore: + */ + _visit(type: string, value: any, callback: (type: string, data: any) => any): any; + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value: Record, callback: (type: string, data: any) => any): any; + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types: Record>): TypedDataEncoder; + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types: Record>): string; + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name: string, types: Record>, value: Record): string; + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain: TypedDataDomain): string; + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain: TypedDataDomain, types: Record>, value: Record): string; + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static resolveNames(domain: TypedDataDomain, types: Record>, value: Record, resolveName: (name: string) => Promise): Promise<{ + domain: TypedDataDomain; + value: any; + }>; + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain: TypedDataDomain, types: Record>, value: Record): any; +} +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +export declare function verifyTypedData(domain: TypedDataDomain, types: Record>, value: Record, signature: SignatureLike): string; +//# sourceMappingURL=typed-data.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/typed-data.d.ts.map b/dist/ethers.js/src.ts/hash/typed-data.d.ts.map new file mode 100644 index 0000000..3c34368 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/typed-data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/typed-data.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAajE;;GAEG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAExB;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,GAAG,YAAY,CAAC;IAE9B;;OAEG;IACH,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAElC;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC;CAC3B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;CAChB;AAmHD;;;;;;;GAOG;AACH,qBAAa,gBAAgB;;IACzB;;;;;;;OAOG;IACH,QAAQ,CAAC,WAAW,EAAG,MAAM,CAAC;IAI9B;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAEjD;IAMD;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,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAEnK"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/typed-data.js b/dist/ethers.js/src.ts/hash/typed-data.js new file mode 100644 index 0000000..660260d --- /dev/null +++ b/dist/ethers.js/src.ts/hash/typed-data.js @@ -0,0 +1,508 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _TypedDataEncoder_instances, _TypedDataEncoder_types, _TypedDataEncoder_fullTypes, _TypedDataEncoder_encoderCache, _TypedDataEncoder_getEncoder; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.verifyTypedData = exports.TypedDataEncoder = void 0; +//import { TypedDataDomain, TypedDataField } from "@ethersproject/providerabstract-signer"; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const id_js_1 = require("./id.js"); +const padding = new Uint8Array(32); +padding.fill(0); +const BN__1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_MAX_UINT256 = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +; +; +function hexPadRight(value) { + const bytes = (0, index_js_4.getBytes)(value); + const padOffset = bytes.length % 32; + if (padOffset) { + return (0, index_js_4.concat)([bytes, padding.slice(padOffset)]); + } + return (0, index_js_4.hexlify)(bytes); +} +const hexTrue = (0, index_js_4.toBeHex)(BN_1, 32); +const hexFalse = (0, index_js_4.toBeHex)(BN_0, 32); +const domainFieldTypes = { + name: "string", + version: "string", + chainId: "uint256", + verifyingContract: "address", + salt: "bytes32" +}; +const domainFieldNames = [ + "name", "version", "chainId", "verifyingContract", "salt" +]; +function checkString(key) { + return function (value) { + (0, index_js_4.assertArgument)(typeof (value) === "string", `invalid domain value for ${JSON.stringify(key)}`, `domain.${key}`, value); + return value; + }; +} +const domainChecks = { + name: checkString("name"), + version: checkString("version"), + chainId: function (_value) { + const value = (0, index_js_4.getBigInt)(_value, "domain.chainId"); + (0, index_js_4.assertArgument)(value >= 0, "invalid chain ID", "domain.chainId", _value); + if (Number.isSafeInteger(value)) { + return Number(value); + } + return (0, index_js_4.toQuantity)(value); + }, + verifyingContract: function (value) { + try { + return (0, index_js_1.getAddress)(value).toLowerCase(); + } + catch (error) { } + (0, index_js_4.assertArgument)(false, `invalid domain value "verifyingContract"`, "domain.verifyingContract", value); + }, + salt: function (value) { + const bytes = (0, index_js_4.getBytes)(value, "domain.salt"); + (0, index_js_4.assertArgument)(bytes.length === 32, `invalid domain value "salt"`, "domain.salt", value); + return (0, index_js_4.hexlify)(bytes); + } +}; +function getBaseEncoder(type) { + // intXX and uintXX + { + const match = type.match(/^(u?)int(\d*)$/); + if (match) { + const signed = (match[1] === ""); + const width = parseInt(match[2] || "256"); + (0, index_js_4.assertArgument)(width % 8 === 0 && width !== 0 && width <= 256 && (match[2] == null || match[2] === String(width)), "invalid numeric width", "type", type); + const boundsUpper = (0, index_js_4.mask)(BN_MAX_UINT256, signed ? (width - 1) : width); + const boundsLower = signed ? ((boundsUpper + BN_1) * BN__1) : BN_0; + return function (_value) { + const value = (0, index_js_4.getBigInt)(_value, "value"); + (0, index_js_4.assertArgument)(value >= boundsLower && value <= boundsUpper, `value out-of-bounds for ${type}`, "value", value); + return (0, index_js_4.toBeHex)(signed ? (0, index_js_4.toTwos)(value, 256) : value, 32); + }; + } + } + // bytesXX + { + const match = type.match(/^bytes(\d+)$/); + if (match) { + const width = parseInt(match[1]); + (0, index_js_4.assertArgument)(width !== 0 && width <= 32 && match[1] === String(width), "invalid bytes width", "type", type); + return function (value) { + const bytes = (0, index_js_4.getBytes)(value); + (0, index_js_4.assertArgument)(bytes.length === width, `invalid length for ${type}`, "value", value); + return hexPadRight(value); + }; + } + } + switch (type) { + case "address": return function (value) { + return (0, index_js_4.zeroPadValue)((0, index_js_1.getAddress)(value), 32); + }; + case "bool": return function (value) { + return ((!value) ? hexFalse : hexTrue); + }; + case "bytes": return function (value) { + return (0, index_js_2.keccak256)(value); + }; + case "string": return function (value) { + return (0, id_js_1.id)(value); + }; + } + return null; +} +function encodeType(name, fields) { + return `${name}(${fields.map(({ name, type }) => (type + " " + name)).join(",")})`; +} +/** + * A **TypedDataEncode** prepares and encodes [[link-eip-712]] payloads + * for signed typed data. + * + * This is useful for those that wish to compute various components of a + * typed data hash, primary types, or sub-components, but generally the + * higher level [[Signer-signTypedData]] is more useful. + */ +class TypedDataEncoder { + /** + * The types. + */ + get types() { + return JSON.parse(__classPrivateFieldGet(this, _TypedDataEncoder_types, "f")); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + * + * This performs all necessary checking that types are valid and + * do not violate the [[link-eip-712]] structural constraints as + * well as computes the [[primaryType]]. + */ + constructor(types) { + _TypedDataEncoder_instances.add(this); + _TypedDataEncoder_types.set(this, void 0); + _TypedDataEncoder_fullTypes.set(this, void 0); + _TypedDataEncoder_encoderCache.set(this, void 0); + __classPrivateFieldSet(this, _TypedDataEncoder_types, JSON.stringify(types), "f"); + __classPrivateFieldSet(this, _TypedDataEncoder_fullTypes, new Map(), "f"); + __classPrivateFieldSet(this, _TypedDataEncoder_encoderCache, new Map(), "f"); + // Link struct types to their direct child structs + const links = new Map(); + // Link structs to structs which contain them as a child + const parents = new Map(); + // Link all subtypes within a given struct + const subtypes = new Map(); + Object.keys(types).forEach((type) => { + links.set(type, new Set()); + parents.set(type, []); + subtypes.set(type, new Set()); + }); + for (const name in types) { + const uniqueNames = new Set(); + for (const field of types[name]) { + // Check each field has a unique name + (0, index_js_4.assertArgument)(!uniqueNames.has(field.name), `duplicate variable name ${JSON.stringify(field.name)} in ${JSON.stringify(name)}`, "types", types); + uniqueNames.add(field.name); + // Get the base type (drop any array specifiers) + const baseType = (field.type.match(/^([^\x5b]*)(\x5b|$)/))[1] || null; + (0, index_js_4.assertArgument)(baseType !== name, `circular type reference to ${JSON.stringify(baseType)}`, "types", types); + // Is this a base encoding type? + const encoder = getBaseEncoder(baseType); + if (encoder) { + continue; + } + (0, index_js_4.assertArgument)(parents.has(baseType), `unknown type ${JSON.stringify(baseType)}`, "types", types); + // Add linkage + parents.get(baseType).push(name); + links.get(name).add(baseType); + } + } + // Deduce the primary type + const primaryTypes = Array.from(parents.keys()).filter((n) => (parents.get(n).length === 0)); + (0, index_js_4.assertArgument)(primaryTypes.length !== 0, "missing primary type", "types", types); + (0, index_js_4.assertArgument)(primaryTypes.length === 1, `ambiguous primary types or unused types: ${primaryTypes.map((t) => (JSON.stringify(t))).join(", ")}`, "types", types); + (0, index_js_4.defineProperties)(this, { primaryType: primaryTypes[0] }); + // Check for circular type references + function checkCircular(type, found) { + (0, index_js_4.assertArgument)(!found.has(type), `circular type reference to ${JSON.stringify(type)}`, "types", types); + found.add(type); + for (const child of links.get(type)) { + if (!parents.has(child)) { + continue; + } + // Recursively check children + checkCircular(child, found); + // Mark all ancestors as having this decendant + for (const subtype of found) { + subtypes.get(subtype).add(child); + } + } + found.delete(type); + } + checkCircular(this.primaryType, new Set()); + // Compute each fully describe type + for (const [name, set] of subtypes) { + const st = Array.from(set); + st.sort(); + __classPrivateFieldGet(this, _TypedDataEncoder_fullTypes, "f").set(name, encodeType(name, types[name]) + st.map((t) => encodeType(t, types[t])).join("")); + } + } + /** + * Returnthe encoder for the specific %%type%%. + */ + getEncoder(type) { + let encoder = __classPrivateFieldGet(this, _TypedDataEncoder_encoderCache, "f").get(type); + if (!encoder) { + encoder = __classPrivateFieldGet(this, _TypedDataEncoder_instances, "m", _TypedDataEncoder_getEncoder).call(this, type); + __classPrivateFieldGet(this, _TypedDataEncoder_encoderCache, "f").set(type, encoder); + } + return encoder; + } + /** + * Return the full type for %%name%%. + */ + encodeType(name) { + const result = __classPrivateFieldGet(this, _TypedDataEncoder_fullTypes, "f").get(name); + (0, index_js_4.assertArgument)(result, `unknown type: ${JSON.stringify(name)}`, "name", name); + return result; + } + /** + * Return the encoded %%value%% for the %%type%%. + */ + encodeData(type, value) { + return this.getEncoder(type)(value); + } + /** + * Returns the hash of %%value%% for the type of %%name%%. + */ + hashStruct(name, value) { + return (0, index_js_2.keccak256)(this.encodeData(name, value)); + } + /** + * Return the fulled encoded %%value%% for the [[types]]. + */ + encode(value) { + return this.encodeData(this.primaryType, value); + } + /** + * Return the hash of the fully encoded %%value%% for the [[types]]. + */ + hash(value) { + return this.hashStruct(this.primaryType, value); + } + /** + * @_ignore: + */ + _visit(type, value, callback) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return callback(type, value); + } + } + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + (0, index_js_4.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); + return value.map((v) => this._visit(match[1], v, callback)); + } + // Struct + const fields = this.types[type]; + if (fields) { + return fields.reduce((accum, { name, type }) => { + accum[name] = this._visit(type, value[name], callback); + return accum; + }, {}); + } + (0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type); + } + /** + * Call %%calback%% for each value in %%value%%, passing the type and + * component within %%value%%. + * + * This is useful for replacing addresses or other transformation that + * may be desired on each component, based on its type. + */ + visit(value, callback) { + return this._visit(this.primaryType, value, callback); + } + /** + * Create a new **TypedDataEncoder** for %%types%%. + */ + static from(types) { + return new TypedDataEncoder(types); + } + /** + * Return the primary type for %%types%%. + */ + static getPrimaryType(types) { + return TypedDataEncoder.from(types).primaryType; + } + /** + * Return the hashed struct for %%value%% using %%types%% and %%name%%. + */ + static hashStruct(name, types, value) { + return TypedDataEncoder.from(types).hashStruct(name, value); + } + /** + * Return the domain hash for %%domain%%. + */ + static hashDomain(domain) { + const domainFields = []; + for (const name in domain) { + if (domain[name] == null) { + continue; + } + const type = domainFieldTypes[name]; + (0, index_js_4.assertArgument)(type, `invalid typed-data domain key: ${JSON.stringify(name)}`, "domain", domain); + domainFields.push({ name, type }); + } + domainFields.sort((a, b) => { + return domainFieldNames.indexOf(a.name) - domainFieldNames.indexOf(b.name); + }); + return TypedDataEncoder.hashStruct("EIP712Domain", { EIP712Domain: domainFields }, domain); + } + /** + * Return the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static encode(domain, types, value) { + return (0, index_js_4.concat)([ + "0x1901", + TypedDataEncoder.hashDomain(domain), + TypedDataEncoder.from(types).hash(value) + ]); + } + /** + * Return the hash of the fully encoded [[link-eip-712]] %%value%% for %%types%% with %%domain%%. + */ + static hash(domain, types, value) { + return (0, index_js_2.keccak256)(TypedDataEncoder.encode(domain, types, value)); + } + // Replaces all address types with ENS names with their looked up address + /** + * Resolves to the value from resolving all addresses in %%value%% for + * %%types%% and the %%domain%%. + */ + static resolveNames(domain, types, value, resolveName) { + return __awaiter(this, void 0, void 0, function* () { + // Make a copy to isolate it from the object passed in + domain = Object.assign({}, domain); + // Allow passing null to ignore value + for (const key in domain) { + if (domain[key] == null) { + delete domain[key]; + } + } + // Look up all ENS names + const ensCache = {}; + // Do we need to look up the domain's verifyingContract? + if (domain.verifyingContract && !(0, index_js_4.isHexString)(domain.verifyingContract, 20)) { + ensCache[domain.verifyingContract] = "0x"; + } + // We are going to use the encoder to visit all the base values + const encoder = TypedDataEncoder.from(types); + // Get a list of all the addresses + encoder.visit(value, (type, value) => { + if (type === "address" && !(0, index_js_4.isHexString)(value, 20)) { + ensCache[value] = "0x"; + } + return value; + }); + // Lookup each name + for (const name in ensCache) { + ensCache[name] = yield resolveName(name); + } + // Replace the domain verifyingContract if needed + if (domain.verifyingContract && ensCache[domain.verifyingContract]) { + domain.verifyingContract = ensCache[domain.verifyingContract]; + } + // Replace all ENS names with their address + value = encoder.visit(value, (type, value) => { + if (type === "address" && ensCache[value]) { + return ensCache[value]; + } + return value; + }); + return { domain, value }; + }); + } + /** + * Returns the JSON-encoded payload expected by nodes which implement + * the JSON-RPC [[link-eip-712]] method. + */ + static getPayload(domain, types, value) { + // Validate the domain fields + TypedDataEncoder.hashDomain(domain); + // Derive the EIP712Domain Struct reference type + const domainValues = {}; + const domainTypes = []; + domainFieldNames.forEach((name) => { + const value = domain[name]; + if (value == null) { + return; + } + domainValues[name] = domainChecks[name](value); + domainTypes.push({ name, type: domainFieldTypes[name] }); + }); + const encoder = TypedDataEncoder.from(types); + const typesWithDomain = Object.assign({}, types); + (0, index_js_4.assertArgument)(typesWithDomain.EIP712Domain == null, "types must not contain EIP712Domain type", "types.EIP712Domain", types); + typesWithDomain.EIP712Domain = domainTypes; + // Validate the data structures and types + encoder.encode(value); + return { + types: typesWithDomain, + domain: domainValues, + primaryType: encoder.primaryType, + message: encoder.visit(value, (type, value) => { + // bytes + if (type.match(/^bytes(\d*)/)) { + return (0, index_js_4.hexlify)((0, index_js_4.getBytes)(value)); + } + // uint or int + if (type.match(/^u?int/)) { + return (0, index_js_4.getBigInt)(value).toString(); + } + switch (type) { + case "address": + return value.toLowerCase(); + case "bool": + return !!value; + case "string": + (0, index_js_4.assertArgument)(typeof (value) === "string", "invalid string", "value", value); + return value; + } + (0, index_js_4.assertArgument)(false, "unsupported type", "type", type); + }) + }; + } +} +exports.TypedDataEncoder = TypedDataEncoder; +_TypedDataEncoder_types = new WeakMap(), _TypedDataEncoder_fullTypes = new WeakMap(), _TypedDataEncoder_encoderCache = new WeakMap(), _TypedDataEncoder_instances = new WeakSet(), _TypedDataEncoder_getEncoder = function _TypedDataEncoder_getEncoder(type) { + // Basic encoder type (address, bool, uint256, etc) + { + const encoder = getBaseEncoder(type); + if (encoder) { + return encoder; + } + } + // Array + const match = type.match(/^(.*)(\x5b(\d*)\x5d)$/); + if (match) { + const subtype = match[1]; + const subEncoder = this.getEncoder(subtype); + return (value) => { + (0, index_js_4.assertArgument)(!match[3] || parseInt(match[3]) === value.length, `array length mismatch; expected length ${parseInt(match[3])}`, "value", value); + let result = value.map(subEncoder); + if (__classPrivateFieldGet(this, _TypedDataEncoder_fullTypes, "f").has(subtype)) { + result = result.map(index_js_2.keccak256); + } + return (0, index_js_2.keccak256)((0, index_js_4.concat)(result)); + }; + } + // Struct + const fields = this.types[type]; + if (fields) { + const encodedType = (0, id_js_1.id)(__classPrivateFieldGet(this, _TypedDataEncoder_fullTypes, "f").get(type)); + return (value) => { + const values = fields.map(({ name, type }) => { + const result = this.getEncoder(type)(value[name]); + if (__classPrivateFieldGet(this, _TypedDataEncoder_fullTypes, "f").has(type)) { + return (0, index_js_2.keccak256)(result); + } + return result; + }); + values.unshift(encodedType); + return (0, index_js_4.concat)(values); + }; + } + (0, index_js_4.assertArgument)(false, `unknown type: ${type}`, "type", type); +}; +/** + * Compute the address used to sign the typed data for the %%signature%%. + */ +function verifyTypedData(domain, types, value, signature) { + return (0, index_js_3.recoverAddress)(TypedDataEncoder.hash(domain, types, value), signature); +} +exports.verifyTypedData = verifyTypedData; +//# sourceMappingURL=typed-data.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/hash/typed-data.js.map b/dist/ethers.js/src.ts/hash/typed-data.js.map new file mode 100644 index 0000000..d0ee447 --- /dev/null +++ b/dist/ethers.js/src.ts/hash/typed-data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"typed-data.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/hash/typed-data.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,2FAA2F;AAC3F,kDAAiD;AACjD,iDAA+C;AAC/C,sDAAyD;AACzD,gDAG2B;AAE3B,mCAA6B;AAM7B,MAAM,OAAO,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;AACnC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAEhB,MAAM,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,cAAc,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AAgCnG,CAAC;AAeD,CAAC;AAEF,SAAS,WAAW,CAAC,KAAgB;IACjC,MAAM,KAAK,GAAG,IAAA,mBAAQ,EAAC,KAAK,CAAC,CAAC;IAC9B,MAAM,SAAS,GAAG,KAAK,CAAC,MAAM,GAAG,EAAE,CAAA;IACnC,IAAI,SAAS,EAAE;QACX,OAAO,IAAA,iBAAM,EAAC,CAAE,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,CAAC,CAAE,CAAC,CAAC;KACtD;IACD,OAAO,IAAA,kBAAO,EAAC,KAAK,CAAC,CAAC;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b/dist/ethers.js/src.ts/index.d.ts @@ -0,0 +1,11 @@ +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +import * as ethers from "./ethers.js"; +export { ethers }; +export * from "./ethers.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/index.d.ts.map b/dist/ethers.js/src.ts/index.d.ts.map new file mode 100644 index 0000000..ea77bd7 --- /dev/null +++ b/dist/ethers.js/src.ts/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,MAAM,EAAE,CAAC;AAElB,cAAc,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/index.js b/dist/ethers.js/src.ts/index.js new file mode 100644 index 0000000..121369a --- /dev/null +++ b/dist/ethers.js/src.ts/index.js @@ -0,0 +1,40 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.ethers = void 0; +/** + * The Application Programming Interface (API) is the collection of + * functions, classes and types offered by the Ethers library. + * + * @_section: api:Application Programming Interface [about-api] + * @_navTitle: API + */ +const ethers = __importStar(require("./ethers.js")); +exports.ethers = ethers; +__exportStar(require("./ethers.js"), exports); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/index.js.map b/dist/ethers.js/src.ts/index.js.map new file mode 100644 index 0000000..dba5dc5 --- /dev/null +++ b/dist/ethers.js/src.ts/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/ethers.js/src.ts/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,oDAAsC;AAE7B,wBAAM;AAEf,8CAA4B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-provider.d.ts b/dist/ethers.js/src.ts/providers/abstract-provider.d.ts new file mode 100644 index 0000000..8f4a18b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-provider.d.ts @@ -0,0 +1,451 @@ +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +import { FetchRequest } from "../utils/index.js"; +import { EnsResolver } from "./ens-resolver.js"; +import { Network } from "./network.js"; +import { Block, FeeData, Log, TransactionReceipt, TransactionResponse } from "./provider.js"; +import type { AddressLike } from "../address/index.js"; +import type { BigNumberish } from "../utils/index.js"; +import type { Listener } from "../utils/index.js"; +import type { Networkish } from "./network.js"; +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +import type { BlockTag, EventFilter, Filter, FilterByBlockHash, OrphanFilter, PreparedTransactionRequest, Provider, ProviderEvent, TransactionRequest } from "./provider.js"; +/** + * The types of additional event values that can be emitted for the + * ``"debug"`` event. + */ +export type DebugEventAbstractProvider = { + action: "sendCcipReadFetchRequest"; + request: FetchRequest; + index: number; + urls: Array; +} | { + action: "receiveCcipReadFetchResult"; + request: FetchRequest; + result: any; +} | { + action: "receiveCcipReadFetchError"; + request: FetchRequest; + result: any; +} | { + action: "sendCcipReadCall"; + transaction: { + to: string; + data: string; + }; +} | { + action: "receiveCcipReadCallResult"; + transaction: { + to: string; + data: string; + }; + result: string; +} | { + action: "receiveCcipReadCallError"; + transaction: { + to: string; + data: string; + }; + error: Error; +}; +/** + * The value passed to the [[AbstractProvider-_getSubscriber]] method. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export type Subscription = { + type: "block" | "close" | "debug" | "error" | "finalized" | "network" | "pending" | "safe"; + tag: string; +} | { + type: "transaction"; + tag: string; + hash: string; +} | { + type: "event"; + tag: string; + filter: EventFilter; +} | { + type: "orphan"; + tag: string; + filter: OrphanFilter; +}; +/** + * A **Subscriber** manages a subscription. + * + * Only developers sub-classing [[AbstractProvider[[ will care about this, + * if they are modifying a low-level feature of how subscriptions operate. + */ +export interface Subscriber { + /** + * Called initially when a subscriber is added the first time. + */ + start(): void; + /** + * Called when there are no more subscribers to the event. + */ + stop(): void; + /** + * Called when the subscription should pause. + * + * If %%dropWhilePaused%%, events that occur while paused should not + * be emitted [[resume]]. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume a paused subscriber. + */ + resume(): void; + /** + * The frequency (in ms) to poll for events, if polling is used by + * the subscriber. + * + * For non-polling subscribers, this must return ``undefined``. + */ + pollingInterval?: number; +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +export declare class UnmanagedSubscriber implements Subscriber { + /** + * The name fof the event. + */ + name: string; + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name: string); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **AbstractPlugin** is used to provide additional internal services + * to an [[AbstractProvider]] without adding backwards-incompatible changes + * to method signatures or other internal and complex logic. + */ +export interface AbstractProviderPlugin { + /** + * The reverse domain notation of the plugin. + */ + readonly name: string; + /** + * Creates a new instance of the plugin, connected to %%provider%%. + */ + connect(provider: AbstractProvider): AbstractProviderPlugin; +} +/** + * A normalized filter used for [[PerformActionRequest]] objects. + */ +export type PerformActionFilter = { + address?: string | Array; + topics?: Array>; + fromBlock?: BlockTag; + toBlock?: BlockTag; +} | { + address?: string | Array; + topics?: Array>; + blockHash?: string; +}; +/** + * A normalized transactions used for [[PerformActionRequest]] objects. + */ +export interface PerformActionTransaction extends PreparedTransactionRequest { + /** + * The ``to`` address of the transaction. + */ + to?: string; + /** + * The sender of the transaction. + */ + from?: string; +} +/** + * The [[AbstractProvider]] methods will normalize all values and pass this + * type to [[AbstractProvider-_perform]]. + */ +export type PerformActionRequest = { + method: "broadcastTransaction"; + signedTransaction: string; +} | { + method: "call"; + transaction: PerformActionTransaction; + blockTag: BlockTag; +} | { + method: "chainId"; +} | { + method: "estimateGas"; + transaction: PerformActionTransaction; +} | { + method: "getBalance"; + address: string; + blockTag: BlockTag; +} | { + method: "getBlock"; + blockTag: BlockTag; + includeTransactions: boolean; +} | { + method: "getBlock"; + blockHash: string; + includeTransactions: boolean; +} | { + method: "getBlockNumber"; +} | { + method: "getCode"; + address: string; + blockTag: BlockTag; +} | { + method: "getGasPrice"; +} | { + method: "getLogs"; + filter: PerformActionFilter; +} | { + method: "getPriorityFee"; +} | { + method: "getStorage"; + address: string; + position: bigint; + blockTag: BlockTag; +} | { + method: "getTransaction"; + hash: string; +} | { + method: "getTransactionCount"; + address: string; + blockTag: BlockTag; +} | { + method: "getTransactionReceipt"; + hash: string; +} | { + method: "getTransactionResult"; + hash: string; +}; +/** + * Options for configuring some internal aspects of an [[AbstractProvider]]. + * + * **``cacheTimeout``** - how long to cache a low-level ``_perform`` + * for, based on input parameters. This reduces the number of calls + * to getChainId and getBlockNumber, but may break test chains which + * can perform operations (internally) synchronously. Use ``-1`` to + * disable, ``0`` will only buffer within the same event loop and + * any other value is in ms. (default: ``250``) + */ +export type AbstractProviderOptions = { + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +export declare class AbstractProvider implements Provider { + #private; + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network?: "any" | Networkish, options?: AbstractProviderOptions); + get pollingInterval(): number; + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider(): this; + /** + * Returns all the registered plug-ins. + */ + get plugins(): Array; + /** + * Attach a new plug-in. + */ + attachPlugin(plugin: AbstractProviderPlugin): this; + /** + * Get a plugin by name. + */ + getPlugin(name: string): null | T; + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead(): boolean; + set disableCcipRead(value: boolean); + /** + * Resolves to the data for executing the CCIP-read operations. + */ + ccipReadFetch(tx: PerformActionTransaction, calldata: string, urls: Array): Promise; + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value: BlockParams, network: Network): Block; + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value: LogParams, network: Network): Log; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value: TransactionReceiptParams, network: Network): TransactionReceipt; + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx: TransactionResponseParams, network: Network): TransactionResponse; + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork(): Promise; + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + _perform(req: PerformActionRequest): Promise; + getBlockNumber(): Promise; + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address: AddressLike): string | Promise; + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag?: BlockTag): string | Promise; + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter: Filter | FilterByBlockHash): PerformActionFilter | Promise; + /** + * Returns or resovles to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request: TransactionRequest): PerformActionTransaction | Promise; + getNetwork(): Promise; + getFeeData(): Promise; + estimateGas(_tx: TransactionRequest): Promise; + call(_tx: TransactionRequest): Promise; + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + getStorage(address: AddressLike, _position: BigNumberish, blockTag?: BlockTag): Promise; + broadcastTransaction(signedTx: string): Promise; + getBlock(block: BlockTag | string, prefetchTxs?: boolean): Promise; + getTransaction(hash: string): Promise; + getTransactionReceipt(hash: string): Promise; + getTransactionResult(hash: string): Promise; + getLogs(_filter: Filter | FilterByBlockHash): Promise>; + _getProvider(chainId: number): AbstractProvider; + getResolver(name: string): Promise; + getAvatar(name: string): Promise; + resolveName(name: string): Promise; + lookupAddress(address: string): Promise; + waitForTransaction(hash: string, _confirms?: null | number, timeout?: null | number): Promise; + waitForBlock(blockTag?: BlockTag): Promise; + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId: number): void; + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func: () => void, timeout?: number): number; + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func: (s: Subscriber) => void): void; + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub: Subscriber, newSub: Subscriber): void; + on(event: ProviderEvent, listener: Listener): Promise; + once(event: ProviderEvent, listener: Listener): Promise; + emit(event: ProviderEvent, ...args: Array): Promise; + listenerCount(event?: ProviderEvent): Promise; + listeners(event?: ProviderEvent): Promise>; + off(event: ProviderEvent, listener?: Listener): Promise; + removeAllListeners(event?: ProviderEvent): Promise; + addListener(event: ProviderEvent, listener: Listener): Promise; + removeListener(event: ProviderEvent, listener: Listener): Promise; + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed(): boolean; + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy(): void; + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused(): boolean; + set paused(pause: boolean); + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused?: boolean): void; + /** + * Resume the provider. + */ + resume(): void; +} +//# sourceMappingURL=abstract-provider.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-provider.d.ts.map b/dist/ethers.js/src.ts/providers/abstract-provider.d.ts.map new file mode 100644 index 0000000..5eed326 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/abstract-provider.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAeH,OAAO,EAIH,YAAY,EAIf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAIhD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAe,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAM1G,OAAO,KAAK,EAAe,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACpE,OAAO,KAAK,EAAE,YAAY,EAAa,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EACR,WAAW,EAAE,SAAS,EAAE,wBAAwB,EAChD,yBAAyB,EAC5B,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EACR,QAAQ,EAAE,WAAW,EAAE,MAAM,EAAE,iBAAiB,EAAE,YAAY,EAC9D,0BAA0B,EAAE,QAAQ,EAAE,aAAa,EACnD,kBAAkB,EACrB,MAAM,eAAe,CAAC;AAkCvB;;;G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KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAcrD,SAAS,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAa1D,GAAG,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAiB7D,kBAAkB,CAAC,KAAK,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAexD,WAAW,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAKpE,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAI7E;;;;;;OAMG;IACH,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED;;;;;OAKG;IACH,OAAO,IAAI,IAAI;IAYf;;;;;;;;;;OAUG;IACH,IAAI,MAAM,IAAI,OAAO,CAAwC;IAC7D,IAAI,MAAM,CAAC,KAAK,EAAE,OAAO,EAQxB;IAED;;;;OAIG;IACH,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAsBtC;;OAEG;IACH,MAAM,IAAI,IAAI;CAiBjB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-provider.js b/dist/ethers.js/src.ts/providers/abstract-provider.js new file mode 100644 index 0000000..329583c --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-provider.js @@ -0,0 +1,1492 @@ +"use strict"; +/** + * The available providers should suffice for most developers purposes, + * but the [[AbstractProvider]] class has many features which enable + * sub-classing it for specific purposes. + * + * @_section: api/providers/abstract-provider: Subclassing Provider [abstract-provider] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _AbstractProvider_instances, _AbstractProvider_subs, _AbstractProvider_plugins, _AbstractProvider_pausedState, _AbstractProvider_destroyed, _AbstractProvider_networkPromise, _AbstractProvider_anyNetwork, _AbstractProvider_performCache, _AbstractProvider_lastBlockNumber, _AbstractProvider_nextTimer, _AbstractProvider_timers, _AbstractProvider_disableCcipRead, _AbstractProvider_options, _AbstractProvider_perform, _AbstractProvider_call, _AbstractProvider_checkNetwork, _AbstractProvider_getAccountValue, _AbstractProvider_getBlock, _AbstractProvider_hasSub, _AbstractProvider_getSub; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AbstractProvider = exports.UnmanagedSubscriber = void 0; +// @TODO +// Event coalescence +// When we register an event with an async value (e.g. address is a Signer +// or ENS name), we need to add it immeidately for the Event API, but also +// need time to resolve the address. Upon resolving the address, we need to +// migrate the listener to the static event. We also need to maintain a map +// of Signer/ENS name to address so we can sync respond to listenerCount. +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../contract/index.js"); +const index_js_4 = require("../hash/index.js"); +const index_js_5 = require("../transaction/index.js"); +const index_js_6 = require("../utils/index.js"); +const ens_resolver_js_1 = require("./ens-resolver.js"); +const format_js_1 = require("./format.js"); +const network_js_1 = require("./network.js"); +const provider_js_1 = require("./provider.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +// Constants +const BN_2 = BigInt(2); +const MAX_CCIP_REDIRECTS = 10; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +function getTag(prefix, value) { + return prefix + ":" + JSON.stringify(value, (k, v) => { + if (v == null) { + return "null"; + } + if (typeof (v) === "bigint") { + return `bigint:${v.toString()}`; + } + if (typeof (v) === "string") { + return v.toLowerCase(); + } + // Sort object keys + if (typeof (v) === "object" && !Array.isArray(v)) { + const keys = Object.keys(v); + keys.sort(); + return keys.reduce((accum, key) => { + accum[key] = v[key]; + return accum; + }, {}); + } + return v; + }); +} +/** + * An **UnmanagedSubscriber** is useful for events which do not require + * any additional management, such as ``"debug"`` which only requires + * emit in synchronous event loop triggered calls. + */ +class UnmanagedSubscriber { + /** + * Create a new UnmanagedSubscriber with %%name%%. + */ + constructor(name) { (0, index_js_6.defineProperties)(this, { name }); } + start() { } + stop() { } + pause(dropWhilePaused) { } + resume() { } +} +exports.UnmanagedSubscriber = UnmanagedSubscriber; +function copy(value) { + return JSON.parse(JSON.stringify(value)); +} +function concisify(items) { + items = Array.from((new Set(items)).values()); + items.sort(); + return items; +} +function getSubscription(_event, provider) { + return __awaiter(this, void 0, void 0, function* () { + if (_event == null) { + throw new Error("invalid event"); + } + // Normalize topic array info an EventFilter + if (Array.isArray(_event)) { + _event = { topics: _event }; + } + if (typeof (_event) === "string") { + switch (_event) { + case "block": + case "debug": + case "error": + case "finalized": + case "network": + case "pending": + case "safe": { + return { type: _event, tag: _event }; + } + } + } + if ((0, index_js_6.isHexString)(_event, 32)) { + const hash = _event.toLowerCase(); + return { type: "transaction", tag: getTag("tx", { hash }), hash }; + } + if (_event.orphan) { + const event = _event; + // @TODO: Should lowercase and whatnot things here instead of copy... + return { type: "orphan", tag: getTag("orphan", event), filter: copy(event) }; + } + if ((_event.address || _event.topics)) { + const event = _event; + const filter = { + topics: ((event.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + })) + }; + if (event.address) { + const addresses = []; + const promises = []; + const addAddress = (addr) => { + if ((0, index_js_6.isHexString)(addr)) { + addresses.push(addr); + } + else { + promises.push((() => __awaiter(this, void 0, void 0, function* () { + addresses.push(yield (0, index_js_1.resolveAddress)(addr, provider)); + }))()); + } + }; + if (Array.isArray(event.address)) { + event.address.forEach(addAddress); + } + else { + addAddress(event.address); + } + if (promises.length) { + yield Promise.all(promises); + } + filter.address = concisify(addresses.map((a) => a.toLowerCase())); + } + return { filter, tag: getTag("event", filter), type: "event" }; + } + (0, index_js_6.assertArgument)(false, "unknown ProviderEvent", "event", _event); + }); +} +function getTime() { return (new Date()).getTime(); } +const defaultOptions = { + cacheTimeout: 250, + pollingInterval: 4000 +}; +/** + * An **AbstractProvider** provides a base class for other sub-classes to + * implement the [[Provider]] API by normalizing input arguments and + * formatting output results as well as tracking events for consistent + * behaviour on an eventually-consistent network. + */ +class AbstractProvider { + /** + * Create a new **AbstractProvider** connected to %%network%%, or + * use the various network detection capabilities to discover the + * [[Network]] if necessary. + */ + constructor(_network, options) { + _AbstractProvider_instances.add(this); + _AbstractProvider_subs.set(this, void 0); + _AbstractProvider_plugins.set(this, void 0); + // null=unpaused, true=paused+dropWhilePaused, false=paused + _AbstractProvider_pausedState.set(this, void 0); + _AbstractProvider_destroyed.set(this, void 0); + _AbstractProvider_networkPromise.set(this, void 0); + _AbstractProvider_anyNetwork.set(this, void 0); + _AbstractProvider_performCache.set(this, void 0); + // The most recent block number if running an event or -1 if no "block" event + _AbstractProvider_lastBlockNumber.set(this, void 0); + _AbstractProvider_nextTimer.set(this, void 0); + _AbstractProvider_timers.set(this, void 0); + _AbstractProvider_disableCcipRead.set(this, void 0); + _AbstractProvider_options.set(this, void 0); + __classPrivateFieldSet(this, _AbstractProvider_options, Object.assign({}, defaultOptions, options || {}), "f"); + if (_network === "any") { + __classPrivateFieldSet(this, _AbstractProvider_anyNetwork, true, "f"); + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, null, "f"); + } + else if (_network) { + const network = network_js_1.Network.from(_network); + __classPrivateFieldSet(this, _AbstractProvider_anyNetwork, false, "f"); + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, Promise.resolve(network), "f"); + setTimeout(() => { this.emit("network", network, null); }, 0); + } + else { + __classPrivateFieldSet(this, _AbstractProvider_anyNetwork, false, "f"); + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, null, "f"); + } + __classPrivateFieldSet(this, _AbstractProvider_lastBlockNumber, -1, "f"); + __classPrivateFieldSet(this, _AbstractProvider_performCache, new Map(), "f"); + __classPrivateFieldSet(this, _AbstractProvider_subs, new Map(), "f"); + __classPrivateFieldSet(this, _AbstractProvider_plugins, new Map(), "f"); + __classPrivateFieldSet(this, _AbstractProvider_pausedState, null, "f"); + __classPrivateFieldSet(this, _AbstractProvider_destroyed, false, "f"); + __classPrivateFieldSet(this, _AbstractProvider_nextTimer, 1, "f"); + __classPrivateFieldSet(this, _AbstractProvider_timers, new Map(), "f"); + __classPrivateFieldSet(this, _AbstractProvider_disableCcipRead, false, "f"); + } + get pollingInterval() { return __classPrivateFieldGet(this, _AbstractProvider_options, "f").pollingInterval; } + /** + * Returns ``this``, to allow an **AbstractProvider** to implement + * the [[ContractRunner]] interface. + */ + get provider() { return this; } + /** + * Returns all the registered plug-ins. + */ + get plugins() { + return Array.from(__classPrivateFieldGet(this, _AbstractProvider_plugins, "f").values()); + } + /** + * Attach a new plug-in. + */ + attachPlugin(plugin) { + if (__classPrivateFieldGet(this, _AbstractProvider_plugins, "f").get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + __classPrivateFieldGet(this, _AbstractProvider_plugins, "f").set(plugin.name, plugin.connect(this)); + return this; + } + /** + * Get a plugin by name. + */ + getPlugin(name) { + return (__classPrivateFieldGet(this, _AbstractProvider_plugins, "f").get(name)) || null; + } + /** + * Prevent any CCIP-read operation, regardless of whether requested + * in a [[call]] using ``enableCcipRead``. + */ + get disableCcipRead() { return __classPrivateFieldGet(this, _AbstractProvider_disableCcipRead, "f"); } + set disableCcipRead(value) { __classPrivateFieldSet(this, _AbstractProvider_disableCcipRead, !!value, "f"); } + /** + * Resolves to the data for executing the CCIP-read operations. + */ + ccipReadFetch(tx, calldata, urls) { + return __awaiter(this, void 0, void 0, function* () { + if (this.disableCcipRead || urls.length === 0 || tx.to == null) { + return null; + } + const sender = tx.to.toLowerCase(); + const data = calldata.toLowerCase(); + const errorMessages = []; + for (let i = 0; i < urls.length; i++) { + const url = urls[i]; + // URL expansion + const href = url.replace("{sender}", sender).replace("{data}", data); + // If no {data} is present, use POST; otherwise GET + //const json: string | null = (url.indexOf("{data}") >= 0) ? null: JSON.stringify({ data, sender }); + //const result = await fetchJson({ url: href, errorPassThrough: true }, json, (value, response) => { + // value.status = response.statusCode; + // return value; + //}); + const request = new index_js_6.FetchRequest(href); + if (url.indexOf("{data}") === -1) { + request.body = { data, sender }; + } + this.emit("debug", { action: "sendCcipReadFetchRequest", request, index: i, urls }); + let errorMessage = "unknown error"; + const resp = yield request.send(); + try { + const result = resp.bodyJson; + if (result.data) { + this.emit("debug", { action: "receiveCcipReadFetchResult", request, result }); + return result.data; + } + if (result.message) { + errorMessage = result.message; + } + this.emit("debug", { action: "receiveCcipReadFetchError", request, result }); + } + catch (error) { } + // 4xx indicates the result is not present; stop + (0, index_js_6.assert)(resp.statusCode < 400 || resp.statusCode >= 500, `response not found during CCIP fetch: ${errorMessage}`, "OFFCHAIN_FAULT", { reason: "404_MISSING_RESOURCE", transaction: tx, info: { url, errorMessage } }); + // 5xx indicates server issue; try the next url + errorMessages.push(errorMessage); + } + (0, index_js_6.assert)(false, `error encountered during CCIP fetch: ${errorMessages.map((m) => JSON.stringify(m)).join(", ")}`, "OFFCHAIN_FAULT", { + reason: "500_SERVER_ERROR", + transaction: tx, info: { urls, errorMessages } + }); + }); + } + /** + * Provides the opportunity for a sub-class to wrap a block before + * returning it, to add additional properties or an alternate + * sub-class of [[Block]]. + */ + _wrapBlock(value, network) { + return new provider_js_1.Block((0, format_js_1.formatBlock)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a log before + * returning it, to add additional properties or an alternate + * sub-class of [[Log]]. + */ + _wrapLog(value, network) { + return new provider_js_1.Log((0, format_js_1.formatLog)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * receipt before returning it, to add additional properties or an + * alternate sub-class of [[TransactionReceipt]]. + */ + _wrapTransactionReceipt(value, network) { + return new provider_js_1.TransactionReceipt((0, format_js_1.formatTransactionReceipt)(value), this); + } + /** + * Provides the opportunity for a sub-class to wrap a transaction + * response before returning it, to add additional properties or an + * alternate sub-class of [[TransactionResponse]]. + */ + _wrapTransactionResponse(tx, network) { + return new provider_js_1.TransactionResponse((0, format_js_1.formatTransactionResponse)(tx), this); + } + /** + * Resolves to the Network, forcing a network detection using whatever + * technique the sub-class requires. + * + * Sub-classes **must** override this. + */ + _detectNetwork() { + (0, index_js_6.assert)(false, "sub-classes must implement this", "UNSUPPORTED_OPERATION", { + operation: "_detectNetwork" + }); + } + /** + * Sub-classes should use this to perform all built-in operations. All + * methods sanitizes and normalizes the values passed into this. + * + * Sub-classes **must** override this. + */ + _perform(req) { + return __awaiter(this, void 0, void 0, function* () { + (0, index_js_6.assert)(false, `unsupported method: ${req.method}`, "UNSUPPORTED_OPERATION", { + operation: req.method, + info: req + }); + }); + } + // State + getBlockNumber() { + return __awaiter(this, void 0, void 0, function* () { + const blockNumber = (0, index_js_6.getNumber)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getBlockNumber" }), "%response"); + if (__classPrivateFieldGet(this, _AbstractProvider_lastBlockNumber, "f") >= 0) { + __classPrivateFieldSet(this, _AbstractProvider_lastBlockNumber, blockNumber, "f"); + } + return blockNumber; + }); + } + /** + * Returns or resolves to the address for %%address%%, resolving ENS + * names and [[Addressable]] objects and returning if already an + * address. + */ + _getAddress(address) { + return (0, index_js_1.resolveAddress)(address, this); + } + /** + * Returns or resolves to a valid block tag for %%blockTag%%, resolving + * negative values and returning if already a valid block tag. + */ + _getBlockTag(blockTag) { + if (blockTag == null) { + return "latest"; + } + switch (blockTag) { + case "earliest": + return "0x0"; + case "finalized": + case "latest": + case "pending": + case "safe": + return blockTag; + } + if ((0, index_js_6.isHexString)(blockTag)) { + if ((0, index_js_6.isHexString)(blockTag, 32)) { + return blockTag; + } + return (0, index_js_6.toQuantity)(blockTag); + } + if (typeof (blockTag) === "bigint") { + blockTag = (0, index_js_6.getNumber)(blockTag, "blockTag"); + } + if (typeof (blockTag) === "number") { + if (blockTag >= 0) { + return (0, index_js_6.toQuantity)(blockTag); + } + if (__classPrivateFieldGet(this, _AbstractProvider_lastBlockNumber, "f") >= 0) { + return (0, index_js_6.toQuantity)(__classPrivateFieldGet(this, _AbstractProvider_lastBlockNumber, "f") + blockTag); + } + return this.getBlockNumber().then((b) => (0, index_js_6.toQuantity)(b + blockTag)); + } + (0, index_js_6.assertArgument)(false, "invalid blockTag", "blockTag", blockTag); + } + /** + * Returns or resolves to a filter for %%filter%%, resolving any ENS + * names or [[Addressable]] object and returning if already a valid + * filter. + */ + _getFilter(filter) { + // Create a canonical representation of the topics + const topics = (filter.topics || []).map((t) => { + if (t == null) { + return null; + } + if (Array.isArray(t)) { + return concisify(t.map((t) => t.toLowerCase())); + } + return t.toLowerCase(); + }); + const blockHash = ("blockHash" in filter) ? filter.blockHash : undefined; + const resolve = (_address, fromBlock, toBlock) => { + let address = undefined; + switch (_address.length) { + case 0: break; + case 1: + address = _address[0]; + break; + default: + _address.sort(); + address = _address; + } + if (blockHash) { + if (fromBlock != null || toBlock != null) { + throw new Error("invalid filter"); + } + } + const filter = {}; + if (address) { + filter.address = address; + } + if (topics.length) { + filter.topics = topics; + } + if (fromBlock) { + filter.fromBlock = fromBlock; + } + if (toBlock) { + filter.toBlock = toBlock; + } + if (blockHash) { + filter.blockHash = blockHash; + } + return filter; + }; + // Addresses could be async (ENS names or Addressables) + let address = []; + if (filter.address) { + if (Array.isArray(filter.address)) { + for (const addr of filter.address) { + address.push(this._getAddress(addr)); + } + } + else { + address.push(this._getAddress(filter.address)); + } + } + let fromBlock = undefined; + if ("fromBlock" in filter) { + fromBlock = this._getBlockTag(filter.fromBlock); + } + let toBlock = undefined; + if ("toBlock" in filter) { + toBlock = this._getBlockTag(filter.toBlock); + } + if (address.filter((a) => (typeof (a) !== "string")).length || + (fromBlock != null && typeof (fromBlock) !== "string") || + (toBlock != null && typeof (toBlock) !== "string")) { + return Promise.all([Promise.all(address), fromBlock, toBlock]).then((result) => { + return resolve(result[0], result[1], result[2]); + }); + } + return resolve(address, fromBlock, toBlock); + } + /** + * Returns or resovles to a transaction for %%request%%, resolving + * any ENS names or [[Addressable]] and returning if already a valid + * transaction. + */ + _getTransactionRequest(_request) { + const request = (0, provider_js_1.copyRequest)(_request); + const promises = []; + ["to", "from"].forEach((key) => { + if (request[key] == null) { + return; + } + const addr = (0, index_js_1.resolveAddress)(request[key], this); + if (isPromise(addr)) { + promises.push((function () { + return __awaiter(this, void 0, void 0, function* () { request[key] = yield addr; }); + })()); + } + else { + request[key] = addr; + } + }); + if (request.blockTag != null) { + const blockTag = this._getBlockTag(request.blockTag); + if (isPromise(blockTag)) { + promises.push((function () { + return __awaiter(this, void 0, void 0, function* () { request.blockTag = yield blockTag; }); + })()); + } + else { + request.blockTag = blockTag; + } + } + if (promises.length) { + return (function () { + return __awaiter(this, void 0, void 0, function* () { + yield Promise.all(promises); + return request; + }); + })(); + } + return request; + } + getNetwork() { + return __awaiter(this, void 0, void 0, function* () { + // No explicit network was set and this is our first time + if (__classPrivateFieldGet(this, _AbstractProvider_networkPromise, "f") == null) { + // Detect the current network (shared with all calls) + const detectNetwork = this._detectNetwork().then((network) => { + this.emit("network", network, null); + return network; + }, (error) => { + // Reset the networkPromise on failure, so we will try again + if (__classPrivateFieldGet(this, _AbstractProvider_networkPromise, "f") === detectNetwork) { + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, null, "f"); + } + throw error; + }); + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, detectNetwork, "f"); + return (yield detectNetwork).clone(); + } + const networkPromise = __classPrivateFieldGet(this, _AbstractProvider_networkPromise, "f"); + const [expected, actual] = yield Promise.all([ + networkPromise, + this._detectNetwork() // The actual connected network + ]); + if (expected.chainId !== actual.chainId) { + if (__classPrivateFieldGet(this, _AbstractProvider_anyNetwork, "f")) { + // The "any" network can change, so notify listeners + this.emit("network", actual, expected); + // Update the network if something else hasn't already changed it + if (__classPrivateFieldGet(this, _AbstractProvider_networkPromise, "f") === networkPromise) { + __classPrivateFieldSet(this, _AbstractProvider_networkPromise, Promise.resolve(actual), "f"); + } + } + else { + // Otherwise, we do not allow changes to the underlying network + (0, index_js_6.assert)(false, `network changed: ${expected.chainId} => ${actual.chainId} `, "NETWORK_ERROR", { + event: "changed" + }); + } + } + return expected.clone(); + }); + } + getFeeData() { + return __awaiter(this, void 0, void 0, function* () { + const network = yield this.getNetwork(); + const getFeeDataFunc = () => __awaiter(this, void 0, void 0, function* () { + const { _block, gasPrice, priorityFee } = yield (0, index_js_6.resolveProperties)({ + _block: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getBlock).call(this, "latest", false), + gasPrice: ((() => __awaiter(this, void 0, void 0, function* () { + try { + const value = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getGasPrice" }); + return (0, index_js_6.getBigInt)(value, "%response"); + } + catch (error) { } + return null; + }))()), + priorityFee: ((() => __awaiter(this, void 0, void 0, function* () { + try { + const value = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getPriorityFee" }); + return (0, index_js_6.getBigInt)(value, "%response"); + } + catch (error) { } + return null; + }))()) + }); + let maxFeePerGas = null; + let maxPriorityFeePerGas = null; + // These are the recommended EIP-1559 heuristics for fee data + const block = this._wrapBlock(_block, network); + if (block && block.baseFeePerGas) { + maxPriorityFeePerGas = (priorityFee != null) ? priorityFee : BigInt("1000000000"); + maxFeePerGas = (block.baseFeePerGas * BN_2) + maxPriorityFeePerGas; + } + return new provider_js_1.FeeData(gasPrice, maxFeePerGas, maxPriorityFeePerGas); + }); + // Check for a FeeDataNetWorkPlugin + const plugin = network.getPlugin("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + if (plugin) { + const req = new index_js_6.FetchRequest(plugin.url); + const feeData = yield plugin.processFunc(getFeeDataFunc, this, req); + return new provider_js_1.FeeData(feeData.gasPrice, feeData.maxFeePerGas, feeData.maxPriorityFeePerGas); + } + return yield getFeeDataFunc(); + }); + } + estimateGas(_tx) { + return __awaiter(this, void 0, void 0, function* () { + let tx = this._getTransactionRequest(_tx); + if (isPromise(tx)) { + tx = yield tx; + } + return (0, index_js_6.getBigInt)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { + method: "estimateGas", transaction: tx + }), "%response"); + }); + } + call(_tx) { + return __awaiter(this, void 0, void 0, function* () { + const { tx, blockTag } = yield (0, index_js_6.resolveProperties)({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); + return yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_checkNetwork).call(this, __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_call).call(this, tx, blockTag, _tx.enableCcipRead ? 0 : -1)); + }); + } + getBalance(address, blockTag) { + return __awaiter(this, void 0, void 0, function* () { + return (0, index_js_6.getBigInt)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getAccountValue).call(this, { method: "getBalance" }, address, blockTag), "%response"); + }); + } + getTransactionCount(address, blockTag) { + return __awaiter(this, void 0, void 0, function* () { + return (0, index_js_6.getNumber)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getAccountValue).call(this, { method: "getTransactionCount" }, address, blockTag), "%response"); + }); + } + getCode(address, blockTag) { + return __awaiter(this, void 0, void 0, function* () { + return (0, index_js_6.hexlify)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getAccountValue).call(this, { method: "getCode" }, address, blockTag)); + }); + } + getStorage(address, _position, blockTag) { + return __awaiter(this, void 0, void 0, function* () { + const position = (0, index_js_6.getBigInt)(_position, "position"); + return (0, index_js_6.hexlify)(yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getAccountValue).call(this, { method: "getStorage", position }, address, blockTag)); + }); + } + // Write + broadcastTransaction(signedTx) { + return __awaiter(this, void 0, void 0, function* () { + const { blockNumber, hash, network } = yield (0, index_js_6.resolveProperties)({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: "broadcastTransaction", + signedTransaction: signedTx + }), + network: this.getNetwork() + }); + const tx = index_js_5.Transaction.from(signedTx); + if (tx.hash !== hash) { + throw new Error("@TODO: the returned hash did not match"); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + }); + } + // Queries + getBlock(block, prefetchTxs) { + return __awaiter(this, void 0, void 0, function* () { + const { network, params } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getBlock).call(this, block, !!prefetchTxs) + }); + if (params == null) { + return null; + } + return this._wrapBlock(params, network); + }); + } + getTransaction(hash) { + return __awaiter(this, void 0, void 0, function* () { + const { network, params } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getTransaction", hash }) + }); + if (params == null) { + return null; + } + return this._wrapTransactionResponse(params, network); + }); + } + getTransactionReceipt(hash) { + return __awaiter(this, void 0, void 0, function* () { + const { network, params } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getTransactionReceipt", hash }) + }); + if (params == null) { + return null; + } + // Some backends did not backfill the effectiveGasPrice into old transactions + // in the receipt, so we look it up manually and inject it. + if (params.gasPrice == null && params.effectiveGasPrice == null) { + const tx = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getTransaction", hash }); + if (tx == null) { + throw new Error("report this; could not find tx or effectiveGasPrice"); + } + params.effectiveGasPrice = tx.gasPrice; + } + return this._wrapTransactionReceipt(params, network); + }); + } + getTransactionResult(hash) { + return __awaiter(this, void 0, void 0, function* () { + const { result } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + result: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getTransactionResult", hash }) + }); + if (result == null) { + return null; + } + return (0, index_js_6.hexlify)(result); + }); + } + // Bloom-filter Queries + getLogs(_filter) { + return __awaiter(this, void 0, void 0, function* () { + let filter = this._getFilter(_filter); + if (isPromise(filter)) { + filter = yield filter; + } + const { network, params } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + params: __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { method: "getLogs", filter }) + }); + return params.map((p) => this._wrapLog(p, network)); + }); + } + // ENS + _getProvider(chainId) { + (0, index_js_6.assert)(false, "provider cannot connect to target network", "UNSUPPORTED_OPERATION", { + operation: "_getProvider()" + }); + } + getResolver(name) { + return __awaiter(this, void 0, void 0, function* () { + return yield ens_resolver_js_1.EnsResolver.fromName(this, name); + }); + } + getAvatar(name) { + return __awaiter(this, void 0, void 0, function* () { + const resolver = yield this.getResolver(name); + if (resolver) { + return yield resolver.getAvatar(); + } + return null; + }); + } + resolveName(name) { + return __awaiter(this, void 0, void 0, function* () { + const resolver = yield this.getResolver(name); + if (resolver) { + return yield resolver.getAddress(); + } + return null; + }); + } + lookupAddress(address) { + return __awaiter(this, void 0, void 0, function* () { + address = (0, index_js_1.getAddress)(address); + const node = (0, index_js_4.namehash)(address.substring(2).toLowerCase() + ".addr.reverse"); + try { + const ensAddr = yield ens_resolver_js_1.EnsResolver.getEnsAddress(this); + const ensContract = new index_js_3.Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], this); + const resolver = yield ensContract.resolver(node); + if (resolver == null || resolver === index_js_2.ZeroAddress) { + return null; + } + const resolverContract = new index_js_3.Contract(resolver, [ + "function name(bytes32) view returns (string)" + ], this); + const name = yield resolverContract.name(node); + // Failed forward resolution + const check = yield this.resolveName(name); + if (check !== address) { + return null; + } + return name; + } + catch (error) { + // No data was returned from the resolver + if ((0, index_js_6.isError)(error, "BAD_DATA") && error.value === "0x") { + return null; + } + // Something reerted + if ((0, index_js_6.isError)(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + return null; + }); + } + waitForTransaction(hash, _confirms, timeout) { + return __awaiter(this, void 0, void 0, function* () { + const confirms = (_confirms != null) ? _confirms : 1; + if (confirms === 0) { + return this.getTransactionReceipt(hash); + } + return new Promise((resolve, reject) => __awaiter(this, void 0, void 0, function* () { + let timer = null; + const listener = ((blockNumber) => __awaiter(this, void 0, void 0, function* () { + try { + const receipt = yield this.getTransactionReceipt(hash); + if (receipt != null) { + if (blockNumber - receipt.blockNumber + 1 >= confirms) { + resolve(receipt); + //this.off("block", listener); + if (timer) { + clearTimeout(timer); + timer = null; + } + return; + } + } + } + catch (error) { + console.log("EEE", error); + } + this.once("block", listener); + })); + if (timeout != null) { + timer = setTimeout(() => { + if (timer == null) { + return; + } + timer = null; + this.off("block", listener); + reject((0, index_js_6.makeError)("timeout", "TIMEOUT", { reason: "timeout" })); + }, timeout); + } + listener(yield this.getBlockNumber()); + })); + }); + } + waitForBlock(blockTag) { + return __awaiter(this, void 0, void 0, function* () { + (0, index_js_6.assert)(false, "not implemented yet", "NOT_IMPLEMENTED", { + operation: "waitForBlock" + }); + }); + } + /** + * Clear a timer created using the [[_setTimeout]] method. + */ + _clearTimeout(timerId) { + const timer = __classPrivateFieldGet(this, _AbstractProvider_timers, "f").get(timerId); + if (!timer) { + return; + } + if (timer.timer) { + clearTimeout(timer.timer); + } + __classPrivateFieldGet(this, _AbstractProvider_timers, "f").delete(timerId); + } + /** + * Create a timer that will execute %%func%% after at least %%timeout%% + * (in ms). If %%timeout%% is unspecified, then %%func%% will execute + * in the next event loop. + * + * [Pausing](AbstractProvider-paused) the provider will pause any + * associated timers. + */ + _setTimeout(_func, timeout) { + var _a, _b; + if (timeout == null) { + timeout = 0; + } + const timerId = (__classPrivateFieldSet(this, _AbstractProvider_nextTimer, (_b = __classPrivateFieldGet(this, _AbstractProvider_nextTimer, "f"), _a = _b++, _b), "f"), _a); + const func = () => { + __classPrivateFieldGet(this, _AbstractProvider_timers, "f").delete(timerId); + _func(); + }; + if (this.paused) { + __classPrivateFieldGet(this, _AbstractProvider_timers, "f").set(timerId, { timer: null, func, time: timeout }); + } + else { + const timer = setTimeout(func, timeout); + __classPrivateFieldGet(this, _AbstractProvider_timers, "f").set(timerId, { timer, func, time: getTime() }); + } + return timerId; + } + /** + * Perform %%func%% on each subscriber. + */ + _forEachSubscriber(func) { + for (const sub of __classPrivateFieldGet(this, _AbstractProvider_subs, "f").values()) { + func(sub.subscriber); + } + } + /** + * Sub-classes may override this to customize subscription + * implementations. + */ + _getSubscriber(sub) { + switch (sub.type) { + case "debug": + case "error": + case "network": + return new UnmanagedSubscriber(sub.type); + case "block": { + const subscriber = new subscriber_polling_js_1.PollingBlockSubscriber(this); + subscriber.pollingInterval = this.pollingInterval; + return subscriber; + } + case "safe": + case "finalized": + return new subscriber_polling_js_1.PollingBlockTagSubscriber(this, sub.type); + case "event": + return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); + case "transaction": + return new subscriber_polling_js_1.PollingTransactionSubscriber(this, sub.hash); + case "orphan": + return new subscriber_polling_js_1.PollingOrphanSubscriber(this, sub.filter); + } + throw new Error(`unsupported event: ${sub.type}`); + } + /** + * If a [[Subscriber]] fails and needs to replace itself, this + * method may be used. + * + * For example, this is used for providers when using the + * ``eth_getFilterChanges`` method, which can return null if state + * filters are not supported by the backend, allowing the Subscriber + * to swap in a [[PollingEventSubscriber]]. + */ + _recoverSubscriber(oldSub, newSub) { + for (const sub of __classPrivateFieldGet(this, _AbstractProvider_subs, "f").values()) { + if (sub.subscriber === oldSub) { + if (sub.started) { + sub.subscriber.stop(); + } + sub.subscriber = newSub; + if (sub.started) { + newSub.start(); + } + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") != null) { + newSub.pause(__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f")); + } + break; + } + } + } + on(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getSub).call(this, event); + sub.listeners.push({ listener, once: false }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") != null) { + sub.subscriber.pause(__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f")); + } + } + return this; + }); + } + once(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getSub).call(this, event); + sub.listeners.push({ listener, once: true }); + if (!sub.started) { + sub.subscriber.start(); + sub.started = true; + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") != null) { + sub.subscriber.pause(__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f")); + } + } + return this; + }); + } + emit(event, ...args) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_hasSub).call(this, event, args); + // If there is not subscription or if a recent emit removed + // the last of them (which also deleted the sub) do nothing + if (!sub || sub.listeners.length === 0) { + return false; + } + ; + const count = sub.listeners.length; + sub.listeners = sub.listeners.filter(({ listener, once }) => { + const payload = new index_js_6.EventPayload(this, (once ? null : listener), event); + try { + listener.call(this, ...args, payload); + } + catch (error) { } + return !once; + }); + if (sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + __classPrivateFieldGet(this, _AbstractProvider_subs, "f").delete(sub.tag); + } + return (count > 0); + }); + } + listenerCount(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_hasSub).call(this, event); + if (!sub) { + return 0; + } + return sub.listeners.length; + } + let total = 0; + for (const { listeners } of __classPrivateFieldGet(this, _AbstractProvider_subs, "f").values()) { + total += listeners.length; + } + return total; + }); + } + listeners(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_hasSub).call(this, event); + if (!sub) { + return []; + } + return sub.listeners.map(({ listener }) => listener); + } + let result = []; + for (const { listeners } of __classPrivateFieldGet(this, _AbstractProvider_subs, "f").values()) { + result = result.concat(listeners.map(({ listener }) => listener)); + } + return result; + }); + } + off(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + const sub = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_hasSub).call(this, event); + if (!sub) { + return this; + } + if (listener) { + const index = sub.listeners.map(({ listener }) => listener).indexOf(listener); + if (index >= 0) { + sub.listeners.splice(index, 1); + } + } + if (!listener || sub.listeners.length === 0) { + if (sub.started) { + sub.subscriber.stop(); + } + __classPrivateFieldGet(this, _AbstractProvider_subs, "f").delete(sub.tag); + } + return this; + }); + } + removeAllListeners(event) { + return __awaiter(this, void 0, void 0, function* () { + if (event) { + const { tag, started, subscriber } = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_getSub).call(this, event); + if (started) { + subscriber.stop(); + } + __classPrivateFieldGet(this, _AbstractProvider_subs, "f").delete(tag); + } + else { + for (const [tag, { started, subscriber }] of __classPrivateFieldGet(this, _AbstractProvider_subs, "f")) { + if (started) { + subscriber.stop(); + } + __classPrivateFieldGet(this, _AbstractProvider_subs, "f").delete(tag); + } + } + return this; + }); + } + // Alias for "on" + addListener(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.on(event, listener); + }); + } + // Alias for "off" + removeListener(event, listener) { + return __awaiter(this, void 0, void 0, function* () { + return this.off(event, listener); + }); + } + /** + * If this provider has been destroyed using the [[destroy]] method. + * + * Once destroyed, all resources are reclaimed, internal event loops + * and timers are cleaned up and no further requests may be sent to + * the provider. + */ + get destroyed() { + return __classPrivateFieldGet(this, _AbstractProvider_destroyed, "f"); + } + /** + * Sub-classes may use this to shutdown any sockets or release their + * resources and reject any pending requests. + * + * Sub-classes **must** call ``super.destroy()``. + */ + destroy() { + // Stop all listeners + this.removeAllListeners(); + // Shut down all tiemrs + for (const timerId of __classPrivateFieldGet(this, _AbstractProvider_timers, "f").keys()) { + this._clearTimeout(timerId); + } + __classPrivateFieldSet(this, _AbstractProvider_destroyed, true, "f"); + } + /** + * Whether the provider is currently paused. + * + * A paused provider will not emit any events, and generally should + * not make any requests to the network, but that is up to sub-classes + * to manage. + * + * Setting ``paused = true`` is identical to calling ``.pause(false)``, + * which will buffer any events that occur while paused until the + * provider is unpaused. + */ + get paused() { return (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") != null); } + set paused(pause) { + if (!!pause === this.paused) { + return; + } + if (this.paused) { + this.resume(); + } + else { + this.pause(false); + } + } + /** + * Pause the provider. If %%dropWhilePaused%%, any events that occur + * while paused are dropped, otherwise all events will be emitted once + * the provider is unpaused. + */ + pause(dropWhilePaused) { + __classPrivateFieldSet(this, _AbstractProvider_lastBlockNumber, -1, "f"); + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") != null) { + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") == !!dropWhilePaused) { + return; + } + (0, index_js_6.assert)(false, "cannot change pause type; resume first", "UNSUPPORTED_OPERATION", { + operation: "pause" + }); + } + this._forEachSubscriber((s) => s.pause(dropWhilePaused)); + __classPrivateFieldSet(this, _AbstractProvider_pausedState, !!dropWhilePaused, "f"); + for (const timer of __classPrivateFieldGet(this, _AbstractProvider_timers, "f").values()) { + // Clear the timer + if (timer.timer) { + clearTimeout(timer.timer); + } + // Remaining time needed for when we become unpaused + timer.time = getTime() - timer.time; + } + } + /** + * Resume the provider. + */ + resume() { + if (__classPrivateFieldGet(this, _AbstractProvider_pausedState, "f") == null) { + return; + } + this._forEachSubscriber((s) => s.resume()); + __classPrivateFieldSet(this, _AbstractProvider_pausedState, null, "f"); + for (const timer of __classPrivateFieldGet(this, _AbstractProvider_timers, "f").values()) { + // Remaining time when we were paused + let timeout = timer.time; + if (timeout < 0) { + timeout = 0; + } + // Start time (in cause paused, so we con compute remaininf time) + timer.time = getTime(); + // Start the timer + setTimeout(timer.func, timeout); + } + } +} +exports.AbstractProvider = AbstractProvider; +_AbstractProvider_subs = new WeakMap(), _AbstractProvider_plugins = new WeakMap(), _AbstractProvider_pausedState = new WeakMap(), _AbstractProvider_destroyed = new WeakMap(), _AbstractProvider_networkPromise = new WeakMap(), _AbstractProvider_anyNetwork = new WeakMap(), _AbstractProvider_performCache = new WeakMap(), _AbstractProvider_lastBlockNumber = new WeakMap(), _AbstractProvider_nextTimer = new WeakMap(), _AbstractProvider_timers = new WeakMap(), _AbstractProvider_disableCcipRead = new WeakMap(), _AbstractProvider_options = new WeakMap(), _AbstractProvider_instances = new WeakSet(), _AbstractProvider_perform = function _AbstractProvider_perform(req) { + return __awaiter(this, void 0, void 0, function* () { + const timeout = __classPrivateFieldGet(this, _AbstractProvider_options, "f").cacheTimeout; + // Caching disabled + if (timeout < 0) { + return yield this._perform(req); + } + // Create a tag + const tag = getTag(req.method, req); + let perform = __classPrivateFieldGet(this, _AbstractProvider_performCache, "f").get(tag); + if (!perform) { + perform = this._perform(req); + __classPrivateFieldGet(this, _AbstractProvider_performCache, "f").set(tag, perform); + setTimeout(() => { + if (__classPrivateFieldGet(this, _AbstractProvider_performCache, "f").get(tag) === perform) { + __classPrivateFieldGet(this, _AbstractProvider_performCache, "f").delete(tag); + } + }, timeout); + } + return yield perform; + }); +}, _AbstractProvider_call = function _AbstractProvider_call(tx, blockTag, attempt) { + return __awaiter(this, void 0, void 0, function* () { + (0, index_js_6.assert)(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", { + reason: "TOO_MANY_REDIRECTS", + transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true }) + }); + // This came in as a PerformActionTransaction, so to/from are safe; we can cast + const transaction = (0, provider_js_1.copyRequest)(tx); + try { + return (0, index_js_6.hexlify)(yield this._perform({ method: "call", transaction, blockTag })); + } + catch (error) { + // CCIP Read OffchainLookup + if (!this.disableCcipRead && (0, index_js_6.isCallException)(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && (0, index_js_6.dataSlice)(error.data, 0, 4) === "0x556f1830") { + const data = error.data; + const txSender = yield (0, index_js_1.resolveAddress)(transaction.to, this); + // Parse the CCIP Read Arguments + let ccipArgs; + try { + ccipArgs = parseOffchainLookup((0, index_js_6.dataSlice)(error.data, 4)); + } + catch (error) { + (0, index_js_6.assert)(false, error.message, "OFFCHAIN_FAULT", { + reason: "BAD_DATA", transaction, info: { data } + }); + } + // Check the sender of the OffchainLookup matches the transaction + (0, index_js_6.assert)(ccipArgs.sender.toLowerCase() === txSender.toLowerCase(), "CCIP Read sender mismatch", "CALL_EXCEPTION", { + action: "call", + data, + reason: "OffchainLookup", + transaction: transaction, + invocation: null, + revert: { + signature: "OffchainLookup(address,string[],bytes,bytes4,bytes)", + name: "OffchainLookup", + args: ccipArgs.errorArgs + } + }); + const ccipResult = yield this.ccipReadFetch(transaction, ccipArgs.calldata, ccipArgs.urls); + (0, index_js_6.assert)(ccipResult != null, "CCIP Read failed to fetch data", "OFFCHAIN_FAULT", { + reason: "FETCH_FAILED", transaction, info: { data: error.data, errorArgs: ccipArgs.errorArgs } + }); + const tx = { + to: txSender, + data: (0, index_js_6.concat)([ccipArgs.selector, encodeBytes([ccipResult, ccipArgs.extraData])]) + }; + this.emit("debug", { action: "sendCcipReadCall", transaction: tx }); + try { + const result = yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_call).call(this, tx, blockTag, attempt + 1); + this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx), result }); + return result; + } + catch (error) { + this.emit("debug", { action: "receiveCcipReadCallError", transaction: Object.assign({}, tx), error }); + throw error; + } + } + throw error; + } + }); +}, _AbstractProvider_checkNetwork = function _AbstractProvider_checkNetwork(promise) { + return __awaiter(this, void 0, void 0, function* () { + const { value } = yield (0, index_js_6.resolveProperties)({ + network: this.getNetwork(), + value: promise + }); + return value; + }); +}, _AbstractProvider_getAccountValue = function _AbstractProvider_getAccountValue(request, _address, _blockTag) { + return __awaiter(this, void 0, void 0, function* () { + let address = this._getAddress(_address); + let blockTag = this._getBlockTag(_blockTag); + if (typeof (address) !== "string" || typeof (blockTag) !== "string") { + [address, blockTag] = yield Promise.all([address, blockTag]); + } + return yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_checkNetwork).call(this, __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, Object.assign(request, { address, blockTag }))); + }); +}, _AbstractProvider_getBlock = function _AbstractProvider_getBlock(block, includeTransactions) { + return __awaiter(this, void 0, void 0, function* () { + // @TODO: Add CustomBlockPlugin check + if ((0, index_js_6.isHexString)(block, 32)) { + return yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { + method: "getBlock", blockHash: block, includeTransactions + }); + } + let blockTag = this._getBlockTag(block); + if (typeof (blockTag) !== "string") { + blockTag = yield blockTag; + } + return yield __classPrivateFieldGet(this, _AbstractProvider_instances, "m", _AbstractProvider_perform).call(this, { + method: "getBlock", blockTag, includeTransactions + }); + }); +}, _AbstractProvider_hasSub = function _AbstractProvider_hasSub(event, emitArgs) { + return __awaiter(this, void 0, void 0, function* () { + let sub = yield getSubscription(event, this); + // This is a log that is removing an existing log; we actually want + // to emit an orphan event for the removed log + if (sub.type === "event" && emitArgs && emitArgs.length > 0 && emitArgs[0].removed === true) { + sub = yield getSubscription({ orphan: "drop-log", log: emitArgs[0] }, this); + } + return __classPrivateFieldGet(this, _AbstractProvider_subs, "f").get(sub.tag) || null; + }); +}, _AbstractProvider_getSub = function _AbstractProvider_getSub(event) { + return __awaiter(this, void 0, void 0, function* () { + const subscription = yield getSubscription(event, this); + // Prevent tampering with our tag in any subclass' _getSubscriber + const tag = subscription.tag; + let sub = __classPrivateFieldGet(this, _AbstractProvider_subs, "f").get(tag); + if (!sub) { + const subscriber = this._getSubscriber(subscription); + const addressableMap = new WeakMap(); + const nameMap = new Map(); + sub = { subscriber, tag, addressableMap, nameMap, started: false, listeners: [] }; + __classPrivateFieldGet(this, _AbstractProvider_subs, "f").set(tag, sub); + } + return sub; + }); +}; +function _parseString(result, start) { + try { + const bytes = _parseBytes(result, start); + if (bytes) { + return (0, index_js_6.toUtf8String)(bytes); + } + } + catch (error) { } + return null; +} +function _parseBytes(result, start) { + if (result === "0x") { + return null; + } + try { + const offset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, start, start + 32)); + const length = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(result, offset, offset + 32)); + return (0, index_js_6.dataSlice)(result, offset + 32, offset + 32 + length); + } + catch (error) { } + return null; +} +function numPad(value) { + const result = (0, index_js_6.toBeArray)(value); + if (result.length > 32) { + throw new Error("internal; should not happen"); + } + const padded = new Uint8Array(32); + padded.set(result, 32 - result.length); + return padded; +} +function bytesPad(value) { + if ((value.length % 32) === 0) { + return value; + } + const result = new Uint8Array(Math.ceil(value.length / 32) * 32); + result.set(value); + return result; +} +const empty = new Uint8Array([]); +// ABI Encodes a series of (bytes, bytes, ...) +function encodeBytes(datas) { + const result = []; + let byteCount = 0; + // Add place-holders for pointers as we add items + for (let i = 0; i < datas.length; i++) { + result.push(empty); + byteCount += 32; + } + for (let i = 0; i < datas.length; i++) { + const data = (0, index_js_6.getBytes)(datas[i]); + // Update the bytes offset + result[i] = numPad(byteCount); + // The length and padded value of data + result.push(numPad(data.length)); + result.push(bytesPad(data)); + byteCount += 32 + Math.ceil(data.length / 32) * 32; + } + return (0, index_js_6.concat)(result); +} +const zeros = "0x0000000000000000000000000000000000000000000000000000000000000000"; +function parseOffchainLookup(data) { + const result = { + sender: "", urls: [], calldata: "", selector: "", extraData: "", errorArgs: [] + }; + (0, index_js_6.assert)((0, index_js_6.dataLength)(data) >= 5 * 32, "insufficient OffchainLookup data", "OFFCHAIN_FAULT", { + reason: "insufficient OffchainLookup data" + }); + const sender = (0, index_js_6.dataSlice)(data, 0, 32); + (0, index_js_6.assert)((0, index_js_6.dataSlice)(sender, 0, 12) === (0, index_js_6.dataSlice)(zeros, 0, 12), "corrupt OffchainLookup sender", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup sender" + }); + result.sender = (0, index_js_6.dataSlice)(sender, 12); + // Read the URLs from the response + try { + const urls = []; + const urlsOffset = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, 32, 64)); + const urlsLength = (0, index_js_6.getNumber)((0, index_js_6.dataSlice)(data, urlsOffset, urlsOffset + 32)); + const urlsData = (0, index_js_6.dataSlice)(data, urlsOffset + 32); + for (let u = 0; u < urlsLength; u++) { + const url = _parseString(urlsData, u * 32); + if (url == null) { + throw new Error("abort"); + } + urls.push(url); + } + result.urls = urls; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup urls", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup urls" + }); + } + // Get the CCIP calldata to forward + try { + const calldata = _parseBytes(data, 64); + if (calldata == null) { + throw new Error("abort"); + } + result.calldata = calldata; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup calldata", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup calldata" + }); + } + // Get the callbackSelector (bytes4) + (0, index_js_6.assert)((0, index_js_6.dataSlice)(data, 100, 128) === (0, index_js_6.dataSlice)(zeros, 0, 28), "corrupt OffchainLookup callbaackSelector", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup callbaackSelector" + }); + result.selector = (0, index_js_6.dataSlice)(data, 96, 100); + // Get the extra data to send back to the contract as context + try { + const extraData = _parseBytes(data, 128); + if (extraData == null) { + throw new Error("abort"); + } + result.extraData = extraData; + } + catch (error) { + (0, index_js_6.assert)(false, "corrupt OffchainLookup extraData", "OFFCHAIN_FAULT", { + reason: "corrupt OffchainLookup extraData" + }); + } + result.errorArgs = "sender,urls,calldata,selector,extraData".split(/,/).map((k) => result[k]); + return result; +} +//# sourceMappingURL=abstract-provider.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-provider.js.map b/dist/ethers.js/src.ts/providers/abstract-provider.js.map new file mode 100644 index 0000000..6e44c8c --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-provider.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/abstract-provider.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,QAAQ;AACR,oBAAoB;AACpB,4EAA4E;AAC5E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,2EAA2E;AAE3E,kDAAiE;AACjE,oDAAoD;AACpD,mDAAgD;AAChD,+CAA4C;AAC5C,sDAAsD;AACtD,gDAQ2B;AAE3B,uDAAgD;AAChD,2CAEqB;AACrB,6CAAuC;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AC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-signer.d.ts b/dist/ethers.js/src.ts/providers/abstract-signer.d.ts new file mode 100644 index 0000000..d701941 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-signer.d.ts @@ -0,0 +1,67 @@ +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +export declare abstract class AbstractSigner

implements Signer { + /** + * The provider this signer is connected to. + */ + readonly provider: P; + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider?: P); + /** + * Resolves to the Signer address. + */ + abstract getAddress(): Promise; + /** + * Returns the signer connected to %%provider%%. + * + * This may throw, for example, a Signer connected over a Socket or + * to a specific instance of a node may not be transferrable. + */ + abstract connect(provider: null | Provider): Signer; + getNonce(blockTag?: BlockTag): Promise; + populateCall(tx: TransactionRequest): Promise>; + populateTransaction(tx: TransactionRequest): Promise>; + estimateGas(tx: TransactionRequest): Promise; + call(tx: TransactionRequest): Promise; + resolveName(name: string): Promise; + sendTransaction(tx: TransactionRequest): Promise; + abstract signTransaction(tx: TransactionRequest): Promise; + abstract signMessage(message: string | Uint8Array): Promise; + abstract signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +export declare class VoidSigner extends AbstractSigner { + #private; + /** + * The signer address. + */ + readonly address: string; + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address: string, provider?: null | Provider); + getAddress(): Promise; + connect(provider: null | Provider): VoidSigner; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=abstract-signer.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-signer.d.ts.map b/dist/ethers.js/src.ts/providers/abstract-signer.d.ts.map new file mode 100644 index 0000000..9d1601f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/abstract-signer.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA+B1C;;;;;GAKG;AACH,8BAAsB,cAAc,CAAC,CAAC,SAAS,IAAI,GAAG,QAAQ,GAAG,IAAI,GAAG,QAAQ,CAAE,YAAW,MAAM;IAC/F;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,CAAC,CAAC;IAEtB;;OAEG;gBACS,QAAQ,CAAC,EAAE,CAAC;IAIxB;;OAEG;IACH,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAEtC;;;;;OAKG;IACH,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAE7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAI9C,YAAY,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAKtE,mBAAmB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E,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAG1I"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-signer.js b/dist/ethers.js/src.ts/providers/abstract-signer.js new file mode 100644 index 0000000..90f962e --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-signer.js @@ -0,0 +1,260 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _VoidSigner_instances, _VoidSigner_throwUnsupported; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.VoidSigner = exports.AbstractSigner = void 0; +/** + * Generally the [[Wallet]] and [[JsonRpcSigner]] and their sub-classes + * are sufficent for most developers, but this is provided to + * fascilitate more complex Signers. + * + * @_section: api/providers/abstract-signer: Subclassing Signer [abstract-signer] + */ +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../transaction/index.js"); +const index_js_3 = require("../utils/index.js"); +const provider_js_1 = require("./provider.js"); +function checkProvider(signer, operation) { + if (signer.provider) { + return signer.provider; + } + (0, index_js_3.assert)(false, "missing provider", "UNSUPPORTED_OPERATION", { operation }); +} +function populate(signer, tx) { + return __awaiter(this, void 0, void 0, function* () { + let pop = (0, provider_js_1.copyRequest)(tx); + if (pop.to != null) { + pop.to = (0, index_js_1.resolveAddress)(pop.to, signer); + } + if (pop.from != null) { + const from = pop.from; + pop.from = Promise.all([ + signer.getAddress(), + (0, index_js_1.resolveAddress)(from, signer) + ]).then(([address, from]) => { + (0, index_js_3.assertArgument)(address.toLowerCase() === from.toLowerCase(), "transaction from mismatch", "tx.from", from); + return address; + }); + } + else { + pop.from = signer.getAddress(); + } + return yield (0, index_js_3.resolveProperties)(pop); + }); +} +/** + * An **AbstractSigner** includes most of teh functionality required + * to get a [[Signer]] working as expected, but requires a few + * Signer-specific methods be overridden. + * + */ +class AbstractSigner { + /** + * Creates a new Signer connected to %%provider%%. + */ + constructor(provider) { + (0, index_js_3.defineProperties)(this, { provider: (provider || null) }); + } + getNonce(blockTag) { + return __awaiter(this, void 0, void 0, function* () { + return checkProvider(this, "getTransactionCount").getTransactionCount(yield this.getAddress(), blockTag); + }); + } + populateCall(tx) { + return __awaiter(this, void 0, void 0, function* () { + const pop = yield populate(this, tx); + return pop; + }); + } + populateTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + const provider = checkProvider(this, "populateTransaction"); + const pop = yield populate(this, tx); + if (pop.nonce == null) { + pop.nonce = yield this.getNonce("pending"); + } + if (pop.gasLimit == null) { + pop.gasLimit = yield this.estimateGas(pop); + } + // Populate the chain ID + const network = yield (this.provider).getNetwork(); + if (pop.chainId != null) { + const chainId = (0, index_js_3.getBigInt)(pop.chainId); + (0, index_js_3.assertArgument)(chainId === network.chainId, "transaction chainId mismatch", "tx.chainId", tx.chainId); + } + else { + pop.chainId = network.chainId; + } + // Do not allow mixing pre-eip-1559 and eip-1559 properties + const hasEip1559 = (pop.maxFeePerGas != null || pop.maxPriorityFeePerGas != null); + if (pop.gasPrice != null && (pop.type === 2 || hasEip1559)) { + (0, index_js_3.assertArgument)(false, "eip-1559 transaction do not support gasPrice", "tx", tx); + } + else if ((pop.type === 0 || pop.type === 1) && hasEip1559) { + (0, index_js_3.assertArgument)(false, "pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas", "tx", tx); + } + if ((pop.type === 2 || pop.type == null) && (pop.maxFeePerGas != null && pop.maxPriorityFeePerGas != null)) { + // Fully-formed EIP-1559 transaction (skip getFeeData) + pop.type = 2; + } + else if (pop.type === 0 || pop.type === 1) { + // Explicit Legacy or EIP-2930 transaction + // We need to get fee data to determine things + const feeData = yield provider.getFeeData(); + (0, index_js_3.assert)(feeData.gasPrice != null, "network does not support gasPrice", "UNSUPPORTED_OPERATION", { + operation: "getGasPrice" + }); + // Populate missing gasPrice + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + } + else { + // We need to get fee data to determine things + const feeData = yield provider.getFeeData(); + if (pop.type == null) { + // We need to auto-detect the intended type of this transaction... + if (feeData.maxFeePerGas != null && feeData.maxPriorityFeePerGas != null) { + // The network supports EIP-1559! + // Upgrade transaction from null to eip-1559 + pop.type = 2; + if (pop.gasPrice != null) { + // Using legacy gasPrice property on an eip-1559 network, + // so use gasPrice as both fee properties + const gasPrice = pop.gasPrice; + delete pop.gasPrice; + pop.maxFeePerGas = gasPrice; + pop.maxPriorityFeePerGas = gasPrice; + } + else { + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + else if (feeData.gasPrice != null) { + // Network doesn't support EIP-1559... + // ...but they are trying to use EIP-1559 properties + (0, index_js_3.assert)(!hasEip1559, "network does not support EIP-1559", "UNSUPPORTED_OPERATION", { + operation: "populateTransaction" + }); + // Populate missing fee data + if (pop.gasPrice == null) { + pop.gasPrice = feeData.gasPrice; + } + // Explicitly set untyped transaction to legacy + // @TODO: Maybe this shold allow type 1? + pop.type = 0; + } + else { + // getFeeData has failed us. + (0, index_js_3.assert)(false, "failed to get consistent fee data", "UNSUPPORTED_OPERATION", { + operation: "signer.getFeeData" + }); + } + } + else if (pop.type === 2) { + // Explicitly using EIP-1559 + // Populate missing fee data + if (pop.maxFeePerGas == null) { + pop.maxFeePerGas = feeData.maxFeePerGas; + } + if (pop.maxPriorityFeePerGas == null) { + pop.maxPriorityFeePerGas = feeData.maxPriorityFeePerGas; + } + } + } + //@TOOD: Don't await all over the place; save them up for + // the end for better batching + return yield (0, index_js_3.resolveProperties)(pop); + }); + } + estimateGas(tx) { + return __awaiter(this, void 0, void 0, function* () { + return checkProvider(this, "estimateGas").estimateGas(yield this.populateCall(tx)); + }); + } + call(tx) { + return __awaiter(this, void 0, void 0, function* () { + return checkProvider(this, "call").call(yield this.populateCall(tx)); + }); + } + resolveName(name) { + return __awaiter(this, void 0, void 0, function* () { + const provider = checkProvider(this, "resolveName"); + return yield provider.resolveName(name); + }); + } + sendTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + const provider = checkProvider(this, "sendTransaction"); + const pop = yield this.populateTransaction(tx); + delete pop.from; + const txObj = index_js_2.Transaction.from(pop); + return yield provider.broadcastTransaction(yield this.signTransaction(txObj)); + }); + } +} +exports.AbstractSigner = AbstractSigner; +/** + * A **VoidSigner** is a class deisgned to allow an address to be used + * in any API which accepts a Signer, but for which there are no + * credentials available to perform any actual signing. + * + * This for example allow impersonating an account for the purpose of + * static calls or estimating gas, but does not allow sending transactions. + */ +class VoidSigner extends AbstractSigner { + /** + * Creates a new **VoidSigner** with %%address%% attached to + * %%provider%%. + */ + constructor(address, provider) { + super(provider); + _VoidSigner_instances.add(this); + (0, index_js_3.defineProperties)(this, { address }); + } + getAddress() { + return __awaiter(this, void 0, void 0, function* () { return this.address; }); + } + connect(provider) { + return new VoidSigner(this.address, provider); + } + signTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + __classPrivateFieldGet(this, _VoidSigner_instances, "m", _VoidSigner_throwUnsupported).call(this, "transactions", "signTransaction"); + }); + } + signMessage(message) { + return __awaiter(this, void 0, void 0, function* () { + __classPrivateFieldGet(this, _VoidSigner_instances, "m", _VoidSigner_throwUnsupported).call(this, "messages", "signMessage"); + }); + } + signTypedData(domain, types, value) { + return __awaiter(this, void 0, void 0, function* () { + __classPrivateFieldGet(this, _VoidSigner_instances, "m", _VoidSigner_throwUnsupported).call(this, "typed-data", "signTypedData"); + }); + } +} +exports.VoidSigner = VoidSigner; +_VoidSigner_instances = new WeakSet(), _VoidSigner_throwUnsupported = function _VoidSigner_throwUnsupported(suffix, operation) { + (0, index_js_3.assert)(false, `VoidSigner cannot sign ${suffix}`, "UNSUPPORTED_OPERATION", { operation }); +}; +//# sourceMappingURL=abstract-signer.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/abstract-signer.js.map b/dist/ethers.js/src.ts/providers/abstract-signer.js.map new file mode 100644 index 0000000..28946bb --- /dev/null +++ b/dist/ethers.js/src.ts/providers/abstract-signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"abstract-signer.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/abstract-signer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,kDAAqD;AACrD,sDAAsD;AACtD,gDAG2B;AAE3B,+CAA4C;AAW5C,SAAS,aAAa,CAAC,MAAsB,EAAE,SAAiB;IAC5D,IAAI,MAAM,CAAC,QAAQ,EAAE;QAAE,OAAO,MAAM,CAAC,QAAQ,CAAC;KAAE;IAChD,IAAA,iBAAM,EAAC,KAAK,EAAE,kBAAkB,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,SAAe,QAAQ,CAAC,MAAsB,EAAE,EAAsB;;QAClE,IAAI,GAAG,GAAQ,IAAA,yBAAW,EAAC,EAAE,CAAC,CAAC;QAE/B,IAAI,GAAG,CAAC,EAAE,IAAI,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ACH,MAAa,UAAW,SAAQ,cAAc;IAM1C;;;OAGG;IACH,YAAY,OAAe,EAAE,QAA0B;QACnD,KAAK,CAAC,QAAQ,CAAC,CAAC;;QAChB,IAAA,2BAAgB,EAAa,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAEK,UAAU;8DAAsB,OAAO,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;KAAA;IAE5D,OAAO,CAAC,QAAyB;QAC7B,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;IAMK,eAAe,CAAC,EAAsB;;YACxC,uBAAA,IAAI,2DAAkB,MAAtB,IAAI,EAAmB,cAAc,EAAE,iBAAiB,CAAC,CAAC;QAC9D,CAAC;KAAA;IAEK,WAAW,CAAC,OAA4B;;YAC1C,uBAAA,IAAI,2DAAkB,MAAtB,IAAI,EAAmB,UAAU,EAAE,aAAa,CAAC,CAAC;QACtD,CAAC;KAAA;IAEK,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;;YACjH,uBAAA,IAAI,2DAAkB,MAAtB,IAAI,EAAmB,YAAY,EAAE,eAAe,CAAC,CAAC;QAC1D,CAAC;KAAA;CACJ;AApCD,gCAoCC;4GAfqB,MAAc,EAAE,SAAiB;IAC/C,IAAA,iBAAM,EAAC,KAAK,EAAE,0BAA2B,MAAO,EAAE,EAAE,uBAAuB,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;AAChG,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/community.d.ts b/dist/ethers.js/src.ts/providers/community.d.ts new file mode 100644 index 0000000..f9ee493 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/community.d.ts @@ -0,0 +1,29 @@ +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +/** + * Providers which offer community credentials should extend this + * to notify any interested consumers whether community credentials + * are in-use. + */ +export interface CommunityResourcable { + /** + * Returns true of the instance is connected using the community + * credentials. + */ + isCommunityResource(): boolean; +} +/** + * Displays a warning in tht console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +export declare function showThrottleMessage(service: string): void; +//# sourceMappingURL=community.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/community.d.ts.map b/dist/ethers.js/src.ts/providers/community.d.ts.map new file mode 100644 index 0000000..52c2c56 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/community.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"community.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/community.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACjC;;;OAGG;IACH,mBAAmB,IAAI,OAAO,CAAC;CAClC;AAKD;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAgBzD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/community.js b/dist/ethers.js/src.ts/providers/community.js new file mode 100644 index 0000000..be4e02d --- /dev/null +++ b/dist/ethers.js/src.ts/providers/community.js @@ -0,0 +1,40 @@ +"use strict"; +/** + * There are many awesome community services that provide Ethereum + * nodes both for developers just starting out and for large-scale + * communities. + * + * @_section: api/providers/thirdparty: Community Providers [thirdparty] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.showThrottleMessage = void 0; +// Show the throttle message only once per service +const shown = new Set(); +/** + * Displays a warning in tht console when the community resource is + * being used too heavily by the app, recommending the developer + * acquire their own credentials instead of using the community + * credentials. + * + * The notification will only occur once per service. + */ +function showThrottleMessage(service) { + if (shown.has(service)) { + return; + } + shown.add(service); + console.log("========= NOTICE ========="); + console.log(`Request-Rate Exceeded for ${service} (this message will not be repeated)`); + console.log(""); + console.log("The default API keys for each service are provided as a highly-throttled,"); + console.log("community resource for low-traffic projects and early prototyping."); + console.log(""); + console.log("While your application will continue to function, we highly recommended"); + console.log("signing up for your own API keys to improve performance, increase your"); + console.log("request rate/limit and enable other perks, such as metrics and advanced APIs."); + console.log(""); + console.log("For more details: https:/\/docs.ethers.org/api-keys/"); + console.log("=========================="); +} +exports.showThrottleMessage = showThrottleMessage; +//# sourceMappingURL=community.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/community.js.map b/dist/ethers.js/src.ts/providers/community.js.map new file mode 100644 index 0000000..a708aac --- /dev/null +++ b/dist/ethers.js/src.ts/providers/community.js.map @@ -0,0 +1 @@ +{"version":3,"file":"community.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/community.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAeH,kDAAkD;AAClD,MAAM,KAAK,GAAgB,IAAI,GAAG,EAAE,CAAC;AAErC;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,OAAe;IAC/C,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;QAAE,OAAO;KAAE;IACnC,KAAK,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IAEnB,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAA;IACzC,OAAO,CAAC,GAAG,CAAC,6BAA8B,OAAQ,sCAAsC,CAAC,CAAC;IAC1F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,2EAA2E,CAAC,CAAC;IACzF,OAAO,CAAC,GAAG,CAAC,oEAAoE,CAAC,CAAC;IAClF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,yEAAyE,CAAC,CAAC;IACvF,OAAO,CAAC,GAAG,CAAC,wEAAwE,CAAC,CAAC;IACtF,OAAO,CAAC,GAAG,CAAC,+EAA+E,CAAC,CAAC;IAC7F,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAChB,OAAO,CAAC,GAAG,CAAC,sDAAsD,CAAC,CAAC;IACpE,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC9C,CAAC;AAhBD,kDAgBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/contracts.d.ts b/dist/ethers.js/src.ts/providers/contracts.d.ts new file mode 100644 index 0000000..e5f1d42 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/contracts.d.ts @@ -0,0 +1,36 @@ +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A **ContractRunner** is a generic interface which defines an object + * capable of interacting with a Contract on the network. + * + * The more operations supported, the more utility it is capable of. + * + * The most common ContractRunners are [Providers](Provider) which enable + * read-only access and [Signers](Signer) which enable write-access. + */ +export interface ContractRunner { + /** + * The provider used for necessary state querying operations. + * + * This can also point to the **ContractRunner** itself, in the + * case of an [[AbstractProvider]]. + */ + provider: null | Provider; + /** + * Required to estimate gas. + */ + estimateGas?: (tx: TransactionRequest) => Promise; + /** + * Required for pure, view or static calls to contracts. + */ + call?: (tx: TransactionRequest) => Promise; + /** + * Required to support ENS names + */ + resolveName?: (name: string) => Promise; + /** + * Required for state mutating calls + */ + sendTransaction?: (tx: TransactionRequest) => Promise; +} +//# sourceMappingURL=contracts.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/contracts.d.ts.map b/dist/ethers.js/src.ts/providers/contracts.d.ts.map new file mode 100644 index 0000000..e960db1 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/contracts.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/contracts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EACpD,MAAM,eAAe,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B;;;;;OAKG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1D;;OAEG;IACH,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAEnD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC,CAAC;IAEvD;;OAEG;IACH,eAAe,CAAC,EAAE,CAAC,EAAE,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CAC9E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/contracts.js b/dist/ethers.js/src.ts/providers/contracts.js new file mode 100644 index 0000000..705cd38 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/contracts.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=contracts.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/contracts.js.map b/dist/ethers.js/src.ts/providers/contracts.js.map new file mode 100644 index 0000000..9b54cc3 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/contracts.js.map @@ -0,0 +1 @@ +{"version":3,"file":"contracts.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/contracts.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/default-provider.d.ts b/dist/ethers.js/src.ts/providers/default-provider.d.ts new file mode 100644 index 0000000..d7c1e13 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/default-provider.d.ts @@ -0,0 +1,48 @@ +import type { AbstractProvider } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import { WebSocketLike } from "./provider-websocket.js"; +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +export declare function getDefaultProvider(network: string | Networkish | WebSocketLike, options?: any): AbstractProvider; +//# sourceMappingURL=default-provider.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/default-provider.d.ts.map b/dist/ethers.js/src.ts/providers/default-provider.d.ts.map new file mode 100644 index 0000000..146ffab --- /dev/null +++ b/dist/ethers.js/src.ts/providers/default-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/default-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AASxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,aAAa,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,gBAAgB,CAkHhH"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/default-provider.js b/dist/ethers.js/src.ts/providers/default-provider.js new file mode 100644 index 0000000..142ba7c --- /dev/null +++ b/dist/ethers.js/src.ts/providers/default-provider.js @@ -0,0 +1,181 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getDefaultProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const provider_ankr_js_1 = require("./provider-ankr.js"); +const provider_alchemy_js_1 = require("./provider-alchemy.js"); +const provider_cloudflare_js_1 = require("./provider-cloudflare.js"); +const provider_etherscan_js_1 = require("./provider-etherscan.js"); +const provider_infura_js_1 = require("./provider-infura.js"); +//import { PocketProvider } from "./provider-pocket.js"; +const provider_quicknode_js_1 = require("./provider-quicknode.js"); +const provider_fallback_js_1 = require("./provider-fallback.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const network_js_1 = require("./network.js"); +const provider_websocket_js_1 = require("./provider-websocket.js"); +function isWebSocketLike(value) { + return (value && typeof (value.send) === "function" && + typeof (value.close) === "function"); +} +const Testnets = "goerli kovan sepolia classicKotti optimism-goerli arbitrum-goerli matic-mumbai bnbt".split(" "); +/** + * Returns a default provider for %%network%%. + * + * If %%network%% is a [[WebSocketLike]] or string that begins with + * ``"ws:"`` or ``"wss:"``, a [[WebSocketProvider]] is returned backed + * by that WebSocket or URL. + * + * If %%network%% is a string that begins with ``"HTTP:"`` or ``"HTTPS:"``, + * a [[JsonRpcProvider]] is returned connected to that URL. + * + * Otherwise, a default provider is created backed by well-known public + * Web3 backends (such as [[link-infura]]) using community-provided API + * keys. + * + * The %%options%% allows specifying custom API keys per backend (setting + * an API key to ``"-"`` will omit that provider) and ``options.exclusive`` + * can be set to either a backend name or and array of backend names, which + * will whitelist **only** those backends. + * + * Current backend strings supported are: + * - ``"alchemy"`` + * - ``"ankr"`` + * - ``"cloudflare"`` + * - ``"etherscan"`` + * - ``"infura"`` + * - ``"publicPolygon"`` + * - ``"quicknode"`` + * + * @example: + * // Connect to a local Geth node + * provider = getDefaultProvider("http://localhost:8545/"); + * + * // Connect to Ethereum mainnet with any current and future + * // third-party services available + * provider = getDefaultProvider("mainnet"); + * + * // Connect to Polygon, but only allow Etherscan and + * // INFURA and use "MY_API_KEY" in calls to Etherscan. + * provider = getDefaultProvider("matic", { + * etherscan: "MY_API_KEY", + * exclusive: [ "etherscan", "infura" ] + * }); + */ +function getDefaultProvider(network, options) { + if (options == null) { + options = {}; + } + const allowService = (name) => { + if (options[name] === "-") { + return false; + } + if (typeof (options.exclusive) === "string") { + return (name === options.exclusive); + } + if (Array.isArray(options.exclusive)) { + return (options.exclusive.indexOf(name) !== -1); + } + return true; + }; + if (typeof (network) === "string" && network.match(/^https?:/)) { + return new provider_jsonrpc_js_1.JsonRpcProvider(network); + } + if (typeof (network) === "string" && network.match(/^wss?:/) || isWebSocketLike(network)) { + return new provider_websocket_js_1.WebSocketProvider(network); + } + // Get the network and name, if possible + let staticNetwork = null; + try { + staticNetwork = network_js_1.Network.from(network); + } + catch (error) { } + const providers = []; + if (allowService("publicPolygon") && staticNetwork) { + if (staticNetwork.name === "matic") { + providers.push(new provider_jsonrpc_js_1.JsonRpcProvider("https:/\/polygon-rpc.com/", staticNetwork, { staticNetwork })); + } + } + if (allowService("alchemy")) { + try { + providers.push(new provider_alchemy_js_1.AlchemyProvider(network, options.alchemy)); + } + catch (error) { } + } + if (allowService("ankr") && options.ankr != null) { + try { + providers.push(new provider_ankr_js_1.AnkrProvider(network, options.ankr)); + } + catch (error) { } + } + if (allowService("cloudflare")) { + try { + providers.push(new provider_cloudflare_js_1.CloudflareProvider(network)); + } + catch (error) { } + } + if (allowService("etherscan")) { + try { + providers.push(new provider_etherscan_js_1.EtherscanProvider(network, options.etherscan)); + } + catch (error) { } + } + if (allowService("infura")) { + try { + let projectId = options.infura; + let projectSecret = undefined; + if (typeof (projectId) === "object") { + projectSecret = projectId.projectSecret; + projectId = projectId.projectId; + } + providers.push(new provider_infura_js_1.InfuraProvider(network, projectId, projectSecret)); + } + catch (error) { } + } + /* + if (options.pocket !== "-") { + try { + let appId = options.pocket; + let secretKey: undefined | string = undefined; + let loadBalancer: undefined | boolean = undefined; + if (typeof(appId) === "object") { + loadBalancer = !!appId.loadBalancer; + secretKey = appId.secretKey; + appId = appId.appId; + } + providers.push(new PocketProvider(network, appId, secretKey, loadBalancer)); + } catch (error) { console.log(error); } + } + */ + if (allowService("quicknode")) { + try { + let token = options.quicknode; + providers.push(new provider_quicknode_js_1.QuickNodeProvider(network, token)); + } + catch (error) { } + } + (0, index_js_1.assert)(providers.length, "unsupported default network", "UNSUPPORTED_OPERATION", { + operation: "getDefaultProvider" + }); + // No need for a FallbackProvider + if (providers.length === 1) { + return providers[0]; + } + // We use the floor because public third-party providers can be unreliable, + // so a low number of providers with a large quorum will fail too often + let quorum = Math.floor(providers.length / 2); + if (quorum > 2) { + quorum = 2; + } + // Testnets don't need as strong a security gaurantee and speed is + // more useful during testing + if (staticNetwork && Testnets.indexOf(staticNetwork.name) !== -1) { + quorum = 1; + } + // Provided override qorum takes priority + if (options && options.quorum) { + quorum = options.quorum; + } + return new provider_fallback_js_1.FallbackProvider(providers, undefined, { quorum }); +} +exports.getDefaultProvider = getDefaultProvider; +//# sourceMappingURL=default-provider.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/default-provider.js.map b/dist/ethers.js/src.ts/providers/default-provider.js.map new file mode 100644 index 0000000..f9bfa82 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/default-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"default-provider.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/default-provider.ts"],"names":[],"mappings":";;;AAC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M,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,CAAC,CAAC;KAAE;IAE/B,kEAAkE;IAClE,6BAA6B;IAC7B,IAAI,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;QAAE,MAAM,GAAG,CAAC,CAAC;KAAE;IAEjF,yCAAyC;IACzC,IAAI,OAAO,IAAI,OAAO,CAAC,MAAM,EAAE;QAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;KAAE;IAE3D,OAAO,IAAI,uCAAgB,CAAC,SAAS,EAAE,SAAS,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;AAClE,CAAC;AAlHD,gDAkHC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ens-resolver.d.ts b/dist/ethers.js/src.ts/providers/ens-resolver.d.ts new file mode 100644 index 0000000..7019a6f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ens-resolver.d.ts @@ -0,0 +1,147 @@ +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +import type { BytesLike } from "../utils/index.js"; +import type { AbstractProvider, AbstractProviderPlugin } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * The type of data found during a steip during avatar resolution. + */ +export type AvatarLinkageType = "name" | "avatar" | "!avatar" | "url" | "data" | "ipfs" | "erc721" | "erc1155" | "!erc721-caip" | "!erc1155-caip" | "!owner" | "owner" | "!balance" | "balance" | "metadata-url-base" | "metadata-url-expanded" | "metadata-url" | "!metadata-url" | "!metadata" | "metadata" | "!imageUrl" | "imageUrl-ipfs" | "imageUrl" | "!imageUrl-ipfs"; +/** + * An individual record for each step during avatar resolution. + */ +export interface AvatarLinkage { + /** + * The type of linkage. + */ + type: AvatarLinkageType; + /** + * The linkage value. + */ + value: string; +} +/** + * When resolving an avatar for an ENS name, there are many + * steps involved, fetching metadata, validating results, et cetera. + * + * Some applications may wish to analyse this data, or use this data + * to diagnose promblems, so an **AvatarResult** provides details of + * each completed step during avatar resolution. + */ +export interface AvatarResult { + /** + * How the [[url]] was arrived at, resolving the many steps required + * for an avatar URL. + */ + linkage: Array; + /** + * The avatar URL or null if the avatar was not set, or there was + * an issue during validation (such as the address not owning the + * avatar or a metadata error). + */ + url: null | string; +} +/** + * A provider plugin super-class for processing multicoin address types. + */ +export declare abstract class MulticoinProviderPlugin implements AbstractProviderPlugin { + /** + * The name. + */ + readonly name: string; + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name: string); + connect(proivder: Provider): MulticoinProviderPlugin; + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType: number): boolean; + /** + * Resovles to the encoded %%address%% for %%coinType%%. + */ + encodeAddress(coinType: number, address: string): Promise; + /** + * Resovles to the decoded %%data%% for %%coinType%%. + */ + decodeAddress(coinType: number, data: BytesLike): Promise; +} +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +export declare class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor(); +} +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +export declare class EnsResolver { + #private; + /** + * The connected provider. + */ + provider: AbstractProvider; + /** + * The address of the resolver. + */ + address: string; + /** + * The name this resolver was resolved against. + */ + name: string; + constructor(provider: AbstractProvider, address: string, name: string); + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + supportsWildcard(): Promise; + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + getAddress(coinType?: number): Promise; + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + getText(key: string): Promise; + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + getContentHash(): Promise; + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + getAvatar(): Promise; + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + _getAvatar(): Promise; + static getEnsAddress(provider: Provider): Promise; + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static fromName(provider: AbstractProvider, name: string): Promise; +} +//# sourceMappingURL=ens-resolver.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ens-resolver.d.ts.map b/dist/ethers.js/src.ts/providers/ens-resolver.d.ts.map new file mode 100644 index 0000000..f47ab18 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ens-resolver.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ens-resolver.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAeH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAEvF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAgB9C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,QAAQ,GAAG,SAAS,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GACnF,QAAQ,GAAG,SAAS,GAAG,cAAc,GAAG,eAAe,GACvD,QAAQ,GAAG,OAAO,GAAG,UAAU,GAAG,SAAS,GAC3C,mBAAmB,GAAG,uBAAuB,GAAG,cAAc,GAAG,eAAe,GAChF,WAAW,GAAG,UAAU,GACxB,WAAW,GAAG,eAAe,GAAG,UAAU,GAAG,gBAAgB,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B;;OAEG;IACH,IAAI,EAAE,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AAG,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAMlD;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IA6B9C;;;;;;;OAOG;IACG,SAAS,IAAI,OAAO,CAAC,IAAI,GAAG,MAAM,CAAC;IAKzC;;;;;;;OAOG;IACG,UAAU,IAAI,OAAO,CAAC,YAAY,CAAC;WAgK5B,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAoC/D;;;OAGG;WACU,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC;CA2B/F"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ens-resolver.js b/dist/ethers.js/src.ts/providers/ens-resolver.js new file mode 100644 index 0000000..ff165fe --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ens-resolver.js @@ -0,0 +1,531 @@ +"use strict"; +/** + * ENS is a service which allows easy-to-remember names to map to + * network addresses. + * + * @_section: api/providers/ens-resolver:ENS Resolver [about-ens-rsolver] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _EnsResolver_instances, _a, _EnsResolver_supports2544, _EnsResolver_resolver, _EnsResolver_fetch, _EnsResolver_getResolver; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EnsResolver = exports.BasicMulticoinProviderPlugin = exports.MulticoinProviderPlugin = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../constants/index.js"); +const index_js_3 = require("../contract/index.js"); +const index_js_4 = require("../hash/index.js"); +const index_js_5 = require("../utils/index.js"); +// @TODO: This should use the fetch-data:ipfs gateway +// Trim off the ipfs:// prefix and return the default gateway URL +function getIpfsLink(link) { + if (link.match(/^ipfs:\/\/ipfs\//i)) { + link = link.substring(12); + } + else if (link.match(/^ipfs:\/\//i)) { + link = link.substring(7); + } + else { + (0, index_js_5.assertArgument)(false, "unsupported IPFS format", "link", link); + } + return `https:/\/gateway.ipfs.io/ipfs/${link}`; +} +; +; +/** + * A provider plugin super-class for processing multicoin address types. + */ +class MulticoinProviderPlugin { + /** + * Creates a new **MulticoinProviderPluing** for %%name%%. + */ + constructor(name) { + (0, index_js_5.defineProperties)(this, { name }); + } + connect(proivder) { + return this; + } + /** + * Returns ``true`` if %%coinType%% is supported by this plugin. + */ + supportsCoinType(coinType) { + return false; + } + /** + * Resovles to the encoded %%address%% for %%coinType%%. + */ + encodeAddress(coinType, address) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("unsupported coin"); + }); + } + /** + * Resovles to the decoded %%data%% for %%coinType%%. + */ + decodeAddress(coinType, data) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("unsupported coin"); + }); + } +} +exports.MulticoinProviderPlugin = MulticoinProviderPlugin; +const BasicMulticoinPluginId = "org.ethers.plugins.provider.BasicMulticoin"; +/** + * A **BasicMulticoinProviderPlugin** provides service for common + * coin types, which do not require additional libraries to encode or + * decode. + */ +class BasicMulticoinProviderPlugin extends MulticoinProviderPlugin { + /** + * Creates a new **BasicMulticoinProviderPlugin**. + */ + constructor() { + super(BasicMulticoinPluginId); + } +} +exports.BasicMulticoinProviderPlugin = BasicMulticoinProviderPlugin; +const matcherIpfs = new RegExp("^(ipfs):/\/(.*)$", "i"); +const matchers = [ + new RegExp("^(https):/\/(.*)$", "i"), + new RegExp("^(data):(.*)$", "i"), + matcherIpfs, + new RegExp("^eip155:[0-9]+/(erc[0-9]+):(.*)$", "i"), +]; +/** + * A connected object to a resolved ENS name resolver, which can be + * used to query additional details. + */ +class EnsResolver { + constructor(provider, address, name) { + _EnsResolver_instances.add(this); + // For EIP-2544 names, the ancestor that provided the resolver + _EnsResolver_supports2544.set(this, void 0); + _EnsResolver_resolver.set(this, void 0); + (0, index_js_5.defineProperties)(this, { provider, address, name }); + __classPrivateFieldSet(this, _EnsResolver_supports2544, null, "f"); + __classPrivateFieldSet(this, _EnsResolver_resolver, new index_js_3.Contract(address, [ + "function supportsInterface(bytes4) view returns (bool)", + "function resolve(bytes, bytes) view returns (bytes)", + "function addr(bytes32) view returns (address)", + "function addr(bytes32, uint) view returns (bytes)", + "function text(bytes32, string) view returns (string)", + "function contenthash(bytes32) view returns (bytes)", + ], provider), "f"); + } + /** + * Resolves to true if the resolver supports wildcard resolution. + */ + supportsWildcard() { + return __awaiter(this, void 0, void 0, function* () { + if (__classPrivateFieldGet(this, _EnsResolver_supports2544, "f") == null) { + __classPrivateFieldSet(this, _EnsResolver_supports2544, (() => __awaiter(this, void 0, void 0, function* () { + try { + return yield __classPrivateFieldGet(this, _EnsResolver_resolver, "f").supportsInterface("0x9061b923"); + } + catch (error) { + // Wildcard resolvers must understand supportsInterface + // and return true. + if ((0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + return false; + } + // Let future attempts try again... + __classPrivateFieldSet(this, _EnsResolver_supports2544, null, "f"); + throw error; + } + }))(), "f"); + } + return yield __classPrivateFieldGet(this, _EnsResolver_supports2544, "f"); + }); + } + /** + * Resolves to the address for %%coinType%% or null if the + * provided %%coinType%% has not been configured. + */ + getAddress(coinType) { + return __awaiter(this, void 0, void 0, function* () { + if (coinType == null) { + coinType = 60; + } + if (coinType === 60) { + try { + const result = yield __classPrivateFieldGet(this, _EnsResolver_instances, "m", _EnsResolver_fetch).call(this, "addr(bytes32)"); + // No address + if (result == null || result === index_js_2.ZeroAddress) { + return null; + } + return result; + } + catch (error) { + if ((0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + return null; + } + throw error; + } + } + // Try decoding its EVM canonical chain as an EVM chain address first + if (coinType >= 0 && coinType < 0x80000000) { + let ethCoinType = coinType + 0x80000000; + const data = yield __classPrivateFieldGet(this, _EnsResolver_instances, "m", _EnsResolver_fetch).call(this, "addr(bytes32,uint)", [ethCoinType]); + if ((0, index_js_5.isHexString)(data, 20)) { + return (0, index_js_1.getAddress)(data); + } + } + let coinPlugin = null; + for (const plugin of this.provider.plugins) { + if (!(plugin instanceof MulticoinProviderPlugin)) { + continue; + } + if (plugin.supportsCoinType(coinType)) { + coinPlugin = plugin; + break; + } + } + if (coinPlugin == null) { + return null; + } + // keccak256("addr(bytes32,uint256") + const data = yield __classPrivateFieldGet(this, _EnsResolver_instances, "m", _EnsResolver_fetch).call(this, "addr(bytes32,uint)", [coinType]); + // No address + if (data == null || data === "0x") { + return null; + } + // Compute the address + const address = yield coinPlugin.decodeAddress(coinType, data); + if (address != null) { + return address; + } + (0, index_js_5.assert)(false, `invalid coin data`, "UNSUPPORTED_OPERATION", { + operation: `getAddress(${coinType})`, + info: { coinType, data } + }); + }); + } + /** + * Resolves to the EIP-634 text record for %%key%%, or ``null`` + * if unconfigured. + */ + getText(key) { + return __awaiter(this, void 0, void 0, function* () { + const data = yield __classPrivateFieldGet(this, _EnsResolver_instances, "m", _EnsResolver_fetch).call(this, "text(bytes32,string)", [key]); + if (data == null || data === "0x") { + return null; + } + return data; + }); + } + /** + * Rsolves to the content-hash or ``null`` if unconfigured. + */ + getContentHash() { + return __awaiter(this, void 0, void 0, function* () { + // keccak256("contenthash()") + const data = yield __classPrivateFieldGet(this, _EnsResolver_instances, "m", _EnsResolver_fetch).call(this, "contenthash(bytes32)"); + // No contenthash + if (data == null || data === "0x") { + return null; + } + // IPFS (CID: 1, Type: 70=DAG-PB, 72=libp2p-key) + const ipfs = data.match(/^0x(e3010170|e5010172)(([0-9a-f][0-9a-f])([0-9a-f][0-9a-f])([0-9a-f]*))$/); + if (ipfs) { + const scheme = (ipfs[1] === "e3010170") ? "ipfs" : "ipns"; + const length = parseInt(ipfs[4], 16); + if (ipfs[5].length === length * 2) { + return `${scheme}:/\/${(0, index_js_5.encodeBase58)("0x" + ipfs[2])}`; + } + } + // Swarm (CID: 1, Type: swarm-manifest; hash/length hard-coded to keccak256/32) + const swarm = data.match(/^0xe40101fa011b20([0-9a-f]*)$/); + if (swarm && swarm[1].length === 64) { + return `bzz:/\/${swarm[1]}`; + } + (0, index_js_5.assert)(false, `invalid or unsupported content hash data`, "UNSUPPORTED_OPERATION", { + operation: "getContentHash()", + info: { data } + }); + }); + } + /** + * Resolves to the avatar url or ``null`` if the avatar is either + * unconfigured or incorrectly configured (e.g. references an NFT + * not owned by the address). + * + * If diagnosing issues with configurations, the [[_getAvatar]] + * method may be useful. + */ + getAvatar() { + return __awaiter(this, void 0, void 0, function* () { + const avatar = yield this._getAvatar(); + return avatar.url; + }); + } + /** + * When resolving an avatar, there are many steps involved, such + * fetching metadata and possibly validating ownership of an + * NFT. + * + * This method can be used to examine each step and the value it + * was working from. + */ + _getAvatar() { + return __awaiter(this, void 0, void 0, function* () { + const linkage = [{ type: "name", value: this.name }]; + try { + // test data for ricmoo.eth + //const avatar = "eip155:1/erc721:0x265385c7f4132228A0d54EB1A9e7460b91c0cC68/29233"; + const avatar = yield this.getText("avatar"); + if (avatar == null) { + linkage.push({ type: "!avatar", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "avatar", value: avatar }); + for (let i = 0; i < matchers.length; i++) { + const match = avatar.match(matchers[i]); + if (match == null) { + continue; + } + const scheme = match[1].toLowerCase(); + switch (scheme) { + case "https": + case "data": + linkage.push({ type: "url", value: avatar }); + return { linkage, url: avatar }; + case "ipfs": { + const url = getIpfsLink(avatar); + linkage.push({ type: "ipfs", value: avatar }); + linkage.push({ type: "url", value: url }); + return { linkage, url }; + } + case "erc721": + case "erc1155": { + // Depending on the ERC type, use tokenURI(uint256) or url(uint256) + const selector = (scheme === "erc721") ? "tokenURI(uint256)" : "uri(uint256)"; + linkage.push({ type: scheme, value: avatar }); + // The owner of this name + const owner = yield this.getAddress(); + if (owner == null) { + linkage.push({ type: "!owner", value: "" }); + return { url: null, linkage }; + } + const comps = (match[2] || "").split("/"); + if (comps.length !== 2) { + linkage.push({ type: `!${scheme}caip`, value: (match[2] || "") }); + return { url: null, linkage }; + } + const tokenId = comps[1]; + const contract = new index_js_3.Contract(comps[0], [ + // ERC-721 + "function tokenURI(uint) view returns (string)", + "function ownerOf(uint) view returns (address)", + // ERC-1155 + "function uri(uint) view returns (string)", + "function balanceOf(address, uint256) view returns (uint)" + ], this.provider); + // Check that this account owns the token + if (scheme === "erc721") { + const tokenOwner = yield contract.ownerOf(tokenId); + if (owner !== tokenOwner) { + linkage.push({ type: "!owner", value: tokenOwner }); + return { url: null, linkage }; + } + linkage.push({ type: "owner", value: tokenOwner }); + } + else if (scheme === "erc1155") { + const balance = yield contract.balanceOf(owner, tokenId); + if (!balance) { + linkage.push({ type: "!balance", value: "0" }); + return { url: null, linkage }; + } + linkage.push({ type: "balance", value: balance.toString() }); + } + // Call the token contract for the metadata URL + let metadataUrl = yield contract[selector](tokenId); + if (metadataUrl == null || metadataUrl === "0x") { + linkage.push({ type: "!metadata-url", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata-url-base", value: metadataUrl }); + // ERC-1155 allows a generic {id} in the URL + if (scheme === "erc1155") { + metadataUrl = metadataUrl.replace("{id}", (0, index_js_5.toBeHex)(tokenId, 32).substring(2)); + linkage.push({ type: "metadata-url-expanded", value: metadataUrl }); + } + // Transform IPFS metadata links + if (metadataUrl.match(/^ipfs:/i)) { + metadataUrl = getIpfsLink(metadataUrl); + } + linkage.push({ type: "metadata-url", value: metadataUrl }); + // Get the token metadata + let metadata = {}; + const response = yield (new index_js_5.FetchRequest(metadataUrl)).send(); + response.assertOk(); + try { + metadata = response.bodyJson; + } + catch (error) { + try { + linkage.push({ type: "!metadata", value: response.bodyText }); + } + catch (error) { + const bytes = response.body; + if (bytes) { + linkage.push({ type: "!metadata", value: (0, index_js_5.hexlify)(bytes) }); + } + return { url: null, linkage }; + } + return { url: null, linkage }; + } + if (!metadata) { + linkage.push({ type: "!metadata", value: "" }); + return { url: null, linkage }; + } + linkage.push({ type: "metadata", value: JSON.stringify(metadata) }); + // Pull the image URL out + let imageUrl = metadata.image; + if (typeof (imageUrl) !== "string") { + linkage.push({ type: "!imageUrl", value: "" }); + return { url: null, linkage }; + } + if (imageUrl.match(/^(https:\/\/|data:)/i)) { + // Allow + } + else { + // Transform IPFS link to gateway + const ipfs = imageUrl.match(matcherIpfs); + if (ipfs == null) { + linkage.push({ type: "!imageUrl-ipfs", value: imageUrl }); + return { url: null, linkage }; + } + linkage.push({ type: "imageUrl-ipfs", value: imageUrl }); + imageUrl = getIpfsLink(imageUrl); + } + linkage.push({ type: "url", value: imageUrl }); + return { linkage, url: imageUrl }; + } + } + } + } + catch (error) { } + return { linkage, url: null }; + }); + } + static getEnsAddress(provider) { + return __awaiter(this, void 0, void 0, function* () { + const network = yield provider.getNetwork(); + const ensPlugin = network.getPlugin("org.ethers.plugins.network.Ens"); + // No ENS... + (0, index_js_5.assert)(ensPlugin, "network does not support ENS", "UNSUPPORTED_OPERATION", { + operation: "getEnsAddress", info: { network } + }); + return ensPlugin.address; + }); + } + /** + * Resolve to the ENS resolver for %%name%% using %%provider%% or + * ``null`` if unconfigured. + */ + static fromName(provider, name) { + return __awaiter(this, void 0, void 0, function* () { + let currentName = name; + while (true) { + if (currentName === "" || currentName === ".") { + return null; + } + // Optimization since the eth node cannot change and does + // not have a wildcard resolver + if (name !== "eth" && currentName === "eth") { + return null; + } + // Check the current node for a resolver + const addr = yield __classPrivateFieldGet(EnsResolver, _a, "m", _EnsResolver_getResolver).call(EnsResolver, provider, currentName); + // Found a resolver! + if (addr != null) { + const resolver = new EnsResolver(provider, addr, name); + // Legacy resolver found, using EIP-2544 so it isn't safe to use + if (currentName !== name && !(yield resolver.supportsWildcard())) { + return null; + } + return resolver; + } + // Get the parent node + currentName = currentName.split(".").slice(1).join("."); + } + }); + } +} +exports.EnsResolver = EnsResolver; +_a = EnsResolver, _EnsResolver_supports2544 = new WeakMap(), _EnsResolver_resolver = new WeakMap(), _EnsResolver_instances = new WeakSet(), _EnsResolver_fetch = function _EnsResolver_fetch(funcName, params) { + return __awaiter(this, void 0, void 0, function* () { + params = (params || []).slice(); + const iface = __classPrivateFieldGet(this, _EnsResolver_resolver, "f").interface; + // The first parameters is always the nodehash + params.unshift((0, index_js_4.namehash)(this.name)); + let fragment = null; + if (yield this.supportsWildcard()) { + fragment = iface.getFunction(funcName); + (0, index_js_5.assert)(fragment, "missing fragment", "UNKNOWN_ERROR", { + info: { funcName } + }); + params = [ + (0, index_js_4.dnsEncode)(this.name), + iface.encodeFunctionData(fragment, params) + ]; + funcName = "resolve(bytes,bytes)"; + } + params.push({ + enableCcipRead: true + }); + try { + const result = yield __classPrivateFieldGet(this, _EnsResolver_resolver, "f")[funcName](...params); + if (fragment) { + return iface.decodeFunctionResult(fragment, result)[0]; + } + return result; + } + catch (error) { + if (!(0, index_js_5.isError)(error, "CALL_EXCEPTION")) { + throw error; + } + } + return null; + }); +}, _EnsResolver_getResolver = function _EnsResolver_getResolver(provider, name) { + return __awaiter(this, void 0, void 0, function* () { + const ensAddr = yield EnsResolver.getEnsAddress(provider); + try { + const contract = new index_js_3.Contract(ensAddr, [ + "function resolver(bytes32) view returns (address)" + ], provider); + const addr = yield contract.resolver((0, index_js_4.namehash)(name), { + enableCcipRead: true + }); + if (addr === index_js_2.ZeroAddress) { + return null; + } + return addr; + } + catch (error) { + // ENS registry cannot throw errors on resolver(bytes32), + // so probably a link error + throw error; + } + return null; + }); +}; +//# sourceMappingURL=ens-resolver.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ens-resolver.js.map b/dist/ethers.js/src.ts/providers/ens-resolver.js.map new file mode 100644 index 0000000..1b8cb10 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ens-resolver.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ens-resolver.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ens-resolver.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,kDAAiD;AACjD,oDAAoD;AACpD,mDAAgD;AAChD,+CAAuD;AACvD,gDAK2B;AAU3B,qDAAqD;AACrD,iEAAiE;AACjE,SAAS,WAAW,CAAC,IAAY;IAC7B,IAAI,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,EAAE;QACjC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;KAC7B;SAAM,IAAI,IAAI,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;QAClC,IAAI,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAC5B;SAAM;QACH,IAAA,yBAAc,EAAC,KAAK,EAAE,yBAAyB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAClE;IAED,OAAO,iCAAkC,IAAK,EAAE,CAAC;AACrD,CAAC;AAyBA,CAAC;AAuBD,CAAC;AAEF;;GAEG;AACH,MAAsB,uBAAuB;IAMzC;;OAEG;IACH,YAAY,IAAY;QACpB,IAA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O,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC;QAE1D,IAAI;YACA,MAAM,QAAQ,GAAG,IAAI,mBAAQ,CAAC,OAAO,EAAE;gBACnC,mDAAmD;aACtD,EAAE,QAAQ,CAAC,CAAC;YAEb,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,IAAA,mBAAQ,EAAC,IAAI,CAAC,EAAE;gBACjD,cAAc,EAAE,IAAI;aACvB,CAAC,CAAC;YAEH,IAAI,IAAI,KAAK,sBAAW,EAAE;gBAAE,OAAO,IAAI,CAAC;aAAE;YAC1C,OAAO,IAAI,CAAC;SAEf;QAAC,OAAO,KAAK,EAAE;YACZ,yDAAyD;YACzD,2BAA2B;YAC3B,MAAM,KAAK,CAAC;SACf;QAED,OAAO,IAAI,CAAC;IAChB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/format.d.ts b/dist/ethers.js/src.ts/providers/format.d.ts new file mode 100644 index 0000000..e088632 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/format.d.ts @@ -0,0 +1,15 @@ +import type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +export type FormatFunc = (value: any) => any; +export declare function allowNull(format: FormatFunc, nullValue?: any): FormatFunc; +export declare function arrayOf(format: FormatFunc): FormatFunc; +export declare function object(format: Record, altNames?: Record>): FormatFunc; +export declare function formatBoolean(value: any): boolean; +export declare function formatData(value: string): string; +export declare function formatHash(value: any): string; +export declare function formatUint256(value: any): string; +export declare function formatLog(value: any): LogParams; +export declare function formatBlock(value: any): BlockParams; +export declare function formatReceiptLog(value: any): LogParams; +export declare function formatTransactionReceipt(value: any): TransactionReceiptParams; +export declare function formatTransactionResponse(value: any): TransactionResponseParams; +//# sourceMappingURL=format.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/format.d.ts.map b/dist/ethers.js/src.ts/providers/format.d.ts.map new file mode 100644 index 0000000..b2388c6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/format.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/format.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACR,WAAW,EAAE,SAAS,EACtB,wBAAwB,EAAE,yBAAyB,EACtD,MAAM,iBAAiB,CAAC;AAKzB,MAAM,MAAM,UAAU,GAAG,CAAC,KAAK,EAAE,GAAG,KAAK,GAAG,CAAC;AAE7C,wBAAgB,SAAS,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,CAAC,EAAE,GAAG,GAAG,UAAU,CAKzE;AAED,wBAAgB,OAAO,CAAC,MAAM,EAAE,UAAU,GAAG,UAAU,CAKtD;AAKD,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,EAAE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,GAAG,UAAU,CAwB/G;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,OAAO,CAQjD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGhD;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAG7C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,GAAG,GAAG,MAAM,CAKhD;AAgBD,wBAAgB,SAAS,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAE/C;AAoBD,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,WAAW,CAOnD;AAeD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,GAAG,GAAG,SAAS,CAEtD;AA0BD,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,GAAG,GAAG,wBAAwB,CAE7E;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,GAAG,GAAG,yBAAyB,CA+G/E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/format.js b/dist/ethers.js/src.ts/providers/format.js new file mode 100644 index 0000000..a549999 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/format.js @@ -0,0 +1,273 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.formatTransactionResponse = exports.formatTransactionReceipt = exports.formatReceiptLog = exports.formatBlock = exports.formatLog = exports.formatUint256 = exports.formatHash = exports.formatData = exports.formatBoolean = exports.object = exports.arrayOf = exports.allowNull = void 0; +/** + * @_ignore + */ +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const BN_0 = BigInt(0); +function allowNull(format, nullValue) { + return (function (value) { + if (value == null) { + return nullValue; + } + return format(value); + }); +} +exports.allowNull = allowNull; +function arrayOf(format) { + return ((array) => { + if (!Array.isArray(array)) { + throw new Error("not an array"); + } + return array.map((i) => format(i)); + }); +} +exports.arrayOf = arrayOf; +// Requires an object which matches a fleet of other formatters +// Any FormatFunc may return `undefined` to have the value omitted +// from the result object. Calls preserve `this`. +function object(format, altNames) { + return ((value) => { + const result = {}; + for (const key in format) { + let srcKey = key; + if (altNames && key in altNames && !(srcKey in value)) { + for (const altKey of altNames[key]) { + if (altKey in value) { + srcKey = altKey; + break; + } + } + } + try { + const nv = format[key](value[srcKey]); + if (nv !== undefined) { + result[key] = nv; + } + } + catch (error) { + const message = (error instanceof Error) ? error.message : "not-an-error"; + (0, index_js_4.assert)(false, `invalid value for value.${key} (${message})`, "BAD_DATA", { value }); + } + } + return result; + }); +} +exports.object = object; +function formatBoolean(value) { + switch (value) { + case true: + case "true": + return true; + case false: + case "false": + return false; + } + (0, index_js_4.assertArgument)(false, `invalid boolean; ${JSON.stringify(value)}`, "value", value); +} +exports.formatBoolean = formatBoolean; +function formatData(value) { + (0, index_js_4.assertArgument)((0, index_js_4.isHexString)(value, true), "invalid data", "value", value); + return value; +} +exports.formatData = formatData; +function formatHash(value) { + (0, index_js_4.assertArgument)((0, index_js_4.isHexString)(value, 32), "invalid hash", "value", value); + return value; +} +exports.formatHash = formatHash; +function formatUint256(value) { + if (!(0, index_js_4.isHexString)(value)) { + throw new Error("invalid uint256"); + } + return (0, index_js_4.zeroPadValue)(value, 32); +} +exports.formatUint256 = formatUint256; +const _formatLog = object({ + address: index_js_1.getAddress, + blockHash: formatHash, + blockNumber: index_js_4.getNumber, + data: formatData, + index: index_js_4.getNumber, + removed: allowNull(formatBoolean, false), + topics: arrayOf(formatHash), + transactionHash: formatHash, + transactionIndex: index_js_4.getNumber, +}, { + index: ["logIndex"] +}); +function formatLog(value) { + return _formatLog(value); +} +exports.formatLog = formatLog; +const _formatBlock = object({ + hash: allowNull(formatHash), + parentHash: formatHash, + number: index_js_4.getNumber, + timestamp: index_js_4.getNumber, + nonce: allowNull(formatData), + difficulty: index_js_4.getBigInt, + gasLimit: index_js_4.getBigInt, + gasUsed: index_js_4.getBigInt, + miner: allowNull(index_js_1.getAddress), + extraData: formatData, + baseFeePerGas: allowNull(index_js_4.getBigInt) +}); +function formatBlock(value) { + const result = _formatBlock(value); + result.transactions = value.transactions.map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return formatTransactionResponse(tx); + }); + return result; +} +exports.formatBlock = formatBlock; +const _formatReceiptLog = object({ + transactionIndex: index_js_4.getNumber, + blockNumber: index_js_4.getNumber, + transactionHash: formatHash, + address: index_js_1.getAddress, + topics: arrayOf(formatHash), + data: formatData, + index: index_js_4.getNumber, + blockHash: formatHash, +}, { + index: ["logIndex"] +}); +function formatReceiptLog(value) { + return _formatReceiptLog(value); +} +exports.formatReceiptLog = formatReceiptLog; +const _formatTransactionReceipt = object({ + to: allowNull(index_js_1.getAddress, null), + from: allowNull(index_js_1.getAddress, null), + contractAddress: allowNull(index_js_1.getAddress, null), + // should be allowNull(hash), but broken-EIP-658 support is handled in receipt + index: index_js_4.getNumber, + root: allowNull(index_js_4.hexlify), + gasUsed: index_js_4.getBigInt, + logsBloom: allowNull(formatData), + blockHash: formatHash, + hash: formatHash, + logs: arrayOf(formatReceiptLog), + blockNumber: index_js_4.getNumber, + //confirmations: allowNull(getNumber, null), + cumulativeGasUsed: index_js_4.getBigInt, + effectiveGasPrice: allowNull(index_js_4.getBigInt), + status: allowNull(index_js_4.getNumber), + type: allowNull(index_js_4.getNumber, 0) +}, { + effectiveGasPrice: ["gasPrice"], + hash: ["transactionHash"], + index: ["transactionIndex"], +}); +function formatTransactionReceipt(value) { + return _formatTransactionReceipt(value); +} +exports.formatTransactionReceipt = formatTransactionReceipt; +function formatTransactionResponse(value) { + // Some clients (TestRPC) do strange things like return 0x0 for the + // 0 address; correct this to be a real address + if (value.to && (0, index_js_4.getBigInt)(value.to) === BN_0) { + value.to = "0x0000000000000000000000000000000000000000"; + } + const result = object({ + hash: formatHash, + type: (value) => { + if (value === "0x" || value == null) { + return 0; + } + return (0, index_js_4.getNumber)(value); + }, + accessList: allowNull(index_js_3.accessListify, null), + blockHash: allowNull(formatHash, null), + blockNumber: allowNull(index_js_4.getNumber, null), + transactionIndex: allowNull(index_js_4.getNumber, null), + //confirmations: allowNull(getNumber, null), + from: index_js_1.getAddress, + // either (gasPrice) or (maxPriorityFeePerGas + maxFeePerGas) must be set + gasPrice: allowNull(index_js_4.getBigInt), + maxPriorityFeePerGas: allowNull(index_js_4.getBigInt), + maxFeePerGas: allowNull(index_js_4.getBigInt), + gasLimit: index_js_4.getBigInt, + to: allowNull(index_js_1.getAddress, null), + value: index_js_4.getBigInt, + nonce: index_js_4.getNumber, + data: formatData, + creates: allowNull(index_js_1.getAddress, null), + chainId: allowNull(index_js_4.getBigInt, null) + }, { + data: ["input"], + gasLimit: ["gas"] + })(value); + // If to and creates are empty, populate the creates from the value + if (result.to == null && result.creates == null) { + result.creates = (0, index_js_1.getCreateAddress)(result); + } + // @TODO: Check fee data + // Add an access list to supported transaction types + if ((value.type === 1 || value.type === 2) && value.accessList == null) { + result.accessList = []; + } + // Compute the signature + if (value.signature) { + result.signature = index_js_2.Signature.from(value.signature); + } + else { + result.signature = index_js_2.Signature.from(value); + } + // Some backends omit ChainId on legacy transactions, but we can compute it + if (result.chainId == null) { + const chainId = result.signature.legacyChainId; + if (chainId != null) { + result.chainId = chainId; + } + } + // @TODO: check chainID + /* + if (value.chainId != null) { + let chainId = value.chainId; + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + result.chainId = chainId; + + } else { + let chainId = value.networkId; + + // geth-etc returns chainId + if (chainId == null && result.v == null) { + chainId = value.chainId; + } + + if (isHexString(chainId)) { + chainId = BigNumber.from(chainId).toNumber(); + } + + if (typeof(chainId) !== "number" && result.v != null) { + chainId = (result.v - 35) / 2; + if (chainId < 0) { chainId = 0; } + chainId = parseInt(chainId); + } + + if (typeof(chainId) !== "number") { chainId = 0; } + + result.chainId = chainId; + } + */ + // 0x0000... should actually be null + if (result.blockHash && (0, index_js_4.getBigInt)(result.blockHash) === BN_0) { + result.blockHash = null; + } + return result; +} +exports.formatTransactionResponse = formatTransactionResponse; +//# sourceMappingURL=format.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/format.js.map b/dist/ethers.js/src.ts/providers/format.js.map new file mode 100644 index 0000000..fc66aa5 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/format.js.map @@ -0,0 +1 @@ +{"version":3,"file":"format.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/format.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,kDAAmE;AACnE,iDAA8C;AAC9C,sDAAwD;AACxD,gDAG2B;AAQ3B,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAIvB,SAAgB,SAAS,CAAC,MAAkB,EAAE,SAAe;IACzD,OAAO,CAAC,UAAS,KAAU;QACvB,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,OAAO,SAAS,CAAC;SAAE;QACxC,OAAO,MAAM,CAAC,KAAK,CAAC,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C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/formatting.d.ts b/dist/ethers.js/src.ts/providers/formatting.d.ts new file mode 100644 index 0000000..b1129ca --- /dev/null +++ b/dist/ethers.js/src.ts/providers/formatting.d.ts @@ -0,0 +1,268 @@ +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +import type { Signature } from "../crypto/index.js"; +import type { AccessList } from "../transaction/index.js"; +/** + * a **BlockParams** encodes the minimal required properties for a + * formatted block. + */ +export interface BlockParams { + /** + * The block hash. + */ + hash?: null | string; + /** + * The block number. + */ + number: number; + /** + * The timestamp for this block, which is the number of seconds + * since epoch that this block was included. + */ + timestamp: number; + /** + * The hash of the previous block in the blockchain. The genesis block + * has the parentHash of the [[ZeroHash]]. + */ + parentHash: string; + /** + * A random sequence provided during the mining process for + * proof-of-work networks. + */ + nonce: string; + /** + * For proof-of-work networks, the difficulty target is used to + * adjust the difficulty in mining to ensure a expected block rate. + */ + difficulty: bigint; + /** + * The maximum amount of gas a block can consume. + */ + gasLimit: bigint; + /** + * The amount of gas a block consumed. + */ + gasUsed: bigint; + /** + * The miner (or author) of a block. + */ + miner: string; + /** + * Additional data the miner choose to include. + */ + extraData: string; + /** + * The protocol-defined base fee per gas in an [[link-eip-1559]] + * block. + */ + baseFeePerGas: null | bigint; + /** + * The list of transactions in the block. + */ + transactions: ReadonlyArray; +} +/** + * a **LogParams** encodes the minimal required properties for a + * formatted log. + */ +export interface LogParams { + /** + * The transaction hash for the transaxction the log occurred in. + */ + transactionHash: string; + /** + * The block hash of the block that included the transaction for this + * log. + */ + blockHash: string; + /** + * The block number of the block that included the transaction for this + * log. + */ + blockNumber: number; + /** + * Whether this log was removed due to the transaction it was included + * in being removed dur to an orphaned block. + */ + removed: boolean; + /** + * The address of the contract that emitted this log. + */ + address: string; + /** + * The data emitted with this log. + */ + data: string; + /** + * The topics emitted with this log. + */ + topics: ReadonlyArray; + /** + * The index of this log. + */ + index: number; + /** + * The transaction index of this log. + */ + transactionIndex: number; +} +/** + * a **TransactionReceiptParams** encodes the minimal required properties + * for a formatted transaction receipt. + */ +export interface TransactionReceiptParams { + /** + * The target of the transaction. If null, the transaction was trying + * to deploy a transaction with the ``data`` as the initi=code. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * If the transaction was directly deploying a contract, the [[to]] + * will be null, the ``data`` will be initcode and if successful, this + * will be the address of the contract deployed. + */ + contractAddress: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: string; + /** + * The block number of the block that included this transaction. + */ + blockNumber: number; + /** + * The bloom filter for the logs emitted during execution of this + * transaction. + */ + logsBloom: string; + /** + * The logs emitted during the execution of this transaction. + */ + logs: ReadonlyArray; + /** + * The amount of gas consumed executing this transaciton. + */ + gasUsed: bigint; + /** + * The total amount of gas consumed during the entire block up to + * and including this transaction. + */ + cumulativeGasUsed: bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + gasPrice?: null | bigint; + /** + * The actual gas price per gas charged for this transaction. + */ + effectiveGasPrice?: null | bigint; + /** + * The [[link-eip-2718]] envelope type. + */ + type: number; + /** + * The status of the transaction execution. If ``1`` then the + * the transaction returned success, if ``0`` then the transaction + * was reverted. For pre-byzantium blocks, this is usually null, but + * some nodes may have backfilled this data. + */ + status: null | number; + /** + * The root of this transaction in a pre-bazatium block. In + * post-byzantium blocks this is null. + */ + root: null | string; +} +/** + * a **TransactionResponseParams** encodes the minimal required properties + * for a formatted transaction response. + */ +export interface TransactionResponseParams { + /** + * The block number of the block that included this transaction. + */ + blockNumber: null | number; + /** + * The block hash of the block that included this transaction. + */ + blockHash: null | string; + /** + * The transaction hash. + */ + hash: string; + /** + * The transaction index. + */ + index: number; + /** + * The [[link-eip-2718]] transaction type. + */ + type: number; + /** + * The target of the transaction. If ``null``, the ``data`` is initcode + * and this transaction is a deployment transaction. + */ + to: null | string; + /** + * The sender of the transaction. + */ + from: string; + /** + * The nonce of the transaction, used for replay protection. + */ + nonce: number; + /** + * The maximum amount of gas this transaction is authorized to consume. + */ + gasLimit: bigint; + /** + * For legacy transactions, this is the gas price per gas to pay. + */ + gasPrice: bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum priority + * fee to allow a producer to claim. + */ + maxPriorityFeePerGas: null | bigint; + /** + * For [[link-eip-1559]] transactions, this is the maximum fee that + * will be paid. + */ + maxFeePerGas: null | bigint; + /** + * The transaction data. + */ + data: string; + /** + * The transaction value (in wei). + */ + value: bigint; + /** + * The chain ID this transaction is valid on. + */ + chainId: bigint; + /** + * The signature of the transaction. + */ + signature: Signature; + /** + * The transaction access list. + */ + accessList: null | AccessList; +} +//# sourceMappingURL=formatting.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/formatting.d.ts.map b/dist/ethers.js/src.ts/providers/formatting.d.ts.map new file mode 100644 index 0000000..016102a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/formatting.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/formatting.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAM1D;;;GAGG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,IAAI,CAAC,EAAE,IAAI,GAAG,MAAM,CAAC;IAErB;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;OAEG;IACH,OAAO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ting.js new file mode 100644 index 0000000..aa2ace7 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/formatting.js @@ -0,0 +1,10 @@ +"use strict"; +/** + * About provider formatting? + * + * @_section: api/providers/formatting:Formatting [provider-formatting] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +; +; +//# sourceMappingURL=formatting.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/formatting.js.map b/dist/ethers.js/src.ts/providers/formatting.js.map new file mode 100644 index 0000000..c7e899a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/formatting.js.map @@ -0,0 +1 @@ +{"version":3,"file":"formatting.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/formatting.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;AA8EF,CAAC;AA+QD,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/index.d.ts b/dist/ethers.js/src.ts/providers/index.d.ts new file mode 100644 index 0000000..e06cb1b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/index.d.ts @@ -0,0 +1,47 @@ +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +export { AbstractProvider, UnmanagedSubscriber } from "./abstract-provider.js"; +export { AbstractSigner, VoidSigner, } from "./abstract-signer.js"; +export { showThrottleMessage } from "./community.js"; +export { getDefaultProvider } from "./default-provider.js"; +export { EnsResolver, MulticoinProviderPlugin } from "./ens-resolver.js"; +export { Network } from "./network.js"; +export { NonceManager } from "./signer-noncemanager.js"; +export { NetworkPlugin, GasCostPlugin, EnsPlugin, FeeDataNetworkPlugin, FetchUrlFeeDataNetworkPlugin, } from "./plugins-network.js"; +export { Block, FeeData, Log, TransactionReceipt, TransactionResponse, copyRequest, } from "./provider.js"; +export { FallbackProvider } from "./provider-fallback.js"; +export { JsonRpcApiProvider, JsonRpcProvider, JsonRpcSigner } from "./provider-jsonrpc.js"; +export { BrowserProvider } from "./provider-browser.js"; +export { AlchemyProvider } from "./provider-alchemy.js"; +export { AnkrProvider } from "./provider-ankr.js"; +export { CloudflareProvider } from "./provider-cloudflare.js"; +export { EtherscanProvider, EtherscanPlugin } from "./provider-etherscan.js"; +export { InfuraProvider, InfuraWebSocketProvider } from "./provider-infura.js"; +export { PocketProvider } from "./provider-pocket.js"; +export { QuickNodeProvider } from "./provider-quicknode.js"; +import { IpcSocketProvider } from "./provider-ipcsocket.js"; +export { IpcSocketProvider }; +export { SocketProvider } from "./provider-socket.js"; +export { WebSocketProvider } from "./provider-websocket.js"; +export { SocketSubscriber, SocketBlockSubscriber, SocketPendingSubscriber, SocketEventSubscriber } from "./provider-socket.js"; +export type { AbstractProviderOptions, Subscription, Subscriber, AbstractProviderPlugin, PerformActionFilter, PerformActionTransaction, PerformActionRequest, } from "./abstract-provider.js"; +export type { ContractRunner } from "./contracts.js"; +export type { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams, } from "./formatting.js"; +export type { Networkish } from "./network.js"; +export type { GasCostParameters } from "./plugins-network.js"; +export type { BlockTag, TransactionRequest, PreparedTransactionRequest, EventFilter, Filter, FilterByBlockHash, OrphanFilter, ProviderEvent, TopicFilter, Provider, MinedBlock, MinedTransactionResponse } from "./provider.js"; +export type { DebugEventBrowserProvider, Eip1193Provider } from "./provider-browser.js"; +export type { FallbackProviderOptions } from "./provider-fallback.js"; +export type { JsonRpcPayload, JsonRpcResult, JsonRpcError, JsonRpcApiProviderOptions, JsonRpcTransactionRequest, } from "./provider-jsonrpc.js"; +export type { WebSocketCreator, WebSocketLike } from "./provider-websocket.js"; +export type { Signer } from "./signer.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/index.d.ts.map b/dist/ethers.js/src.ts/providers/index.d.ts.map new file mode 100644 index 0000000..07fcbfc --- /dev/null +++ b/dist/ethers.js/src.ts/providers/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,EACH,gBAAgB,EAAE,mBAAmB,EACxC,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EACH,cAAc,EACd,UAAU,GACb,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,mBAAmB,EACtB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EACH,WAAW,EACX,uBAAuB,EAC1B,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAExD,OAAO,EACH,aAAa,EACb,aAAa,EACb,SAAS,EACT,oBAAoB,EACpB,4BAA4B,GAC/B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACH,KAAK,EACL,OAAO,EACP,GAAG,EACH,kBAAkB,EAClB,mBAAmB,EAEnB,WAAW,GAEd,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAA;AAE1F,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC7E,OAAO,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,sB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gB,EAAE,aAAa,EAClC,MAAM,yBAAyB,CAAC;AAEjC,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/index.js b/dist/ethers.js/src.ts/providers/index.js new file mode 100644 index 0000000..66bae6a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/index.js @@ -0,0 +1,80 @@ +"use strict"; +/** + * A **Provider** provides a connection to the blockchain, whch can be + * used to query its current state, simulate execution and send transactions + * to update the state. + * + * It is one of the most fundamental components of interacting with a + * blockchain application, and there are many ways to connect, such as over + * HTTP, WebSockets or injected providers such as [MetaMask](link-metamask). + * + * @_section: api/providers:Providers [about-providers] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = exports.WebSocketProvider = exports.SocketProvider = exports.IpcSocketProvider = exports.QuickNodeProvider = exports.PocketProvider = exports.InfuraWebSocketProvider = exports.InfuraProvider = exports.EtherscanPlugin = exports.EtherscanProvider = exports.CloudflareProvider = exports.AnkrProvider = exports.AlchemyProvider = exports.BrowserProvider = exports.JsonRpcSigner = exports.JsonRpcProvider = exports.JsonRpcApiProvider = exports.FallbackProvider = exports.copyRequest = exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.FeeData = exports.Block = exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = exports.NonceManager = exports.Network = exports.MulticoinProviderPlugin = exports.EnsResolver = exports.getDefaultProvider = exports.showThrottleMessage = exports.VoidSigner = exports.AbstractSigner = exports.UnmanagedSubscriber = exports.AbstractProvider = void 0; +var abstract_provider_js_1 = require("./abstract-provider.js"); +Object.defineProperty(exports, "AbstractProvider", { enumerable: true, get: function () { return abstract_provider_js_1.AbstractProvider; } }); +Object.defineProperty(exports, "UnmanagedSubscriber", { enumerable: true, get: function () { return abstract_provider_js_1.UnmanagedSubscriber; } }); +var abstract_signer_js_1 = require("./abstract-signer.js"); +Object.defineProperty(exports, "AbstractSigner", { enumerable: true, get: function () { return abstract_signer_js_1.AbstractSigner; } }); +Object.defineProperty(exports, "VoidSigner", { enumerable: true, get: function () { return abstract_signer_js_1.VoidSigner; } }); +var community_js_1 = require("./community.js"); +Object.defineProperty(exports, "showThrottleMessage", { enumerable: true, get: function () { return community_js_1.showThrottleMessage; } }); +var default_provider_js_1 = require("./default-provider.js"); +Object.defineProperty(exports, "getDefaultProvider", { enumerable: true, get: function () { return default_provider_js_1.getDefaultProvider; } }); +var ens_resolver_js_1 = require("./ens-resolver.js"); +Object.defineProperty(exports, "EnsResolver", { enumerable: true, get: function () { return ens_resolver_js_1.EnsResolver; } }); +Object.defineProperty(exports, "MulticoinProviderPlugin", { enumerable: true, get: function () { return ens_resolver_js_1.MulticoinProviderPlugin; } }); +var network_js_1 = require("./network.js"); +Object.defineProperty(exports, "Network", { enumerable: true, get: function () { return network_js_1.Network; } }); +var signer_noncemanager_js_1 = require("./signer-noncemanager.js"); +Object.defineProperty(exports, "NonceManager", { enumerable: true, get: function () { return signer_noncemanager_js_1.NonceManager; } }); +var plugins_network_js_1 = require("./plugins-network.js"); +Object.defineProperty(exports, "NetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.NetworkPlugin; } }); +Object.defineProperty(exports, "GasCostPlugin", { enumerable: true, get: function () { return plugins_network_js_1.GasCostPlugin; } }); +Object.defineProperty(exports, "EnsPlugin", { enumerable: true, get: function () { return plugins_network_js_1.EnsPlugin; } }); +Object.defineProperty(exports, "FeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FeeDataNetworkPlugin; } }); +Object.defineProperty(exports, "FetchUrlFeeDataNetworkPlugin", { enumerable: true, get: function () { return plugins_network_js_1.FetchUrlFeeDataNetworkPlugin; } }); +var provider_js_1 = require("./provider.js"); +Object.defineProperty(exports, "Block", { enumerable: true, get: function () { return provider_js_1.Block; } }); +Object.defineProperty(exports, "FeeData", { enumerable: true, get: function () { return provider_js_1.FeeData; } }); +Object.defineProperty(exports, "Log", { enumerable: true, get: function () { return provider_js_1.Log; } }); +Object.defineProperty(exports, "TransactionReceipt", { enumerable: true, get: function () { return provider_js_1.TransactionReceipt; } }); +Object.defineProperty(exports, "TransactionResponse", { enumerable: true, get: function () { return provider_js_1.TransactionResponse; } }); +Object.defineProperty(exports, "copyRequest", { enumerable: true, get: function () { return provider_js_1.copyRequest; } }); +var provider_fallback_js_1 = require("./provider-fallback.js"); +Object.defineProperty(exports, "FallbackProvider", { enumerable: true, get: function () { return provider_fallback_js_1.FallbackProvider; } }); +var provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +Object.defineProperty(exports, "JsonRpcApiProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcApiProvider; } }); +Object.defineProperty(exports, "JsonRpcProvider", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcProvider; } }); +Object.defineProperty(exports, "JsonRpcSigner", { enumerable: true, get: function () { return provider_jsonrpc_js_1.JsonRpcSigner; } }); +var provider_browser_js_1 = require("./provider-browser.js"); +Object.defineProperty(exports, "BrowserProvider", { enumerable: true, get: function () { return provider_browser_js_1.BrowserProvider; } }); +var provider_alchemy_js_1 = require("./provider-alchemy.js"); +Object.defineProperty(exports, "AlchemyProvider", { enumerable: true, get: function () { return provider_alchemy_js_1.AlchemyProvider; } }); +var provider_ankr_js_1 = require("./provider-ankr.js"); +Object.defineProperty(exports, "AnkrProvider", { enumerable: true, get: function () { return provider_ankr_js_1.AnkrProvider; } }); +var provider_cloudflare_js_1 = require("./provider-cloudflare.js"); +Object.defineProperty(exports, "CloudflareProvider", { enumerable: true, get: function () { return provider_cloudflare_js_1.CloudflareProvider; } }); +var provider_etherscan_js_1 = require("./provider-etherscan.js"); +Object.defineProperty(exports, "EtherscanProvider", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanProvider; } }); +Object.defineProperty(exports, "EtherscanPlugin", { enumerable: true, get: function () { return provider_etherscan_js_1.EtherscanPlugin; } }); +var provider_infura_js_1 = require("./provider-infura.js"); +Object.defineProperty(exports, "InfuraProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraProvider; } }); +Object.defineProperty(exports, "InfuraWebSocketProvider", { enumerable: true, get: function () { return provider_infura_js_1.InfuraWebSocketProvider; } }); +var provider_pocket_js_1 = require("./provider-pocket.js"); +Object.defineProperty(exports, "PocketProvider", { enumerable: true, get: function () { return provider_pocket_js_1.PocketProvider; } }); +var provider_quicknode_js_1 = require("./provider-quicknode.js"); +Object.defineProperty(exports, "QuickNodeProvider", { enumerable: true, get: function () { return provider_quicknode_js_1.QuickNodeProvider; } }); +const provider_ipcsocket_js_1 = require("./provider-ipcsocket.js"); /*-browser*/ +Object.defineProperty(exports, "IpcSocketProvider", { enumerable: true, get: function () { return provider_ipcsocket_js_1.IpcSocketProvider; } }); +var provider_socket_js_1 = require("./provider-socket.js"); +Object.defineProperty(exports, "SocketProvider", { enumerable: true, get: function () { return provider_socket_js_1.SocketProvider; } }); +var provider_websocket_js_1 = require("./provider-websocket.js"); +Object.defineProperty(exports, "WebSocketProvider", { enumerable: true, get: function () { return provider_websocket_js_1.WebSocketProvider; } }); +var provider_socket_js_2 = require("./provider-socket.js"); +Object.defineProperty(exports, "SocketSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketSubscriber; } }); +Object.defineProperty(exports, "SocketBlockSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketBlockSubscriber; } }); +Object.defineProperty(exports, "SocketPendingSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketPendingSubscriber; } }); +Object.defineProperty(exports, "SocketEventSubscriber", { enumerable: true, get: function () { return provider_socket_js_2.SocketEventSubscriber; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/index.js.map b/dist/ethers.js/src.ts/providers/index.js.map new file mode 100644 index 0000000..9284091 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;AAGH,+DAEgC;AAD5B,wHAAA,gBAAgB,OAAA;AAAE,2HAAA,mBAAmB,OAAA;AAGzC,2DAG8B;AAF1B,oHAAA,cAAc,OAAA;AACd,gHAAA,UAAU,OAAA;AAGd,+CAEwB;AADpB,mHAAA,mBAAmB,OAAA;AAGvB,6DAA2D;AAAlD,yHAAA,kBAAkB,OAAA;AAE3B,qDAG2B;AAFvB,8GAAA,WAAW,OAAA;AACX,0HAAA,uBAAuB,OAAA;AAG3B,2CAAuC;AAA9B,qGAAA,OAAO,OAAA;AAEhB,mEAAwD;AAA/C,sHAAA,YAAY,OAAA;AAErB,2DAM8B;AAL1B,mHAAA,aAAa,OAAA;AACb,mHAAA,aAAa,OAAA;AACb,+GAAA,SAAS,OAAA;AACT,0HAAA,oBAAoB,OAAA;AACpB,kIAAA,4BAA4B,OAAA;AAGhC,6CASuB;AARnB,oGAAA,KAAK,OAAA;AACL,sGAAA,OAAO,OAAA;AACP,kGAAA,GAAG,OAAA;AACH,iHAAA,kBAAkB,OAAA;AAClB,kHAAA,mBAAmB,OAAA;AAEnB,0GAAA,WAAW,OAAA;AAIf,+DAA0D;AAAjD,wHAAA,gBAAgB,OAAA;AACzB,6DAA0F;AAAjF,yHAAA,kBAAkB,OAAA;AAAE,sHAAA,eAAe,OAAA;AAAE,oHAAA,aAAa,OAAA;AAE3D,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AAExB,6DAAwD;AAA/C,sHAAA,eAAe,OAAA;AACxB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AACrB,mEAA8D;AAArD,4HAAA,kBAAkB,OAAA;AAC3B,iEAA6E;AAApE,0HAAA,iBAAiB,OAAA;AAAE,wHAAA,eAAe,OAAA;AAC3C,2DAA+E;AAAtE,oHAAA,cAAc,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChD,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,mEAA4D,CAAC,YAAY;AAChE,kGADA,yCAAiB,OACA;AAC1B,2DAAsD;AAA7C,oHAAA,cAAc,OAAA;AACvB,iEAA4D;AAAnD,0HAAA,iBAAiB,OAAA;AAE1B,2DAG8B;AAF1B,sHAAA,gBAAgB,OAAA;AAAE,2HAAA,qBAAqB,OAAA;AAAE,6HAAA,uBAAuB,OAAA;AAChE,2HAAA,qBAAqB,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/network.d.ts b/dist/ethers.js/src.ts/providers/network.d.ts new file mode 100644 index 0000000..2355df4 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/network.d.ts @@ -0,0 +1,99 @@ +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +import type { BigNumberish } from "../utils/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { NetworkPlugin } from "./plugins-network.js"; +/** + * A Networkish can be used to allude to a Network, by specifing: + * - a [[Network]] object + * - a well-known (or registered) network name + * - a well-known (or registered) chain ID + * - an object with sufficient details to describe a network + */ +export type Networkish = Network | number | bigint | string | { + name?: string; + chainId?: number; + ensAddress?: string; + ensNetwork?: number; +}; +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +export declare class Network { + #private; + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name: string, chainId: BigNumberish); + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON(): any; + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name(): string; + set name(value: string); + /** + * The network chain ID. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other: Networkish): boolean; + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins(): Array; + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin: NetworkPlugin): this; + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name: string): null | T; + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename: string): Array; + /** + * Create a copy of this Network. + */ + clone(): Network; + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx: TransactionLike): number; + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network?: Networkish): Network; + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId: string | number | bigint, networkFunc: () => Network): void; +} +//# sourceMappingURL=network.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/network.d.ts.map b/dist/ethers.js/src.ts/providers/network.d.ts.map new file mode 100644 index 0000000..8894d07 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"network.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/network.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AASH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAG1D;;;;;;GAMG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG;IAC1D,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB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/network.js new file mode 100644 index 0000000..8c17d55 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/network.js @@ -0,0 +1,384 @@ +"use strict"; +/** + * A **Network** encapsulates the various properties required to + * interact with a specific chain. + * + * @_subsection: api/providers:Networks [networks] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Network_name, _Network_chainId, _Network_plugins; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Network = void 0; +const index_js_1 = require("../transaction/index.js"); +const index_js_2 = require("../utils/index.js"); +const plugins_network_js_1 = require("./plugins-network.js"); +/* * * * +// Networks which operation against an L2 can use this plugin to +// specify how to access L1, for the purpose of resolving ENS, +// for example. +export class LayerOneConnectionPlugin extends NetworkPlugin { + readonly provider!: Provider; +// @TODO: Rename to ChainAccess and allow for connecting to any chain + constructor(provider: Provider) { + super("org.ethers.plugins.layer-one-connection"); + defineProperties(this, { provider }); + } + + clone(): LayerOneConnectionPlugin { + return new LayerOneConnectionPlugin(this.provider); + } +} +*/ +const Networks = new Map(); +/** + * A **Network** provides access to a chain's properties and allows + * for plug-ins to extend functionality. + */ +class Network { + /** + * Creates a new **Network** for %%name%% and %%chainId%%. + */ + constructor(name, chainId) { + _Network_name.set(this, void 0); + _Network_chainId.set(this, void 0); + _Network_plugins.set(this, void 0); + __classPrivateFieldSet(this, _Network_name, name, "f"); + __classPrivateFieldSet(this, _Network_chainId, (0, index_js_2.getBigInt)(chainId), "f"); + __classPrivateFieldSet(this, _Network_plugins, new Map(), "f"); + } + /** + * Returns a JSON-compatible representation of a Network. + */ + toJSON() { + return { name: this.name, chainId: String(this.chainId) }; + } + /** + * The network common name. + * + * This is the canonical name, as networks migh have multiple + * names. + */ + get name() { return __classPrivateFieldGet(this, _Network_name, "f"); } + set name(value) { __classPrivateFieldSet(this, _Network_name, value, "f"); } + /** + * The network chain ID. + */ + get chainId() { return __classPrivateFieldGet(this, _Network_chainId, "f"); } + set chainId(value) { __classPrivateFieldSet(this, _Network_chainId, (0, index_js_2.getBigInt)(value, "chainId"), "f"); } + /** + * Returns true if %%other%% matches this network. Any chain ID + * must match, and if no chain ID is present, the name must match. + * + * This method does not currently check for additional properties, + * such as ENS address or plug-in compatibility. + */ + matches(other) { + if (other == null) { + return false; + } + if (typeof (other) === "string") { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other)); + } + catch (error) { } + return (this.name === other); + } + if (typeof (other) === "number" || typeof (other) === "bigint") { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other)); + } + catch (error) { } + return false; + } + if (typeof (other) === "object") { + if (other.chainId != null) { + try { + return (this.chainId === (0, index_js_2.getBigInt)(other.chainId)); + } + catch (error) { } + return false; + } + if (other.name != null) { + return (this.name === other.name); + } + return false; + } + return false; + } + /** + * Returns the list of plugins currently attached to this Network. + */ + get plugins() { + return Array.from(__classPrivateFieldGet(this, _Network_plugins, "f").values()); + } + /** + * Attach a new %%plugin%% to this Network. The network name + * must be unique, excluding any fragment. + */ + attachPlugin(plugin) { + if (__classPrivateFieldGet(this, _Network_plugins, "f").get(plugin.name)) { + throw new Error(`cannot replace existing plugin: ${plugin.name} `); + } + __classPrivateFieldGet(this, _Network_plugins, "f").set(plugin.name, plugin.clone()); + return this; + } + /** + * Return the plugin, if any, matching %%name%% exactly. Plugins + * with fragments will not be returned unless %%name%% includes + * a fragment. + */ + getPlugin(name) { + return (__classPrivateFieldGet(this, _Network_plugins, "f").get(name)) || null; + } + /** + * Gets a list of all plugins that match %%name%%, with otr without + * a fragment. + */ + getPlugins(basename) { + return (this.plugins.filter((p) => (p.name.split("#")[0] === basename))); + } + /** + * Create a copy of this Network. + */ + clone() { + const clone = new Network(this.name, this.chainId); + this.plugins.forEach((plugin) => { + clone.attachPlugin(plugin.clone()); + }); + return clone; + } + /** + * Compute the intrinsic gas required for a transaction. + * + * A GasCostPlugin can be attached to override the default + * values. + */ + computeIntrinsicGas(tx) { + const costs = this.getPlugin("org.ethers.plugins.network.GasCost") || (new plugins_network_js_1.GasCostPlugin()); + let gas = costs.txBase; + if (tx.to == null) { + gas += costs.txCreate; + } + if (tx.data) { + for (let i = 2; i < tx.data.length; i += 2) { + if (tx.data.substring(i, i + 2) === "00") { + gas += costs.txDataZero; + } + else { + gas += costs.txDataNonzero; + } + } + } + if (tx.accessList) { + const accessList = (0, index_js_1.accessListify)(tx.accessList); + for (const addr in accessList) { + gas += costs.txAccessListAddress + costs.txAccessListStorageKey * accessList[addr].storageKeys.length; + } + } + return gas; + } + /** + * Returns a new Network for the %%network%% name or chainId. + */ + static from(network) { + injectCommonNetworks(); + // Default network + if (network == null) { + return Network.from("mainnet"); + } + // Canonical name or chain ID + if (typeof (network) === "number") { + network = BigInt(network); + } + if (typeof (network) === "string" || typeof (network) === "bigint") { + const networkFunc = Networks.get(network); + if (networkFunc) { + return networkFunc(); + } + if (typeof (network) === "bigint") { + return new Network("unknown", network); + } + (0, index_js_2.assertArgument)(false, "unknown network", "network", network); + } + // Clonable with network-like abilities + if (typeof (network.clone) === "function") { + const clone = network.clone(); + //if (typeof(network.name) !== "string" || typeof(network.chainId) !== "number") { + //} + return clone; + } + // Networkish + if (typeof (network) === "object") { + (0, index_js_2.assertArgument)(typeof (network.name) === "string" && typeof (network.chainId) === "number", "invalid network object name or chainId", "network", network); + const custom = new Network((network.name), (network.chainId)); + if (network.ensAddress || network.ensNetwork != null) { + custom.attachPlugin(new plugins_network_js_1.EnsPlugin(network.ensAddress, network.ensNetwork)); + } + //if ((network).layerOneConnection) { + // custom.attachPlugin(new LayerOneConnectionPlugin((network).layerOneConnection)); + //} + return custom; + } + (0, index_js_2.assertArgument)(false, "invalid network", "network", network); + } + /** + * Register %%nameOrChainId%% with a function which returns + * an instance of a Network representing that chain. + */ + static register(nameOrChainId, networkFunc) { + if (typeof (nameOrChainId) === "number") { + nameOrChainId = BigInt(nameOrChainId); + } + const existing = Networks.get(nameOrChainId); + if (existing) { + (0, index_js_2.assertArgument)(false, `conflicting network for ${JSON.stringify(existing.name)}`, "nameOrChainId", nameOrChainId); + } + Networks.set(nameOrChainId, networkFunc); + } +} +exports.Network = Network; +_Network_name = new WeakMap(), _Network_chainId = new WeakMap(), _Network_plugins = new WeakMap(); +// We don't want to bring in formatUnits because it is backed by +// FixedNumber and we want to keep Networks tiny. The values +// included by the Gas Stations are also IEEE 754 with lots of +// rounding issues and exceed the strict checks formatUnits has. +function parseUnits(_value, decimals) { + const value = String(_value); + if (!value.match(/^[0-9.]+$/)) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Break into [ whole, fraction ] + const comps = value.split("."); + if (comps.length === 1) { + comps.push(""); + } + // More than 1 decimal point or too many fractional positions + if (comps.length !== 2) { + throw new Error(`invalid gwei value: ${_value}`); + } + // Pad the fraction to 9 decimalplaces + while (comps[1].length < decimals) { + comps[1] += "0"; + } + // Too many decimals and some non-zero ending, take the ceiling + if (comps[1].length > 9) { + let frac = BigInt(comps[1].substring(0, 9)); + if (!comps[1].substring(9).match(/^0+$/)) { + frac++; + } + comps[1] = frac.toString(); + } + return BigInt(comps[0] + comps[1]); +} +// Used by Polygon to use a gas station for fee data +function getGasStationPlugin(url) { + return new plugins_network_js_1.FetchUrlFeeDataNetworkPlugin(url, (fetchFeeData, provider, request) => __awaiter(this, void 0, void 0, function* () { + // Prevent Cloudflare from blocking our request in node.js + request.setHeader("User-Agent", "ethers"); + let response; + try { + const [_response, _feeData] = yield Promise.all([ + request.send(), fetchFeeData() + ]); + response = _response; + const payload = response.bodyJson.standard; + const feeData = { + gasPrice: _feeData.gasPrice, + maxFeePerGas: parseUnits(payload.maxFee, 9), + maxPriorityFeePerGas: parseUnits(payload.maxPriorityFee, 9), + }; + return feeData; + } + catch (error) { + (0, index_js_2.assert)(false, `error encountered with polygon gas station (${JSON.stringify(request.url)})`, "SERVER_ERROR", { request, response, error }); + } + })); +} +// See: https://chainlist.org +let injected = false; +function injectCommonNetworks() { + if (injected) { + return; + } + injected = true; + /// Register popular Ethereum networks + function registerEth(name, chainId, options) { + const func = function () { + const network = new Network(name, chainId); + // We use 0 to disable ENS + if (options.ensNetwork != null) { + network.attachPlugin(new plugins_network_js_1.EnsPlugin(null, options.ensNetwork)); + } + network.attachPlugin(new plugins_network_js_1.GasCostPlugin()); + (options.plugins || []).forEach((plugin) => { + network.attachPlugin(plugin); + }); + return network; + }; + // Register the network by name and chain ID + Network.register(name, func); + Network.register(chainId, func); + if (options.altNames) { + options.altNames.forEach((name) => { + Network.register(name, func); + }); + } + } + registerEth("mainnet", 1, { ensNetwork: 1, altNames: ["homestead"] }); + registerEth("ropsten", 3, { ensNetwork: 3 }); + registerEth("rinkeby", 4, { ensNetwork: 4 }); + registerEth("goerli", 5, { ensNetwork: 5 }); + registerEth("kovan", 42, { ensNetwork: 42 }); + registerEth("sepolia", 11155111, { ensNetwork: 11155111 }); + registerEth("classic", 61, {}); + registerEth("classicKotti", 6, {}); + registerEth("arbitrum", 42161, { + ensNetwork: 1, + }); + registerEth("arbitrum-goerli", 421613, {}); + registerEth("base", 8453, { ensNetwork: 1 }); + registerEth("base-goerli", 84531, {}); + registerEth("base-sepolia", 84532, {}); + registerEth("bnb", 56, { ensNetwork: 1 }); + registerEth("bnbt", 97, {}); + registerEth("linea", 59144, { ensNetwork: 1 }); + registerEth("linea-goerli", 59140, {}); + registerEth("matic", 137, { + ensNetwork: 1, + plugins: [ + getGasStationPlugin("https:/\/gasstation.polygon.technology/v2") + ] + }); + registerEth("matic-mumbai", 80001, { + altNames: ["maticMumbai", "maticmum"], + plugins: [ + getGasStationPlugin("https:/\/gasstation-testnet.polygon.technology/v2") + ] + }); + registerEth("optimism", 10, { + ensNetwork: 1, + plugins: [] + }); + registerEth("optimism-goerli", 420, {}); + registerEth("xdai", 100, { ensNetwork: 1 }); +} +//# sourceMappingURL=network.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/network.js.map b/dist/ethers.js/src.ts/providers/network.js.map new file mode 100644 index 0000000..f15f83e --- /dev/null +++ b/dist/ethers.js/src.ts/providers/network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"network.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/network.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,sDAAwD;AACxD,gDAAsE;AAEtE,6DAE8B;AA0B9B;;;;;;;;;;;;;;;;EAgBE;AAGF,MAAM,QAAQ,GAAwC,IAAI,GAAG,EAAE,CAAC;AAGhE;;;GAGG;AACH,MAAa,OAAO;IAMhB;;OAEG;IACH,YAAY,IAAY,EAAE,OAAqB;QAR/C,gCAAc;QACd,mCAAiB;QAEjB,mCAAqC;QAMjC,uBAAA,IAAI,iBAAS,IAAI,MAAA,CAAC;QAClB,uBAAA,IAAI,oBAAY,IAAA,oBAAS,EAAC,OAAO,CAAC,MAAA,CAAC;QAC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,EAAE,EAAG;KACf,CAAC,CAAC;IACH,WAAW,CAAC,iBAAiB,EAAE,GAAG,EAAE,EAAG,CAAC,CAAC;IAEzC,WAAW,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC,CAAC;AAChD,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/pagination.d.ts b/dist/ethers.js/src.ts/providers/pagination.d.ts new file mode 100644 index 0000000..a772a85 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/pagination.d.ts @@ -0,0 +1,6 @@ +export interface PaginationResult extends Array { + next(): Promise>; + totalResults: null | number; + done: boolean; +} +//# sourceMappingURL=pagination.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/pagination.d.ts.map b/dist/ethers.js/src.ts/providers/pagination.d.ts.map new file mode 100644 index 0000000..e1fa7fa --- /dev/null +++ b/dist/ethers.js/src.ts/providers/pagination.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/pagination.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB,CAAC,CAAC,CAAE,SAAQ,KAAK,CAAC,CAAC,CAAC;IACjD,IAAI,IAAI,OAAO,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC;IAGrC,YAAY,EAAE,IAAI,GAAG,MAAM,CAAC;IAE5B,IAAI,EAAE,OAAO,CAAC;CACjB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/pagination.js b/dist/ethers.js/src.ts/providers/pagination.js new file mode 100644 index 0000000..7696f1a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/pagination.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=pagination.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/pagination.js.map b/dist/ethers.js/src.ts/providers/pagination.js.map new file mode 100644 index 0000000..0ffbbe0 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/pagination.js.map @@ -0,0 +1 @@ +{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/pagination.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts b/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts new file mode 100644 index 0000000..6c525ec --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts @@ -0,0 +1,13 @@ +import { AbstractProviderPlugin } from "./abstract-provider.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +export declare const PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +export declare class CheckQualifiedPlugin implements AbstractProviderPlugin { + name: string; + constructor(); + connect(provider: AbstractProvider): CheckQualifiedPlugin; + isQualified(action: PerformActionRequest, result: any): boolean; +} +export declare class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action: PerformActionRequest, result: any): boolean; +} +//# sourceMappingURL=plugin-fallback.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts.map b/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts.map new file mode 100644 index 0000000..3f506fd --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugin-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAGhE,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGrF,eAAO,MAAM,wBAAwB,gDAAgD,CAAC;AAEtF,qBAAa,oBAAqB,YAAW,sBAAsB;IACvD,IAAI,EAAE,MAAM,CAAC;;IAMrB,OAAO,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB;IAMzD,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAGlE;AAED,qBAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAAM,EAAE,oBAAoB,EAAE,MAAM,EAAE,GAAG,GAAG,OAAO;CAMlE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugin-fallback.js b/dist/ethers.js/src.ts/providers/plugin-fallback.js new file mode 100644 index 0000000..9bb9193 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugin-fallback.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PossiblyPrunedTransactionPlugin = exports.CheckQualifiedPlugin = exports.PluginIdFallbackProvider = void 0; +const index_js_1 = require("../utils/index.js"); +exports.PluginIdFallbackProvider = "org.ethers.plugins.provider.QualifiedPlugin"; +class CheckQualifiedPlugin { + constructor() { + (0, index_js_1.defineProperties)(this, { name: exports.PluginIdFallbackProvider }); + } + connect(provider) { + return this; + } + // Retruns true if this value should be considered qualified for + // inclusion in the quorum. + isQualified(action, result) { + return true; + } +} +exports.CheckQualifiedPlugin = CheckQualifiedPlugin; +class PossiblyPrunedTransactionPlugin extends CheckQualifiedPlugin { + isQualified(action, result) { + if (action.method === "getTransaction" || action.method === "getTransactionReceipt") { + if (result == null) { + return false; + } + } + return super.isQualified(action, result); + } +} +exports.PossiblyPrunedTransactionPlugin = PossiblyPrunedTransactionPlugin; +//# sourceMappingURL=plugin-fallback.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugin-fallback.js.map b/dist/ethers.js/src.ts/providers/plugin-fallback.js.map new file mode 100644 index 0000000..cdaf86d --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugin-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugin-fallback.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/plugin-fallback.ts"],"names":[],"mappings":";;;AAEA,gDAAqD;AAKxC,QAAA,wBAAwB,GAAG,6CAA6C,CAAC;AAEtF,MAAa,oBAAoB;IAG7B;QACI,IAAA,2BAAgB,EAAuB,IAAI,EAAE,EAAE,IAAI,EAAE,gCAAwB,EAAE,CAAC,CAAC;IACrF,CAAC;IAED,OAAO,CAAC,QAA0B;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,gEAAgE;IAChE,2BAA2B;IAC3B,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,OAAO,IAAI,CAAC;IAChB,CAAC;CACJ;AAhBD,oDAgBC;AAED,MAAa,+BAAgC,SAAQ,oBAAoB;IACrE,WAAW,CAAC,MAA4B,EAAE,MAAW;QACjD,IAAI,MAAM,CAAC,MAAM,KAAK,gBAAgB,IAAI,MAAM,CAAC,MAAM,KAAK,uBAAuB,EAAE;YACjF,IAAI,MAAM,IAAI,IAAI,EAAE;gBAAE,OAAO,KAAK,CAAC;aAAE;SACxC;QACD,OAAO,KAAK,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;CACJ;AAPD,0EAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugins-network.d.ts b/dist/ethers.js/src.ts/providers/plugins-network.d.ts new file mode 100644 index 0000000..7385782 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugins-network.d.ts @@ -0,0 +1,170 @@ +import type { FeeData, Provider } from "./provider.js"; +import type { FetchRequest } from "../utils/fetch.js"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +export declare class NetworkPlugin { + /** + * The name of the plugin. + * + * It is recommended to use reverse-domain-notation, which permits + * unique names with a known authority as well as hierarchal entries. + */ + readonly name: string; + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name: string); + /** + * Creates a copy of this plugin. + */ + clone(): NetworkPlugin; +} +/** + * The gas cost parameters for a [[GasCostPlugin]]. + */ +export type GasCostParameters = { + /** + * The transactions base fee. + */ + txBase?: number; + /** + * The fee for creating a new account. + */ + txCreate?: number; + /** + * The fee per zero-byte in the data. + */ + txDataZero?: number; + /** + * The fee per non-zero-byte in the data. + */ + txDataNonzero?: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + txAccessListStorageKey?: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + txAccessListAddress?: number; +}; +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +export declare class GasCostPlugin extends NetworkPlugin implements GasCostParameters { + /** + * The block number to treat these values as valid from. + * + * This allows a hardfork to have updated values included as well as + * mulutiple hardforks to be supported. + */ + readonly effectiveBlock: number; + /** + * The transactions base fee. + */ + readonly txBase: number; + /** + * The fee for creating a new account. + */ + readonly txCreate: number; + /** + * The fee per zero-byte in the data. + */ + readonly txDataZero: number; + /** + * The fee per non-zero-byte in the data. + */ + readonly txDataNonzero: number; + /** + * The fee per storage key in the [[link-eip-2930]] access list. + */ + readonly txAccessListStorageKey: number; + /** + * The fee per address in the [[link-eip-2930]] access list. + */ + readonly txAccessListAddress: number; + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock?: number, costs?: GasCostParameters); + clone(): GasCostPlugin; +} +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +export declare class EnsPlugin extends NetworkPlugin { + /** + * The ENS Registrty Contract address. + */ + readonly address: string; + /** + * The chain ID that the ENS contract lives on. + */ + readonly targetNetwork: number; + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address?: null | string, targetNetwork?: null | number); + clone(): EnsPlugin; +} +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +export declare class FeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc(): (provider: Provider) => Promise; + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc: (provider: Provider) => Promise); + /** + * Resolves to the fee data. + */ + getFeeData(provider: Provider): Promise; + clone(): FeeDataNetworkPlugin; +} +export declare class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + #private; + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url(): string; + /** + * The callback to use when computing the FeeData. + */ + get processFunc(): (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>; + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url: string, processFunc: (f: () => Promise, p: Provider, r: FetchRequest) => Promise<{ + gasPrice?: null | bigint; + maxFeePerGas?: null | bigint; + maxPriorityFeePerGas?: null | bigint; + }>); + clone(): FetchUrlFeeDataNetworkPlugin; +} +//# sourceMappingURL=plugins-network.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugins-network.d.ts.map b/dist/ethers.js/src.ts/providers/plugins-network.d.ts.map new file mode 100644 index 0000000..52d1b2f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugins-network.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/plugins-network.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAKtD;;GAEG;AACH,qBAAa,aAAa;IACtB;;;;;OAKG;IAC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I,4BAA4B;CACxC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugins-network.js b/dist/ethers.js/src.ts/providers/plugins-network.js new file mode 100644 index 0000000..dc592a4 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugins-network.js @@ -0,0 +1,195 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _FeeDataNetworkPlugin_feeDataFunc, _FetchUrlFeeDataNetworkPlugin_url, _FetchUrlFeeDataNetworkPlugin_processFunc; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FetchUrlFeeDataNetworkPlugin = exports.FeeDataNetworkPlugin = exports.EnsPlugin = exports.GasCostPlugin = exports.NetworkPlugin = void 0; +const properties_js_1 = require("../utils/properties.js"); +const index_js_1 = require("../utils/index.js"); +const EnsAddress = "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e"; +/** + * A **NetworkPlugin** provides additional functionality on a [[Network]]. + */ +class NetworkPlugin { + /** + * Creates a new **NetworkPlugin**. + */ + constructor(name) { + (0, properties_js_1.defineProperties)(this, { name }); + } + /** + * Creates a copy of this plugin. + */ + clone() { + return new NetworkPlugin(this.name); + } +} +exports.NetworkPlugin = NetworkPlugin; +/** + * A **GasCostPlugin** allows a network to provide alternative values when + * computing the intrinsic gas required for a transaction. + */ +class GasCostPlugin extends NetworkPlugin { + /** + * Creates a new GasCostPlugin from %%effectiveBlock%% until the + * latest block or another GasCostPlugin supercedes that block number, + * with the associated %%costs%%. + */ + constructor(effectiveBlock, costs) { + if (effectiveBlock == null) { + effectiveBlock = 0; + } + super(`org.ethers.network.plugins.GasCost#${(effectiveBlock || 0)}`); + const props = { effectiveBlock }; + function set(name, nullish) { + let value = (costs || {})[name]; + if (value == null) { + value = nullish; + } + (0, index_js_1.assertArgument)(typeof (value) === "number", `invalud value for ${name}`, "costs", costs); + props[name] = value; + } + set("txBase", 21000); + set("txCreate", 32000); + set("txDataZero", 4); + set("txDataNonzero", 16); + set("txAccessListStorageKey", 1900); + set("txAccessListAddress", 2400); + (0, properties_js_1.defineProperties)(this, props); + } + clone() { + return new GasCostPlugin(this.effectiveBlock, this); + } +} +exports.GasCostPlugin = GasCostPlugin; +/** + * An **EnsPlugin** allows a [[Network]] to specify the ENS Registry + * Contract address and the target network to use when using that + * contract. + * + * Various testnets have their own instance of the contract to use, but + * in general, the mainnet instance supports multi-chain addresses and + * should be used. + */ +class EnsPlugin extends NetworkPlugin { + /** + * Creates a new **EnsPlugin** connected to %%address%% on the + * %%targetNetwork%%. The default ENS address and mainnet is used + * if unspecified. + */ + constructor(address, targetNetwork) { + super("org.ethers.plugins.network.Ens"); + (0, properties_js_1.defineProperties)(this, { + address: (address || EnsAddress), + targetNetwork: ((targetNetwork == null) ? 1 : targetNetwork) + }); + } + clone() { + return new EnsPlugin(this.address, this.targetNetwork); + } +} +exports.EnsPlugin = EnsPlugin; +/** + * A **FeeDataNetworkPlugin** allows a network to provide and alternate + * means to specify its fee data. + * + * For example, a network which does not support [[link-eip-1559]] may + * choose to use a Gas Station site to approximate the gas price. + */ +class FeeDataNetworkPlugin extends NetworkPlugin { + /** + * The fee data function provided to the constructor. + */ + get feeDataFunc() { + return __classPrivateFieldGet(this, _FeeDataNetworkPlugin_feeDataFunc, "f"); + } + /** + * Creates a new **FeeDataNetworkPlugin**. + */ + constructor(feeDataFunc) { + super("org.ethers.plugins.network.FeeData"); + _FeeDataNetworkPlugin_feeDataFunc.set(this, void 0); + __classPrivateFieldSet(this, _FeeDataNetworkPlugin_feeDataFunc, feeDataFunc, "f"); + } + /** + * Resolves to the fee data. + */ + getFeeData(provider) { + return __awaiter(this, void 0, void 0, function* () { + return yield __classPrivateFieldGet(this, _FeeDataNetworkPlugin_feeDataFunc, "f").call(this, provider); + }); + } + clone() { + return new FeeDataNetworkPlugin(__classPrivateFieldGet(this, _FeeDataNetworkPlugin_feeDataFunc, "f")); + } +} +exports.FeeDataNetworkPlugin = FeeDataNetworkPlugin; +_FeeDataNetworkPlugin_feeDataFunc = new WeakMap(); +class FetchUrlFeeDataNetworkPlugin extends NetworkPlugin { + /** + * The URL to initialize the FetchRequest with in %%processFunc%%. + */ + get url() { return __classPrivateFieldGet(this, _FetchUrlFeeDataNetworkPlugin_url, "f"); } + /** + * The callback to use when computing the FeeData. + */ + get processFunc() { return __classPrivateFieldGet(this, _FetchUrlFeeDataNetworkPlugin_processFunc, "f"); } + /** + * Creates a new **FetchUrlFeeDataNetworkPlugin** which will + * be used when computing the fee data for the network. + */ + constructor(url, processFunc) { + super("org.ethers.plugins.network.FetchUrlFeeDataPlugin"); + _FetchUrlFeeDataNetworkPlugin_url.set(this, void 0); + _FetchUrlFeeDataNetworkPlugin_processFunc.set(this, void 0); + __classPrivateFieldSet(this, _FetchUrlFeeDataNetworkPlugin_url, url, "f"); + __classPrivateFieldSet(this, _FetchUrlFeeDataNetworkPlugin_processFunc, processFunc, "f"); + } + // We are immutable, so we can serve as our own clone + clone() { return this; } +} +exports.FetchUrlFeeDataNetworkPlugin = FetchUrlFeeDataNetworkPlugin; +_FetchUrlFeeDataNetworkPlugin_url = new WeakMap(), _FetchUrlFeeDataNetworkPlugin_processFunc = new WeakMap(); +/* +export class CustomBlockNetworkPlugin extends NetworkPlugin { + readonly #blockFunc: (provider: Provider, block: BlockParams) => Block; + readonly #blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block; + + constructor(blockFunc: (provider: Provider, block: BlockParams) => Block, blockWithTxsFunc: (provider: Provider, block: BlockParams) => Block) { + super("org.ethers.network-plugins.custom-block"); + this.#blockFunc = blockFunc; + this.#blockWithTxsFunc = blockWithTxsFunc; + } + + async getBlock(provider: Provider, block: BlockParams): Promise> { + return await this.#blockFunc(provider, block); + } + + async getBlockions(provider: Provider, block: BlockParams): Promise> { + return await this.#blockWithTxsFunc(provider, block); + } + + clone(): CustomBlockNetworkPlugin { + return new CustomBlockNetworkPlugin(this.#blockFunc, this.#blockWithTxsFunc); + } +} +*/ +//# sourceMappingURL=plugins-network.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/plugins-network.js.map b/dist/ethers.js/src.ts/providers/plugins-network.js.map new file mode 100644 index 0000000..042b953 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/plugins-network.js.map @@ -0,0 +1 @@ +{"version":3,"file":"plugins-network.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/plugins-network.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA0D;AAE1D,gDAAmD;AAMnD,MAAM,UAAU,GAAG,4CAA4C,CAAC;AAEhE;;GAEG;AACH,MAAa,aAAa;IAStB;;OAEG;IACH,YAAY,IAAY;QACpB,IAAA,gCAAgB,EAAgB,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,C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a,CAAC,CAAC,CAAC;IAEvN;;;OAGG;IACH,YAAY,GAAW,EAAE,WAAmL;QACxM,KAAK,CAAC,kDAAkD,CAAC,CAAC;QAlBrD,oDAAa;QACb,4DAAqL;QAkB1L,uBAAA,IAAI,qCAAQ,GAAG,MAAA,CAAC;QAChB,uBAAA,IAAI,6CAAgB,WAAW,MAAA,CAAC;IACpC,CAAC;IAED,qDAAqD;IACrD,KAAK,KAAmC,OAAO,IAAI,CAAC,CAAC,CAAC;CACzD;AA1BD,oEA0BC;;AAED;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts b/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts new file mode 100644 index 0000000..7d10f23 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts @@ -0,0 +1,31 @@ +/** + * About Alchemy + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider, PerformActionRequest } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +export declare class AlchemyProvider extends JsonRpcProvider implements CommunityResourcable { + readonly apiKey: string; + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + _perform(req: PerformActionRequest): Promise; + isCommunityResource(): boolean; + static getRequest(network: Network, apiKey?: string): FetchRequest; +} +//# sourceMappingURL=provider-alchemy.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts.map b/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts.map new file mode 100644 index 0000000..21c9d47 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-alchemy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAEH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmC/C;;;;;;;;;;GAUG;AACH,qBAAa,eAAgB,SAAQ,eAAgB,YAAW,oBAAoB;IAChF,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;gBAEb,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAWzD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAOzC,QAAQ,CAAC,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IAmCvD,mBAAmB,IAAI,OAAO;IAI9B,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY;CAerE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-alchemy.js b/dist/ethers.js/src.ts/providers/provider-alchemy.js new file mode 100644 index 0000000..2c47a22 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-alchemy.js @@ -0,0 +1,137 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AlchemyProvider = void 0; +/** + * About Alchemy + * + * @_subsection: api/providers/thirdparty:Alchemy [providers-alchemy] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.alchemyapi.io"; + case "goerli": + return "eth-goerli.g.alchemy.com"; + case "sepolia": + return "eth-sepolia.g.alchemy.com"; + case "arbitrum": + return "arb-mainnet.g.alchemy.com"; + case "arbitrum-goerli": + return "arb-goerli.g.alchemy.com"; + case "base": + return "base-mainnet.g.alchemy.com"; + case "base-goerli": + return "base-goerli.g.alchemy.com"; + case "matic": + return "polygon-mainnet.g.alchemy.com"; + case "matic-mumbai": + return "polygon-mumbai.g.alchemy.com"; + case "optimism": + return "opt-mainnet.g.alchemy.com"; + case "optimism-goerli": + return "opt-goerli.g.alchemy.com"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **AlchemyProvider** connects to the [[link-alchemy]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-alchemy-signup). + * + * @_docloc: api/providers/thirdparty + */ +class AlchemyProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = AlchemyProvider.getRequest(network, apiKey); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AlchemyProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + _perform(req) { + const _super = Object.create(null, { + _perform: { get: () => super._perform } + }); + return __awaiter(this, void 0, void 0, function* () { + // https://docs.alchemy.com/reference/trace-transaction + if (req.method === "getTransactionResult") { + const { trace, tx } = yield (0, index_js_1.resolveProperties)({ + trace: this.send("trace_transaction", [req.hash]), + tx: this.getTransaction(req.hash) + }); + if (trace == null || tx == null) { + return null; + } + let data; + let error = false; + try { + data = trace[0].result.output; + error = (trace[0].error === "Reverted"); + } + catch (error) { } + if (data) { + (0, index_js_1.assert)(!error, "an error occurred during transaction executions", "CALL_EXCEPTION", { + action: "getTransactionResult", + data, + reason: null, + transaction: tx, + invocation: null, + revert: null // @TODO + }); + return data; + } + (0, index_js_1.assert)(false, "could not parse trace result", "BAD_DATA", { value: trace }); + } + return yield _super._perform.call(this, req); + }); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v2/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = (request, response, attempt) => __awaiter(this, void 0, void 0, function* () { + (0, community_js_1.showThrottleMessage)("alchemy"); + return true; + }); + } + return request; + } +} +exports.AlchemyProvider = AlchemyProvider; +//# sourceMappingURL=provider-alchemy.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-alchemy.js.map b/dist/ethers.js/src.ts/providers/provider-alchemy.js.map new file mode 100644 index 0000000..29eec8c --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-alchemy.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-alchemy.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-alchemy.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;GAIG;AACH,gDAG2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAOxD,MAAM,aAAa,GAAG,kCAAkC,CAAA;AAExD,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,2BAA2B,CAAC;QACvC,KAAK,QAAQ;YACT,OAAO,0BAA0B,CAAC;QACtC,KAAK,SAAS;YACV,OAAO,2BAA2B,CAAC;QAEvC,KAAK,UAAU;YACX,OAAO,2BAA2B,CAAC;QACvC,KAAK,iBAAiB;YAClB,OAAO,0BAA0B,CAAC;QACtC,KAAK,MAAM;YACP,OAAO,4BAA4B,CAAC;QACxC,KAAK,aAAa;YACd,OAAO,2BAA2B,CAAC;QACvC,KAAK,OAAO;YACR,OAAO,+BAA+B,CAAC;QAC3C,KAAK,cAAc;YACf,OAAO,8BAA8B,CAAC;QAC1C,KAAK,UAAU;YACX,OAAO,2BAA2B,CAAC;QACvC,KAAK,iBAAiB;YAClB,OAAO,0BAA0B,CAAC;KACzC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAa,eAAgB,SAAQ,qCAAe;IAGhD,YAAY,QAAqB,EAAE,MAAsB;QACrD,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,SAAS,CAAC;SAAE;QAC/C,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC;SAAE;QAE/C,MAAM,OAAO,GAAG,eAAe,CAAC,UAAU,CAAC,OAAO,EAAE,MAAM,CAAC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sB;wBAC9B,IAAI;wBACJ,MAAM,EAAE,IAAI;wBACZ,WAAW,EAAE,EAAE;wBACf,UAAU,EAAE,IAAI;wBAChB,MAAM,EAAE,IAAI,CAAC,QAAQ;qBACxB,CAAC,CAAC;oBACH,OAAO,IAAI,CAAC;iBACf;gBAED,IAAA,iBAAM,EAAC,KAAK,EAAE,8BAA8B,EAAE,UAAU,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;aAC/E;YAED,OAAO,MAAM,OAAM,QAAQ,YAAC,GAAG,CAAC,CAAC;QACrC,CAAC;KAAA;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;IAED,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,MAAe;QAC/C,IAAI,MAAM,IAAI,IAAI,EAAE;YAAE,MAAM,GAAG,aAAa,CAAC;SAAE;QAE/C,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,OAAQ,MAAO,EAAE,CAAC,CAAC;QACvF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QAEzB,IAAI,MAAM,KAAK,aAAa,EAAE;YAC1B,OAAO,CAAC,SAAS,GAAG,CAAO,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,SAAS,CAAC,CAAC;gBAC/B,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA,CAAA;SACJ;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AA3ED,0CA2EC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ankr.d.ts b/dist/ethers.js/src.ts/providers/provider-ankr.d.ts new file mode 100644 index 0000000..eb2a8f8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ankr.d.ts @@ -0,0 +1,51 @@ +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +import type { JsonRpcError, JsonRpcPayload } from "./provider-jsonrpc.js"; +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +export declare class AnkrProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API key for the Ankr connection. + */ + readonly apiKey: string; + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, apiKey?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network: Network, apiKey?: null | string): FetchRequest; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-ankr.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ankr.d.ts.map b/dist/ethers.js/src.ts/providers/provider-ankr.d.ts.map new file mode 100644 index 0000000..742a6e0 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ankr.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ankr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,YAAY,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAqB1E;;;;;;;;GAQG;AACH,qBAAa,YAAa,SAAQ,eAAgB,YAAW,oBAAoB;IAE7E;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM;IAczD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAgBzE,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAUhE,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ankr.js b/dist/ethers.js/src.ts/providers/provider-ankr.js new file mode 100644 index 0000000..7efffe5 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ankr.js @@ -0,0 +1,112 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AnkrProvider = void 0; +/** + * [[link-ankr]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Ankr [providers-ankr] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApiKey = "9f7d929b018cdffb338517efa06f58359e86ff1ffd350bc889738523659e7972"; +function getHost(name) { + switch (name) { + case "mainnet": + return "rpc.ankr.com/eth"; + case "goerli": + return "rpc.ankr.com/eth_goerli"; + case "matic": + return "rpc.ankr.com/polygon"; + case "arbitrum": + return "rpc.ankr.com/arbitrum"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **AnkrProvider** connects to the [[link-ankr]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-ankr-signup). + */ +class AnkrProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * Create a new **AnkrProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, apiKey) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (apiKey == null) { + apiKey = defaultApiKey; + } + // Ankr does not support filterId, so we force polling + const options = { polling: true, staticNetwork: network }; + const request = AnkrProvider.getRequest(network, apiKey); + super(request, network, options); + (0, index_js_1.defineProperties)(this, { apiKey }); + } + _getProvider(chainId) { + try { + return new AnkrProvider(chainId, this.apiKey); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%apiKey%%. + */ + static getRequest(network, apiKey) { + if (apiKey == null) { + apiKey = defaultApiKey; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${apiKey}`); + request.allowGzip = true; + if (apiKey === defaultApiKey) { + request.retryFunc = (request, response, attempt) => __awaiter(this, void 0, void 0, function* () { + (0, community_js_1.showThrottleMessage)("AnkrProvider"); + return true; + }); + } + return request; + } + getRpcError(payload, error) { + if (payload.method === "eth_sendRawTransaction") { + if (error && error.error && error.error.message === "INTERNAL_ERROR: could not replace existing tx") { + error.error.message = "replacement transaction underpriced"; + } + } + return super.getRpcError(payload, error); + } + isCommunityResource() { + return (this.apiKey === defaultApiKey); + } +} +exports.AnkrProvider = AnkrProvider; +//# sourceMappingURL=provider-ankr.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ankr.js.map b/dist/ethers.js/src.ts/providers/provider-ankr.js.map new file mode 100644 index 0000000..ff05cef --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ankr.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ankr.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ankr.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAE2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAOxD,MAAM,aAAa,GAAG,kEAAkE,CAAC;AAEzF,SAAS,OAAO,CAAC,IAAY;IACzB,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS;YACV,OAAO,kBAAkB,CAAC;QAC9B,KAAK,QAAQ;YACT,OAAO,yBAAyB,CAAC;QACrC,KAAK,OAAO;YACR,OAAO,sBAAsB,CAAC;QAClC,KAAK,UAAU;YACX,OAAO,uBAAuB,CAAC;KACtC;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAGD;;;;;;;;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EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,cAAc,CAAC,CAAC;gBACpC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,WAAW,CAAC,OAAuB,EAAE,KAAmB;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,wBAAwB,EAAE;YAC7C,IAAI,KAAK,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,KAAK,CAAC,OAAO,KAAK,+CAA+C,EAAE;gBACjG,KAAK,CAAC,KAAK,CAAC,OAAO,GAAG,qCAAqC,CAAC;aAC/D;SACJ;QAED,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC;IAC7C,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;CACJ;AAnED,oCAmEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-browser.d.ts b/dist/ethers.js/src.ts/providers/provider-browser.d.ts new file mode 100644 index 0000000..f5ab219 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-browser.d.ts @@ -0,0 +1,56 @@ +import { JsonRpcApiPollingProvider } from "./provider-jsonrpc.js"; +import type { JsonRpcError, JsonRpcPayload, JsonRpcResult, JsonRpcSigner } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * The interface to an [[link-eip-1193]] provider, which is a standard + * used by most injected providers, which the [[BrowserProvider]] accepts + * and exposes the API of. + */ +export interface Eip1193Provider { + /** + * See [[link-eip-1193]] for details on this method. + */ + request(request: { + method: string; + params?: Array | Record; + }): Promise; +} +/** + * The possible additional events dispatched when using the ``"debug"`` + * event on a [[BrowserProvider]]. + */ +export type DebugEventBrowserProvider = { + action: "sendEip1193Payload"; + payload: { + method: string; + params: Array; + }; +} | { + action: "receiveEip1193Result"; + result: any; +} | { + action: "receiveEip1193Error"; + error: Error; +}; +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +export declare class BrowserProvider extends JsonRpcApiPollingProvider { + #private; + /** + * Connnect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum: Eip1193Provider, network?: Networkish); + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; + getRpcError(payload: JsonRpcPayload, error: JsonRpcError): Error; + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + hasSigner(address: number | string): Promise; + getSigner(address?: number | string): Promise; +} +//# sourceMappingURL=provider-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-browser.d.ts.map b/dist/ethers.js/src.ts/providers/provider-browser.d.ts.map new file mode 100644 index 0000000..bcb5267 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-browser.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,KAAK,EACR,YAAY,EAAE,cAAc,EAAE,aAAa,EAC3C,aAAa,EAChB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC5B;;OAEG;IACH,OAAO,CAAC,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;CACjG;AAED;;;GAGG;AACH,MAAM,MAAM,yBAAyB,GAAG;IACpC,MAAM,EAAE,oBAAoB,CAAC;IAC7B,OAAO,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,CAAA;KAAE,CAAA;CAClD,GAAG;IACA,MAAM,EAAE,sBAAsB,CAAC;IAC/B,MAAM,EAAE,GAAG,CAAA;CACd,GAAG;IACA,MAAM,EAAE,qBAAqB,CAAC;IAC9B,KAAK,EAAE,KAAK,CAAA;CACf,CAAC;AAGF;;;;GAIG;AACH,qBAAa,eAAgB,SAAQ,yBAAyB;;IAG1D;;;OAGG;gBACS,QAAQ,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,UAAU;IAqBrD,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC;IAM5E,KAAK,CAAC,OAAO,EAAE,cAAc,GAAG,KAAK,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAc1G,WAAW,CAAC,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,YAAY,GAAG,KAAK;IAkBhE;;OAEG;IACG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAYrD,SAAS,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAiBrE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-browser.js b/dist/ethers.js/src.ts/providers/provider-browser.js new file mode 100644 index 0000000..c50d099 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-browser.js @@ -0,0 +1,138 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _BrowserProvider_request; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BrowserProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +; +/** + * A **BrowserProvider** is intended to wrap an injected provider which + * adheres to the [[link-eip-1193]] standard, which most (if not all) + * currently do. + */ +class BrowserProvider extends provider_jsonrpc_js_1.JsonRpcApiPollingProvider { + /** + * Connnect to the %%ethereum%% provider, optionally forcing the + * %%network%%. + */ + constructor(ethereum, network) { + super(network, { batchMaxCount: 1 }); + _BrowserProvider_request.set(this, void 0); + __classPrivateFieldSet(this, _BrowserProvider_request, (method, params) => __awaiter(this, void 0, void 0, function* () { + const payload = { method, params }; + this.emit("debug", { action: "sendEip1193Request", payload }); + try { + const result = yield ethereum.request(payload); + this.emit("debug", { action: "receiveEip1193Result", result }); + return result; + } + catch (e) { + const error = new Error(e.message); + error.code = e.code; + error.data = e.data; + error.payload = payload; + this.emit("debug", { action: "receiveEip1193Error", error }); + throw error; + } + }), "f"); + } + send(method, params) { + const _super = Object.create(null, { + send: { get: () => super.send } + }); + return __awaiter(this, void 0, void 0, function* () { + yield this._start(); + return yield _super.send.call(this, method, params); + }); + } + _send(payload) { + return __awaiter(this, void 0, void 0, function* () { + (0, index_js_1.assertArgument)(!Array.isArray(payload), "EIP-1193 does not support batch request", "payload", payload); + try { + const result = yield __classPrivateFieldGet(this, _BrowserProvider_request, "f").call(this, payload.method, payload.params || []); + return [{ id: payload.id, result }]; + } + catch (e) { + return [{ + id: payload.id, + error: { code: e.code, data: e.data, message: e.message } + }]; + } + }); + } + getRpcError(payload, error) { + error = JSON.parse(JSON.stringify(error)); + // EIP-1193 gives us some machine-readable error codes, so rewrite + // them into + switch (error.error.code || -1) { + case 4001: + error.error.message = `ethers-user-denied: ${error.error.message}`; + break; + case 4200: + error.error.message = `ethers-unsupported: ${error.error.message}`; + break; + } + return super.getRpcError(payload, error); + } + /** + * Resolves to ``true`` if the provider manages the %%address%%. + */ + hasSigner(address) { + return __awaiter(this, void 0, void 0, function* () { + if (address == null) { + address = 0; + } + const accounts = yield this.send("eth_accounts", []); + if (typeof (address) === "number") { + return (accounts.length > address); + } + address = address.toLowerCase(); + return accounts.filter((a) => (a.toLowerCase() === address)).length !== 0; + }); + } + getSigner(address) { + const _super = Object.create(null, { + getSigner: { get: () => super.getSigner } + }); + return __awaiter(this, void 0, void 0, function* () { + if (address == null) { + address = 0; + } + if (!(yield this.hasSigner(address))) { + try { + //const resp = + yield __classPrivateFieldGet(this, _BrowserProvider_request, "f").call(this, "eth_requestAccounts", []); + //console.log("RESP", resp); + } + catch (error) { + const payload = error.payload; + throw this.getRpcError(payload, { id: payload.id, error }); + } + } + return yield _super.getSigner.call(this, address); + }); + } +} +exports.BrowserProvider = BrowserProvider; +_BrowserProvider_request = new WeakMap(); +//# sourceMappingURL=provider-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-browser.js.map b/dist/ethers.js/src.ts/providers/provider-browser.js.map new file mode 100644 index 0000000..f1b955b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-browser.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAmD;AAEnD,+DAAkE;AAkBjE,CAAC;AAkBF;;;;GAIG;AACH,MAAa,eAAgB,SAAQ,+CAAyB;IAG1D;;;OAGG;IACH,YAAY,QAAyB,EAAE,OAAoB;QACvD,KAAK,CAAC,OAAO,EAAE,EAAE,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;QAPzC,2CAAqF;QASjF,uBAAA,IAAI,4BAAY,CAAO,MAAc,EAAE,MAAwC,EAAE,EAAE;YAC/E,MAAM,OAAO,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;YACnC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,oBAAoB,EAAE,OAAO,EAAE,CAAC,CAAC;YAC9D,IAAI;gBACA,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;gBAC/C,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,EAAE,CAAC,CAAC;gBAC/D,OAAO,MAAM,CAAC;aACjB;YAAC,OAAO,CAAM,EAAE;gBACb,MAAM,KAAK,GAAG,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;gBAC7B,KAAM,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;gBACrB,KAAM,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC;gBACrB,KAAM,CAAC,OAAO,GAAG,OAAO,CAAC;gBAC/B,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,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EAAE,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;iBAC9D;aACJ;YAED,OAAO,MAAM,OAAM,SAAS,YAAC,OAAO,CAAC,CAAC;QAC1C,CAAC;KAAA;CACJ;AAlGD,0CAkGC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts b/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts new file mode 100644 index 0000000..869651f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts @@ -0,0 +1,14 @@ +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * About Cloudflare... + */ +export declare class CloudflareProvider extends JsonRpcProvider { + constructor(_network?: Networkish); +} +//# sourceMappingURL=provider-cloudflare.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts.map b/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts.map new file mode 100644 index 0000000..a8eefc6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-cloudflare.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,qBAAa,kBAAmB,SAAQ,eAAe;gBACvC,QAAQ,CAAC,EAAE,UAAU;CAMpC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-cloudflare.js b/dist/ethers.js/src.ts/providers/provider-cloudflare.js new file mode 100644 index 0000000..9e870ac --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-cloudflare.js @@ -0,0 +1,26 @@ +"use strict"; +/** + * About Cloudflare + * + * @_subsection: api/providers/thirdparty:Cloudflare [providers-cloudflare] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.CloudflareProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +/** + * About Cloudflare... + */ +class CloudflareProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + constructor(_network) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + (0, index_js_1.assertArgument)(network.name === "mainnet", "unsupported network", "network", _network); + super("https:/\/cloudflare-eth.com/", network, { staticNetwork: network }); + } +} +exports.CloudflareProvider = CloudflareProvider; +//# sourceMappingURL=provider-cloudflare.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-cloudflare.js.map b/dist/ethers.js/src.ts/providers/provider-cloudflare.js.map new file mode 100644 index 0000000..83b66cb --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-cloudflare.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-cloudflare.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-cloudflare.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,gDAAmD;AAEnD,6CAAuC;AACvC,+DAAwD;AAIxD;;GAEG;AACH,MAAa,kBAAmB,SAAQ,qCAAe;IACnD,YAAY,QAAqB;QAC7B,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,SAAS,CAAC;SAAE;QAC/C,MAAM,OAAO,GAAG,oBAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAA,yBAAc,EAAC,OAAO,CAAC,IAAI,KAAK,SAAS,EAAE,qBAAqB,EAAE,SAAS,EAAE,QAAQ,CAAC,CAAC;QACvF,KAAK,CAAC,8BAA8B,EAAE,OAAO,EAAE,EAAE,aAAa,EAAE,OAAO,EAAE,CAAC,CAAC;IAC/E,CAAC;CACJ;AAPD,gDAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts b/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts new file mode 100644 index 0000000..13252f6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts @@ -0,0 +1,141 @@ +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +import { Contract } from "../contract/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { NetworkPlugin } from "./plugins-network.js"; +import { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { TransactionRequest } from "./provider.js"; +/** + * When subscribing to the ``"debug"`` event on an Etherscan-based + * provider, the events receive a **DebugEventEtherscanProvider** + * payload. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export type DebugEventEtherscanProvider = { + action: "sendRequest"; + id: number; + url: string; + payload: Record; +} | { + action: "receiveRequest"; + id: number; + result: any; +} | { + action: "receiveError"; + id: number; + error: any; +}; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanPlugin extends NetworkPlugin { + /** + * The Etherscan API base URL. + */ + readonly baseUrl: string; + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl: string); + clone(): EtherscanPlugin; +} +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +export declare class EtherscanProvider extends AbstractProvider { + #private; + /** + * The connected network. + */ + readonly network: Network; + /** + * The API key or null if using the community provided bandwidth. + */ + readonly apiKey: null | string; + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network?: Networkish, _apiKey?: string); + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + */ + getBaseUrl(): string; + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module: string, params: Record): string; + /** + * Returns the URL for using POST requests. + */ + getPostUrl(): string; + /** + * Returns the parameters for using POST requests. + */ + getPostData(module: string, params: Record): Record; + detectNetwork(): Promise; + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + fetch(module: string, params: Record, post?: boolean): Promise; + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction: TransactionRequest): Record; + /** + * Throws the normalized Etherscan error. + */ + _checkError(req: PerformActionRequest, error: Error, transaction: any): never; + _detectNetwork(): Promise; + _perform(req: PerformActionRequest): Promise; + getNetwork(): Promise; + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + getEtherPrice(): Promise; + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + getContract(_address: string): Promise; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-etherscan.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts.map b/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts.map new file mode 100644 index 0000000..fd1f2b4 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-etherscan.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan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.js/src.ts/providers/provider-etherscan.js b/dist/ethers.js/src.ts/providers/provider-etherscan.js new file mode 100644 index 0000000..93bef08 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-etherscan.js @@ -0,0 +1,590 @@ +"use strict"; +/** + * [[link-etherscan]] provides a third-party service for connecting to + * various blockchains over a combination of JSON-RPC and custom API + * endpoints. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection api/providers/thirdparty:Etherscan [providers-etherscan] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _EtherscanProvider_plugin; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EtherscanProvider = exports.EtherscanPlugin = void 0; +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../contract/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const network_js_1 = require("./network.js"); +const plugins_network_js_1 = require("./plugins-network.js"); +const community_js_1 = require("./community.js"); +const THROTTLE = 2000; +function isPromise(value) { + return (value && typeof (value.then) === "function"); +} +const EtherscanPluginId = "org.ethers.plugins.provider.Etherscan"; +/** + * A Network can include an **EtherscanPlugin** to provide + * a custom base URL. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanPlugin extends plugins_network_js_1.NetworkPlugin { + /** + * Creates a new **EtherscanProvider** which will use + * %%baseUrl%%. + */ + constructor(baseUrl) { + super(EtherscanPluginId); + (0, index_js_4.defineProperties)(this, { baseUrl }); + } + clone() { + return new EtherscanPlugin(this.baseUrl); + } +} +exports.EtherscanPlugin = EtherscanPlugin; +const skipKeys = ["enableCcipRead"]; +let nextId = 1; +/** + * The **EtherscanBaseProvider** is the super-class of + * [[EtherscanProvider]], which should generally be used instead. + * + * Since the **EtherscanProvider** includes additional code for + * [[Contract]] access, in //rare cases// that contracts are not + * used, this class can reduce code size. + * + * @_docloc: api/providers/thirdparty:Etherscan + */ +class EtherscanProvider extends abstract_provider_js_1.AbstractProvider { + /** + * Creates a new **EtherscanBaseProvider**. + */ + constructor(_network, _apiKey) { + const apiKey = (_apiKey != null) ? _apiKey : null; + super(); + _EtherscanProvider_plugin.set(this, void 0); + const network = network_js_1.Network.from(_network); + __classPrivateFieldSet(this, _EtherscanProvider_plugin, network.getPlugin(EtherscanPluginId), "f"); + (0, index_js_4.defineProperties)(this, { apiKey, network }); + // Test that the network is supported by Etherscan + this.getBaseUrl(); + } + /** + * Returns the base URL. + * + * If an [[EtherscanPlugin]] is configured on the + * [[EtherscanBaseProvider_network]], returns the plugin's + * baseUrl. + */ + getBaseUrl() { + if (__classPrivateFieldGet(this, _EtherscanProvider_plugin, "f")) { + return __classPrivateFieldGet(this, _EtherscanProvider_plugin, "f").baseUrl; + } + switch (this.network.name) { + case "mainnet": + return "https:/\/api.etherscan.io"; + case "goerli": + return "https:/\/api-goerli.etherscan.io"; + case "sepolia": + return "https:/\/api-sepolia.etherscan.io"; + case "arbitrum": + return "https:/\/api.arbiscan.io"; + case "arbitrum-goerli": + return "https:/\/api-goerli.arbiscan.io"; + case "matic": + return "https:/\/api.polygonscan.com"; + case "matic-mumbai": + return "https:/\/api-testnet.polygonscan.com"; + case "optimism": + return "https:/\/api-optimistic.etherscan.io"; + case "optimism-goerli": + return "https:/\/api-goerli-optimistic.etherscan.io"; + case "bnb": + return "http:/\/api.bscscan.com"; + case "bnbt": + return "http:/\/api-testnet.bscscan.com"; + default: + } + (0, index_js_4.assertArgument)(false, "unsupported network", "network", this.network); + } + /** + * Returns the URL for the %%module%% and %%params%%. + */ + getUrl(module, params) { + const query = Object.keys(params).reduce((accum, key) => { + const value = params[key]; + if (value != null) { + accum += `&${key}=${value}`; + } + return accum; + }, ""); + const apiKey = ((this.apiKey) ? `&apikey=${this.apiKey}` : ""); + return `${this.getBaseUrl()}/api?module=${module}${query}${apiKey}`; + } + /** + * Returns the URL for using POST requests. + */ + getPostUrl() { + return `${this.getBaseUrl()}/api`; + } + /** + * Returns the parameters for using POST requests. + */ + getPostData(module, params) { + params.module = module; + params.apikey = this.apiKey; + return params; + } + detectNetwork() { + return __awaiter(this, void 0, void 0, function* () { + return this.network; + }); + } + /** + * Resolves to the result of calling %%module%% with %%params%%. + * + * If %%post%%, the request is made as a POST request. + */ + fetch(module, params, post) { + return __awaiter(this, void 0, void 0, function* () { + const id = nextId++; + const url = (post ? this.getPostUrl() : this.getUrl(module, params)); + const payload = (post ? this.getPostData(module, params) : null); + this.emit("debug", { action: "sendRequest", id, url, payload: payload }); + const request = new index_js_4.FetchRequest(url); + request.setThrottleParams({ slotInterval: 1000 }); + request.retryFunc = (req, resp, attempt) => { + if (this.isCommunityResource()) { + (0, community_js_1.showThrottleMessage)("Etherscan"); + } + return Promise.resolve(true); + }; + request.processFunc = (request, response) => __awaiter(this, void 0, void 0, function* () { + const result = response.hasBody() ? JSON.parse((0, index_js_4.toUtf8String)(response.body)) : {}; + const throttle = ((typeof (result.result) === "string") ? result.result : "").toLowerCase().indexOf("rate limit") >= 0; + if (module === "proxy") { + // This JSON response indicates we are being throttled + if (result && result.status == 0 && result.message == "NOTOK" && throttle) { + this.emit("debug", { action: "receiveError", id, reason: "proxy-NOTOK", error: result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + else { + if (throttle) { + this.emit("debug", { action: "receiveError", id, reason: "null result", error: result.result }); + response.throwThrottleError(result.result, THROTTLE); + } + } + return response; + }); + if (payload) { + request.setHeader("content-type", "application/x-www-form-urlencoded; charset=UTF-8"); + request.body = Object.keys(payload).map((k) => `${k}=${payload[k]}`).join("&"); + } + const response = yield request.send(); + try { + response.assertOk(); + } + catch (error) { + this.emit("debug", { action: "receiveError", id, error, reason: "assertOk" }); + (0, index_js_4.assert)(false, "response error", "SERVER_ERROR", { request, response }); + } + if (!response.hasBody()) { + this.emit("debug", { action: "receiveError", id, error: "missing body", reason: "null body" }); + (0, index_js_4.assert)(false, "missing response", "SERVER_ERROR", { request, response }); + } + const result = JSON.parse((0, index_js_4.toUtf8String)(response.body)); + if (module === "proxy") { + if (result.jsonrpc != "2.0") { + this.emit("debug", { action: "receiveError", id, result, reason: "invalid JSON-RPC" }); + (0, index_js_4.assert)(false, "invalid JSON-RPC response (missing jsonrpc='2.0')", "SERVER_ERROR", { request, response, info: { result } }); + } + if (result.error) { + this.emit("debug", { action: "receiveError", id, result, reason: "JSON-RPC error" }); + (0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + else { + // getLogs, getHistory have weird success responses + if (result.status == 0 && (result.message === "No records found" || result.message === "No transactions found")) { + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + if (result.status != 1 || (typeof (result.message) === "string" && !result.message.match(/^OK/))) { + this.emit("debug", { action: "receiveError", id, result }); + (0, index_js_4.assert)(false, "error response", "SERVER_ERROR", { request, response, info: { result } }); + } + this.emit("debug", { action: "receiveRequest", id, result }); + return result.result; + } + }); + } + /** + * Returns %%transaction%% normalized for the Etherscan API. + */ + _getTransactionPostData(transaction) { + const result = {}; + for (let key in transaction) { + if (skipKeys.indexOf(key) >= 0) { + continue; + } + if (transaction[key] == null) { + continue; + } + let value = transaction[key]; + if (key === "type" && value === 0) { + continue; + } + if (key === "blockTag" && value === "latest") { + continue; + } + // Quantity-types require no leading zero, unless 0 + if ({ type: true, gasLimit: true, gasPrice: true, maxFeePerGs: true, maxPriorityFeePerGas: true, nonce: true, value: true }[key]) { + value = (0, index_js_4.toQuantity)(value); + } + else if (key === "accessList") { + value = "[" + (0, index_js_3.accessListify)(value).map((set) => { + return `{address:"${set.address}",storageKeys:["${set.storageKeys.join('","')}"]}`; + }).join(",") + "]"; + } + else { + value = (0, index_js_4.hexlify)(value); + } + result[key] = value; + } + return result; + } + /** + * Throws the normalized Etherscan error. + */ + _checkError(req, error, transaction) { + // Pull any message out if, possible + let message = ""; + if ((0, index_js_4.isError)(error, "SERVER_ERROR")) { + // Check for an error emitted by a proxy call + try { + message = error.info.result.error.message; + } + catch (e) { } + if (!message) { + try { + message = error.info.message; + } + catch (e) { } + } + } + if (req.method === "estimateGas") { + if (!message.match(/revert/i) && message.match(/insufficient funds/i)) { + (0, index_js_4.assert)(false, "insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: req.transaction + }); + } + } + if (req.method === "call" || req.method === "estimateGas") { + if (message.match(/execution reverted/i)) { + let data = ""; + try { + data = error.info.result.error.data; + } + catch (error) { } + const e = index_js_1.AbiCoder.getBuiltinCallException(req.method, req.transaction, data); + e.info = { request: req, error }; + throw e; + } + } + if (message) { + if (req.method === "broadcastTransaction") { + const transaction = index_js_3.Transaction.from(req.signedTransaction); + if (message.match(/replacement/i) && message.match(/underpriced/i)) { + (0, index_js_4.assert)(false, "replacement fee too low", "REPLACEMENT_UNDERPRICED", { + transaction + }); + } + if (message.match(/insufficient funds/)) { + (0, index_js_4.assert)(false, "insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction + }); + } + if (message.match(/same hash was already imported|transaction nonce is too low|nonce too low/)) { + (0, index_js_4.assert)(false, "nonce has already been used", "NONCE_EXPIRED", { + transaction + }); + } + } + } + // Something we could not process + throw error; + } + _detectNetwork() { + return __awaiter(this, void 0, void 0, function* () { + return this.network; + }); + } + _perform(req) { + const _super = Object.create(null, { + _perform: { get: () => super._perform } + }); + return __awaiter(this, void 0, void 0, function* () { + switch (req.method) { + case "chainId": + return this.network.chainId; + case "getBlockNumber": + return this.fetch("proxy", { action: "eth_blockNumber" }); + case "getGasPrice": + return this.fetch("proxy", { action: "eth_gasPrice" }); + case "getPriorityFee": + // This is temporary until Etherscan completes support + if (this.network.name === "mainnet") { + return "1000000000"; + } + else if (this.network.name === "optimism") { + return "1000000"; + } + else { + throw new Error("fallback onto the AbstractProvider default"); + } + /* Working with Etherscan to get this added: + try { + const test = await this.fetch("proxy", { + action: "eth_maxPriorityFeePerGas" + }); + console.log(test); + return test; + } catch (e) { + console.log("DEBUG", e); + throw e; + } + */ + /* This might be safe; but due to rounding neither myself + or Etherscan are necessarily comfortable with this. :) + try { + const result = await this.fetch("gastracker", { action: "gasoracle" }); + console.log(result); + const gasPrice = parseUnits(result.SafeGasPrice, "gwei"); + const baseFee = parseUnits(result.suggestBaseFee, "gwei"); + const priorityFee = gasPrice - baseFee; + if (priorityFee < 0) { throw new Error("negative priority fee; defer to abstract provider default"); } + return priorityFee; + } catch (error) { + console.log("DEBUG", error); + throw error; + } + */ + case "getBalance": + // Returns base-10 result + return this.fetch("account", { + action: "balance", + address: req.address, + tag: req.blockTag + }); + case "getTransactionCount": + return this.fetch("proxy", { + action: "eth_getTransactionCount", + address: req.address, + tag: req.blockTag + }); + case "getCode": + return this.fetch("proxy", { + action: "eth_getCode", + address: req.address, + tag: req.blockTag + }); + case "getStorage": + return this.fetch("proxy", { + action: "eth_getStorageAt", + address: req.address, + position: req.position, + tag: req.blockTag + }); + case "broadcastTransaction": + return this.fetch("proxy", { + action: "eth_sendRawTransaction", + hex: req.signedTransaction + }, true).catch((error) => { + return this._checkError(req, error, req.signedTransaction); + }); + case "getBlock": + if ("blockTag" in req) { + return this.fetch("proxy", { + action: "eth_getBlockByNumber", + tag: req.blockTag, + boolean: (req.includeTransactions ? "true" : "false") + }); + } + (0, index_js_4.assert)(false, "getBlock by blockHash not supported by Etherscan", "UNSUPPORTED_OPERATION", { + operation: "getBlock(blockHash)" + }); + case "getTransaction": + return this.fetch("proxy", { + action: "eth_getTransactionByHash", + txhash: req.hash + }); + case "getTransactionReceipt": + return this.fetch("proxy", { + action: "eth_getTransactionReceipt", + txhash: req.hash + }); + case "call": { + if (req.blockTag !== "latest") { + throw new Error("EtherscanProvider does not support blockTag for call"); + } + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_call"; + try { + return yield this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + case "estimateGas": { + const postData = this._getTransactionPostData(req.transaction); + postData.module = "proxy"; + postData.action = "eth_estimateGas"; + try { + return yield this.fetch("proxy", postData, true); + } + catch (error) { + return this._checkError(req, error, req.transaction); + } + } + /* + case "getLogs": { + // Needs to complain if more than one address is passed in + const args: Record = { action: "getLogs" } + + if (params.filter.fromBlock) { + args.fromBlock = checkLogTag(params.filter.fromBlock); + } + + if (params.filter.toBlock) { + args.toBlock = checkLogTag(params.filter.toBlock); + } + + if (params.filter.address) { + args.address = params.filter.address; + } + + // @TODO: We can handle slightly more complicated logs using the logs API + if (params.filter.topics && params.filter.topics.length > 0) { + if (params.filter.topics.length > 1) { + logger.throwError("unsupported topic count", Logger.Errors.UNSUPPORTED_OPERATION, { topics: params.filter.topics }); + } + if (params.filter.topics.length === 1) { + const topic0 = params.filter.topics[0]; + if (typeof(topic0) !== "string" || topic0.length !== 66) { + logger.throwError("unsupported topic format", Logger.Errors.UNSUPPORTED_OPERATION, { topic0: topic0 }); + } + args.topic0 = topic0; + } + } + + const logs: Array = await this.fetch("logs", args); + + // Cache txHash => blockHash + let blocks: { [tag: string]: string } = {}; + + // Add any missing blockHash to the logs + for (let i = 0; i < logs.length; i++) { + const log = logs[i]; + if (log.blockHash != null) { continue; } + if (blocks[log.blockNumber] == null) { + const block = await this.getBlock(log.blockNumber); + if (block) { + blocks[log.blockNumber] = block.hash; + } + } + + log.blockHash = blocks[log.blockNumber]; + } + + return logs; + } + */ + default: + break; + } + return _super._perform.call(this, req); + }); + } + getNetwork() { + return __awaiter(this, void 0, void 0, function* () { + return this.network; + }); + } + /** + * Resolves to the current price of ether. + * + * This returns ``0`` on any network other than ``mainnet``. + */ + getEtherPrice() { + return __awaiter(this, void 0, void 0, function* () { + if (this.network.name !== "mainnet") { + return 0.0; + } + return parseFloat((yield this.fetch("stats", { action: "ethprice" })).ethusd); + }); + } + /** + * Resolves to a [Contract]] for %%address%%, using the + * Etherscan API to retreive the Contract ABI. + */ + getContract(_address) { + return __awaiter(this, void 0, void 0, function* () { + let address = this._getAddress(_address); + if (isPromise(address)) { + address = yield address; + } + try { + const resp = yield this.fetch("contract", { + action: "getabi", address + }); + const abi = JSON.parse(resp); + return new index_js_2.Contract(address, abi, this); + } + catch (error) { + return null; + } + }); + } + isCommunityResource() { + return (this.apiKey == null); + } +} +exports.EtherscanProvider = EtherscanProvider; +_EtherscanProvider_plugin = new WeakMap(); +//# sourceMappingURL=provider-etherscan.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-etherscan.js.map b/dist/ethers.js/src.ts/providers/provider-etherscan.js.map new file mode 100644 index 0000000..b8bf142 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-etherscan.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-etherscan.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-etherscan.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;GAkBG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,8CAA2C;AAC3C,mDAAgD;AAChD,sDAAqE;AACrE,gDAO4B;AAE5B,iEAA0D;AAC1D,6CAAuC;AACvC,6DAAqD;AACrD,iDAAqD;AAOrD,MAAM,QAAQ,GAAG,IAAI,CAAC;AAEtB,SAAS,SAAS,CAAU,KAAU;IAClC,OAAO,CAAC,KAAK,IAAI,OAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,UAAU,CAAC,CAAC;AACxD,CAAC;AAyBD,MAAM,iBAAiB,GAAG,uCAAuC,CAAC;AAElE;;;;;GAKG;AACH,MAAa,eAAgB,SAAQ,kCAAa;IAM9C;;;OAGG;IACH,YAAY,OAAe;QACvB,KAAK,CAAC,iBAAiB,CAAC,CAAC;QACzB,IAAA,2BAAgB,EAAkB,IAAI,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,KAAK;QACD,OAAO,IAAI,eAAe,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,CAAC;CACJ;AAlBD,0CAkBC;AAED,MAAM,QAAQ,GAAG,CAAE,gBAAgB,CAAE,CAAC;AAEtC,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,uCAAgB;IAcnD;;OAEG;IACH,YAAY,QAAqB,EAAE,OAAgB;QAC/C,MAAM,MAAM,GAAG,CAAC,OAAO,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,OAAO,CAAA,CAAC,CAAC,IAAI,CAAC;QAEjD,KAAK,EAAE,CAAC;QARH,4CA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EAAE;oBAC1C,MAAM,EAAE,QAAQ,EAAE,OAAO;iBAAE,CAAC,CAAC;gBAC7B,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAC7B,OAAO,IAAI,mBAAQ,CAAC,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;aAC3C;YAAC,OAAO,KAAK,EAAE;gBACZ,OAAO,IAAI,CAAC;aACf;QACL,CAAC;KAAA;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC;IACjC,CAAC;CACJ;AArhBD,8CAqhBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-fallback.d.ts b/dist/ethers.js/src.ts/providers/provider-fallback.d.ts new file mode 100644 index 0000000..eaba025 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-fallback.d.ts @@ -0,0 +1,115 @@ +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import type { PerformActionRequest } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +/** + * A configuration entry for how to use a [[Provider]]. + */ +export interface FallbackProviderConfig { + /** + * The provider. + */ + provider: AbstractProvider; + /** + * The amount of time to wait before kicking off the next provider. + * + * Any providers that have not responded can still respond and be + * counted, but this ensures new providers start. + */ + stallTimeout?: number; + /** + * The priority. Lower priority providers are dispatched first. + */ + priority?: number; + /** + * The amount of weight a provider is given against the quorum. + */ + weight?: number; +} +/** + * The statistics and state maintained for a [[Provider]]. + */ +export interface FallbackProviderState extends Required { + /** + * The most recent blockNumber this provider has reported (-2 if none). + */ + blockNumber: number; + /** + * The number of total requests ever sent to this provider. + */ + requests: number; + /** + * The number of responses that errored. + */ + errorResponses: number; + /** + * The number of responses that occured after the result resolved. + */ + lateResponses: number; + /** + * How many times syncing was required to catch up the expected block. + */ + outOfSync: number; + /** + * The number of requests which reported unsupported operation. + */ + unsupportedEvents: number; + /** + * A rolling average (5% current duration) for response time. + */ + rollingDuration: number; + /** + * The ratio of quorum-agreed results to total. + */ + score: number; +} +/** + * Additional options to configure a [[FallbackProvider]]. + */ +export type FallbackProviderOptions = { + quorum?: number; + eventQuorum?: number; + eventWorkers?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resiliance by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +export declare class FallbackProvider extends AbstractProvider { + #private; + /** + * The number of backends that must agree on a value before it is + * accpeted. + */ + readonly quorum: number; + /** + * @_ignore: + */ + readonly eventQuorum: number; + /** + * @_ignore: + */ + readonly eventWorkers: number; + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers: Array, network?: Networkish, options?: FallbackProviderOptions); + get providerConfigs(): Array; + _detectNetwork(): Promise; + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + _translatePerform(provider: AbstractProvider, req: PerformActionRequest): Promise; + _perform(req: PerformActionRequest): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-fallback.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-fallback.d.ts.map b/dist/ethers.js/src.ts/providers/provider-fallback.d.ts.map new file mode 100644 index 0000000..17ab480 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-fallback.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-fallback.ts"],"names":[],"mappings":"AAUA,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AA6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AC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,uBAAuB;IA8BhI,IAAI,eAAe,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAQlD;IAEK,cAAc,IAAI,OAAO,CAAC,OAAO,CAAC;IASxC;;OAEG;IACG,iBAAiB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,GAAG,CAAC;IA6QtF,QAAQ,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,oBAAoB,GAAG,OAAO,CAAC,CAAC,CAAC;IA8ExD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAMjC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-fallback.js b/dist/ethers.js/src.ts/providers/provider-fallback.js new file mode 100644 index 0000000..556ddd8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-fallback.js @@ -0,0 +1,634 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _FallbackProvider_instances, _FallbackProvider_configs, _FallbackProvider_height, _FallbackProvider_initialSyncPromise, _FallbackProvider_getNextConfig, _FallbackProvider_addRunner, _FallbackProvider_initialSync, _FallbackProvider_checkQuorum, _FallbackProvider_waitForQuorum; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FallbackProvider = void 0; +/** + * A **FallbackProvider** providers resiliance, security and performatnce + * in a way that is customizable and configurable. + * + * @_section: api/providers/fallback-provider:Fallback Provider [about-fallback-provider] + */ +const index_js_1 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const network_js_1 = require("./network.js"); +const BN_1 = BigInt("1"); +const BN_2 = BigInt("2"); +function shuffle(array) { + for (let i = array.length - 1; i > 0; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const tmp = array[i]; + array[i] = array[j]; + array[j] = tmp; + } +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getTime() { return (new Date()).getTime(); } +function stringify(value) { + return JSON.stringify(value, (key, value) => { + if (typeof (value) === "bigint") { + return { type: "bigint", value: value.toString() }; + } + return value; + }); +} +; +const defaultConfig = { stallTimeout: 400, priority: 1, weight: 1 }; +const defaultState = { + blockNumber: -2, requests: 0, lateResponses: 0, errorResponses: 0, + outOfSync: -1, unsupportedEvents: 0, rollingDuration: 0, score: 0, + _network: null, _updateNumber: null, _totalTime: 0, + _lastFatalError: null, _lastFatalErrorTimestamp: 0 +}; +function waitForSync(config, blockNumber) { + return __awaiter(this, void 0, void 0, function* () { + while (config.blockNumber < 0 || config.blockNumber < blockNumber) { + if (!config._updateNumber) { + config._updateNumber = (() => __awaiter(this, void 0, void 0, function* () { + try { + const blockNumber = yield config.provider.getBlockNumber(); + if (blockNumber > config.blockNumber) { + config.blockNumber = blockNumber; + } + } + catch (error) { + config.blockNumber = -2; + config._lastFatalError = error; + config._lastFatalErrorTimestamp = getTime(); + } + config._updateNumber = null; + }))(); + } + yield config._updateNumber; + config.outOfSync++; + if (config._lastFatalError) { + break; + } + } + }); +} +function _normalize(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[" + (value.map(_normalize)).join(",") + "]"; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return _normalize(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + case "number": + return BigInt(value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{" + keys.map((k) => `${JSON.stringify(k)}:${_normalize(value[k])}`).join(",") + "}"; + } + } + console.log("Could not serialize", value); + throw new Error("Hmm..."); +} +function normalizeResult(value) { + if ("error" in value) { + const error = value.error; + return { tag: _normalize(error), value: error }; + } + const result = value.result; + return { tag: _normalize(result), value: result }; +} +// This strategy picks the highest weight result, as long as the weight is +// equal to or greater than quorum +function checkQuorum(quorum, results) { + const tally = new Map(); + for (const { value, tag, weight } of results) { + const t = tally.get(tag) || { value, weight: 0 }; + t.weight += weight; + tally.set(tag, t); + } + let best = null; + for (const r of tally.values()) { + if (r.weight >= quorum && (!best || r.weight > best.weight)) { + best = r; + } + } + if (best) { + return best.value; + } + return undefined; +} +function getMedian(quorum, results) { + let resultWeight = 0; + const errorMap = new Map(); + let bestError = null; + const values = []; + for (const { value, tag, weight } of results) { + if (value instanceof Error) { + const e = errorMap.get(tag) || { value, weight: 0 }; + e.weight += weight; + errorMap.set(tag, e); + if (bestError == null || e.weight > bestError.weight) { + bestError = e; + } + } + else { + values.push(BigInt(value)); + resultWeight += weight; + } + } + if (resultWeight < quorum) { + // We have quorum for an error + if (bestError && bestError.weight >= quorum) { + return bestError.value; + } + // We do not have quorum for a result + return undefined; + } + // Get the sorted values + values.sort((a, b) => ((a < b) ? -1 : (b > a) ? 1 : 0)); + const mid = Math.floor(values.length / 2); + // Odd-length; take the middle value + if (values.length % 2) { + return values[mid]; + } + // Even length; take the ceiling of the mean of the center two values + return (values[mid - 1] + values[mid] + BN_1) / BN_2; +} +function getAnyResult(quorum, results) { + // If any value or error meets quorum, that is our preferred result + const result = checkQuorum(quorum, results); + if (result !== undefined) { + return result; + } + // Otherwise, do we have any result? + for (const r of results) { + if (r.value) { + return r.value; + } + } + // Nope! + return undefined; +} +function getFuzzyMode(quorum, results) { + if (quorum === 1) { + return (0, index_js_1.getNumber)(getMedian(quorum, results), "%internal"); + } + const tally = new Map(); + const add = (result, weight) => { + const t = tally.get(result) || { result, weight: 0 }; + t.weight += weight; + tally.set(result, t); + }; + for (const { weight, value } of results) { + const r = (0, index_js_1.getNumber)(value); + add(r - 1, weight); + add(r, weight); + add(r + 1, weight); + } + let bestWeight = 0; + let bestResult = undefined; + for (const { weight, result } of tally.values()) { + // Use this result, if this result meets quorum and has either: + // - a better weight + // - or equal weight, but the result is larger + if (weight >= quorum && (weight > bestWeight || (bestResult != null && weight === bestWeight && result > bestResult))) { + bestWeight = weight; + bestResult = result; + } + } + return bestResult; +} +/** + * A **FallbackProvider** manages several [[Providers]] providing + * resiliance by switching between slow or misbehaving nodes, security + * by requiring multiple backends to aggree and performance by allowing + * faster backends to respond earlier. + * + */ +class FallbackProvider extends abstract_provider_js_1.AbstractProvider { + /** + * Creates a new **FallbackProvider** with %%providers%% connected to + * %%network%%. + * + * If a [[Provider]] is included in %%providers%%, defaults are used + * for the configuration. + */ + constructor(providers, network, options) { + super(network, options); + _FallbackProvider_instances.add(this); + _FallbackProvider_configs.set(this, void 0); + _FallbackProvider_height.set(this, void 0); + _FallbackProvider_initialSyncPromise.set(this, void 0); + __classPrivateFieldSet(this, _FallbackProvider_configs, providers.map((p) => { + if (p instanceof abstract_provider_js_1.AbstractProvider) { + return Object.assign({ provider: p }, defaultConfig, defaultState); + } + else { + return Object.assign({}, defaultConfig, p, defaultState); + } + }), "f"); + __classPrivateFieldSet(this, _FallbackProvider_height, -2, "f"); + __classPrivateFieldSet(this, _FallbackProvider_initialSyncPromise, null, "f"); + if (options && options.quorum != null) { + this.quorum = options.quorum; + } + else { + this.quorum = Math.ceil(__classPrivateFieldGet(this, _FallbackProvider_configs, "f").reduce((accum, config) => { + accum += config.weight; + return accum; + }, 0) / 2); + } + this.eventQuorum = 1; + this.eventWorkers = 1; + (0, index_js_1.assertArgument)(this.quorum <= __classPrivateFieldGet(this, _FallbackProvider_configs, "f").reduce((a, c) => (a + c.weight), 0), "quorum exceed provider wieght", "quorum", this.quorum); + } + get providerConfigs() { + return __classPrivateFieldGet(this, _FallbackProvider_configs, "f").map((c) => { + const result = Object.assign({}, c); + for (const key in result) { + if (key[0] === "_") { + delete result[key]; + } + } + return result; + }); + } + _detectNetwork() { + return __awaiter(this, void 0, void 0, function* () { + return network_js_1.Network.from((0, index_js_1.getBigInt)(yield this._perform({ method: "chainId" }))); + }); + } + // @TODO: Add support to select providers to be the event subscriber + //_getSubscriber(sub: Subscription): Subscriber { + // throw new Error("@TODO"); + //} + /** + * Transforms a %%req%% into the correct method call on %%provider%%. + */ + _translatePerform(provider, req) { + return __awaiter(this, void 0, void 0, function* () { + switch (req.method) { + case "broadcastTransaction": + return yield provider.broadcastTransaction(req.signedTransaction); + case "call": + return yield provider.call(Object.assign({}, req.transaction, { blockTag: req.blockTag })); + case "chainId": + return (yield provider.getNetwork()).chainId; + case "estimateGas": + return yield provider.estimateGas(req.transaction); + case "getBalance": + return yield provider.getBalance(req.address, req.blockTag); + case "getBlock": { + const block = ("blockHash" in req) ? req.blockHash : req.blockTag; + return yield provider.getBlock(block, req.includeTransactions); + } + case "getBlockNumber": + return yield provider.getBlockNumber(); + case "getCode": + return yield provider.getCode(req.address, req.blockTag); + case "getGasPrice": + return (yield provider.getFeeData()).gasPrice; + case "getPriorityFee": + return (yield provider.getFeeData()).maxPriorityFeePerGas; + case "getLogs": + return yield provider.getLogs(req.filter); + case "getStorage": + return yield provider.getStorage(req.address, req.position, req.blockTag); + case "getTransaction": + return yield provider.getTransaction(req.hash); + case "getTransactionCount": + return yield provider.getTransactionCount(req.address, req.blockTag); + case "getTransactionReceipt": + return yield provider.getTransactionReceipt(req.hash); + case "getTransactionResult": + return yield provider.getTransactionResult(req.hash); + } + }); + } + _perform(req) { + return __awaiter(this, void 0, void 0, function* () { + // Broadcasting a transaction is rare (ish) and already incurs + // a cost on the user, so spamming is safe-ish. Just send it to + // every backend. + if (req.method === "broadcastTransaction") { + // Once any broadcast provides a positive result, use it. No + // need to wait for anyone else + const results = __classPrivateFieldGet(this, _FallbackProvider_configs, "f").map((c) => null); + const broadcasts = __classPrivateFieldGet(this, _FallbackProvider_configs, "f").map(({ provider, weight }, index) => __awaiter(this, void 0, void 0, function* () { + try { + const result = yield provider._perform(req); + results[index] = Object.assign(normalizeResult({ result }), { weight }); + } + catch (error) { + results[index] = Object.assign(normalizeResult({ error }), { weight }); + } + })); + // As each promise finishes... + while (true) { + // Check for a valid broadcast result + const done = results.filter((r) => (r != null)); + for (const { value } of done) { + if (!(value instanceof Error)) { + return value; + } + } + // Check for a legit broadcast error (one which we cannot + // recover from; some nodes may return the following red + // herring events: + // - alredy seend (UNKNOWN_ERROR) + // - NONCE_EXPIRED + // - REPLACEMENT_UNDERPRICED + const result = checkQuorum(this.quorum, results.filter((r) => (r != null))); + if ((0, index_js_1.isError)(result, "INSUFFICIENT_FUNDS")) { + throw result; + } + // Kick off the next provider (if any) + const waiting = broadcasts.filter((b, i) => (results[i] == null)); + if (waiting.length === 0) { + break; + } + yield Promise.race(waiting); + } + // Use standard quorum results; any result was returned above, + // so this will find any error that met quorum if any + const result = getAnyResult(this.quorum, results); + (0, index_js_1.assert)(result !== undefined, "problem multi-broadcasting", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: results.map(stringify) } + }); + if (result instanceof Error) { + throw result; + } + return result; + } + yield __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_initialSync).call(this); + // Bootstrap enough runners to meet quorum + const running = new Set(); + let inflightQuorum = 0; + while (true) { + const runner = __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_addRunner).call(this, running, req); + if (runner == null) { + break; + } + inflightQuorum += runner.config.weight; + if (inflightQuorum >= this.quorum) { + break; + } + } + const result = yield __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_waitForQuorum).call(this, running, req); + // Track requests sent to a provider that are still + // outstanding after quorum has been otherwise found + for (const runner of running) { + if (runner.perform && runner.result == null) { + runner.config.lateResponses++; + } + } + return result; + }); + } + destroy() { + const _super = Object.create(null, { + destroy: { get: () => super.destroy } + }); + return __awaiter(this, void 0, void 0, function* () { + for (const { provider } of __classPrivateFieldGet(this, _FallbackProvider_configs, "f")) { + provider.destroy(); + } + _super.destroy.call(this); + }); + } +} +exports.FallbackProvider = FallbackProvider; +_FallbackProvider_configs = new WeakMap(), _FallbackProvider_height = new WeakMap(), _FallbackProvider_initialSyncPromise = new WeakMap(), _FallbackProvider_instances = new WeakSet(), _FallbackProvider_getNextConfig = function _FallbackProvider_getNextConfig(running) { + // @TODO: Maybe do a check here to favour (heavily) providers that + // do not require waitForSync and disfavour providers that + // seem down-ish or are behaving slowly + const configs = Array.from(running).map((r) => r.config); + // Shuffle the states, sorted by priority + const allConfigs = __classPrivateFieldGet(this, _FallbackProvider_configs, "f").slice(); + shuffle(allConfigs); + allConfigs.sort((a, b) => (a.priority - b.priority)); + for (const config of allConfigs) { + if (config._lastFatalError) { + continue; + } + if (configs.indexOf(config) === -1) { + return config; + } + } + return null; +}, _FallbackProvider_addRunner = function _FallbackProvider_addRunner(running, req) { + const config = __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_getNextConfig).call(this, running); + // No runners available + if (config == null) { + return null; + } + // Create a new runner + const runner = { + config, result: null, didBump: false, + perform: null, staller: null + }; + const now = getTime(); + // Start performing this operation + runner.perform = (() => __awaiter(this, void 0, void 0, function* () { + try { + config.requests++; + const result = yield this._translatePerform(config.provider, req); + runner.result = { result }; + } + catch (error) { + config.errorResponses++; + runner.result = { error }; + } + const dt = (getTime() - now); + config._totalTime += dt; + config.rollingDuration = 0.95 * config.rollingDuration + 0.05 * dt; + runner.perform = null; + }))(); + // Start a staller; when this times out, it's time to force + // kicking off another runner because we are taking too long + runner.staller = (() => __awaiter(this, void 0, void 0, function* () { + yield stall(config.stallTimeout); + runner.staller = null; + }))(); + running.add(runner); + return runner; +}, _FallbackProvider_initialSync = function _FallbackProvider_initialSync() { + return __awaiter(this, void 0, void 0, function* () { + let initialSync = __classPrivateFieldGet(this, _FallbackProvider_initialSyncPromise, "f"); + if (!initialSync) { + const promises = []; + __classPrivateFieldGet(this, _FallbackProvider_configs, "f").forEach((config) => { + promises.push((() => __awaiter(this, void 0, void 0, function* () { + yield waitForSync(config, 0); + if (!config._lastFatalError) { + config._network = yield config.provider.getNetwork(); + } + }))()); + }); + __classPrivateFieldSet(this, _FallbackProvider_initialSyncPromise, initialSync = (() => __awaiter(this, void 0, void 0, function* () { + // Wait for all providers to have a block number and network + yield Promise.all(promises); + // Check all the networks match + let chainId = null; + for (const config of __classPrivateFieldGet(this, _FallbackProvider_configs, "f")) { + if (config._lastFatalError) { + continue; + } + const network = (config._network); + if (chainId == null) { + chainId = network.chainId; + } + else if (network.chainId !== chainId) { + (0, index_js_1.assert)(false, "cannot mix providers on different networks", "UNSUPPORTED_OPERATION", { + operation: "new FallbackProvider" + }); + } + } + }))(), "f"); + } + yield initialSync; + }); +}, _FallbackProvider_checkQuorum = function _FallbackProvider_checkQuorum(running, req) { + return __awaiter(this, void 0, void 0, function* () { + // Get all the result objects + const results = []; + for (const runner of running) { + if (runner.result != null) { + const { tag, value } = normalizeResult(runner.result); + results.push({ tag, value, weight: runner.config.weight }); + } + } + // Are there enough results to event meet quorum? + if (results.reduce((a, r) => (a + r.weight), 0) < this.quorum) { + return undefined; + } + switch (req.method) { + case "getBlockNumber": { + // We need to get the bootstrap block height + if (__classPrivateFieldGet(this, _FallbackProvider_height, "f") === -2) { + __classPrivateFieldSet(this, _FallbackProvider_height, Math.ceil((0, index_js_1.getNumber)(getMedian(this.quorum, __classPrivateFieldGet(this, _FallbackProvider_configs, "f").filter((c) => (!c._lastFatalError)).map((c) => ({ + value: c.blockNumber, + tag: (0, index_js_1.getNumber)(c.blockNumber).toString(), + weight: c.weight + }))))), "f"); + } + // Find the mode across all the providers, allowing for + // a little drift between block heights + const mode = getFuzzyMode(this.quorum, results); + if (mode === undefined) { + return undefined; + } + if (mode > __classPrivateFieldGet(this, _FallbackProvider_height, "f")) { + __classPrivateFieldSet(this, _FallbackProvider_height, mode, "f"); + } + return __classPrivateFieldGet(this, _FallbackProvider_height, "f"); + } + case "getGasPrice": + case "getPriorityFee": + case "estimateGas": + return getMedian(this.quorum, results); + case "getBlock": + // Pending blocks are in the mempool and already + // quite untrustworthy; just grab anything + if ("blockTag" in req && req.blockTag === "pending") { + return getAnyResult(this.quorum, results); + } + return checkQuorum(this.quorum, results); + case "call": + case "chainId": + case "getBalance": + case "getTransactionCount": + case "getCode": + case "getStorage": + case "getTransaction": + case "getTransactionReceipt": + case "getLogs": + return checkQuorum(this.quorum, results); + case "broadcastTransaction": + return getAnyResult(this.quorum, results); + } + (0, index_js_1.assert)(false, "unsupported method", "UNSUPPORTED_OPERATION", { + operation: `_perform(${stringify(req.method)})` + }); + }); +}, _FallbackProvider_waitForQuorum = function _FallbackProvider_waitForQuorum(running, req) { + return __awaiter(this, void 0, void 0, function* () { + if (running.size === 0) { + throw new Error("no runners?!"); + } + // Any promises that are interesting to watch for; an expired stall + // or a successful perform + const interesting = []; + let newRunners = 0; + for (const runner of running) { + // No responses, yet; keep an eye on it + if (runner.perform) { + interesting.push(runner.perform); + } + // Still stalling... + if (runner.staller) { + interesting.push(runner.staller); + continue; + } + // This runner has already triggered another runner + if (runner.didBump) { + continue; + } + // Got a response (result or error) or stalled; kick off another runner + runner.didBump = true; + newRunners++; + } + // Check if we have reached quorum on a result (or error) + const value = yield __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_checkQuorum).call(this, running, req); + if (value !== undefined) { + if (value instanceof Error) { + throw value; + } + return value; + } + // Add any new runners, because a staller timed out or a result + // or error response came in. + for (let i = 0; i < newRunners; i++) { + __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_addRunner).call(this, running, req); + } + // All providers have returned, and we have no result + (0, index_js_1.assert)(interesting.length > 0, "quorum not met", "SERVER_ERROR", { + request: "%sub-requests", + info: { request: req, results: Array.from(running).map((r) => stringify(r.result)) } + }); + // Wait for someone to either complete its perform or stall out + yield Promise.race(interesting); + // This is recursive, but at worst case the depth is 2x the + // number of providers (each has a perform and a staller) + return yield __classPrivateFieldGet(this, _FallbackProvider_instances, "m", _FallbackProvider_waitForQuorum).call(this, running, req); + }); +}; +//# sourceMappingURL=provider-fallback.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-fallback.js.map b/dist/ethers.js/src.ts/providers/provider-fallback.js.map new file mode 100644 index 0000000..093e857 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-fallback.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-fallback.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-fallback.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;GAKG;AACH,gDAE2B;AAE3B,iEAA0D;AAC1D,6CAAsC;AAKtC,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AACzB,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;AAEzB,SAAS,OAAO,CAAU,KAAe;IACrC,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE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,EAAE,eAAe;YACxB,IAAI,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,EAAE;SACvF,CAAC,CAAC;QAEH,+DAA+D;QAC/D,MAAM,OAAO,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAEhC,2DAA2D;QAC3D,yDAAyD;QACzD,OAAO,MAAM,uBAAA,IAAI,oEAAe,MAAnB,IAAI,EAAgB,OAAO,EAAE,GAAG,CAAC,CAAC;IACnD,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-infura.d.ts b/dist/ethers.js/src.ts/providers/provider-infura.d.ts new file mode 100644 index 0000000..b670e7e --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-infura.d.ts @@ -0,0 +1,90 @@ +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import { WebSocketProvider } from "./provider-websocket.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network?: Networkish, projectId?: string); + isCommunityResource(): boolean; +} +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +export declare class InfuraProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Project ID for the INFURA connection. + */ + readonly projectId: string; + /** + * The Project Secret. + * + * If null, no authenticated requests are made. This should not + * be used outside of private contexts. + */ + readonly projectSecret: null | string; + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network?: Networkish, projectId?: null | string, projectSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network?: Networkish, projectId?: string): InfuraWebSocketProvider; + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network: Network, projectId?: null | string, projectSecret?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-infura.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-infura.d.ts.map b/dist/ethers.js/src.ts/providers/provider-infura.d.ts.map new file mode 100644 index 0000000..585e907 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-infura.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-infura.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-infura.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EACe,YAAY,EACjC,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AAE,OAAO,EAAE,SAAS,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAiB9G"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-infura.js b/dist/ethers.js/src.ts/providers/provider-infura.js new file mode 100644 index 0000000..59d0af5 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-infura.js @@ -0,0 +1,163 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.InfuraProvider = exports.InfuraWebSocketProvider = void 0; +/** + * [[link-infura]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Sepolia Testnet (``sepolia``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:INFURA [providers-infura] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const provider_websocket_js_1 = require("./provider-websocket.js"); +const defaultProjectId = "84842078b09946638c03157f83405213"; +function getHost(name) { + switch (name) { + case "mainnet": + return "mainnet.infura.io"; + case "goerli": + return "goerli.infura.io"; + case "sepolia": + return "sepolia.infura.io"; + case "arbitrum": + return "arbitrum-mainnet.infura.io"; + case "arbitrum-goerli": + return "arbitrum-goerli.infura.io"; + case "linea": + return "linea-mainnet.infura.io"; + case "linea-goerli": + return "linea-goerli.infura.io"; + case "matic": + return "polygon-mainnet.infura.io"; + case "matic-mumbai": + return "polygon-mumbai.infura.io"; + case "optimism": + return "optimism-mainnet.infura.io"; + case "optimism-goerli": + return "optimism-goerli.infura.io"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **InfuraWebSocketProvider** connects to the [[link-infura]] + * WebSocket end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraWebSocketProvider extends provider_websocket_js_1.WebSocketProvider { + /** + * Creates a new **InfuraWebSocketProvider**. + */ + constructor(network, projectId) { + const provider = new InfuraProvider(network, projectId); + const req = provider._getConnection(); + (0, index_js_1.assert)(!req.credentials, "INFURA WebSocket project secrets unsupported", "UNSUPPORTED_OPERATION", { operation: "InfuraProvider.getWebSocketProvider()" }); + const url = req.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/"); + super(url, network); + (0, index_js_1.defineProperties)(this, { + projectId: provider.projectId, + projectSecret: provider.projectSecret + }); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } +} +exports.InfuraWebSocketProvider = InfuraWebSocketProvider; +/** + * The **InfuraProvider** connects to the [[link-infura]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-infura-signup). + */ +class InfuraProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * Creates a new **InfuraProvider**. + */ + constructor(_network, projectId, projectSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = InfuraProvider.getRequest(network, projectId, projectSecret); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { projectId, projectSecret }); + } + _getProvider(chainId) { + try { + return new InfuraProvider(chainId, this.projectId, this.projectSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.projectId === defaultProjectId); + } + /** + * Creates a new **InfuraWebSocketProvider**. + */ + static getWebSocketProvider(network, projectId) { + return new InfuraWebSocketProvider(network, projectId); + } + /** + * Returns a prepared request for connecting to %%network%% + * with %%projectId%% and %%projectSecret%%. + */ + static getRequest(network, projectId, projectSecret) { + if (projectId == null) { + projectId = defaultProjectId; + } + if (projectSecret == null) { + projectSecret = null; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v3/${projectId}`); + request.allowGzip = true; + if (projectSecret) { + request.setCredentials("", projectSecret); + } + if (projectId === defaultProjectId) { + request.retryFunc = (request, response, attempt) => __awaiter(this, void 0, void 0, function* () { + (0, community_js_1.showThrottleMessage)("InfuraProvider"); + return true; + }); + } + return request; + } +} +exports.InfuraProvider = InfuraProvider; +//# sourceMappingURL=provider-infura.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-infura.js.map b/dist/ethers.js/src.ts/providers/provider-infura.js.map new file mode 100644 index 0000000..a9b47c8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-infura.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-infura.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-infura.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,gDAE2B;AAE3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AACxD,mEAA4D;AAO5D,MAAM,gBAAgB,GAAG,kCAAkC,CAAC;AAE5D,SAAS,OAAO,CAAC,IAAY;IACzB,QAAO,IAAI,EAAE;QACT,KAAK,SAAS;YACV,OAAO,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,CAAC;IAC3D,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,SAAyB,EAAE,aAA6B;QACxF,IAAI,SAAS,IAAI,IAAI,EAAE;YAAE,SAAS,GAAG,gBAAgB,CAAC;SAAE;QACxD,IAAI,aAAa,IAAI,IAAI,EAAE;YAAE,aAAa,GAAG,IAAI,CAAC;SAAE;QAEpD,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,OAAQ,SAAU,EAAE,CAAC,CAAC;QAC1F,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,IAAI,aAAa,EAAE;YAAE,OAAO,CAAC,cAAc,CAAC,EAAE,EAAE,aAAa,CAAC,CAAC;SAAE;QAEjE,IAAI,SAAS,KAAK,gBAAgB,EAAE;YAChC,OAAO,CAAC,SAAS,GAAG,CAAO,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AApED,wCAoEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts new file mode 100644 index 0000000..6aae787 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts @@ -0,0 +1,3 @@ +declare const IpcSocketProvider: undefined; +export { IpcSocketProvider }; +//# sourceMappingURL=provider-ipcsocket-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts.map b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts.map new file mode 100644 index 0000000..07a249a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,iBAAiB,WAAY,CAAC;AAEpC,OAAO,EAAE,iBAAiB,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js new file mode 100644 index 0000000..7a8728f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IpcSocketProvider = void 0; +const IpcSocketProvider = undefined; +exports.IpcSocketProvider = IpcSocketProvider; +//# sourceMappingURL=provider-ipcsocket-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js.map b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js.map new file mode 100644 index 0000000..6ab19a6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ipcsocket-browser.ts"],"names":[],"mappings":";;;AAAA,MAAM,iBAAiB,GAAG,SAAS,CAAC;AAE3B,8CAAiB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts b/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts new file mode 100644 index 0000000..23d1f2f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts @@ -0,0 +1,21 @@ +/// +import { SocketProvider } from "./provider-socket.js"; +import type { Socket } from "net"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +export declare class IpcSocketProvider extends SocketProvider { + #private; + /** + * The connected socket. + */ + get socket(): Socket; + constructor(path: string, network?: Networkish, options?: JsonRpcApiProviderOptions); + destroy(): void; + _write(message: string): Promise; +} +//# sourceMappingURL=provider-ipcsocket.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts.map b/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts.map new file mode 100644 index 0000000..5e279f9 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AACvE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAmB/C;;;;GAIG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAGjD;;OAEG;IACH,IAAI,MAAM,IAAI,MAAM,CAAyB;gBAEjC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA8BnF,OAAO,IAAI,IAAI;IAOT,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket.js b/dist/ethers.js/src.ts/providers/provider-ipcsocket.js new file mode 100644 index 0000000..6c450d2 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket.js @@ -0,0 +1,93 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _IpcSocketProvider_socket; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.IpcSocketProvider = void 0; +const net_1 = require("net"); +const provider_socket_js_1 = require("./provider-socket.js"); +// @TODO: Is this sufficient? Is this robust? Will newlines occur between +// all payloads and only between payloads? +function splitBuffer(data) { + const messages = []; + let lastStart = 0; + while (true) { + const nl = data.indexOf(10, lastStart); + if (nl === -1) { + break; + } + messages.push(data.subarray(lastStart, nl).toString().trim()); + lastStart = nl + 1; + } + return { messages, remaining: data.subarray(lastStart) }; +} +/** + * An **IpcSocketProvider** connects over an IPC socket on the host + * which provides fast access to the node, but requires the node and + * the script run on the same machine. + */ +class IpcSocketProvider extends provider_socket_js_1.SocketProvider { + /** + * The connected socket. + */ + get socket() { return __classPrivateFieldGet(this, _IpcSocketProvider_socket, "f"); } + constructor(path, network, options) { + super(network, options); + _IpcSocketProvider_socket.set(this, void 0); + __classPrivateFieldSet(this, _IpcSocketProvider_socket, (0, net_1.connect)(path), "f"); + this.socket.on("ready", () => __awaiter(this, void 0, void 0, function* () { + try { + yield this._start(); + } + catch (error) { + console.log("failed to start IpcSocketProvider", error); + // @TODO: Now what? Restart? + } + })); + let response = Buffer.alloc(0); + this.socket.on("data", (data) => { + response = Buffer.concat([response, data]); + const { messages, remaining } = splitBuffer(response); + messages.forEach((message) => { + this._processMessage(message); + }); + response = remaining; + }); + this.socket.on("end", () => { + this.emit("close"); + this.socket.destroy(); + this.socket.end(); + }); + } + destroy() { + this.socket.destroy(); + this.socket.end(); + super.destroy(); + } + _write(message) { + return __awaiter(this, void 0, void 0, function* () { + this.socket.write(message); + }); + } +} +exports.IpcSocketProvider = IpcSocketProvider; +_IpcSocketProvider_socket = new WeakMap(); +//# sourceMappingURL=provider-ipcsocket.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-ipcsocket.js.map b/dist/ethers.js/src.ts/providers/provider-ipcsocket.js.map new file mode 100644 index 0000000..a2bb423 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-ipcsocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-ipcsocket.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-ipcsocket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AACA,6BAA8B;AAC9B,6DAAsD;AAQtD,yEAAyE;AACzE,0CAA0C;AAC1C,SAAS,WAAW,CAAC,IAAY;IAC7B,MAAM,QAAQ,GAAkB,EAAG,CAAC;IAEpC,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,OAAO,IAAI,EAAE;QACT,MAAM,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;QACvC,IAAI,EAAE,KAAK,CAAC,CAAC,EAAE;YAAE,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O,EAAE,EAAE;gBACzB,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;YAClC,CAAC,CAAC,CAAC;YACH,QAAQ,GAAG,SAAS,CAAC;QACzB,CAAC,CAAC,CAAC;QAEH,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE;YACvB,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YACnB,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QACtB,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO;QACH,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACtB,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC;QAElB,KAAK,CAAC,OAAO,EAAE,CAAC;IACpB,CAAC;IAEK,MAAM,CAAC,OAAe;;YACxB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;KAAA;CACJ;AAhDD,8CAgDC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts b/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts new file mode 100644 index 0000000..6b68221 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts @@ -0,0 +1,350 @@ +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { AbstractSigner } from "./abstract-signer.js"; +import { Network } from "./network.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { PerformActionRequest, Subscriber, Subscription } from "./abstract-provider.js"; +import type { Networkish } from "./network.js"; +import type { Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A JSON-RPC payload, which are sent to a JSON-RPC server. + */ +export type JsonRpcPayload = { + /** + * The JSON-RPC request ID. + */ + id: number; + /** + * The JSON-RPC request method. + */ + method: string; + /** + * The JSON-RPC request parameters. + */ + params: Array | Record; + /** + * A required constant in the JSON-RPC specification. + */ + jsonrpc: "2.0"; +}; +/** + * A JSON-RPC result, which are returned on success from a JSON-RPC server. + */ +export type JsonRpcResult = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response result. + */ + result: any; +}; +/** + * A JSON-RPC error, which are returned on failure from a JSON-RPC server. + */ +export type JsonRpcError = { + /** + * The response ID to match it to the relevant request. + */ + id: number; + /** + * The response error. + */ + error: { + code: number; + message?: string; + data?: any; + }; +}; +/** + * When subscribing to the ``"debug"`` event, the [[Listener]] will + * receive this object as the first parameter. + */ +export type DebugEventJsonRpcApiProvider = { + action: "sendRpcPayload"; + payload: JsonRpcPayload | Array; +} | { + action: "receiveRpcResult"; + result: Array; +} | { + action: "receiveRpcError"; + error: Error; +}; +/** + * Options for configuring a [[JsonRpcApiProvider]]. Much of this + * is targetted towards sub-classes, which often will not expose + * any of these options to their consumers. + * + * **``polling``** - use the polling strategy is used immediately + * for events; otherwise, attempt to use filters and fall back onto + * polling (default: ``false``) + * + * **``staticNetwork``** - do not request chain ID on requests to + * validate the underlying chain has not changed (default: ``null``) + * + * This should **ONLY** be used if it is **certain** that the network + * cannot change, such as when using INFURA (since the URL dictates the + * network). If the network is assumed static and it does change, this + * can have tragic consequences. For example, this **CANNOT** be used + * with MetaMask, since the used can select a new network from the + * drop-down at any time. + * + * **``batchStallTime``** - how long (ms) to aggregate requests into a + * single batch. ``0`` indicates batching will only encompass the current + * event loop. If ``batchMaxCount = 1``, this is ignored. (default: ``10``) + * + * **``batchMaxSize``** - target maximum size (bytes) to allow per batch + * request (default: 1Mb) + * + * **``batchMaxCount``** - maximum number of requests to allow in a batch. + * If ``batchMaxCount = 1``, then batching is disabled. (default: ``100``) + * + * **``cacheTimeout``** - passed as [[AbstractProviderOptions]]. + */ +export type JsonRpcApiProviderOptions = { + polling?: boolean; + staticNetwork?: null | boolean | Network; + batchStallTime?: number; + batchMaxSize?: number; + batchMaxCount?: number; + cacheTimeout?: number; + pollingInterval?: number; +}; +/** + * A **JsonRpcTransactionRequest** is formatted as needed by the JSON-RPC + * Ethereum API specification. + */ +export interface JsonRpcTransactionRequest { + /** + * The sender address to use when signing. + */ + from?: string; + /** + * The target address. + */ + to?: string; + /** + * The transaction data. + */ + data?: string; + /** + * The chain ID the transaction is valid on. + */ + chainId?: string; + /** + * The [[link-eip-2718]] transaction type. + */ + type?: string; + /** + * The maximum amount of gas to allow a transaction to consume. + * + * In most other places in ethers, this is called ``gasLimit`` which + * differs from the JSON-RPC Ethereum API specification. + */ + gas?: string; + /** + * The gas price per wei for transactions prior to [[link-eip-1559]]. + */ + gasPrice?: string; + /** + * The maximum fee per gas for [[link-eip-1559]] transactions. + */ + maxFeePerGas?: string; + /** + * The maximum priority fee per gas for [[link-eip-1559]] transactions. + */ + maxPriorityFeePerGas?: string; + /** + * The nonce for the transaction. + */ + nonce?: string; + /** + * The transaction value (in wei). + */ + value?: string; + /** + * The transaction access list. + */ + accessList?: Array<{ + address: string; + storageKeys: Array; + }>; +} +export declare class JsonRpcSigner extends AbstractSigner { + address: string; + constructor(provider: JsonRpcApiProvider, address: string); + connect(provider: null | Provider): Signer; + getAddress(): Promise; + populateTransaction(tx: TransactionRequest): Promise>; + sendUncheckedTransaction(_tx: TransactionRequest): Promise; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(_tx: TransactionRequest): Promise; + signMessage(_message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, _value: Record): Promise; + unlock(password: string): Promise; + _legacySignMessage(_message: string | Uint8Array): Promise; +} +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +export declare abstract class JsonRpcApiProvider extends AbstractProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key: K): JsonRpcApiProviderOptions[K]; + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network(): Network; + /** + * Sends a JSON-RPC %%payload%% (or a batch) to the underlying channel. + * + * Sub-classes **MUST** override this. + */ + abstract _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + _perform(req: PerformActionRequest): Promise; + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + _detectNetwork(): Promise; + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start(): void; + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + _waitUntilReady(): Promise; + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub: Subscription): Subscriber; + /** + * Returns true only if the [[_start]] has been called. + */ + get ready(): boolean; + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx: TransactionRequest): JsonRpcTransactionRequest; + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req: PerformActionRequest): null | { + method: string; + args: Array; + }; + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload: JsonRpcPayload, _error: JsonRpcError): Error; + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method: string, params: Array | Record): Promise; + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + getSigner(address?: number | string): Promise; + listAccounts(): Promise>; + destroy(): void; +} +/** + * @_ignore: + */ +export declare abstract class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + #private; + constructor(network?: Networkish, options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval(): number; + set pollingInterval(value: number); +} +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +export declare class JsonRpcProvider extends JsonRpcApiPollingProvider { + #private; + constructor(url?: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); + _getConnection(): FetchRequest; + send(method: string, params: Array | Record): Promise; + _send(payload: JsonRpcPayload | Array): Promise>; +} +//# sourceMappingURL=provider-jsonrpc.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts.map b/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts.map new file mode 100644 index 0000000..a16f51f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-jsonrpc.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAGH,YAAY,EACf,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAuB,MAAM,wBAAwB,CAAC;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC7F,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,KAAK,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AACvF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AA8C1C;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IAEf;;OAEG;IACH,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAEzC;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB;;OAEG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,MAAM,EAAE,GAAG,CAAC;CACf,CAAC;AAEF;;GAE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providers/provider-jsonrpc.js b/dist/ethers.js/src.ts/providers/provider-jsonrpc.js new file mode 100644 index 0000000..e7dcab0 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-jsonrpc.js @@ -0,0 +1,973 @@ +"use strict"; +/** + * One of the most common ways to interact with the blockchain is + * by a node running a JSON-RPC interface which can be connected to, + * based on the transport, using: + * + * - HTTP or HTTPS - [[JsonRpcProvider]] + * - WebSocket - [[WebSocketProvider]] + * - IPC - [[IpcSocketProvider]] + * + * @_section: api/providers/jsonrpc:JSON-RPC Provider [about-jsonrpcProvider] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _JsonRpcApiProvider_instances, _JsonRpcApiProvider_options, _JsonRpcApiProvider_nextId, _JsonRpcApiProvider_payloads, _JsonRpcApiProvider_drainTimer, _JsonRpcApiProvider_notReady, _JsonRpcApiProvider_network, _JsonRpcApiProvider_pendingDetectNetwork, _JsonRpcApiProvider_scheduleDrain, _JsonRpcApiPollingProvider_pollingInterval, _JsonRpcProvider_connect; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.JsonRpcProvider = exports.JsonRpcApiPollingProvider = exports.JsonRpcApiProvider = exports.JsonRpcSigner = void 0; +// @TODO: +// - Add the batching API +// https://playground.open-rpc.org/?schemaUrl=https://raw.githubusercontent.com/ethereum/eth1.0-apis/assembled-spec/openrpc.json&uiSchema%5BappBar%5D%5Bui:splitView%5D=true&uiSchema%5BappBar%5D%5Bui:input%5D=false&uiSchema%5BappBar%5D%5Bui:examplesDropdown%5D=false +const index_js_1 = require("../abi/index.js"); +const index_js_2 = require("../address/index.js"); +const index_js_3 = require("../hash/index.js"); +const index_js_4 = require("../transaction/index.js"); +const index_js_5 = require("../utils/index.js"); +const abstract_provider_js_1 = require("./abstract-provider.js"); +const abstract_signer_js_1 = require("./abstract-signer.js"); +const network_js_1 = require("./network.js"); +const subscriber_filterid_js_1 = require("./subscriber-filterid.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +const Primitive = "bigint,boolean,function,number,string,symbol".split(/,/g); +//const Methods = "getAddress,then".split(/,/g); +function deepCopy(value) { + if (value == null || Primitive.indexOf(typeof (value)) >= 0) { + return value; + } + // Keep any Addressable + if (typeof (value.getAddress) === "function") { + return value; + } + if (Array.isArray(value)) { + return (value.map(deepCopy)); + } + if (typeof (value) === "object") { + return Object.keys(value).reduce((accum, key) => { + accum[key] = value[key]; + return accum; + }, {}); + } + throw new Error(`should not happen: ${value} (${typeof (value)})`); +} +function stall(duration) { + return new Promise((resolve) => { setTimeout(resolve, duration); }); +} +function getLowerCase(value) { + if (value) { + return value.toLowerCase(); + } + return value; +} +function isPollable(value) { + return (value && typeof (value.pollingInterval) === "number"); +} +const defaultOptions = { + polling: false, + staticNetwork: null, + batchStallTime: 10, + batchMaxSize: (1 << 20), + batchMaxCount: 100, + cacheTimeout: 250, + pollingInterval: 4000 +}; +// @TODO: Unchecked Signers +class JsonRpcSigner extends abstract_signer_js_1.AbstractSigner { + constructor(provider, address) { + super(provider); + address = (0, index_js_2.getAddress)(address); + (0, index_js_5.defineProperties)(this, { address }); + } + connect(provider) { + (0, index_js_5.assert)(false, "cannot reconnect JsonRpcSigner", "UNSUPPORTED_OPERATION", { + operation: "signer.connect" + }); + } + getAddress() { + return __awaiter(this, void 0, void 0, function* () { + return this.address; + }); + } + // JSON-RPC will automatially fill in nonce, etc. so we just check from + populateTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + return yield this.populateCall(tx); + }); + } + // Returns just the hash of the transaction after sent, which is what + // the bare JSON-RPC API does; + sendUncheckedTransaction(_tx) { + return __awaiter(this, void 0, void 0, function* () { + const tx = deepCopy(_tx); + const promises = []; + // Make sure the from matches the sender + if (tx.from) { + const _from = tx.from; + promises.push((() => __awaiter(this, void 0, void 0, function* () { + const from = yield (0, index_js_2.resolveAddress)(_from, this.provider); + (0, index_js_5.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + }))()); + } + else { + tx.from = this.address; + } + // The JSON-RPC for eth_sendTransaction uses 90000 gas; if the user + // wishes to use this, it is easy to specify explicitly, otherwise + // we look it up for them. + if (tx.gasLimit == null) { + promises.push((() => __awaiter(this, void 0, void 0, function* () { + tx.gasLimit = yield this.provider.estimateGas(Object.assign(Object.assign({}, tx), { from: this.address })); + }))()); + } + // The address may be an ENS name or Addressable + if (tx.to != null) { + const _to = tx.to; + promises.push((() => __awaiter(this, void 0, void 0, function* () { + tx.to = yield (0, index_js_2.resolveAddress)(_to, this.provider); + }))()); + } + // Wait until all of our properties are filled in + if (promises.length) { + yield Promise.all(promises); + } + const hexTx = this.provider.getRpcTransaction(tx); + return this.provider.send("eth_sendTransaction", [hexTx]); + }); + } + sendTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + // This cannot be mined any earlier than any recent block + const blockNumber = yield this.provider.getBlockNumber(); + // Send the transaction + const hash = yield this.sendUncheckedTransaction(tx); + // Unfortunately, JSON-RPC only provides and opaque transaction hash + // for a response, and we need the actual transaction, so we poll + // for it; it should show up very quickly + return yield (new Promise((resolve, reject) => { + const timeouts = [1000, 100]; + const checkTx = () => __awaiter(this, void 0, void 0, function* () { + // Try getting the transaction + const tx = yield this.provider.getTransaction(hash); + if (tx != null) { + resolve(tx.replaceableTransaction(blockNumber)); + return; + } + // Wait another 4 seconds + this.provider._setTimeout(() => { checkTx(); }, timeouts.pop() || 4000); + }); + checkTx(); + })); + }); + } + signTransaction(_tx) { + return __awaiter(this, void 0, void 0, function* () { + const tx = deepCopy(_tx); + // Make sure the from matches the sender + if (tx.from) { + const from = yield (0, index_js_2.resolveAddress)(tx.from, this.provider); + (0, index_js_5.assertArgument)(from != null && from.toLowerCase() === this.address.toLowerCase(), "from address mismatch", "transaction", _tx); + tx.from = from; + } + else { + tx.from = this.address; + } + const hexTx = this.provider.getRpcTransaction(tx); + return yield this.provider.send("eth_signTransaction", [hexTx]); + }); + } + signMessage(_message) { + return __awaiter(this, void 0, void 0, function* () { + const message = ((typeof (_message) === "string") ? (0, index_js_5.toUtf8Bytes)(_message) : _message); + return yield this.provider.send("personal_sign", [ + (0, index_js_5.hexlify)(message), this.address.toLowerCase() + ]); + }); + } + signTypedData(domain, types, _value) { + return __awaiter(this, void 0, void 0, function* () { + const value = deepCopy(_value); + // Populate any ENS names (in-place) + const populated = yield index_js_3.TypedDataEncoder.resolveNames(domain, types, value, (value) => __awaiter(this, void 0, void 0, function* () { + const address = yield (0, index_js_2.resolveAddress)(value); + (0, index_js_5.assertArgument)(address != null, "TypedData does not support null address", "value", value); + return address; + })); + return yield this.provider.send("eth_signTypedData_v4", [ + this.address.toLowerCase(), + JSON.stringify(index_js_3.TypedDataEncoder.getPayload(populated.domain, types, populated.value)) + ]); + }); + } + unlock(password) { + return __awaiter(this, void 0, void 0, function* () { + return this.provider.send("personal_unlockAccount", [ + this.address.toLowerCase(), password, null + ]); + }); + } + // https://github.com/ethereum/wiki/wiki/JSON-RPC#eth_sign + _legacySignMessage(_message) { + return __awaiter(this, void 0, void 0, function* () { + const message = ((typeof (_message) === "string") ? (0, index_js_5.toUtf8Bytes)(_message) : _message); + return yield this.provider.send("eth_sign", [ + this.address.toLowerCase(), (0, index_js_5.hexlify)(message) + ]); + }); + } +} +exports.JsonRpcSigner = JsonRpcSigner; +/** + * The JsonRpcApiProvider is an abstract class and **MUST** be + * sub-classed. + * + * It provides the base for all JSON-RPC-based Provider interaction. + * + * Sub-classing Notes: + * - a sub-class MUST override _send + * - a sub-class MUST call the `_start()` method once connected + */ +class JsonRpcApiProvider extends abstract_provider_js_1.AbstractProvider { + constructor(network, options) { + super(network, options); + _JsonRpcApiProvider_instances.add(this); + _JsonRpcApiProvider_options.set(this, void 0); + // The next ID to use for the JSON-RPC ID field + _JsonRpcApiProvider_nextId.set(this, void 0); + // Payloads are queued and triggered in batches using the drainTimer + _JsonRpcApiProvider_payloads.set(this, void 0); + _JsonRpcApiProvider_drainTimer.set(this, void 0); + _JsonRpcApiProvider_notReady.set(this, void 0); + _JsonRpcApiProvider_network.set(this, void 0); + _JsonRpcApiProvider_pendingDetectNetwork.set(this, void 0); + __classPrivateFieldSet(this, _JsonRpcApiProvider_nextId, 1, "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_options, Object.assign({}, defaultOptions, options || {}), "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_payloads, [], "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_drainTimer, null, "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_network, null, "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, null, "f"); + { + let resolve = null; + const promise = new Promise((_resolve) => { + resolve = _resolve; + }); + __classPrivateFieldSet(this, _JsonRpcApiProvider_notReady, { promise, resolve }, "f"); + } + const staticNetwork = this._getOption("staticNetwork"); + if (typeof (staticNetwork) === "boolean") { + (0, index_js_5.assertArgument)(!staticNetwork || network !== "any", "staticNetwork cannot be used on special network 'any'", "options", options); + if (staticNetwork && network != null) { + __classPrivateFieldSet(this, _JsonRpcApiProvider_network, network_js_1.Network.from(network), "f"); + } + } + else if (staticNetwork) { + // Make sure any static network is compatbile with the provided netwrok + (0, index_js_5.assertArgument)(network == null || staticNetwork.matches(network), "staticNetwork MUST match network object", "options", options); + __classPrivateFieldSet(this, _JsonRpcApiProvider_network, staticNetwork, "f"); + } + } + /** + * Returns the value associated with the option %%key%%. + * + * Sub-classes can use this to inquire about configuration options. + */ + _getOption(key) { + return __classPrivateFieldGet(this, _JsonRpcApiProvider_options, "f")[key]; + } + /** + * Gets the [[Network]] this provider has committed to. On each call, the network + * is detected, and if it has changed, the call will reject. + */ + get _network() { + (0, index_js_5.assert)(__classPrivateFieldGet(this, _JsonRpcApiProvider_network, "f"), "network is not available yet", "NETWORK_ERROR"); + return __classPrivateFieldGet(this, _JsonRpcApiProvider_network, "f"); + } + /** + * Resolves to the non-normalized value by performing %%req%%. + * + * Sub-classes may override this to modify behavior of actions, + * and should generally call ``super._perform`` as a fallback. + */ + _perform(req) { + const _super = Object.create(null, { + _perform: { get: () => super._perform } + }); + return __awaiter(this, void 0, void 0, function* () { + // Legacy networks do not like the type field being passed along (which + // is fair), so we delete type if it is 0 and a non-EIP-1559 network + if (req.method === "call" || req.method === "estimateGas") { + let tx = req.transaction; + if (tx && tx.type != null && (0, index_js_5.getBigInt)(tx.type)) { + // If there are no EIP-1559 properties, it might be non-EIP-a559 + if (tx.maxFeePerGas == null && tx.maxPriorityFeePerGas == null) { + const feeData = yield this.getFeeData(); + if (feeData.maxFeePerGas == null && feeData.maxPriorityFeePerGas == null) { + // Network doesn't know about EIP-1559 (and hence type) + req = Object.assign({}, req, { + transaction: Object.assign({}, tx, { type: undefined }) + }); + } + } + } + } + const request = this.getRpcRequest(req); + if (request != null) { + return yield this.send(request.method, request.args); + } + return _super._perform.call(this, req); + }); + } + /** + * Sub-classes may override this; it detects the *actual* network that + * we are **currently** connected to. + * + * Keep in mind that [[send]] may only be used once [[ready]], otherwise the + * _send primitive must be used instead. + */ + _detectNetwork() { + return __awaiter(this, void 0, void 0, function* () { + const network = this._getOption("staticNetwork"); + if (network) { + if (network === true) { + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_network, "f")) { + return __classPrivateFieldGet(this, _JsonRpcApiProvider_network, "f"); + } + } + else { + return network; + } + } + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_pendingDetectNetwork, "f")) { + return yield __classPrivateFieldGet(this, _JsonRpcApiProvider_pendingDetectNetwork, "f"); + } + // If we are ready, use ``send``, which enabled requests to be batched + if (this.ready) { + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, (() => __awaiter(this, void 0, void 0, function* () { + const result = network_js_1.Network.from((0, index_js_5.getBigInt)(yield this.send("eth_chainId", []))); + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, null, "f"); + return result; + }))(), "f"); + return yield __classPrivateFieldGet(this, _JsonRpcApiProvider_pendingDetectNetwork, "f"); + } + // We are not ready yet; use the primitive _send + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, (() => __awaiter(this, void 0, void 0, function* () { + var _a, _b; + const payload = { + id: (__classPrivateFieldSet(this, _JsonRpcApiProvider_nextId, (_b = __classPrivateFieldGet(this, _JsonRpcApiProvider_nextId, "f"), _a = _b++, _b), "f"), _a), method: "eth_chainId", params: [], jsonrpc: "2.0" + }; + this.emit("debug", { action: "sendRpcPayload", payload }); + let result; + try { + result = (yield this._send(payload))[0]; + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, null, "f"); + } + catch (error) { + __classPrivateFieldSet(this, _JsonRpcApiProvider_pendingDetectNetwork, null, "f"); + this.emit("debug", { action: "receiveRpcError", error }); + throw error; + } + this.emit("debug", { action: "receiveRpcResult", result }); + if ("result" in result) { + return network_js_1.Network.from((0, index_js_5.getBigInt)(result.result)); + } + throw this.getRpcError(payload, result); + }))(), "f"); + return yield __classPrivateFieldGet(this, _JsonRpcApiProvider_pendingDetectNetwork, "f"); + }); + } + /** + * Sub-classes **MUST** call this. Until [[_start]] has been called, no calls + * will be passed to [[_send]] from [[send]]. If it is overridden, then + * ``super._start()`` **MUST** be called. + * + * Calling it multiple times is safe and has no effect. + */ + _start() { + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f") == null || __classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f").resolve == null) { + return; + } + __classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f").resolve(); + __classPrivateFieldSet(this, _JsonRpcApiProvider_notReady, null, "f"); + (() => __awaiter(this, void 0, void 0, function* () { + // Bootstrap the network + while (__classPrivateFieldGet(this, _JsonRpcApiProvider_network, "f") == null && !this.destroyed) { + try { + __classPrivateFieldSet(this, _JsonRpcApiProvider_network, yield this._detectNetwork(), "f"); + } + catch (error) { + if (this.destroyed) { + break; + } + console.log("JsonRpcProvider failed to detect network and cannot start up; retry in 1s (perhaps the URL is wrong or the node is not started)"); + this.emit("error", (0, index_js_5.makeError)("failed to bootstrap network detection", "NETWORK_ERROR", { event: "initial-network-discovery", info: { error } })); + yield stall(1000); + } + } + // Start dispatching requests + __classPrivateFieldGet(this, _JsonRpcApiProvider_instances, "m", _JsonRpcApiProvider_scheduleDrain).call(this); + }))(); + } + /** + * Resolves once the [[_start]] has been called. This can be used in + * sub-classes to defer sending data until the connection has been + * established. + */ + _waitUntilReady() { + return __awaiter(this, void 0, void 0, function* () { + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f") == null) { + return; + } + return yield __classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f").promise; + }); + } + /** + * Return a Subscriber that will manage the %%sub%%. + * + * Sub-classes may override this to modify the behavior of + * subscription management. + */ + _getSubscriber(sub) { + // Pending Filters aren't availble via polling + if (sub.type === "pending") { + return new subscriber_filterid_js_1.FilterIdPendingSubscriber(this); + } + if (sub.type === "event") { + if (this._getOption("polling")) { + return new subscriber_polling_js_1.PollingEventSubscriber(this, sub.filter); + } + return new subscriber_filterid_js_1.FilterIdEventSubscriber(this, sub.filter); + } + // Orphaned Logs are handled automatically, by the filter, since + // logs with removed are emitted by it + if (sub.type === "orphan" && sub.filter.orphan === "drop-log") { + return new abstract_provider_js_1.UnmanagedSubscriber("orphan"); + } + return super._getSubscriber(sub); + } + /** + * Returns true only if the [[_start]] has been called. + */ + get ready() { return __classPrivateFieldGet(this, _JsonRpcApiProvider_notReady, "f") == null; } + /** + * Returns %%tx%% as a normalized JSON-RPC transaction request, + * which has all values hexlified and any numeric values converted + * to Quantity values. + */ + getRpcTransaction(tx) { + const result = {}; + // JSON-RPC now requires numeric values to be "quantity" values + ["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach((key) => { + if (tx[key] == null) { + return; + } + let dstKey = key; + if (key === "gasLimit") { + dstKey = "gas"; + } + result[dstKey] = (0, index_js_5.toQuantity)((0, index_js_5.getBigInt)(tx[key], `tx.${key}`)); + }); + // Make sure addresses and data are lowercase + ["from", "to", "data"].forEach((key) => { + if (tx[key] == null) { + return; + } + result[key] = (0, index_js_5.hexlify)(tx[key]); + }); + // Normalize the access list object + if (tx.accessList) { + result["accessList"] = (0, index_js_4.accessListify)(tx.accessList); + } + return result; + } + /** + * Returns the request method and arguments required to perform + * %%req%%. + */ + getRpcRequest(req) { + switch (req.method) { + case "chainId": + return { method: "eth_chainId", args: [] }; + case "getBlockNumber": + return { method: "eth_blockNumber", args: [] }; + case "getGasPrice": + return { method: "eth_gasPrice", args: [] }; + case "getPriorityFee": + return { method: "eth_maxPriorityFeePerGas", args: [] }; + case "getBalance": + return { + method: "eth_getBalance", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getTransactionCount": + return { + method: "eth_getTransactionCount", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getCode": + return { + method: "eth_getCode", + args: [getLowerCase(req.address), req.blockTag] + }; + case "getStorage": + return { + method: "eth_getStorageAt", + args: [ + getLowerCase(req.address), + ("0x" + req.position.toString(16)), + req.blockTag + ] + }; + case "broadcastTransaction": + return { + method: "eth_sendRawTransaction", + args: [req.signedTransaction] + }; + case "getBlock": + if ("blockTag" in req) { + return { + method: "eth_getBlockByNumber", + args: [req.blockTag, !!req.includeTransactions] + }; + } + else if ("blockHash" in req) { + return { + method: "eth_getBlockByHash", + args: [req.blockHash, !!req.includeTransactions] + }; + } + break; + case "getTransaction": + return { + method: "eth_getTransactionByHash", + args: [req.hash] + }; + case "getTransactionReceipt": + return { + method: "eth_getTransactionReceipt", + args: [req.hash] + }; + case "call": + return { + method: "eth_call", + args: [this.getRpcTransaction(req.transaction), req.blockTag] + }; + case "estimateGas": { + return { + method: "eth_estimateGas", + args: [this.getRpcTransaction(req.transaction)] + }; + } + case "getLogs": + if (req.filter && req.filter.address != null) { + if (Array.isArray(req.filter.address)) { + req.filter.address = req.filter.address.map(getLowerCase); + } + else { + req.filter.address = getLowerCase(req.filter.address); + } + } + return { method: "eth_getLogs", args: [req.filter] }; + } + return null; + } + /** + * Returns an ethers-style Error for the given JSON-RPC error + * %%payload%%, coalescing the various strings and error shapes + * that different nodes return, coercing them into a machine-readable + * standardized error. + */ + getRpcError(payload, _error) { + const { method } = payload; + const { error } = _error; + if (method === "eth_estimateGas" && error.message) { + const msg = error.message; + if (!msg.match(/revert/i) && msg.match(/insufficient funds/i)) { + return (0, index_js_5.makeError)("insufficient funds", "INSUFFICIENT_FUNDS", { + transaction: (payload.params[0]), + info: { payload, error } + }); + } + } + if (method === "eth_call" || method === "eth_estimateGas") { + const result = spelunkData(error); + const e = index_js_1.AbiCoder.getBuiltinCallException((method === "eth_call") ? "call" : "estimateGas", (payload.params[0]), (result ? result.data : null)); + e.info = { error, payload }; + return e; + } + // Only estimateGas and call can return arbitrary contract-defined text, so now we + // we can process text safely. + const message = JSON.stringify(spelunkMessage(error)); + if (typeof (error.message) === "string" && error.message.match(/user denied|ethers-user-denied/i)) { + const actionMap = { + eth_sign: "signMessage", + personal_sign: "signMessage", + eth_signTypedData_v4: "signTypedData", + eth_signTransaction: "signTransaction", + eth_sendTransaction: "sendTransaction", + eth_requestAccounts: "requestAccess", + wallet_requestAccounts: "requestAccess", + }; + return (0, index_js_5.makeError)(`user rejected action`, "ACTION_REJECTED", { + action: (actionMap[method] || "unknown"), + reason: "rejected", + info: { payload, error } + }); + } + if (method === "eth_sendRawTransaction" || method === "eth_sendTransaction") { + const transaction = (payload.params[0]); + if (message.match(/insufficient funds|base fee exceeds gas limit/i)) { + return (0, index_js_5.makeError)("insufficient funds for intrinsic transaction cost", "INSUFFICIENT_FUNDS", { + transaction, info: { error } + }); + } + if (message.match(/nonce/i) && message.match(/too low/i)) { + return (0, index_js_5.makeError)("nonce has already been used", "NONCE_EXPIRED", { transaction, info: { error } }); + } + // "replacement transaction underpriced" + if (message.match(/replacement transaction/i) && message.match(/underpriced/i)) { + return (0, index_js_5.makeError)("replacement fee too low", "REPLACEMENT_UNDERPRICED", { transaction, info: { error } }); + } + if (message.match(/only replay-protected/i)) { + return (0, index_js_5.makeError)("legacy pre-eip-155 transactions not supported", "UNSUPPORTED_OPERATION", { + operation: method, info: { transaction, info: { error } } + }); + } + } + let unsupported = !!message.match(/the method .* does not exist/i); + if (!unsupported) { + if (error && error.details && error.details.startsWith("Unauthorized method:")) { + unsupported = true; + } + } + if (unsupported) { + return (0, index_js_5.makeError)("unsupported operation", "UNSUPPORTED_OPERATION", { + operation: payload.method, info: { error, payload } + }); + } + return (0, index_js_5.makeError)("could not coalesce error", "UNKNOWN_ERROR", { error, payload }); + } + /** + * Requests the %%method%% with %%params%% via the JSON-RPC protocol + * over the underlying channel. This can be used to call methods + * on the backend that do not have a high-level API within the Provider + * API. + * + * This method queues requests according to the batch constraints + * in the options, assigns the request a unique ID. + * + * **Do NOT override** this method in sub-classes; instead + * override [[_send]] or force the options values in the + * call to the constructor to modify this method's behavior. + */ + send(method, params) { + // @TODO: cache chainId?? purge on switch_networks + var _a, _b; + // We have been destroyed; no operations are supported anymore + if (this.destroyed) { + return Promise.reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: method })); + } + const id = (__classPrivateFieldSet(this, _JsonRpcApiProvider_nextId, (_b = __classPrivateFieldGet(this, _JsonRpcApiProvider_nextId, "f"), _a = _b++, _b), "f"), _a); + const promise = new Promise((resolve, reject) => { + __classPrivateFieldGet(this, _JsonRpcApiProvider_payloads, "f").push({ + resolve, reject, + payload: { method, params, id, jsonrpc: "2.0" } + }); + }); + // If there is not a pending drainTimer, set one + __classPrivateFieldGet(this, _JsonRpcApiProvider_instances, "m", _JsonRpcApiProvider_scheduleDrain).call(this); + return promise; + } + /** + * Resolves to the [[Signer]] account for %%address%% managed by + * the client. + * + * If the %%address%% is a number, it is used as an index in the + * the accounts from [[listAccounts]]. + * + * This can only be used on clients which manage accounts (such as + * Geth with imported account or MetaMask). + * + * Throws if the account doesn't exist. + */ + getSigner(address) { + return __awaiter(this, void 0, void 0, function* () { + if (address == null) { + address = 0; + } + const accountsPromise = this.send("eth_accounts", []); + // Account index + if (typeof (address) === "number") { + const accounts = (yield accountsPromise); + if (address >= accounts.length) { + throw new Error("no such account"); + } + return new JsonRpcSigner(this, accounts[address]); + } + const { accounts } = yield (0, index_js_5.resolveProperties)({ + network: this.getNetwork(), + accounts: accountsPromise + }); + // Account address + address = (0, index_js_2.getAddress)(address); + for (const account of accounts) { + if ((0, index_js_2.getAddress)(account) === address) { + return new JsonRpcSigner(this, address); + } + } + throw new Error("invalid account"); + }); + } + listAccounts() { + return __awaiter(this, void 0, void 0, function* () { + const accounts = yield this.send("eth_accounts", []); + return accounts.map((a) => new JsonRpcSigner(this, a)); + }); + } + destroy() { + // Stop processing requests + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_drainTimer, "f")) { + clearTimeout(__classPrivateFieldGet(this, _JsonRpcApiProvider_drainTimer, "f")); + __classPrivateFieldSet(this, _JsonRpcApiProvider_drainTimer, null, "f"); + } + // Cancel all pending requests + for (const { payload, reject } of __classPrivateFieldGet(this, _JsonRpcApiProvider_payloads, "f")) { + reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + } + __classPrivateFieldSet(this, _JsonRpcApiProvider_payloads, [], "f"); + // Parent clean-up + super.destroy(); + } +} +exports.JsonRpcApiProvider = JsonRpcApiProvider; +_JsonRpcApiProvider_options = new WeakMap(), _JsonRpcApiProvider_nextId = new WeakMap(), _JsonRpcApiProvider_payloads = new WeakMap(), _JsonRpcApiProvider_drainTimer = new WeakMap(), _JsonRpcApiProvider_notReady = new WeakMap(), _JsonRpcApiProvider_network = new WeakMap(), _JsonRpcApiProvider_pendingDetectNetwork = new WeakMap(), _JsonRpcApiProvider_instances = new WeakSet(), _JsonRpcApiProvider_scheduleDrain = function _JsonRpcApiProvider_scheduleDrain() { + if (__classPrivateFieldGet(this, _JsonRpcApiProvider_drainTimer, "f")) { + return; + } + // If we aren't using batching, no hard in sending it immeidately + const stallTime = (this._getOption("batchMaxCount") === 1) ? 0 : this._getOption("batchStallTime"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_drainTimer, setTimeout(() => { + __classPrivateFieldSet(this, _JsonRpcApiProvider_drainTimer, null, "f"); + const payloads = __classPrivateFieldGet(this, _JsonRpcApiProvider_payloads, "f"); + __classPrivateFieldSet(this, _JsonRpcApiProvider_payloads, [], "f"); + while (payloads.length) { + // Create payload batches that satisfy our batch constraints + const batch = [(payloads.shift())]; + while (payloads.length) { + if (batch.length === __classPrivateFieldGet(this, _JsonRpcApiProvider_options, "f").batchMaxCount) { + break; + } + batch.push((payloads.shift())); + const bytes = JSON.stringify(batch.map((p) => p.payload)); + if (bytes.length > __classPrivateFieldGet(this, _JsonRpcApiProvider_options, "f").batchMaxSize) { + payloads.unshift((batch.pop())); + break; + } + } + // Process the result to each payload + (() => __awaiter(this, void 0, void 0, function* () { + const payload = ((batch.length === 1) ? batch[0].payload : batch.map((p) => p.payload)); + this.emit("debug", { action: "sendRpcPayload", payload }); + try { + const result = yield this._send(payload); + this.emit("debug", { action: "receiveRpcResult", result }); + // Process results in batch order + for (const { resolve, reject, payload } of batch) { + if (this.destroyed) { + reject((0, index_js_5.makeError)("provider destroyed; cancelled request", "UNSUPPORTED_OPERATION", { operation: payload.method })); + continue; + } + // Find the matching result + const resp = result.filter((r) => (r.id === payload.id))[0]; + // No result; the node failed us in unexpected ways + if (resp == null) { + const error = (0, index_js_5.makeError)("missing response for request", "BAD_DATA", { + value: result, info: { payload } + }); + this.emit("error", error); + reject(error); + continue; + } + // The response is an error + if ("error" in resp) { + reject(this.getRpcError(payload, resp)); + continue; + } + // All good; send the result + resolve(resp.result); + } + } + catch (error) { + this.emit("debug", { action: "receiveRpcError", error }); + for (const { reject } of batch) { + // @TODO: augment the error with the payload + reject(error); + } + } + }))(); + } + }, stallTime), "f"); +}; +// @TODO: remove this in v7, it is not exported because this functionality +// is exposed in the JsonRpcApiProvider by setting polling to true. It should +// be safe to remove regardless, because it isn't reachable, but just in case. +/** + * @_ignore: + */ +class JsonRpcApiPollingProvider extends JsonRpcApiProvider { + constructor(network, options) { + super(network, options); + _JsonRpcApiPollingProvider_pollingInterval.set(this, void 0); + __classPrivateFieldSet(this, _JsonRpcApiPollingProvider_pollingInterval, 4000, "f"); + } + _getSubscriber(sub) { + const subscriber = super._getSubscriber(sub); + if (isPollable(subscriber)) { + subscriber.pollingInterval = __classPrivateFieldGet(this, _JsonRpcApiPollingProvider_pollingInterval, "f"); + } + return subscriber; + } + /** + * The polling interval (default: 4000 ms) + */ + get pollingInterval() { return __classPrivateFieldGet(this, _JsonRpcApiPollingProvider_pollingInterval, "f"); } + set pollingInterval(value) { + if (!Number.isInteger(value) || value < 0) { + throw new Error("invalid interval"); + } + __classPrivateFieldSet(this, _JsonRpcApiPollingProvider_pollingInterval, value, "f"); + this._forEachSubscriber((sub) => { + if (isPollable(sub)) { + sub.pollingInterval = __classPrivateFieldGet(this, _JsonRpcApiPollingProvider_pollingInterval, "f"); + } + }); + } +} +exports.JsonRpcApiPollingProvider = JsonRpcApiPollingProvider; +_JsonRpcApiPollingProvider_pollingInterval = new WeakMap(); +/** + * The JsonRpcProvider is one of the most common Providers, + * which performs all operations over HTTP (or HTTPS) requests. + * + * Events are processed by polling the backend for the current block + * number; when it advances, all block-base events are then checked + * for updates. + */ +class JsonRpcProvider extends JsonRpcApiPollingProvider { + constructor(url, network, options) { + if (url == null) { + url = "http:/\/localhost:8545"; + } + super(network, options); + _JsonRpcProvider_connect.set(this, void 0); + if (typeof (url) === "string") { + __classPrivateFieldSet(this, _JsonRpcProvider_connect, new index_js_5.FetchRequest(url), "f"); + } + else { + __classPrivateFieldSet(this, _JsonRpcProvider_connect, url.clone(), "f"); + } + } + _getConnection() { + return __classPrivateFieldGet(this, _JsonRpcProvider_connect, "f").clone(); + } + send(method, params) { + const _super = Object.create(null, { + send: { get: () => super.send } + }); + return __awaiter(this, void 0, void 0, function* () { + // All requests are over HTTP, so we can just start handling requests + // We do this here rather than the constructor so that we don't send any + // requests to the network (i.e. eth_chainId) until we absolutely have to. + yield this._start(); + return yield _super.send.call(this, method, params); + }); + } + _send(payload) { + return __awaiter(this, void 0, void 0, function* () { + // Configure a POST connection for the requested method + const request = this._getConnection(); + request.body = JSON.stringify(payload); + request.setHeader("content-type", "application/json"); + const response = yield request.send(); + response.assertOk(); + let resp = response.bodyJson; + if (!Array.isArray(resp)) { + resp = [resp]; + } + return resp; + }); + } +} +exports.JsonRpcProvider = JsonRpcProvider; +_JsonRpcProvider_connect = new WeakMap(); +function spelunkData(value) { + if (value == null) { + return null; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string" && value.message.match(/revert/i) && (0, index_js_5.isHexString)(value.data)) { + return { message: value.message, data: value.data }; + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + const result = spelunkData(value[key]); + if (result) { + return result; + } + } + return null; + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return spelunkData(JSON.parse(value)); + } + catch (error) { } + } + return null; +} +function _spelunkMessage(value, result) { + if (value == null) { + return; + } + // These *are* the droids we're looking for. + if (typeof (value.message) === "string") { + result.push(value.message); + } + // Spelunk further... + if (typeof (value) === "object") { + for (const key in value) { + _spelunkMessage(value[key], result); + } + } + // Might be a JSON string we can further descend... + if (typeof (value) === "string") { + try { + return _spelunkMessage(JSON.parse(value), result); + } + catch (error) { } + } +} +function spelunkMessage(value) { + const result = []; + _spelunkMessage(value, result); + return result; +} +//# sourceMappingURL=provider-jsonrpc.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-jsonrpc.js.map b/dist/ethers.js/src.ts/providers/provider-jsonrpc.js.map new file mode 100644 index 0000000..62d4829 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-jsonrpc.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-jsonrpc.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-jsonrpc.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;GAUG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,SAAS;AACT,yBAAyB;AAEzB,yQAAyQ;AAEzQ,8CAA2C;AAC3C,kDAAiE;AACjE,+CAAoD;AACpD,sDAAwD;AACxD,gDAI2B;AAE3B,iEAA+E;AAC/E,6DAAsD;AACtD,6CAAuC;AACvC,qEAA8F;AAC9F,mEAAiE;AAajE,MAAM,SAAS,GAAG,8CAA8C,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AAC7E,gDAAgD;AAChD,SAAS,QAAQ,CAAU,KAAQ;IAC/B,IAAI,KAAK,IAAI,IAAI,IAAI,SAAS,CAAC,OAAO,CAAC,OAAM,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,EAAE;QACxD,OAAO,KAAK,CAAC;KAChB;IA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AI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;SACzC;QAAC,OAAO,KAAK,EAAE,GAAG;KACtB;IAED,OAAO,IAAI,CAAC;AAChB,CAAC;AAED,SAAS,eAAe,CAAC,KAAU,EAAE,MAAqB;IACtD,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO;KAAE;IAE9B,4CAA4C;IAC5C,IAAI,OAAM,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,QAAQ,EAAE;QACpC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;KAC9B;IAED,qBAAqB;IACrB,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;QAC5B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE;YACrB,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC,CAAC;SACvC;KACJ;IAED,mDAAmD;IACnD,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE;QAC5B,IAAI;YACA,OAAO,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,CAAC;SACrD;QAAC,OAAO,KAAK,EAAE,GAAG;KACtB;AACL,CAAC;AAED,SAAS,cAAc,CAAC,KAAU;IAC9B,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,eAAe,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/B,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-pocket.d.ts b/dist/ethers.js/src.ts/providers/provider-pocket.d.ts new file mode 100644 index 0000000..e0c4dc8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-pocket.d.ts @@ -0,0 +1,54 @@ +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +import { FetchRequest } from "../utils/index.js"; +import { AbstractProvider } from "./abstract-provider.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +export declare class PocketProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The Application ID for the Pocket connection. + */ + readonly applicationId: string; + /** + * The Application Secret for making authenticated requests + * to the Pocket connection. + */ + readonly applicationSecret: null | string; + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network?: Networkish, applicationId?: null | string, applicationSecret?: null | string); + _getProvider(chainId: number): AbstractProvider; + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network: Network, applicationId?: null | string, applicationSecret?: null | string): FetchRequest; + isCommunityResource(): boolean; +} +//# sourceMappingURL=provider-pocket.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-pocket.d.ts.map b/dist/ethers.js/src.ts/providers/provider-pocket.d.ts.map new file mode 100644 index 0000000..208ee2b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-pocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-pocket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAE1D,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAqB/C;;;;;;;;GAQG;AACH,qBAAa,cAAe,SAAQ,eAAgB,YAAW,oBAAoB;IAE/E;;OAEG;IACH,QAAQ,CAAC,aAAa,EAAG,MAAM,CAAC;IAEhC;;;OAGG;IACH,QAAQ,CAAC,iBAAiB,EAAG,IAAI,GAAG,MAAM,CAAC;IAE3C;;;;;OAKG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM;IAcnG,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,iBAAiB,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;IAoBnH,mBAAmB,IAAI,OAAO;CAGjC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-pocket.js b/dist/ethers.js/src.ts/providers/provider-pocket.js new file mode 100644 index 0000000..e10d9aa --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-pocket.js @@ -0,0 +1,109 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PocketProvider = void 0; +/** + * [[link-pocket]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Polygon (``matic``) + * - Arbitrum (``arbitrum``) + * + * @_subsection: api/providers/thirdparty:Pocket [providers-pocket] + */ +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultApplicationId = "62e1ad51b37b8e00394bda3b"; +function getHost(name) { + switch (name) { + case "mainnet": + return "eth-mainnet.gateway.pokt.network"; + case "goerli": + return "eth-goerli.gateway.pokt.network"; + case "matic": + return "poly-mainnet.gateway.pokt.network"; + case "matic-mumbai": + return "polygon-mumbai-rpc.gateway.pokt.network"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **PocketProvider** connects to the [[link-pocket]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API key is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-pocket-signup). + */ +class PocketProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * Create a new **PocketProvider**. + * + * By default connecting to ``mainnet`` with a highly throttled + * API key. + */ + constructor(_network, applicationId, applicationSecret) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (applicationId == null) { + applicationId = defaultApplicationId; + } + if (applicationSecret == null) { + applicationSecret = null; + } + const options = { staticNetwork: network }; + const request = PocketProvider.getRequest(network, applicationId, applicationSecret); + super(request, network, options); + (0, index_js_1.defineProperties)(this, { applicationId, applicationSecret }); + } + _getProvider(chainId) { + try { + return new PocketProvider(chainId, this.applicationId, this.applicationSecret); + } + catch (error) { } + return super._getProvider(chainId); + } + /** + * Returns a prepared request for connecting to %%network%% with + * %%applicationId%%. + */ + static getRequest(network, applicationId, applicationSecret) { + if (applicationId == null) { + applicationId = defaultApplicationId; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/v1/lb/${applicationId}`); + request.allowGzip = true; + if (applicationSecret) { + request.setCredentials("", applicationSecret); + } + if (applicationId === defaultApplicationId) { + request.retryFunc = (request, response, attempt) => __awaiter(this, void 0, void 0, function* () { + (0, community_js_1.showThrottleMessage)("PocketProvider"); + return true; + }); + } + return request; + } + isCommunityResource() { + return (this.applicationId === defaultApplicationId); + } +} +exports.PocketProvider = PocketProvider; +//# sourceMappingURL=provider-pocket.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-pocket.js.map b/dist/ethers.js/src.ts/providers/provider-pocket.js.map new file mode 100644 index 0000000..891ee43 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-pocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-pocket.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-pocket.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,gDAE2B;AAG3B,iDAAqD;AACrD,6CAAuC;AACvC,+DAAwD;AAKxD,MAAM,oBAAoB,GAAG,0BAA0B,CAAC;AAExD,SAAS,OAAO,CAAC,IAAY;IACzB,QAAQ,IAAI,EAAE;QACV,KAAK,SAAS;YACV,OAAQ,kCAAkC,CAAC;QAC/C,KAAK,QAAQ;YACT,OAAO,iCAAiC,CAAC;QAE7C,KAAK,OAAO;YACR,OAAO,mCAAmC,CAAC;QAC/C,KAAK,cAAc;YACf,OAAO,yCAAyC,CAAC;KACxD;IAED,IAAA,yBAAc,EAAC,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;AAClE,CAAC;AAGD;;;;;;;;GAQG;AACH,MAAa,cAAe,SAAQ,qCAAe;IAa/C;;;;;OAKG;IACH,YAAY,QAAqB,EAAE,aAA6B,EAAE,iBAAiC;QAC/F,I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AAC;SACjD;QAED,IAAI,aAAa,KAAK,oBAAoB,EAAE;YACxC,OAAO,CAAC,SAAS,GAAG,CAAO,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,gBAAgB,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,aAAa,KAAK,oBAAoB,CAAC,CAAC;IACzD,CAAC;CACJ;AAnED,wCAmEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts b/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts new file mode 100644 index 0000000..0cf8821 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts @@ -0,0 +1,50 @@ +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +import { FetchRequest } from "../utils/index.js"; +import { Network } from "./network.js"; +import { JsonRpcProvider } from "./provider-jsonrpc.js"; +import type { AbstractProvider } from "./abstract-provider.js"; +import type { CommunityResourcable } from "./community.js"; +import type { Networkish } from "./network.js"; +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +export declare class QuickNodeProvider extends JsonRpcProvider implements CommunityResourcable { + /** + * The API token. + */ + readonly token: string; + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network?: Networkish, token?: null | string); + _getProvider(chainId: number): AbstractProvider; + isCommunityResource(): boolean; + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network: Network, token?: null | string): FetchRequest; +} +//# sourceMappingURL=provider-quicknode.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts.map b/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts.map new file mode 100644 index 0000000..7dc2005 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-quicknode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-quicknode.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-quicknode.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACe,YAAY,EACjC,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAgC/C;;;;;;;;GAQG;AACH,qBAAa,iBAAkB,SAAQ,eAAgB,YAAW,oBAAoB;IAClF;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,QAAQ,CAAC,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM;IAWxD,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,gBAAgB;IAO/C,mBAAmB,IAAI,OAAO;IAI9B;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,IAAI,GAAG,MAAM,GAAG,YAAY;CAgB3E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-quicknode.js b/dist/ethers.js/src.ts/providers/provider-quicknode.js new file mode 100644 index 0000000..4b40751 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-quicknode.js @@ -0,0 +1,114 @@ +"use strict"; +/** + * [[link-quicknode]] provides a third-party service for connecting to + * various blockchains over JSON-RPC. + * + * **Supported Networks** + * + * - Ethereum Mainnet (``mainnet``) + * - Goerli Testnet (``goerli``) + * - Arbitrum (``arbitrum``) + * - Arbitrum Goerli Testnet (``arbitrum-goerli``) + * - Optimism (``optimism``) + * - Optimism Goerli Testnet (``optimism-goerli``) + * - Polygon (``matic``) + * - Polygon Mumbai Testnet (``matic-mumbai``) + * + * @_subsection: api/providers/thirdparty:QuickNode [providers-quicknode] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.QuickNodeProvider = void 0; +const index_js_1 = require("../utils/index.js"); +const community_js_1 = require("./community.js"); +const network_js_1 = require("./network.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +const defaultToken = "919b412a057b5e9c9b6dce193c5a60242d6efadb"; +function getHost(name) { + switch (name) { + case "mainnet": + return "ethers.quiknode.pro"; + case "goerli": + return "ethers.ethereum-goerli.quiknode.pro"; + //case "sepolia": + // return "sepolia.infura.io"; + case "arbitrum": + return "ethers.arbitrum-mainnet.quiknode.pro"; + case "arbitrum-goerli": + return "ethers.arbitrum-goerli.quiknode.pro"; + case "matic": + return "ethers.matic.quiknode.pro"; + case "matic-mumbai": + return "ethers.matic-testnet.quiknode.pro"; + case "optimism": + return "ethers.optimism.quiknode.pro"; + case "optimism-goerli": + return "ethers.optimism-goerli.quiknode.pro"; + } + (0, index_js_1.assertArgument)(false, "unsupported network", "network", name); +} +/** + * The **QuickNodeProvider** connects to the [[link-quicknode]] + * JSON-RPC end-points. + * + * By default, a highly-throttled API token is used, which is + * appropriate for quick prototypes and simple scripts. To + * gain access to an increased rate-limit, it is highly + * recommended to [sign up here](link-quicknode). + */ +class QuickNodeProvider extends provider_jsonrpc_js_1.JsonRpcProvider { + /** + * Creates a new **QuickNodeProvider**. + */ + constructor(_network, token) { + if (_network == null) { + _network = "mainnet"; + } + const network = network_js_1.Network.from(_network); + if (token == null) { + token = defaultToken; + } + const request = QuickNodeProvider.getRequest(network, token); + super(request, network, { staticNetwork: network }); + (0, index_js_1.defineProperties)(this, { token }); + } + _getProvider(chainId) { + try { + return new QuickNodeProvider(chainId, this.token); + } + catch (error) { } + return super._getProvider(chainId); + } + isCommunityResource() { + return (this.token === defaultToken); + } + /** + * Returns a new request prepared for %%network%% and the + * %%token%%. + */ + static getRequest(network, token) { + if (token == null) { + token = defaultToken; + } + const request = new index_js_1.FetchRequest(`https:/\/${getHost(network.name)}/${token}`); + request.allowGzip = true; + //if (projectSecret) { request.setCredentials("", projectSecret); } + if (token === defaultToken) { + request.retryFunc = (request, response, attempt) => __awaiter(this, void 0, void 0, function* () { + (0, community_js_1.showThrottleMessage)("QuickNodeProvider"); + return true; + }); + } + return request; + } +} +exports.QuickNodeProvider = QuickNodeProvider; +//# sourceMappingURL=provider-quicknode.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-quicknode.js.map b/dist/ethers.js/src.ts/providers/provider-quicknode.js.map new file mode 100644 index 0000000..1088593 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-quicknode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-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AAC,CAAC;QAEpD,IAAA,2BAAgB,EAAoB,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,YAAY,CAAC,OAAe;QACxB,IAAI;YACA,OAAO,IAAI,iBAAiB,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;SACrD;QAAC,OAAO,KAAK,EAAE,GAAG;QACnB,OAAO,KAAK,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;IACvC,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;IACzC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,UAAU,CAAC,OAAgB,EAAE,KAAqB;QACrD,IAAI,KAAK,IAAI,IAAI,EAAE;YAAE,KAAK,GAAG,YAAY,CAAC;SAAE;QAE5C,MAAM,OAAO,GAAG,IAAI,uBAAY,CAAC,YAAa,OAAO,CAAC,OAAO,CAAC,IAAI,CAAE,IAAK,KAAM,EAAE,CAAC,CAAC;QACnF,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC;QACzB,mEAAmE;QAEnE,IAAI,KAAK,KAAK,YAAY,EAAE;YACxB,OAAO,CAAC,SAAS,GAAG,CAAO,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE;gBACrD,IAAA,kCAAmB,EAAC,mBAAmB,CAAC,CAAC;gBACzC,OAAO,IAAI,CAAC;YAChB,CAAC,CAAA,CAAC;SACL;QAED,OAAO,OAAO,CAAC;IACnB,CAAC;CACJ;AAnDD,8CAmDC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-socket.d.ts b/dist/ethers.js/src.ts/providers/provider-socket.d.ts new file mode 100644 index 0000000..41c58fc --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-socket.d.ts @@ -0,0 +1,113 @@ +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +import { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +import type { Subscriber, Subscription } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProviderOptions, JsonRpcError, JsonRpcPayload, JsonRpcResult } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +export declare class SocketSubscriber implements Subscriber { + #private; + /** + * The filter. + */ + get filter(): Array; + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider: SocketProvider, filter: Array); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; + /** + * @_ignore: + */ + _handleMessage(message: any): void; + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +export declare class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +export declare class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider: SocketProvider); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketEventSubscriber** listens for event logs. + */ +export declare class SocketEventSubscriber extends SocketSubscriber { + #private; + /** + * The filter. + */ + get logFilter(): EventFilter; + /** + * @_ignore: + */ + constructor(provider: SocketProvider, filter: EventFilter); + _emit(provider: SocketProvider, message: any): Promise; +} +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +export declare class SocketProvider extends JsonRpcApiProvider { + #private; + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network?: Networkish, _options?: JsonRpcApiProviderOptions); + _getSubscriber(sub: Subscription): Subscriber; + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId: number | string, subscriber: SocketSubscriber): void; + _send(payload: JsonRpcPayload | Array): Promise>; + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + _processMessage(message: string): Promise; + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + _write(message: string): Promise; +} +//# sourceMappingURL=provider-socket.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-socket.d.ts.map b/dist/ethers.js/src.ts/providers/provider-socket.d.ts.map new file mode 100644 index 0000000..e9f214f --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-socket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-socket.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EACR,yBAAyB,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EACzE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAW/C;;;GAGG;AACH,qBAAa,gBAAiB,YAAW,UAAU;;IAK/C;;OAEG;IACH,IAAI,MAAM,IAAI,KAAK,CAAC,GAAG,CAAC,CAAqC;IAO7D;;;OAGG;gBACS,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC;IAQxD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;I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AAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,GAAG,YAAY,CAAC,CAAC;IAmC1G;;;OAGG;IACG,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuCrD;;;OAGG;IACG,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;CAG/C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-socket.js b/dist/ethers.js/src.ts/providers/provider-socket.js new file mode 100644 index 0000000..0158f38 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-socket.js @@ -0,0 +1,344 @@ +"use strict"; +/** + * Generic long-lived socket provider. + * + * Sub-classing notes + * - a sub-class MUST call the `_start()` method once connected + * - a sub-class MUST override the `_write(string)` method + * - a sub-class MUST call `_processMessage(string)` for each message + * + * @_subsection: api/providers/abstract-provider:Socket Providers [about-socketProvider] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _SocketSubscriber_provider, _SocketSubscriber_filter, _SocketSubscriber_filterId, _SocketSubscriber_paused, _SocketSubscriber_emitPromise, _SocketEventSubscriber_logFilter, _SocketProvider_callbacks, _SocketProvider_subs, _SocketProvider_pending; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.SocketProvider = exports.SocketEventSubscriber = exports.SocketPendingSubscriber = exports.SocketBlockSubscriber = exports.SocketSubscriber = void 0; +const abstract_provider_js_1 = require("./abstract-provider.js"); +const index_js_1 = require("../utils/index.js"); +const provider_jsonrpc_js_1 = require("./provider-jsonrpc.js"); +/** + * A **SocketSubscriber** uses a socket transport to handle events and + * should use [[_emit]] to manage the events. + */ +class SocketSubscriber { + /** + * The filter. + */ + get filter() { return JSON.parse(__classPrivateFieldGet(this, _SocketSubscriber_filter, "f")); } + /** + * Creates a new **SocketSubscriber** attached to %%provider%% listening + * to %%filter%%. + */ + constructor(provider, filter) { + _SocketSubscriber_provider.set(this, void 0); + _SocketSubscriber_filter.set(this, void 0); + _SocketSubscriber_filterId.set(this, void 0); + _SocketSubscriber_paused.set(this, void 0); + _SocketSubscriber_emitPromise.set(this, void 0); + __classPrivateFieldSet(this, _SocketSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _SocketSubscriber_filter, JSON.stringify(filter), "f"); + __classPrivateFieldSet(this, _SocketSubscriber_filterId, null, "f"); + __classPrivateFieldSet(this, _SocketSubscriber_paused, null, "f"); + __classPrivateFieldSet(this, _SocketSubscriber_emitPromise, null, "f"); + } + start() { + __classPrivateFieldSet(this, _SocketSubscriber_filterId, __classPrivateFieldGet(this, _SocketSubscriber_provider, "f").send("eth_subscribe", this.filter).then((filterId) => { + ; + __classPrivateFieldGet(this, _SocketSubscriber_provider, "f")._register(filterId, this); + return filterId; + }), "f"); + } + stop() { + (__classPrivateFieldGet(this, _SocketSubscriber_filterId, "f")).then((filterId) => { + __classPrivateFieldGet(this, _SocketSubscriber_provider, "f").send("eth_unsubscribe", [filterId]); + }); + __classPrivateFieldSet(this, _SocketSubscriber_filterId, null, "f"); + } + // @TODO: pause should trap the current blockNumber, unsub, and on resume use getLogs + // and resume + pause(dropWhilePaused) { + (0, index_js_1.assert)(dropWhilePaused, "preserve logs while paused not supported by SocketSubscriber yet", "UNSUPPORTED_OPERATION", { operation: "pause(false)" }); + __classPrivateFieldSet(this, _SocketSubscriber_paused, !!dropWhilePaused, "f"); + } + resume() { + __classPrivateFieldSet(this, _SocketSubscriber_paused, null, "f"); + } + /** + * @_ignore: + */ + _handleMessage(message) { + if (__classPrivateFieldGet(this, _SocketSubscriber_filterId, "f") == null) { + return; + } + if (__classPrivateFieldGet(this, _SocketSubscriber_paused, "f") === null) { + let emitPromise = __classPrivateFieldGet(this, _SocketSubscriber_emitPromise, "f"); + if (emitPromise == null) { + emitPromise = this._emit(__classPrivateFieldGet(this, _SocketSubscriber_provider, "f"), message); + } + else { + emitPromise = emitPromise.then(() => __awaiter(this, void 0, void 0, function* () { + yield this._emit(__classPrivateFieldGet(this, _SocketSubscriber_provider, "f"), message); + })); + } + __classPrivateFieldSet(this, _SocketSubscriber_emitPromise, emitPromise.then(() => { + if (__classPrivateFieldGet(this, _SocketSubscriber_emitPromise, "f") === emitPromise) { + __classPrivateFieldSet(this, _SocketSubscriber_emitPromise, null, "f"); + } + }), "f"); + } + } + /** + * Sub-classes **must** override this to emit the events on the + * provider. + */ + _emit(provider, message) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("sub-classes must implemente this; _emit"); + }); + } +} +exports.SocketSubscriber = SocketSubscriber; +_SocketSubscriber_provider = new WeakMap(), _SocketSubscriber_filter = new WeakMap(), _SocketSubscriber_filterId = new WeakMap(), _SocketSubscriber_paused = new WeakMap(), _SocketSubscriber_emitPromise = new WeakMap(); +/** + * A **SocketBlockSubscriber** listens for ``newHeads`` events and emits + * ``"block"`` events. + */ +class SocketBlockSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newHeads"]); + } + _emit(provider, message) { + return __awaiter(this, void 0, void 0, function* () { + provider.emit("block", parseInt(message.number)); + }); + } +} +exports.SocketBlockSubscriber = SocketBlockSubscriber; +/** + * A **SocketPendingSubscriber** listens for pending transacitons and emits + * ``"pending"`` events. + */ +class SocketPendingSubscriber extends SocketSubscriber { + /** + * @_ignore: + */ + constructor(provider) { + super(provider, ["newPendingTransactions"]); + } + _emit(provider, message) { + return __awaiter(this, void 0, void 0, function* () { + provider.emit("pending", message); + }); + } +} +exports.SocketPendingSubscriber = SocketPendingSubscriber; +/** + * A **SocketEventSubscriber** listens for event logs. + */ +class SocketEventSubscriber extends SocketSubscriber { + /** + * The filter. + */ + get logFilter() { return JSON.parse(__classPrivateFieldGet(this, _SocketEventSubscriber_logFilter, "f")); } + /** + * @_ignore: + */ + constructor(provider, filter) { + super(provider, ["logs", filter]); + _SocketEventSubscriber_logFilter.set(this, void 0); + __classPrivateFieldSet(this, _SocketEventSubscriber_logFilter, JSON.stringify(filter), "f"); + } + _emit(provider, message) { + return __awaiter(this, void 0, void 0, function* () { + provider.emit(this.logFilter, provider._wrapLog(message, provider._network)); + }); + } +} +exports.SocketEventSubscriber = SocketEventSubscriber; +_SocketEventSubscriber_logFilter = new WeakMap(); +/** + * A **SocketProvider** is backed by a long-lived connection over a + * socket, which can subscribe and receive real-time messages over + * its communication channel. + */ +class SocketProvider extends provider_jsonrpc_js_1.JsonRpcApiProvider { + /** + * Creates a new **SocketProvider** connected to %%network%%. + * + * If unspecified, the network will be discovered. + */ + constructor(network, _options) { + // Copy the options + const options = Object.assign({}, (_options != null) ? _options : {}); + // Support for batches is generally not supported for + // connection-base providers; if this changes in the future + // the _send should be updated to reflect this + (0, index_js_1.assertArgument)(options.batchMaxCount == null || options.batchMaxCount === 1, "sockets-based providers do not support batches", "options.batchMaxCount", _options); + options.batchMaxCount = 1; + // Socket-based Providers (generally) cannot change their network, + // since they have a long-lived connection; but let people override + // this if they have just cause. + if (options.staticNetwork == null) { + options.staticNetwork = true; + } + super(network, options); + _SocketProvider_callbacks.set(this, void 0); + // Maps each filterId to its subscriber + _SocketProvider_subs.set(this, void 0); + // If any events come in before a subscriber has finished + // registering, queue them + _SocketProvider_pending.set(this, void 0); + __classPrivateFieldSet(this, _SocketProvider_callbacks, new Map(), "f"); + __classPrivateFieldSet(this, _SocketProvider_subs, new Map(), "f"); + __classPrivateFieldSet(this, _SocketProvider_pending, new Map(), "f"); + } + // This value is only valid after _start has been called + /* + get _network(): Network { + if (this.#network == null) { + throw new Error("this shouldn't happen"); + } + return this.#network.clone(); + } + */ + _getSubscriber(sub) { + switch (sub.type) { + case "close": + return new abstract_provider_js_1.UnmanagedSubscriber("close"); + case "block": + return new SocketBlockSubscriber(this); + case "pending": + return new SocketPendingSubscriber(this); + case "event": + return new SocketEventSubscriber(this, sub.filter); + case "orphan": + // Handled auto-matically within AbstractProvider + // when the log.removed = true + if (sub.filter.orphan === "drop-log") { + return new abstract_provider_js_1.UnmanagedSubscriber("drop-log"); + } + } + return super._getSubscriber(sub); + } + /** + * Register a new subscriber. This is used internalled by Subscribers + * and generally is unecessary unless extending capabilities. + */ + _register(filterId, subscriber) { + __classPrivateFieldGet(this, _SocketProvider_subs, "f").set(filterId, subscriber); + const pending = __classPrivateFieldGet(this, _SocketProvider_pending, "f").get(filterId); + if (pending) { + for (const message of pending) { + subscriber._handleMessage(message); + } + __classPrivateFieldGet(this, _SocketProvider_pending, "f").delete(filterId); + } + } + _send(payload) { + return __awaiter(this, void 0, void 0, function* () { + // WebSocket provider doesn't accept batches + (0, index_js_1.assertArgument)(!Array.isArray(payload), "WebSocket does not support batch send", "payload", payload); + // @TODO: stringify payloads here and store to prevent mutations + // Prepare a promise to respond to + const promise = new Promise((resolve, reject) => { + __classPrivateFieldGet(this, _SocketProvider_callbacks, "f").set(payload.id, { payload, resolve, reject }); + }); + // Wait until the socket is connected before writing to it + yield this._waitUntilReady(); + // Write the request to the socket + yield this._write(JSON.stringify(payload)); + return [yield promise]; + }); + } + // Sub-classes must call this once they are connected + /* + async _start(): Promise { + if (this.#ready) { return; } + + for (const { payload } of this.#callbacks.values()) { + await this._write(JSON.stringify(payload)); + } + + this.#ready = (async function() { + await super._start(); + })(); + } + */ + /** + * Sub-classes **must** call this with messages received over their + * transport to be processed and dispatched. + */ + _processMessage(message) { + return __awaiter(this, void 0, void 0, function* () { + const result = (JSON.parse(message)); + if (result && typeof (result) === "object" && "id" in result) { + const callback = __classPrivateFieldGet(this, _SocketProvider_callbacks, "f").get(result.id); + if (callback == null) { + this.emit("error", (0, index_js_1.makeError)("received result for unknown id", "UNKNOWN_ERROR", { + reasonCode: "UNKNOWN_ID", + result + })); + return; + } + __classPrivateFieldGet(this, _SocketProvider_callbacks, "f").delete(result.id); + callback.resolve(result); + } + else if (result && result.method === "eth_subscription") { + const filterId = result.params.subscription; + const subscriber = __classPrivateFieldGet(this, _SocketProvider_subs, "f").get(filterId); + if (subscriber) { + subscriber._handleMessage(result.params.result); + } + else { + let pending = __classPrivateFieldGet(this, _SocketProvider_pending, "f").get(filterId); + if (pending == null) { + pending = []; + __classPrivateFieldGet(this, _SocketProvider_pending, "f").set(filterId, pending); + } + pending.push(result.params.result); + } + } + else { + this.emit("error", (0, index_js_1.makeError)("received unexpected message", "UNKNOWN_ERROR", { + reasonCode: "UNEXPECTED_MESSAGE", + result + })); + return; + } + }); + } + /** + * Sub-classes **must** override this to send %%message%% over their + * transport. + */ + _write(message) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("sub-classes must override this"); + }); + } +} +exports.SocketProvider = SocketProvider; +_SocketProvider_callbacks = new WeakMap(), _SocketProvider_subs = new WeakMap(), _SocketProvider_pending = new WeakMap(); +//# sourceMappingURL=provider-socket.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-socket.js.map b/dist/ethers.js/src.ts/providers/provider-socket.js.map new file mode 100644 index 0000000..96ba1b9 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-socket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-socket.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-socket.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;;;;;;;;;;;;;;;;;;;;;;AAEH,iEAA6D;AAC7D,gDAAsE;AACtE,+DAA2D;AAkB3D;;;GAGG;AACH,MAAa,gBAAgB;IAKzB;;OAEG;IACH,IAAI,MAAM,KAAiB,OAAO,IAAI,CAAC,KAAK,CAAC,uBAAA,IAAI,gCAAQ,CAAC,CAAC,CAAC,CAAC;IAO7D;;;OAGG;IACH,YAAY,QAAwB,EAAE,MAAkB;QAlBxD,6CAA0B;QAE1B,2CAAgB;QAOhB,6CAA0C;QAC1C,2CAAwB;QAExB,gDAAmC;QAO/B,uBAAA,IAAI,8BAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,4BAAW,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAA,CAAC;QACtC,uBAAA,IAAI,8BAAa,IAAI,MAAA,CAAC;QACtB,uBAAA,IAAI,4BAAW,IAAI,MAAA,CAAC;QACpB,uBAAA,IAAI,iCAAgB,IAAI,MAAA,CAAC;IAC7B,CAAC;IAED,KAAK;QACD,uBAAA,IAAI,8BAAa,uBAAA,IAAI,kCAAU,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE;YAAE,CAAC;YACpF,uBAAA,IAAI,kCAAU,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;YACzC,OAAO,QAAQ,CAAC;QACpB,CAAC,CAAC,MAAA,CAAC;IACP,CAAC;IAED,IAAI;QACkB,CAAC,uBAAA,IAAI,kCAAU,CAAE,CAAC,IAAI,CAAC,CAAC,QAAQ,EA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CAAC,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;iBACnD;qBAAM;oBACH,IAAI,OAAO,GAAG,uBAAA,IAAI,+BAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;oBAC1C,IAAI,OAAO,IAAI,IAAI,EAAE;wBACjB,OAAO,GAAG,EAAG,CAAC;wBACd,uBAAA,IAAI,+BAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;qBACxC;oBACD,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;iBACtC;aAEJ;iBAAM;gBACH,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,IAAA,oBAAS,EAAC,6BAA6B,EAAE,eAAe,EAAE;oBACzE,UAAU,EAAE,oBAAoB;oBAChC,MAAM;iBACT,CAAC,CAAC,CAAC;gBACJ,OAAO;aACV;QACL,CAAC;KAAA;IAED;;;OAGG;IACG,MAAM,CAAC,OAAe;;YACxB,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;QACtD,CAAC;KAAA;CACJ;AAvKD,wCAuKC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-websocket.d.ts b/dist/ethers.js/src.ts/providers/provider-websocket.d.ts new file mode 100644 index 0000000..b34c984 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-websocket.d.ts @@ -0,0 +1,37 @@ +import { SocketProvider } from "./provider-socket.js"; +import type { JsonRpcApiProviderOptions } from "./provider-jsonrpc.js"; +import type { Networkish } from "./network.js"; +/** + * A generic interface to a Websocket-like object. + */ +export interface WebSocketLike { + onopen: null | ((...args: Array) => any); + onmessage: null | ((...args: Array) => any); + onerror: null | ((...args: Array) => any); + readyState: number; + send(payload: any): void; + close(code?: number, reason?: string): void; +} +/** + * A function which can be used to re-create a WebSocket connection + * on disconnect. + */ +export type WebSocketCreator = () => WebSocketLike; +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +export declare class WebSocketProvider extends SocketProvider { + #private; + get websocket(): WebSocketLike; + constructor(url: string | WebSocketLike | WebSocketCreator, network?: Networkish, options?: JsonRpcApiProviderOptions); + _write(message: string): Promise; + destroy(): Promise; +} +//# sourceMappingURL=provider-websocket.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-websocket.d.ts.map b/dist/ethers.js/src.ts/providers/provider-websocket.d.ts.map new file mode 100644 index 0000000..a78b3b4 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-websocket.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-websocket.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,yBAAyB,EAAC,MAAM,uBAAuB,CAAC;AACtE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,aAAa;IAC1B,MAAM,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAC9C,SAAS,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IACjD,OAAO,EAAE,IAAI,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,CAAC;IAE/C,UAAU,EAAE,MAAM,CAAC;IAEnB,IAAI,CAAC,OAAO,EAAE,GAAG,GAAG,IAAI,CAAC;IACzB,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/C;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,MAAM,aAAa,CAAC;AAEnD;;;;;;;;;GASG;AACH,qBAAa,iBAAkB,SAAQ,cAAc;;IAIjD,IAAI,SAAS,IAAI,aAAa,CAG7B;gBAEW,GAAG,EAAE,MAAM,GAAG,aAAa,GAAG,gBAAgB,EAAE,OAAO,CAAC,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,yBAAyB;IA2C/G,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAItC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAOjC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-websocket.js b/dist/ethers.js/src.ts/providers/provider-websocket.js new file mode 100644 index 0000000..8418231 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-websocket.js @@ -0,0 +1,109 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _WebSocketProvider_connect, _WebSocketProvider_websocket; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocketProvider = void 0; +const ws_js_1 = require("./ws.js"); /*-browser*/ +const provider_socket_js_1 = require("./provider-socket.js"); +/** + * A JSON-RPC provider which is backed by a WebSocket. + * + * WebSockets are often preferred because they retain a live connection + * to a server, which permits more instant access to events. + * + * However, this incurs higher server infrasturture costs, so additional + * resources may be required to host your own WebSocket nodes and many + * third-party services charge additional fees for WebSocket endpoints. + */ +class WebSocketProvider extends provider_socket_js_1.SocketProvider { + get websocket() { + if (__classPrivateFieldGet(this, _WebSocketProvider_websocket, "f") == null) { + throw new Error("websocket closed"); + } + return __classPrivateFieldGet(this, _WebSocketProvider_websocket, "f"); + } + constructor(url, network, options) { + super(network, options); + _WebSocketProvider_connect.set(this, void 0); + _WebSocketProvider_websocket.set(this, void 0); + if (typeof (url) === "string") { + __classPrivateFieldSet(this, _WebSocketProvider_connect, () => { return new ws_js_1.WebSocket(url); }, "f"); + __classPrivateFieldSet(this, _WebSocketProvider_websocket, __classPrivateFieldGet(this, _WebSocketProvider_connect, "f").call(this), "f"); + } + else if (typeof (url) === "function") { + __classPrivateFieldSet(this, _WebSocketProvider_connect, url, "f"); + __classPrivateFieldSet(this, _WebSocketProvider_websocket, url(), "f"); + } + else { + __classPrivateFieldSet(this, _WebSocketProvider_connect, null, "f"); + __classPrivateFieldSet(this, _WebSocketProvider_websocket, url, "f"); + } + this.websocket.onopen = () => __awaiter(this, void 0, void 0, function* () { + try { + yield this._start(); + this.resume(); + } + catch (error) { + console.log("failed to start WebsocketProvider", error); + // @TODO: now what? Attempt reconnect? + } + }); + this.websocket.onmessage = (message) => { + this._processMessage(message.data); + }; + /* + this.websocket.onclose = (event) => { + // @TODO: What event.code should we reconnect on? + const reconnect = false; + if (reconnect) { + this.pause(true); + if (this.#connect) { + this.#websocket = this.#connect(); + this.#websocket.onopen = ... + // @TODO: this requires the super class to rebroadcast; move it there + } + this._reconnect(); + } + }; + */ + } + _write(message) { + return __awaiter(this, void 0, void 0, function* () { + this.websocket.send(message); + }); + } + destroy() { + const _super = Object.create(null, { + destroy: { get: () => super.destroy } + }); + return __awaiter(this, void 0, void 0, function* () { + if (__classPrivateFieldGet(this, _WebSocketProvider_websocket, "f") != null) { + __classPrivateFieldGet(this, _WebSocketProvider_websocket, "f").close(); + __classPrivateFieldSet(this, _WebSocketProvider_websocket, null, "f"); + } + _super.destroy.call(this); + }); + } +} +exports.WebSocketProvider = WebSocketProvider; +_WebSocketProvider_connect = new WeakMap(), _WebSocketProvider_websocket = new WeakMap(); +//# sourceMappingURL=provider-websocket.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider-websocket.js.map b/dist/ethers.js/src.ts/providers/provider-websocket.js.map new file mode 100644 index 0000000..23fa7c5 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider-websocket.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider-websocket.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider-websocket.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAEA,mCAAkD,CAAC,YAAY;AAE/D,6DAAsD;AAyBtD;;;;;;;;;GASG;AACH,MAAa,iBAAkB,SAAQ,mCAAc;IAIjD,IAAI,SAAS;QACT,IAAI,uBAAA,IAAI,oCAAW,IAAI,IAAI,EAAE;YAAE,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAC;SAAE;QACrE,OAAO,uBAAA,IAAI,oCAAW,CAAC;IAC3B,CAAC;IAED,YAAY,GAA8C,EAAE,OAAoB,EAAE,OAAmC;QACjH,KAAK,CAAC,OAAO,EAAE,OA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EAAE,CAAC;gBACxB,uBAAA,IAAI,gCAAc,IAAI,MAAA,CAAC;aAC1B;YACD,OAAM,OAAO,YAAG;QACpB,CAAC;KAAA;CACJ;AA/DD,8CA+DC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider.d.ts b/dist/ethers.js/src.ts/providers/provider.d.ts new file mode 100644 index 0000000..e73da72 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider.d.ts @@ -0,0 +1,1135 @@ +import type { AddressLike, NameResolver } from "../address/index.js"; +import type { BigNumberish, EventEmitterable } from "../utils/index.js"; +import type { Signature } from "../crypto/index.js"; +import type { AccessList, AccessListish, TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { Network } from "./network.js"; +/** + * A **BlockTag** specifies a specific block. + * + * **numeric value** - specifies the block height, where + * the genesis block is block 0; many operations accept a negative + * value which indicates the block number should be deducted from + * the most recent block. A numeric value may be a ``number``, ``bigint``, + * or a decimal of hex string. + * + * **blockhash** - specifies a specific block by its blockhash; this allows + * potentially orphaned blocks to be specifed, without ambiguity, but many + * backends do not support this for some operations. + */ +export type BlockTag = BigNumberish | string; +import { BlockParams, LogParams, TransactionReceiptParams, TransactionResponseParams } from "./formatting.js"; +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +export declare class FeeData { + /** + * The gas price for legacy networks. + */ + readonly gasPrice: null | bigint; + /** + * The maximum fee to pay per gas. + * + * The base fee per gas is defined by the network and based on + * congestion, increasing the cost during times of heavy load + * and lowering when less busy. + * + * The actual fee per gas will be the base fee for the block + * and the priority fee, up to the max fee per gas. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxFeePerGas: null | bigint; + /** + * The additional amout to pay per gas to encourage a validator + * to include the transaction. + * + * The purpose of this is to compensate the validator for the + * adjusted risk for including a given transaction. + * + * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559)) + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint); + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; +} +/** + * A **TransactionRequest** is a transactions with potentially various + * properties not defined, or with less strict types for its values. + * + * This is used to pass to various operations, which will internally + * coerce any types and populate any necessary values. + */ +export interface TransactionRequest { + /** + * The transaction type. + */ + type?: null | number; + /** + * The target of the transaction. + */ + to?: null | AddressLike; + /** + * The sender of the transaction. + */ + from?: null | AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: null | number; + /** + * The maximum amount of gas to allow this transaction to consime. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The transaction data. + */ + data?: null | string; + /** + * The transaction value (in wei). + */ + value?: null | BigNumberish; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: null | AccessListish; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; +} +/** + * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]] + * except all the property types are strictly enforced. + */ +export interface PreparedTransactionRequest { + /** + * The transaction type. + */ + type?: number; + /** + * The target of the transaction. + */ + to?: AddressLike; + /** + * The sender of the transaction. + */ + from?: AddressLike; + /** + * The nonce of the transaction, used to prevent replay attacks. + */ + nonce?: number; + /** + * The maximum amount of gas to allow this transaction to consime. + */ + gasLimit?: bigint; + /** + * The gas price to use for legacy transactions or transactions on + * legacy networks. + * + * Most of the time the ``max*FeePerGas`` is preferred. + */ + gasPrice?: bigint; + /** + * The [[link-eip-1559]] maximum priority fee to pay per gas. + */ + maxPriorityFeePerGas?: bigint; + /** + * The [[link-eip-1559]] maximum total fee to pay per gas. The actual + * value used is protocol enforced to be the block's base fee. + */ + maxFeePerGas?: bigint; + /** + * The transaction data. + */ + data?: string; + /** + * The transaction value (in wei). + */ + value?: bigint; + /** + * The chain ID for the network this transaction is valid on. + */ + chainId?: bigint; + /** + * The [[link-eip-2930]] access list. Storage slots included in the access + * list are //warmed// by pre-loading them, so their initial cost to + * fetch is guaranteed, but then each additional access is cheaper. + */ + accessList?: AccessList; + /** + * A custom object, which can be passed along for network-specific + * values. + */ + customData?: any; + /** + * When using ``call`` or ``estimateGas``, this allows a specific + * block to be queried. Many backends do not support this and when + * unsupported errors are silently squelched and ``"latest"`` is used. + */ + blockTag?: BlockTag; + /** + * When using ``call``, this enables CCIP-read, which permits the + * provider to be redirected to web-based content during execution, + * which is then further validated by the contract. + * + * There are potential security implications allowing CCIP-read, as + * it could be used to expose the IP address or user activity during + * the fetch to unexpected parties. + */ + enableCcipRead?: boolean; +} +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +export declare function copyRequest(req: TransactionRequest): PreparedTransactionRequest; +/** + * An Interface to indicate a [[Block]] has been included in the + * blockchain. This asserts a Type Guard that necessary properties + * are non-null. + * + * Before a block is included, it is a //pending// block. + */ +export interface MinedBlock extends Block { + /** + * The block number also known as the block height. + */ + readonly number: number; + /** + * The block hash. + */ + readonly hash: string; + /** + * The block timestamp, in seconds from epoch. + */ + readonly timestamp: number; + /** + * The block date, created from the [[timestamp]]. + */ + readonly date: Date; + /** + * The miner of the block, also known as the ``author`` or + * block ``producer``. + */ + readonly miner: string; +} +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +export declare class Block implements BlockParams, Iterable { + #private; + /** + * The provider connected to the block used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The block number, sometimes called the block height. This is a + * sequential number that is one higher than the parent block. + */ + readonly number: number; + /** + * The block hash. + * + * This hash includes all properties, so can be safely used to identify + * an exact set of block properties. + */ + readonly hash: null | string; + /** + * The timestamp for this block, which is the number of seconds since + * epoch that this block was included. + */ + readonly timestamp: number; + /** + * The block hash of the parent block. + */ + readonly parentHash: string; + /** + * The nonce. + * + * On legacy networks, this is the random number inserted which + * permitted the difficulty target to be reached. + */ + readonly nonce: string; + /** + * The difficulty target. + * + * On legacy networks, this is the proof-of-work target required + * for a block to meet the protocol rules to be included. + * + * On modern networks, this is a random number arrived at using + * randao. @TODO: Find links? + */ + readonly difficulty: bigint; + /** + * The total gas limit for this block. + */ + readonly gasLimit: bigint; + /** + * The total gas used in this block. + */ + readonly gasUsed: bigint; + /** + * The miner coinbase address, wihch receives any subsidies for + * including this block. + */ + readonly miner: string; + /** + * Any extra data the validator wished to include. + */ + readonly extraData: string; + /** + * The base fee per gas that all transactions in this block were + * charged. + * + * This adjusts after each block, depending on how congested the network + * is. + */ + readonly baseFeePerGas: null | bigint; + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block: BlockParams, provider: Provider); + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions(): ReadonlyArray; + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions(): Array; + /** + * Returns a JSON-friendly value. + */ + toJSON(): any; + [Symbol.iterator](): Iterator; + /** + * The number of transactions in this block. + */ + get length(): number; + /** + * The [[link-js-date]] this block was included at. + */ + get date(): null | Date; + /** + * Get the transaction at %%indexe%% within this block. + */ + getTransaction(indexOrHash: number | string): Promise; + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse; + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined(): this is MinedBlock; + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon(): this is (Block & { + baseFeePerGas: bigint; + }); + /** + * @_ignore: + */ + orphanedEvent(): OrphanFilter; +} +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +export declare class Log implements LogParams { + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The transaction hash of the transaction this log occurred in. Use the + * [[Log-getTransaction]] to get the [[TransactionResponse]]. + */ + readonly transactionHash: string; + /** + * The block hash of the block this log occurred in. Use the + * [[Log-getBlock]] to get the [[Block]]. + */ + readonly blockHash: string; + /** + * The block number of the block this log occurred in. It is preferred + * to use the [[Block-hash]] when fetching the related [[Block]], + * since in the case of an orphaned block, the block at that height may + * have changed. + */ + readonly blockNumber: number; + /** + * If the **Log** represents a block that was removed due to an orphaned + * block, this will be true. + * + * This can only happen within an orphan event listener. + */ + readonly removed: boolean; + /** + * The address of the contract that emitted this log. + */ + readonly address: string; + /** + * The data included in this log when it was emitted. + */ + readonly data: string; + /** + * The indexed topics included in this log when it was emitted. + * + * All topics are included in the bloom filters, so they can be + * efficiently filtered using the [[Provider-getLogs]] method. + */ + readonly topics: ReadonlyArray; + /** + * The index within the block this log occurred at. This is generally + * not useful to developers, but can be used with the various roots + * to proof inclusion within a block. + */ + readonly index: number; + /** + * The index within the transaction of this log. + */ + readonly transactionIndex: number; + /** + * @_ignore: + */ + constructor(log: LogParams, provider: Provider); + /** + * Returns a JSON-compatible object. + */ + toJSON(): any; + /** + * Returns the block that this log occurred in. + */ + getBlock(): Promise; + /** + * Returns the transaction that this log occurred in. + */ + getTransaction(): Promise; + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + getTransactionReceipt(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; +} +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +export declare class TransactionReceipt implements TransactionReceiptParams, Iterable { + #private; + /** + * The provider connected to the log used to fetch additional details + * if necessary. + */ + readonly provider: Provider; + /** + * The address the transaction was sent to. + */ + readonly to: null | string; + /** + * The sender of the transaction. + */ + readonly from: string; + /** + * The address of the contract if the transaction was directly + * responsible for deploying one. + * + * This is non-null **only** if the ``to`` is empty and the ``data`` + * was successfully executed as initcode. + */ + readonly contractAddress: null | string; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The index of this transaction within the block transactions. + */ + readonly index: number; + /** + * The block hash of the [[Block]] this transaction was included in. + */ + readonly blockHash: string; + /** + * The block number of the [[Block]] this transaction was included in. + */ + readonly blockNumber: number; + /** + * The bloom filter bytes that represent all logs that occurred within + * this transaction. This is generally not useful for most developers, + * but can be used to validate the included logs. + */ + readonly logsBloom: string; + /** + * The actual amount of gas used by this transaction. + * + * When creating a transaction, the amount of gas that will be used can + * only be approximated, but the sender must pay the gas fee for the + * entire gas limit. After the transaction, the difference is refunded. + */ + readonly gasUsed: bigint; + /** + * The amount of gas used by all transactions within the block for this + * and all transactions with a lower ``index``. + * + * This is generally not useful for developers but can be used to + * validate certain aspects of execution. + */ + readonly cumulativeGasUsed: bigint; + /** + * The actual gas price used during execution. + * + * Due to the complexity of [[link-eip-1559]] this value can only + * be caluclated after the transaction has been mined, snce the base + * fee is protocol-enforced. + */ + readonly gasPrice: bigint; + /** + * The [[link-eip-2718]] transaction type. + */ + readonly type: number; + /** + * The status of this transaction, indicating success (i.e. ``1``) or + * a revert (i.e. ``0``). + * + * This is available in post-byzantium blocks, but some backends may + * backfill this value. + */ + readonly status: null | number; + /** + * The root hash of this transaction. + * + * This is no present and was only included in pre-byzantium blocks, but + * could be used to validate certain parts of the receipt. + */ + readonly root: null | string; + /** + * @_ignore: + */ + constructor(tx: TransactionReceiptParams, provider: Provider); + /** + * The logs for this transaction. + */ + get logs(): ReadonlyArray; + /** + * Returns a JSON-compatible representation. + */ + toJSON(): any; + /** + * @_ignore: + */ + get length(): number; + [Symbol.iterator](): Iterator; + /** + * The total fee for this transaction, in wei. + */ + get fee(): bigint; + /** + * Resolves to the block this transaction occurred in. + */ + getBlock(): Promise; + /** + * Resolves to the transaction this transaction occurred in. + */ + getTransaction(): Promise; + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + getResult(): Promise; + /** + * Resolves to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * @_ignore: + */ + removedEvent(): OrphanFilter; + /** + * @_ignore: + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; +} +/** + * A **MinedTransactionResponse** is an interface representing a + * transaction which has been mined and allows for a type guard for its + * property values being defined. + */ +export interface MinedTransactionResponse extends TransactionResponse { + /** + * The block number this transaction occurred in. + */ + blockNumber: number; + /** + * The block hash this transaction occurred in. + */ + blockHash: string; + /** + * The date this transaction occurred on. + */ + date: Date; +} +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +export declare class TransactionResponse implements TransactionLike, TransactionResponseParams { + #private; + /** + * The provider this is connected to, which will influence how its + * methods will resolve its async inspection methods. + */ + readonly provider: Provider; + /** + * The block number of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockNumber: null | number; + /** + * The blockHash of the block that this transaction was included in. + * + * This is ``null`` for pending transactions. + */ + readonly blockHash: null | string; + /** + * The index within the block that this transaction resides at. + */ + readonly index: number; + /** + * The transaction hash. + */ + readonly hash: string; + /** + * The [[link-eip-2718]] transaction envelope type. This is + * ``0`` for legacy transactions types. + */ + readonly type: number; + /** + * The receiver of this transaction. + * + * If ``null``, then the transaction is an initcode transaction. + * This means the result of executing the [[data]] will be deployed + * as a new contract on chain (assuming it does not revert) and the + * address may be computed using [[getCreateAddress]]. + */ + readonly to: null | string; + /** + * The sender of this transaction. It is implicitly computed + * from the transaction pre-image hash (as the digest) and the + * [[signature]] using ecrecover. + */ + readonly from: string; + /** + * The nonce, which is used to prevent replay attacks and offer + * a method to ensure transactions from a given sender are explicitly + * ordered. + * + * When sending a transaction, this must be equal to the number of + * transactions ever sent by [[from]]. + */ + readonly nonce: number; + /** + * The maximum units of gas this transaction can consume. If execution + * exceeds this, the entries transaction is reverted and the sender + * is charged for the full amount, despite not state changes being made. + */ + readonly gasLimit: bigint; + /** + * The gas price can have various values, depending on the network. + * + * In modern networks, for transactions that are included this is + * the //effective gas price// (the fee per gas that was actually + * charged), while for transactions that have not been included yet + * is the [[maxFeePerGas]]. + * + * For legacy transactions, or transactions on legacy networks, this + * is the fee that will be charged per unit of gas the transaction + * consumes. + */ + readonly gasPrice: bigint; + /** + * The maximum priority fee (per unit of gas) to allow a + * validator to charge the sender. This is inclusive of the + * [[maxFeeFeePerGas]]. + */ + readonly maxPriorityFeePerGas: null | bigint; + /** + * The maximum fee (per unit of gas) to allow this transaction + * to charge the sender. + */ + readonly maxFeePerGas: null | bigint; + /** + * The data. + */ + readonly data: string; + /** + * The value, in wei. Use [[formatEther]] to format this value + * as ether. + */ + readonly value: bigint; + /** + * The chain ID. + */ + readonly chainId: bigint; + /** + * The signature. + */ + readonly signature: Signature; + /** + * The [[link-eip-2930]] access list for transaction types that + * support it, otherwise ``null``. + */ + readonly accessList: null | AccessList; + /** + * @_ignore: + */ + constructor(tx: TransactionResponseParams, provider: Provider); + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON(): any; + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + getBlock(): Promise; + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + getTransaction(): Promise; + /** + * Resolve to the number of confirmations this transaction has. + */ + confirmations(): Promise; + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(_confirms?: number, _timeout?: number): Promise; + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined(): this is MinedTransactionResponse; + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy(): this is (TransactionResponse & { + accessList: null; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: null; + maxPriorityFeePerGas: null; + }); + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon(): this is (TransactionResponse & { + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent(): OrphanFilter; + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other?: TransactionResponse): OrphanFilter; + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock: number): TransactionResponse; +} +/** + * An Orphan Filter allows detecting when an orphan block has + * resulted in dropping a block or transaction or has resulted + * in transactions changing order. + * + * Not currently fully supported. + */ +export type OrphanFilter = { + orphan: "drop-block"; + hash: string; + number: number; +} | { + orphan: "drop-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "reorder-transaction"; + tx: { + hash: string; + blockHash: string; + blockNumber: number; + }; + other?: { + hash: string; + blockHash: string; + blockNumber: number; + }; +} | { + orphan: "drop-log"; + log: { + transactionHash: string; + blockHash: string; + blockNumber: number; + address: string; + data: string; + topics: ReadonlyArray; + index: number; + }; +}; +/** + * A **TopicFilter** provides a struture to define bloom-filter + * queries. + * + * Each field that is ``null`` matches **any** value, a field that is + * a ``string`` must match exactly that value and and ``array`` is + * effectively an ``OR``-ed set, where any one of those values must + * match. + */ +export type TopicFilter = Array>; +/** + * An **EventFilter** allows efficiently filtering logs (also known as + * events) using bloom filters included within blocks. + */ +export interface EventFilter { + address?: AddressLike | Array; + topics?: TopicFilter; +} +/** + * A **Filter** allows searching a specific range of blocks for mathcing + * logs. + */ +export interface Filter extends EventFilter { + /** + * The start block for the filter (inclusive). + */ + fromBlock?: BlockTag; + /** + * The end block for the filter (inclusive). + */ + toBlock?: BlockTag; +} +/** + * A **FilterByBlockHash** allows searching a specific block for mathcing + * logs. + */ +export interface FilterByBlockHash extends EventFilter { + /** + * The blockhash of the specific block for the filter. + */ + blockHash?: string; +} +/** + * A **ProviderEvent** provides the types of events that can be subscribed + * to on a [[Provider]]. + * + * Each provider may include additional possible events it supports, but + * the most commonly supported are: + * + * **``"block"``** - calls the listener with the current block number on each + * new block. + * + * **``"error"``** - calls the listener on each async error that occurs during + * the event loop, with the error. + * + * **``"debug"``** - calls the listener on debug events, which can be used to + * troubleshoot network errors, provider problems, etc. + * + * **``transaction hash``** - calls the listener on each block after the + * transaction has been mined; generally ``.once`` is more appropriate for + * this event. + * + * **``Array``** - calls the listener on each log that matches the filter. + * + * [[EventFilter]] - calls the listener with each matching log + */ +export type ProviderEvent = string | Array> | EventFilter | OrphanFilter; +/** + * A **Provider** is the primary method to interact with the read-only + * content on Ethereum. + * + * It allows access to details about accounts, blocks and transactions + * and the ability to query event logs and simulate contract execution. + * + * Account data includes the [balance](getBalance), + * [transaction count](getTransactionCount), [code](getCode) and + * [state trie storage](getStorage). + * + * Simulating execution can be used to [call](call), + * [estimate gas](estimateGas) and + * [get transaction results](getTransactionResult). + * + * The [[broadcastTransaction]] is the only method which allows updating + * the blockchain, but it is usually accessed by a [[Signer]], since a + * private key must be used to sign the transaction before it can be + * broadcast. + */ +export interface Provider extends ContractRunner, EventEmitterable, NameResolver { + /** + * The provider iteself. + * + * This is part of the necessary API for executing a contract, as + * it provides a common property on any [[ContractRunner]] that + * can be used to access the read-only portion of the runner. + */ + provider: this; + /** + * Shutdown any resources this provider is using. No additional + * calls should be made to this provider after calling this. + */ + destroy(): void; + /** + * Get the current block number. + */ + getBlockNumber(): Promise; + /** + * Get the connected [[Network]]. + */ + getNetwork(): Promise; + /** + * Get the best guess at the recommended [[FeeData]]. + */ + getFeeData(): Promise; + /** + * Get the account balance (in wei) of %%address%%. If %%blockTag%% + * is specified and the node supports archive access for that + * %%blockTag%%, the balance is as of that [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getBalance(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the number of transactions ever sent for %%address%%, which + * is used as the ``nonce`` when sending a transaction. If + * %%blockTag%% is specified and the node supports archive access + * for that %%blockTag%%, the transaction count is as of that + * [[BlockTag]]. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the bytecode for %%address%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getCode(address: AddressLike, blockTag?: BlockTag): Promise; + /** + * Get the storage slot value for %%address%% at slot %%position%%. + * + * @note On nodes without archive access enabled, the %%blockTag%% may be + * **silently ignored** by the node, which may cause issues if relied on. + */ + getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise; + /** + * Estimates the amount of gas required to executre %%tx%%. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Simulate the execution of %%tx%%. If the call reverts, it will + * throw a [[CallExceptionError]] which includes the revert data. + */ + call(tx: TransactionRequest): Promise; + /** + * Broadcasts the %%signedTx%% to the network, adding it to the + * memory pool of any node for which the transaction meets the + * rebroadcast requirements. + */ + broadcastTransaction(signedTx: string): Promise; + /** + * Resolves to the block for %%blockHashOrBlockTag%%. + * + * If %%prefetchTxs%%, and the backend supports including transactions + * with block requests, all transactions will be included and the + * [[Block]] object will not need to make remote calls for getting + * transactions. + */ + getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise; + /** + * Resolves to the transaction for %%hash%%. + * + * If the transaction is unknown or on pruning nodes which + * discard old transactions this resolves to ``null``. + */ + getTransaction(hash: string): Promise; + /** + * Resolves to the transaction receipt for %%hash%%, if mined. + * + * If the transaction has not been mined, is unknown or on + * pruning nodes which discard old transactions this resolves to + * ``null``. + */ + getTransactionReceipt(hash: string): Promise; + /** + * Resolves to the result returned by the executions of %%hash%%. + * + * This is only supported on nodes with archive access and with + * the necessary debug APIs enabled. + */ + getTransactionResult(hash: string): Promise; + /** + * Resolves to the list of Logs that match %%filter%% + */ + getLogs(filter: Filter | FilterByBlockHash): Promise>; + /** + * Resolves to the address configured for the %%ensName%% or + * ``null`` if unconfigured. + */ + resolveName(ensName: string): Promise; + /** + * Resolves to the ENS name associated for the %%address%% or + * ``null`` if the //primary name// is not configured. + * + * Users must perform additional steps to configure a //primary name//, + * which is not currently common. + */ + lookupAddress(address: string): Promise; + /** + * Waits until the transaction %%hash%% is mined and has %%confirms%% + * confirmations. + */ + waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise; + /** + * Resolves to the block at %%blockTag%% once it has been mined. + * + * This can be useful for waiting some number of blocks by using + * the ``currentBlockNumber + N``. + */ + waitForBlock(blockTag?: BlockTag): Promise; +} +//# sourceMappingURL=provider.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider.d.ts.map b/dist/ethers.js/src.ts/providers/provider.d.ts.map new file mode 100644 index 0000000..a04b315 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAK5C;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,QAAQ,GAAG,YAAY,GAAG,MAAM,CAAC;AAE7C,OAAO,EACH,WAAW,E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AAC;CACrD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider.js b/dist/ethers.js/src.ts/providers/provider.js new file mode 100644 index 0000000..31b434b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider.js @@ -0,0 +1,934 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _Block_transactions, _TransactionReceipt_logs, _TransactionResponse_startBlock; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.TransactionResponse = exports.TransactionReceipt = exports.Log = exports.Block = exports.copyRequest = exports.FeeData = void 0; +//import { resolveAddress } from "@ethersproject/address"; +const index_js_1 = require("../utils/index.js"); +const index_js_2 = require("../transaction/index.js"); +const BN_0 = BigInt(0); +// ----------------------- +function getValue(value) { + if (value == null) { + return null; + } + return value; +} +function toJson(value) { + if (value == null) { + return null; + } + return value.toString(); +} +// @TODO? implements Required +/** + * A **FeeData** wraps all the fee-related values associated with + * the network. + */ +class FeeData { + /** + * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and + * %%maxPriorityFeePerGas%%. + */ + constructor(gasPrice, maxFeePerGas, maxPriorityFeePerGas) { + (0, index_js_1.defineProperties)(this, { + gasPrice: getValue(gasPrice), + maxFeePerGas: getValue(maxFeePerGas), + maxPriorityFeePerGas: getValue(maxPriorityFeePerGas) + }); + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { gasPrice, maxFeePerGas, maxPriorityFeePerGas } = this; + return { + _type: "FeeData", + gasPrice: toJson(gasPrice), + maxFeePerGas: toJson(maxFeePerGas), + maxPriorityFeePerGas: toJson(maxPriorityFeePerGas), + }; + } +} +exports.FeeData = FeeData; +; +/** + * Returns a copy of %%req%% with all properties coerced to their strict + * types. + */ +function copyRequest(req) { + const result = {}; + // These could be addresses, ENS names or Addressables + if (req.to) { + result.to = req.to; + } + if (req.from) { + result.from = req.from; + } + if (req.data) { + result.data = (0, index_js_1.hexlify)(req.data); + } + const bigIntKeys = "chainId,gasLimit,gasPrice,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/); + for (const key of bigIntKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = (0, index_js_1.getBigInt)(req[key], `request.${key}`); + } + const numberKeys = "type,nonce".split(/,/); + for (const key of numberKeys) { + if (!(key in req) || req[key] == null) { + continue; + } + result[key] = (0, index_js_1.getNumber)(req[key], `request.${key}`); + } + if (req.accessList) { + result.accessList = (0, index_js_2.accessListify)(req.accessList); + } + if ("blockTag" in req) { + result.blockTag = req.blockTag; + } + if ("enableCcipRead" in req) { + result.enableCcipRead = !!req.enableCcipRead; + } + if ("customData" in req) { + result.customData = req.customData; + } + return result; +} +exports.copyRequest = copyRequest; +/** + * A **Block** represents the data associated with a full block on + * Ethereum. + */ +class Block { + /** + * Create a new **Block** object. + * + * This should generally not be necessary as the unless implementing a + * low-level library. + */ + constructor(block, provider) { + _Block_transactions.set(this, void 0); + __classPrivateFieldSet(this, _Block_transactions, block.transactions.map((tx) => { + if (typeof (tx) !== "string") { + return new TransactionResponse(tx, provider); + } + return tx; + }), "f"); + (0, index_js_1.defineProperties)(this, { + provider, + hash: getValue(block.hash), + number: block.number, + timestamp: block.timestamp, + parentHash: block.parentHash, + nonce: block.nonce, + difficulty: block.difficulty, + gasLimit: block.gasLimit, + gasUsed: block.gasUsed, + miner: block.miner, + extraData: block.extraData, + baseFeePerGas: getValue(block.baseFeePerGas) + }); + } + /** + * Returns the list of transaction hashes, in the order + * they were executed within the block. + */ + get transactions() { + return __classPrivateFieldGet(this, _Block_transactions, "f").map((tx) => { + if (typeof (tx) === "string") { + return tx; + } + return tx.hash; + }); + } + /** + * Returns the complete transactions, in the order they + * were executed within the block. + * + * This is only available for blocks which prefetched + * transactions, by passing ``true`` to %%prefetchTxs%% + * into [[Provider-getBlock]]. + */ + get prefetchedTransactions() { + const txs = __classPrivateFieldGet(this, _Block_transactions, "f").slice(); + // Doesn't matter... + if (txs.length === 0) { + return []; + } + // Make sure we prefetched the transactions + (0, index_js_1.assert)(typeof (txs[0]) === "object", "transactions were not prefetched with block request", "UNSUPPORTED_OPERATION", { + operation: "transactionResponses()" + }); + return txs; + } + /** + * Returns a JSON-friendly value. + */ + toJSON() { + const { baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash, miner, nonce, number, parentHash, timestamp, transactions } = this; + return { + _type: "Block", + baseFeePerGas: toJson(baseFeePerGas), + difficulty: toJson(difficulty), + extraData, + gasLimit: toJson(gasLimit), + gasUsed: toJson(gasUsed), + hash, miner, nonce, number, parentHash, timestamp, + transactions, + }; + } + [(_Block_transactions = new WeakMap(), Symbol.iterator)]() { + let index = 0; + const txs = this.transactions; + return { + next: () => { + if (index < this.length) { + return { + value: txs[index++], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The number of transactions in this block. + */ + get length() { return __classPrivateFieldGet(this, _Block_transactions, "f").length; } + /** + * The [[link-js-date]] this block was included at. + */ + get date() { + if (this.timestamp == null) { + return null; + } + return new Date(this.timestamp * 1000); + } + /** + * Get the transaction at %%indexe%% within this block. + */ + getTransaction(indexOrHash) { + return __awaiter(this, void 0, void 0, function* () { + // Find the internal value by its index or hash + let tx = undefined; + if (typeof (indexOrHash) === "number") { + tx = __classPrivateFieldGet(this, _Block_transactions, "f")[indexOrHash]; + } + else { + const hash = indexOrHash.toLowerCase(); + for (const v of __classPrivateFieldGet(this, _Block_transactions, "f")) { + if (typeof (v) === "string") { + if (v !== hash) { + continue; + } + tx = v; + break; + } + else { + if (v.hash === hash) { + continue; + } + tx = v; + break; + } + } + } + if (tx == null) { + throw new Error("no such tx"); + } + if (typeof (tx) === "string") { + return (yield this.provider.getTransaction(tx)); + } + else { + return tx; + } + }); + } + /** + * If a **Block** was fetched with a request to include the transactions + * this will allow synchronous access to those transactions. + * + * If the transactions were not prefetched, this will throw. + */ + getPrefetchedTransaction(indexOrHash) { + const txs = this.prefetchedTransactions; + if (typeof (indexOrHash) === "number") { + return txs[indexOrHash]; + } + indexOrHash = indexOrHash.toLowerCase(); + for (const tx of txs) { + if (tx.hash === indexOrHash) { + return tx; + } + } + (0, index_js_1.assertArgument)(false, "no matching transaction", "indexOrHash", indexOrHash); + } + /** + * Returns true if this block been mined. This provides a type guard + * for all properties on a [[MinedBlock]]. + */ + isMined() { return !!this.hash; } + /** + * Returns true if this block is an [[link-eip-2930]] block. + */ + isLondon() { + return !!this.baseFeePerGas; + } + /** + * @_ignore: + */ + orphanedEvent() { + if (!this.isMined()) { + throw new Error(""); + } + return createOrphanedBlockFilter(this); + } +} +exports.Block = Block; +////////////////////// +// Log +/** + * A **Log** in Ethereum represents an event that has been included in a + * transaction using the ``LOG*`` opcodes, which are most commonly used by + * Solidity's emit for announcing events. + */ +class Log { + /** + * @_ignore: + */ + constructor(log, provider) { + this.provider = provider; + const topics = Object.freeze(log.topics.slice()); + (0, index_js_1.defineProperties)(this, { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + removed: log.removed, + address: log.address, + data: log.data, + topics, + index: log.index, + transactionIndex: log.transactionIndex, + }); + } + /** + * Returns a JSON-compatible object. + */ + toJSON() { + const { address, blockHash, blockNumber, data, index, removed, topics, transactionHash, transactionIndex } = this; + return { + _type: "log", + address, blockHash, blockNumber, data, index, + removed, topics, transactionHash, transactionIndex + }; + } + /** + * Returns the block that this log occurred in. + */ + getBlock() { + return __awaiter(this, void 0, void 0, function* () { + const block = yield this.provider.getBlock(this.blockHash); + (0, index_js_1.assert)(!!block, "failed to find transaction", "UNKNOWN_ERROR", {}); + return block; + }); + } + /** + * Returns the transaction that this log occurred in. + */ + getTransaction() { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield this.provider.getTransaction(this.transactionHash); + (0, index_js_1.assert)(!!tx, "failed to find transaction", "UNKNOWN_ERROR", {}); + return tx; + }); + } + /** + * Returns the transaction receipt fot the transaction that this + * log occurred in. + */ + getTransactionReceipt() { + return __awaiter(this, void 0, void 0, function* () { + const receipt = yield this.provider.getTransactionReceipt(this.transactionHash); + (0, index_js_1.assert)(!!receipt, "failed to find transaction receipt", "UNKNOWN_ERROR", {}); + return receipt; + }); + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedLogFilter(this); + } +} +exports.Log = Log; +////////////////////// +// Transaction Receipt +/* +export interface LegacyTransactionReceipt { + byzantium: false; + status: null; + root: string; +} + +export interface ByzantiumTransactionReceipt { + byzantium: true; + status: number; + root: null; +} +*/ +/** + * A **TransactionReceipt** includes additional information about a + * transaction that is only available after it has been mined. + */ +class TransactionReceipt { + /** + * @_ignore: + */ + constructor(tx, provider) { + _TransactionReceipt_logs.set(this, void 0); + __classPrivateFieldSet(this, _TransactionReceipt_logs, Object.freeze(tx.logs.map((log) => { + return new Log(log, provider); + })), "f"); + let gasPrice = BN_0; + if (tx.effectiveGasPrice != null) { + gasPrice = tx.effectiveGasPrice; + } + else if (tx.gasPrice != null) { + gasPrice = tx.gasPrice; + } + (0, index_js_1.defineProperties)(this, { + provider, + to: tx.to, + from: tx.from, + contractAddress: tx.contractAddress, + hash: tx.hash, + index: tx.index, + blockHash: tx.blockHash, + blockNumber: tx.blockNumber, + logsBloom: tx.logsBloom, + gasUsed: tx.gasUsed, + cumulativeGasUsed: tx.cumulativeGasUsed, + gasPrice, + type: tx.type, + //byzantium: tx.byzantium, + status: tx.status, + root: tx.root + }); + } + /** + * The logs for this transaction. + */ + get logs() { return __classPrivateFieldGet(this, _TransactionReceipt_logs, "f"); } + /** + * Returns a JSON-compatible representation. + */ + toJSON() { + const { to, from, contractAddress, hash, index, blockHash, blockNumber, logsBloom, logs, //byzantium, + status, root } = this; + return { + _type: "TransactionReceipt", + blockHash, blockNumber, + //byzantium, + contractAddress, + cumulativeGasUsed: toJson(this.cumulativeGasUsed), + from, + gasPrice: toJson(this.gasPrice), + gasUsed: toJson(this.gasUsed), + hash, index, logs, logsBloom, root, status, to + }; + } + /** + * @_ignore: + */ + get length() { return this.logs.length; } + [(_TransactionReceipt_logs = new WeakMap(), Symbol.iterator)]() { + let index = 0; + return { + next: () => { + if (index < this.length) { + return { value: this.logs[index++], done: false }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The total fee for this transaction, in wei. + */ + get fee() { + return this.gasUsed * this.gasPrice; + } + /** + * Resolves to the block this transaction occurred in. + */ + getBlock() { + return __awaiter(this, void 0, void 0, function* () { + const block = yield this.provider.getBlock(this.blockHash); + if (block == null) { + throw new Error("TODO"); + } + return block; + }); + } + /** + * Resolves to the transaction this transaction occurred in. + */ + getTransaction() { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield this.provider.getTransaction(this.hash); + if (tx == null) { + throw new Error("TODO"); + } + return tx; + }); + } + /** + * Resolves to the return value of the execution of this transaction. + * + * Support for this feature is limited, as it requires an archive node + * with the ``debug_`` or ``trace_`` API enabled. + */ + getResult() { + return __awaiter(this, void 0, void 0, function* () { + return (yield this.provider.getTransactionResult(this.hash)); + }); + } + /** + * Resolves to the number of confirmations this transaction has. + */ + confirmations() { + return __awaiter(this, void 0, void 0, function* () { + return (yield this.provider.getBlockNumber()) - this.blockNumber + 1; + }); + } + /** + * @_ignore: + */ + removedEvent() { + return createRemovedTransactionFilter(this); + } + /** + * @_ignore: + */ + reorderedEvent(other) { + (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transction cannot be orphaned", "UNSUPPORTED_OPERATION", { operation: "reorderedEvent(other)" }); + return createReorderedTransactionFilter(this, other); + } +} +exports.TransactionReceipt = TransactionReceipt; +/** + * A **TransactionResponse** includes all properties about a transaction + * that was sent to the network, which may or may not be included in a + * block. + * + * The [[TransactionResponse-isMined]] can be used to check if the + * transaction has been mined as well as type guard that the otherwise + * possibly ``null`` properties are defined. + */ +class TransactionResponse { + /** + * @_ignore: + */ + constructor(tx, provider) { + _TransactionResponse_startBlock.set(this, void 0); + this.provider = provider; + this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber : null; + this.blockHash = (tx.blockHash != null) ? tx.blockHash : null; + this.hash = tx.hash; + this.index = tx.index; + this.type = tx.type; + this.from = tx.from; + this.to = tx.to || null; + this.gasLimit = tx.gasLimit; + this.nonce = tx.nonce; + this.data = tx.data; + this.value = tx.value; + this.gasPrice = tx.gasPrice; + this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas : null; + this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas : null; + this.chainId = tx.chainId; + this.signature = tx.signature; + this.accessList = (tx.accessList != null) ? tx.accessList : null; + __classPrivateFieldSet(this, _TransactionResponse_startBlock, -1, "f"); + } + /** + * Returns a JSON-compatible representation of this transaction. + */ + toJSON() { + const { blockNumber, blockHash, index, hash, type, to, from, nonce, data, signature, accessList } = this; + return { + _type: "TransactionReceipt", + accessList, blockNumber, blockHash, + chainId: toJson(this.chainId), + data, from, + gasLimit: toJson(this.gasLimit), + gasPrice: toJson(this.gasPrice), + hash, + maxFeePerGas: toJson(this.maxFeePerGas), + maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas), + nonce, signature, to, index, type, + value: toJson(this.value), + }; + } + /** + * Resolves to the Block that this transaction was included in. + * + * This will return null if the transaction has not been included yet. + */ + getBlock() { + return __awaiter(this, void 0, void 0, function* () { + let blockNumber = this.blockNumber; + if (blockNumber == null) { + const tx = yield this.getTransaction(); + if (tx) { + blockNumber = tx.blockNumber; + } + } + if (blockNumber == null) { + return null; + } + const block = this.provider.getBlock(blockNumber); + if (block == null) { + throw new Error("TODO"); + } + return block; + }); + } + /** + * Resolves to this transaction being re-requested from the + * provider. This can be used if you have an unmined transaction + * and wish to get an up-to-date populated instance. + */ + getTransaction() { + return __awaiter(this, void 0, void 0, function* () { + return this.provider.getTransaction(this.hash); + }); + } + /** + * Resolve to the number of confirmations this transaction has. + */ + confirmations() { + return __awaiter(this, void 0, void 0, function* () { + if (this.blockNumber == null) { + const { tx, blockNumber } = yield (0, index_js_1.resolveProperties)({ + tx: this.getTransaction(), + blockNumber: this.provider.getBlockNumber() + }); + // Not mined yet... + if (tx == null || tx.blockNumber == null) { + return 0; + } + return blockNumber - tx.blockNumber + 1; + } + const blockNumber = yield this.provider.getBlockNumber(); + return blockNumber - this.blockNumber + 1; + }); + } + /** + * Resolves once this transaction has been mined and has + * %%confirms%% blocks including it (default: ``1``) with an + * optional %%timeout%%. + * + * This can resolve to ``null`` only if %%confirms%% is ``0`` + * and the transaction has not been mined, otherwise this will + * wait until enough confirmations have completed. + */ + wait(_confirms, _timeout) { + return __awaiter(this, void 0, void 0, function* () { + const confirms = (_confirms == null) ? 1 : _confirms; + const timeout = (_timeout == null) ? 0 : _timeout; + let startBlock = __classPrivateFieldGet(this, _TransactionResponse_startBlock, "f"); + let nextScan = -1; + let stopScanning = (startBlock === -1) ? true : false; + const checkReplacement = () => __awaiter(this, void 0, void 0, function* () { + // Get the current transaction count for this sender + if (stopScanning) { + return null; + } + const { blockNumber, nonce } = yield (0, index_js_1.resolveProperties)({ + blockNumber: this.provider.getBlockNumber(), + nonce: this.provider.getTransactionCount(this.from) + }); + // No transaction or our nonce has not been mined yet; but we + // can start scanning later when we do start + if (nonce < this.nonce) { + startBlock = blockNumber; + return; + } + // We were mined; no replacement + if (stopScanning) { + return null; + } + const mined = yield this.getTransaction(); + if (mined && mined.blockNumber != null) { + return; + } + // We were replaced; start scanning for that transaction + // Starting to scan; look back a few extra blocks for safety + if (nextScan === -1) { + nextScan = startBlock - 3; + if (nextScan < __classPrivateFieldGet(this, _TransactionResponse_startBlock, "f")) { + nextScan = __classPrivateFieldGet(this, _TransactionResponse_startBlock, "f"); + } + } + while (nextScan <= blockNumber) { + // Get the next block to scan + if (stopScanning) { + return null; + } + const block = yield this.provider.getBlock(nextScan, true); + // This should not happen; but we'll try again shortly + if (block == null) { + return; + } + // We were mined; no replacement + for (const hash of block) { + if (hash === this.hash) { + return; + } + } + // Search for the transaction that replaced us + for (let i = 0; i < block.length; i++) { + const tx = yield block.getTransaction(i); + if (tx.from === this.from && tx.nonce === this.nonce) { + // Get the receipt + if (stopScanning) { + return null; + } + const receipt = yield this.provider.getTransactionReceipt(tx.hash); + // This should not happen; but we'll try again shortly + if (receipt == null) { + return; + } + // We will retry this on the next block (this case could be optimized) + if ((blockNumber - receipt.blockNumber + 1) < confirms) { + return; + } + // The reason we were replaced + let reason = "replaced"; + if (tx.data === this.data && tx.to === this.to && tx.value === this.value) { + reason = "repriced"; + } + else if (tx.data === "0x" && tx.from === tx.to && tx.value === BN_0) { + reason = "cancelled"; + } + (0, index_js_1.assert)(false, "transaction was replaced", "TRANSACTION_REPLACED", { + cancelled: (reason === "replaced" || reason === "cancelled"), + reason, + replacement: tx.replaceableTransaction(startBlock), + hash: tx.hash, + receipt + }); + } + } + nextScan++; + } + return; + }); + const checkReceipt = (receipt) => { + if (receipt == null || receipt.status !== 0) { + return receipt; + } + (0, index_js_1.assert)(false, "transaction execution reverted", "CALL_EXCEPTION", { + action: "sendTransaction", + data: null, reason: null, invocation: null, revert: null, + transaction: { + to: receipt.to, + from: receipt.from, + data: "" // @TODO: in v7, split out sendTransaction properties + }, receipt + }); + }; + const receipt = yield this.provider.getTransactionReceipt(this.hash); + if (confirms === 0) { + return checkReceipt(receipt); + } + if (receipt) { + if ((yield receipt.confirmations()) >= confirms) { + return checkReceipt(receipt); + } + } + else { + // Check for a replacement; throws if a replacement was found + yield checkReplacement(); + // Allow null only when the confirms is 0 + if (confirms === 0) { + return null; + } + } + const waiter = new Promise((resolve, reject) => { + // List of things to cancel when we have a result (one way or the other) + const cancellers = []; + const cancel = () => { cancellers.forEach((c) => c()); }; + // On cancel, stop scanning for replacements + cancellers.push(() => { stopScanning = true; }); + // Set up any timeout requested + if (timeout > 0) { + const timer = setTimeout(() => { + cancel(); + reject((0, index_js_1.makeError)("wait for transaction timeout", "TIMEOUT")); + }, timeout); + cancellers.push(() => { clearTimeout(timer); }); + } + const txListener = (receipt) => __awaiter(this, void 0, void 0, function* () { + // Done; return it! + if ((yield receipt.confirmations()) >= confirms) { + cancel(); + try { + resolve(checkReceipt(receipt)); + } + catch (error) { + reject(error); + } + } + }); + cancellers.push(() => { this.provider.off(this.hash, txListener); }); + this.provider.on(this.hash, txListener); + // We support replacement detection; start checking + if (startBlock >= 0) { + const replaceListener = () => __awaiter(this, void 0, void 0, function* () { + try { + // Check for a replacement; this throws only if one is found + yield checkReplacement(); + } + catch (error) { + // We were replaced (with enough confirms); re-throw the error + if ((0, index_js_1.isError)(error, "TRANSACTION_REPLACED")) { + cancel(); + reject(error); + return; + } + } + // Rescheudle a check on the next block + if (!stopScanning) { + this.provider.once("block", replaceListener); + } + }); + cancellers.push(() => { this.provider.off("block", replaceListener); }); + this.provider.once("block", replaceListener); + } + }); + return yield waiter; + }); + } + /** + * Returns ``true`` if this transaction has been included. + * + * This is effective only as of the time the TransactionResponse + * was instantiated. To get up-to-date information, use + * [[getTransaction]]. + * + * This provides a Type Guard that this transaction will have + * non-null property values for properties that are null for + * unmined transactions. + */ + isMined() { + return (this.blockHash != null); + } + /** + * Returns true if the transaction is a legacy (i.e. ``type == 0``) + * transaction. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if the transaction is a Berlin (i.e. ``type == 1``) + * transaction. See [[link-eip-2070]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if the transaction is a London (i.e. ``type == 2``) + * transaction. See [[link-eip-1559]]. + * + * This provides a Type Guard that this transaction will have + * the ``null``-ness for hardfork-specific properties set correctly. + */ + isLondon() { + return (this.type === 2); + } + /** + * Returns a filter which can be used to listen for orphan events + * that evict this transaction. + */ + removedEvent() { + (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createRemovedTransactionFilter(this); + } + /** + * Returns a filter which can be used to listen for orphan events + * that re-order this event against %%other%%. + */ + reorderedEvent(other) { + (0, index_js_1.assert)(this.isMined(), "unmined transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + (0, index_js_1.assert)(!other || other.isMined(), "unmined 'other' transaction canot be orphaned", "UNSUPPORTED_OPERATION", { operation: "removeEvent()" }); + return createReorderedTransactionFilter(this, other); + } + /** + * Returns a new TransactionResponse instance which has the ability to + * detect (and throw an error) if the transaction is replaced, which + * will begin scanning at %%startBlock%%. + * + * This should generally not be used by developers and is intended + * primarily for internal use. Setting an incorrect %%startBlock%% can + * have devastating performance consequences if used incorrectly. + */ + replaceableTransaction(startBlock) { + (0, index_js_1.assertArgument)(Number.isInteger(startBlock) && startBlock >= 0, "invalid startBlock", "startBlock", startBlock); + const tx = new TransactionResponse(this, this.provider); + __classPrivateFieldSet(tx, _TransactionResponse_startBlock, startBlock, "f"); + return tx; + } +} +exports.TransactionResponse = TransactionResponse; +_TransactionResponse_startBlock = new WeakMap(); +function createOrphanedBlockFilter(block) { + return { orphan: "drop-block", hash: block.hash, number: block.number }; +} +function createReorderedTransactionFilter(tx, other) { + return { orphan: "reorder-transaction", tx, other }; +} +function createRemovedTransactionFilter(tx) { + return { orphan: "drop-transaction", tx }; +} +function createRemovedLogFilter(log) { + return { orphan: "drop-log", log: { + transactionHash: log.transactionHash, + blockHash: log.blockHash, + blockNumber: log.blockNumber, + address: log.address, + data: log.data, + topics: Object.freeze(log.topics.slice()), + index: log.index + } }; +} +//# sourceMappingURL=provider.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/provider.js.map b/dist/ethers.js/src.ts/providers/provider.js.map new file mode 100644 index 0000000..8674fbf --- /dev/null +++ b/dist/ethers.js/src.ts/providers/provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,0DAA0D;AAC1D,gDAG2B;AAC3B,sDAAwD;AAWxD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAsBvB,0BAA0B;AAE1B,SAAS,QAAQ,CAAI,KAA2B;IAC5C,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACnC,OAAO,KAAK,CAAC;AACjB,CAAC;AAED,SAAS,MAAM,CAAC,KAAoB;IAChC,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACnC,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC5B,CAAC;AAED,0DAA0D;AAE1D;;;GAGG;AACH,MAAa,OAAO;IA+BhB;;;OAGG;IACH,YAAY,QAAwB,EAAE,YAA4B,EAAE,oBAAoC;QACpG,IAAA,2BAAgB,EAAU,IAAI,EAAE;YAC5B,QAAQ,EAAE,QAAQ,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,OAAO,EAAE,CAAC;IACd,CAAC;CACJ;AApfD,kDAofC;;AAsCD,SAAS,yBAAyB,CAAC,KAAuC;IACtE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;AAC5E,CAAC;AAED,SAAS,gCAAgC,CAAC,EAA4D,EAAE,KAAgE;IACpK,OAAO,EAAE,MAAM,EAAE,qBAAqB,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC;AACxD,CAAC;AAED,SAAS,8BAA8B,CAAC,EAA4D;IAChG,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;AAC9C,CAAC;AAED,SAAS,sBAAsB,CAAC,GAAqJ;IACjL,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,EAAE;YAC9B,eAAe,EAAE,GAAG,CAAC,eAAe;YACpC,SAAS,EAAE,GAAG,CAAC,SAAS;YACxB,WAAW,EAAE,GAAG,CAAC,WAAW;YAC5B,OAAO,EAAE,GAAG,CAAC,OAAO;YACpB,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;YACzC,KAAK,EAAE,GAAG,CAAC,KAAK;SACnB,EAAE,CAAC;AACR,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts b/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts new file mode 100644 index 0000000..4224b60 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts @@ -0,0 +1,38 @@ +import { AbstractSigner } from "./abstract-signer.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +import type { Signer } from "./signer.js"; +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +export declare class NonceManager extends AbstractSigner { + #private; + /** + * The Signer being managed. + */ + signer: Signer; + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer: Signer); + getAddress(): Promise; + connect(provider: null | Provider): NonceManager; + getNonce(blockTag?: BlockTag): Promise; + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment(): void; + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset(): void; + sendTransaction(tx: TransactionRequest): Promise; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=signer-noncemanager.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts.map b/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts.map new file mode 100644 index 0000000..29e9845 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer-noncemanager.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAExE,OAAO,KAAK,EACR,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAG1C;;;;GAIG;AACH,qBAAa,YAAa,SAAQ,cAAc;;IAC5C;;OAEG;IACH,MAAM,EAAG,MAAM,CAAC;IAKhB;;OAEG;gBACS,MAAM,EAAE,MAAM;IAQpB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC;IAInC,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAI1C,QAAQ,CAAC,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;IAapD;;;OAGG;IACH,SAAS,IAAI,IAAI;IAIjB;;;OAGG;IACH,KAAK,IAAI,IAAI;IAKP,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAY3E,eAAe,CAAC,EAAE,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIxD,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,UAAU,GAAG,OAAO,CAAC,MAAM,CAAC;IAI1D,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;CAGpI"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer-noncemanager.js b/dist/ethers.js/src.ts/providers/signer-noncemanager.js new file mode 100644 index 0000000..0677627 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer-noncemanager.js @@ -0,0 +1,106 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _NonceManager_noncePromise, _NonceManager_delta; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.NonceManager = void 0; +const index_js_1 = require("../utils/index.js"); +const abstract_signer_js_1 = require("./abstract-signer.js"); +/** + * A **NonceManager** wraps another [[Signer]] and automatically manages + * the nonce, ensuring serialized and sequential nonces are used during + * transaction. + */ +class NonceManager extends abstract_signer_js_1.AbstractSigner { + /** + * Creates a new **NonceManager** to manage %%signer%%. + */ + constructor(signer) { + super(signer.provider); + _NonceManager_noncePromise.set(this, void 0); + _NonceManager_delta.set(this, void 0); + (0, index_js_1.defineProperties)(this, { signer }); + __classPrivateFieldSet(this, _NonceManager_noncePromise, null, "f"); + __classPrivateFieldSet(this, _NonceManager_delta, 0, "f"); + } + getAddress() { + return __awaiter(this, void 0, void 0, function* () { + return this.signer.getAddress(); + }); + } + connect(provider) { + return new NonceManager(this.signer.connect(provider)); + } + getNonce(blockTag) { + const _super = Object.create(null, { + getNonce: { get: () => super.getNonce } + }); + return __awaiter(this, void 0, void 0, function* () { + if (blockTag === "pending") { + if (__classPrivateFieldGet(this, _NonceManager_noncePromise, "f") == null) { + __classPrivateFieldSet(this, _NonceManager_noncePromise, _super.getNonce.call(this, "pending"), "f"); + } + const delta = __classPrivateFieldGet(this, _NonceManager_delta, "f"); + return (yield __classPrivateFieldGet(this, _NonceManager_noncePromise, "f")) + delta; + } + return _super.getNonce.call(this, blockTag); + }); + } + /** + * Manually increment the nonce. This may be useful when managng + * offline transactions. + */ + increment() { + var _a; + __classPrivateFieldSet(this, _NonceManager_delta, (_a = __classPrivateFieldGet(this, _NonceManager_delta, "f"), _a++, _a), "f"); + } + /** + * Resets the nonce, causing the **NonceManager** to reload the current + * nonce from the blockchain on the next transaction. + */ + reset() { + __classPrivateFieldSet(this, _NonceManager_delta, 0, "f"); + __classPrivateFieldSet(this, _NonceManager_noncePromise, null, "f"); + } + sendTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + const noncePromise = this.getNonce("pending"); + this.increment(); + tx = yield this.signer.populateTransaction(tx); + tx.nonce = yield noncePromise; + // @TODO: Maybe handle interesting/recoverable errors? + // Like don't increment if the tx was certainly not sent + return yield this.signer.sendTransaction(tx); + }); + } + signTransaction(tx) { + return this.signer.signTransaction(tx); + } + signMessage(message) { + return this.signer.signMessage(message); + } + signTypedData(domain, types, value) { + return this.signer.signTypedData(domain, types, value); + } +} +exports.NonceManager = NonceManager; +_NonceManager_noncePromise = new WeakMap(), _NonceManager_delta = new WeakMap(); +//# sourceMappingURL=signer-noncemanager.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer-noncemanager.js.map b/dist/ethers.js/src.ts/providers/signer-noncemanager.js.map new file mode 100644 index 0000000..09cbb47 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer-noncemanager.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer-noncemanager.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/signer-noncemanager.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAqD;AACrD,6DAAsD;AAUtD;;;;GAIG;AACH,MAAa,YAAa,SAAQ,mCAAc;IAS5C;;OAEG;IACH,YAAY,MAAc;QACtB,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAP3B,6CAAsC;QACtC,sCAAe;QAOX,IAAA,2BAAgB,EAAe,IAAI,EAAE,EAAE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D;YACtD,wDAAwD;YACxD,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QACjD,CAAC;KAAA;IAED,eAAe,CAAC,EAAsB;QAClC,OAAO,IAAI,CAAC,MAAM,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,WAAW,CAAC,OAA4B;QACpC,OAAO,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;IAED,aAAa,CAAC,MAAuB,EAAE,KAA4C,EAAE,KAA0B;QAC3G,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;IAC3D,CAAC;CACJ;AAjFD,oCAiFC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer.d.ts b/dist/ethers.js/src.ts/providers/signer.d.ts new file mode 100644 index 0000000..46b5df6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer.d.ts @@ -0,0 +1,118 @@ +import type { Addressable, NameResolver } from "../address/index.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { TransactionLike } from "../transaction/index.js"; +import type { ContractRunner } from "./contracts.js"; +import type { BlockTag, Provider, TransactionRequest, TransactionResponse } from "./provider.js"; +/** + * A Signer represents an account on the Ethereum Blockchain, and is most often + * backed by a private key represented by a mnemonic or residing on a Hardware Wallet. + * + * The API remains abstract though, so that it can deal with more advanced exotic + * Signing entities, such as Smart Contract Wallets or Virtual Wallets (where the + * private key may not be known). + */ +export interface Signer extends Addressable, ContractRunner, NameResolver { + /** + * The [[Provider]] attached to this Signer (if any). + */ + provider: null | Provider; + /** + * Returns a new instance of this Signer connected to //provider// or detached + * from any Provider if null. + */ + connect(provider: null | Provider): Signer; + /** + * Get the address of the Signer. + */ + getAddress(): Promise; + /** + * Gets the next nonce required for this Signer to send a transaction. + * + * @param blockTag - The blocktag to base the transaction count on, keep in mind + * many nodes do not honour this value and silently ignore it [default: ``"latest"``] + */ + getNonce(blockTag?: BlockTag): Promise; + /** + * Prepares a {@link TransactionRequest} for calling: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * + * @param tx - The call to prepare + */ + populateCall(tx: TransactionRequest): Promise>; + /** + * Prepares a {@link TransactionRequest} for sending to the network by + * populating any missing properties: + * - resolves ``to`` and ``from`` addresses + * - if ``from`` is specified , check that it matches this Signer + * - populates ``nonce`` via ``signer.getNonce("pending")`` + * - populates ``gasLimit`` via ``signer.estimateGas(tx)`` + * - populates ``chainId`` via ``signer.provider.getNetwork()`` + * - populates ``type`` and relevant fee data for that type (``gasPrice`` + * for legacy transactions, ``maxFeePerGas`` for EIP-1559, etc) + * + * @note Some Signer implementations may skip populating properties that + * are populated downstream; for example JsonRpcSigner defers to the + * node to populate the nonce and fee data. + * + * @param tx - The call to prepare + */ + populateTransaction(tx: TransactionRequest): Promise>; + /** + * Estimates the required gas required to execute //tx// on the Blockchain. This + * will be the expected amount a transaction will require as its ``gasLimit`` + * to successfully run all the necessary computations and store the needed state + * that the transaction intends. + * + * Keep in mind that this is **best efforts**, since the state of the Blockchain + * is in flux, which could affect transaction gas requirements. + * + * @throws UNPREDICTABLE_GAS_LIMIT A transaction that is believed by the node to likely + * fail will throw an error during gas estimation. This could indicate that it + * will actually fail or that the circumstances are simply too complex for the + * node to take into account. In these cases, a manually determined ``gasLimit`` + * will need to be made. + */ + estimateGas(tx: TransactionRequest): Promise; + /** + * Evaluates the //tx// by running it against the current Blockchain state. This + * cannot change state and has no cost in ether, as it is effectively simulating + * execution. + * + * This can be used to have the Blockchain perform computations based on its state + * (e.g. running a Contract's getters) or to simulate the effect of a transaction + * before actually performing an operation. + */ + call(tx: TransactionRequest): Promise; + /** + * Resolves an ENS Name to an address. + */ + resolveName(name: string): Promise; + /** + * Signs %%tx%%, returning the fully signed transaction. This does not + * populate any additional properties within the transaction. + */ + signTransaction(tx: TransactionRequest): Promise; + /** + * Sends %%tx%% to the Network. The ``signer.populateTransaction(tx)`` + * is called first to ensure all necessary properties for the + * transaction to be valid have been popualted first. + */ + sendTransaction(tx: TransactionRequest): Promise; + /** + * Signs an [[link-eip-191]] prefixed personal message. + * + * If the %%message%% is a string, it is signed as UTF-8 encoded bytes. It is **not** + * interpretted as a [[BytesLike]]; so the string ``"0x1234"`` is signed as six + * characters, **not** two bytes. + * + * To sign that example as two bytes, the Uint8Array should be used + * (i.e. ``new Uint8Array([ 0x12, 0x34 ])``). + */ + signMessage(message: string | Uint8Array): Promise; + /** + * Signs the [[link-eip-712]] typed data. + */ + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=signer.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer.d.ts.map b/dist/ethers.js/src.ts/providers/signer.d.ts.map new file mode 100644 index 0000000..94bea55 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"signer.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/signer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACrE,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEjG;;;;;;;GAOG;AACH,MAAM,WAAW,MAAO,SAAQ,WAAW,EAAE,cAAc,EAAE,YAAY;IAErE;;OAEG;IACH,QAAQ,EAAE,IAAI,GAAG,QAAQ,CAAC;IAE1B;;;OAGG;IACH,OAAO,CAAC,QAAQ,EAA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I"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer.js b/dist/ethers.js/src.ts/providers/signer.js new file mode 100644 index 0000000..c73406a --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=signer.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/signer.js.map b/dist/ethers.js/src.ts/providers/signer.js.map new file mode 100644 index 0000000..ec3f0b7 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"signer.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/signer.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts b/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts new file mode 100644 index 0000000..b235e3b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts @@ -0,0 +1,25 @@ +import type { Subscriber } from "./abstract-provider.js"; +import type { Provider } from "./provider.js"; +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export interface ConnectionRpcProvider extends Provider { + _subscribe(param: Array, processFunc: (result: any) => void): number; + _unsubscribe(filterId: number): void; +} +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +export declare class BlockConnectionSubscriber implements Subscriber { + #private; + constructor(provider: ConnectionRpcProvider); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-connection.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts.map b/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts.map new file mode 100644 index 0000000..d6b4bcf --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-connection.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IAEnD,UAAU,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,CAAC,MAAM,EAAE,GAAG,KAAK,IAAI,GAAG,MAAM,CAAC;IAC1E,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxC;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,YAAW,UAAU;;gBAQ5C,QAAQ,EAAE,qBAAqB;IAO3C,KAAK,IAAI,IAAI;IAcb,IAAI,IAAI,IAAI;IAUZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-connection.js b/dist/ethers.js/src.ts/providers/subscriber-connection.js new file mode 100644 index 0000000..7793c83 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-connection.js @@ -0,0 +1,69 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _BlockConnectionSubscriber_provider, _BlockConnectionSubscriber_blockNumber, _BlockConnectionSubscriber_running, _BlockConnectionSubscriber_filterId; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BlockConnectionSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * @TODO + * + * @_docloc: api/providers/abstract-provider + */ +class BlockConnectionSubscriber { + constructor(provider) { + _BlockConnectionSubscriber_provider.set(this, void 0); + _BlockConnectionSubscriber_blockNumber.set(this, void 0); + _BlockConnectionSubscriber_running.set(this, void 0); + _BlockConnectionSubscriber_filterId.set(this, void 0); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_blockNumber, -2, "f"); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_running, false, "f"); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_filterId, null, "f"); + } + start() { + if (__classPrivateFieldGet(this, _BlockConnectionSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _BlockConnectionSubscriber_running, true, "f"); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_filterId, __classPrivateFieldGet(this, _BlockConnectionSubscriber_provider, "f")._subscribe(["newHeads"], (result) => { + const blockNumber = (0, index_js_1.getNumber)(result.number); + const initial = (__classPrivateFieldGet(this, _BlockConnectionSubscriber_blockNumber, "f") === -2) ? blockNumber : (__classPrivateFieldGet(this, _BlockConnectionSubscriber_blockNumber, "f") + 1); + for (let b = initial; b <= blockNumber; b++) { + __classPrivateFieldGet(this, _BlockConnectionSubscriber_provider, "f").emit("block", b); + } + __classPrivateFieldSet(this, _BlockConnectionSubscriber_blockNumber, blockNumber, "f"); + }), "f"); + } + stop() { + if (!__classPrivateFieldGet(this, _BlockConnectionSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _BlockConnectionSubscriber_running, false, "f"); + if (__classPrivateFieldGet(this, _BlockConnectionSubscriber_filterId, "f") != null) { + __classPrivateFieldGet(this, _BlockConnectionSubscriber_provider, "f")._unsubscribe(__classPrivateFieldGet(this, _BlockConnectionSubscriber_filterId, "f")); + __classPrivateFieldSet(this, _BlockConnectionSubscriber_filterId, null, "f"); + } + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + __classPrivateFieldSet(this, _BlockConnectionSubscriber_blockNumber, -2, "f"); + } + this.stop(); + } + resume() { + this.start(); + } +} +exports.BlockConnectionSubscriber = BlockConnectionSubscriber; +_BlockConnectionSubscriber_provider = new WeakMap(), _BlockConnectionSubscriber_blockNumber = new WeakMap(), _BlockConnectionSubscriber_running = new WeakMap(), _BlockConnectionSubscriber_filterId = new WeakMap(); +//# sourceMappingURL=subscriber-connection.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-connection.js.map b/dist/ethers.js/src.ts/providers/subscriber-connection.js.map new file mode 100644 index 0000000..e235a91 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-connection.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-connection.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/subscriber-connection.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,gDAA8C;AAmB9C;;;;GAIG;AACH,MAAa,yBAAyB;IAQlC,YAAY,QAA+B;QAP3C,sDAAiC;QACjC,yDAAqB;QAErB,qDAAkB;QAElB,sDAAyB;QAGrB,uBAAA,IAAI,uCAAa,QAAQ,MAAA,CAAC;QAC1B,uBAAA,IAAI,0CAAgB,CAAC,CAAC,MAAA,CAAC;QACvB,uBAAA,IAAI,sCAAY,KAAK,MAAA,CAAC;QACtB,uBAAA,IAAI,uCAAa,IAAI,MAAA,CAAC;IAC1B,CAAC;IAED,KAAK;QACD,IAAI,uBAAA,IAAI,0CAAS,EAAE;YAAE,OAAO;SAAE;QAC9B,uBAAA,IAAI,sCAAY,IAAI,MAAA,CAAC;QAErB,uBAAA,IAAI,uCAAa,uBAAA,IAAI,2CAAU,CAAC,UAAU,CAAC,CAAE,UAAU,CAAE,EAAE,CAAC,MAAW,EAAE,EAAE;YACvE,MAAM,WAAW,GAAG,IAAA,oBAAS,EAAC,MAAM,CAAC,MAAM,CAAC,CAAC;YAC7C,MAAM,OAAO,GAAG,CAAC,uBAAA,IAAI,8CAAa,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAA,CAAC,CAAC,CAAC,uBAAA,IAAI,8CAAa,GAAG,CAAC,CAAC,CAAA;YACjF,KAAK,IAAI,CAAC,GAAG,OAAO,EAAE,CAAC,IAAI,WAAW,EAAE,CAAC,EAAE,EAAE;gBACzC,uBAAA,IAAI,2CAAU,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC;aACnC;YACD,uBAAA,IAAI,0CAAgB,WAAW,MAAA,CAAC;QACpC,CAAC,CAAC,MAAA,CAAC;IACP,CAAC;IAED,IAAI;QACA,IAAI,CAAC,uBAAA,IAAI,0CAAS,EAAE;YAAE,OAAO;SAAE;QAC/B,uBAAA,IAAI,sCAAY,KAAK,MAAA,CAAC;QAEtB,IAAI,uBAAA,IAAI,2CAAU,IAAI,IAAI,EAAE;YACxB,uBAAA,IAAI,2CAAU,CAAC,YAAY,CAAC,uBAAA,IAAI,2CAAU,CAAC,CAAC;YAC5C,uBAAA,IAAI,uCAAa,IAAI,MAAA,CAAC;SACzB;IACL,CAAC;IAED,KAAK,CAAC,eAAyB;QAC3B,IAAI,eAAe,EAAE;YAAE,uBAAA,IAAI,0CAAgB,CAAC,CAAC,MAAA,CAAC;SAAE;QAChD,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAED,MAAM;QACF,IAAI,CAAC,KAAK,EAAE,CAAC;IACjB,CAAC;CACJ;AA/CD,8DA+CC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts b/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts new file mode 100644 index 0000000..721d628 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts @@ -0,0 +1,64 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter } from "./provider.js"; +import type { JsonRpcApiProvider } from "./provider-jsonrpc.js"; +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdSubscriber implements Subscriber { + #private; + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider: JsonRpcApiProvider); + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider: JsonRpcApiProvider): Promise; + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider: AbstractProvider, result: Array): Promise; + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider: AbstractProvider): Subscriber; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdEventSubscriber extends FilterIdSubscriber { + #private; + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider: JsonRpcApiProvider, filter: EventFilter); + _recover(provider: AbstractProvider): Subscriber; + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class FilterIdPendingSubscriber extends FilterIdSubscriber { + _subscribe(provider: JsonRpcApiProvider): Promise; + _emitResults(provider: JsonRpcApiProvider, results: Array): Promise; +} +//# sourceMappingURL=subscriber-filterid.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts.map b/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts.map new file mode 100644 index 0000000..8180a63 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-filterid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/subscriber-filterid.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAE3E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAMhE;;;;;;;;;GASG;AACH,qBAAa,kBAAmB,YAAW,UAAU;;IAYjD;;;;OAIG;gBACS,QAAQ,EAAE,kBAAkB;IAaxC;;OAEG;IACH,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD;;OAEG;IACH,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAI3E;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAuDhD,KAAK,IAAI,IAAI;IAOb,IAAI,IAAI,IAAI;IASZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CACjB;AAED;;;;GAIG;AACH,qBAAa,uBAAwB,SAAQ,kBAAkB;;IAG3D;;;OAGG;gBACS,QAAQ,EAAE,kBAAkB,EAAE,MAAM,EAAE,WAAW;IAK7D,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU;IAI1C,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF;AAED;;;;GAIG;AACH,qBAAa,yBAA0B,SAAQ,kBAAkB;IACvD,UAAU,CAAC,QAAQ,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;IAIzD,YAAY,CAAC,QAAQ,EAAE,kBAAkB,EAAE,OAAO,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;CAKvF"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-filterid.js b/dist/ethers.js/src.ts/providers/subscriber-filterid.js new file mode 100644 index 0000000..295ad54 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-filterid.js @@ -0,0 +1,209 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _FilterIdSubscriber_instances, _FilterIdSubscriber_provider, _FilterIdSubscriber_filterIdPromise, _FilterIdSubscriber_poller, _FilterIdSubscriber_running, _FilterIdSubscriber_network, _FilterIdSubscriber_hault, _FilterIdSubscriber_poll, _FilterIdSubscriber_teardown, _FilterIdEventSubscriber_event; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FilterIdPendingSubscriber = exports.FilterIdEventSubscriber = exports.FilterIdSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +const subscriber_polling_js_1 = require("./subscriber-polling.js"); +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Some backends support subscribing to events using a Filter ID. + * + * When subscribing with this technique, the node issues a unique + * //Filter ID//. At this point the node dedicates resources to + * the filter, so that periodic calls to follow up on the //Filter ID// + * will receive any events since the last call. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdSubscriber { + /** + * Creates a new **FilterIdSubscriber** which will used [[_subscribe]] + * and [[_emitResults]] to setup the subscription and provide the event + * to the %%provider%%. + */ + constructor(provider) { + _FilterIdSubscriber_instances.add(this); + _FilterIdSubscriber_provider.set(this, void 0); + _FilterIdSubscriber_filterIdPromise.set(this, void 0); + _FilterIdSubscriber_poller.set(this, void 0); + _FilterIdSubscriber_running.set(this, void 0); + _FilterIdSubscriber_network.set(this, void 0); + _FilterIdSubscriber_hault.set(this, void 0); + __classPrivateFieldSet(this, _FilterIdSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_filterIdPromise, null, "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_poller, __classPrivateFieldGet(this, _FilterIdSubscriber_instances, "m", _FilterIdSubscriber_poll).bind(this), "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_running, false, "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_network, null, "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_hault, false, "f"); + } + /** + * Sub-classes **must** override this to begin the subscription. + */ + _subscribe(provider) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle the events. + */ + _emitResults(provider, result) { + throw new Error("subclasses must override this"); + } + /** + * Sub-classes **must** override this handle recovery on errors. + */ + _recover(provider) { + throw new Error("subclasses must override this"); + } + start() { + if (__classPrivateFieldGet(this, _FilterIdSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _FilterIdSubscriber_running, true, "f"); + __classPrivateFieldGet(this, _FilterIdSubscriber_instances, "m", _FilterIdSubscriber_poll).call(this, -2); + } + stop() { + if (!__classPrivateFieldGet(this, _FilterIdSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _FilterIdSubscriber_running, false, "f"); + __classPrivateFieldSet(this, _FilterIdSubscriber_hault, true, "f"); + __classPrivateFieldGet(this, _FilterIdSubscriber_instances, "m", _FilterIdSubscriber_teardown).call(this); + __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").off("block", __classPrivateFieldGet(this, _FilterIdSubscriber_poller, "f")); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + __classPrivateFieldGet(this, _FilterIdSubscriber_instances, "m", _FilterIdSubscriber_teardown).call(this); + } + __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").off("block", __classPrivateFieldGet(this, _FilterIdSubscriber_poller, "f")); + } + resume() { this.start(); } +} +exports.FilterIdSubscriber = FilterIdSubscriber; +_FilterIdSubscriber_provider = new WeakMap(), _FilterIdSubscriber_filterIdPromise = new WeakMap(), _FilterIdSubscriber_poller = new WeakMap(), _FilterIdSubscriber_running = new WeakMap(), _FilterIdSubscriber_network = new WeakMap(), _FilterIdSubscriber_hault = new WeakMap(), _FilterIdSubscriber_instances = new WeakSet(), _FilterIdSubscriber_poll = function _FilterIdSubscriber_poll(blockNumber) { + return __awaiter(this, void 0, void 0, function* () { + try { + // Subscribe if necessary + if (__classPrivateFieldGet(this, _FilterIdSubscriber_filterIdPromise, "f") == null) { + __classPrivateFieldSet(this, _FilterIdSubscriber_filterIdPromise, this._subscribe(__classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f")), "f"); + } + // Get the Filter ID + let filterId = null; + try { + filterId = yield __classPrivateFieldGet(this, _FilterIdSubscriber_filterIdPromise, "f"); + } + catch (error) { + if (!(0, index_js_1.isError)(error, "UNSUPPORTED_OPERATION") || error.operation !== "eth_newFilter") { + throw error; + } + } + // The backend does not support Filter ID; downgrade to + // polling + if (filterId == null) { + __classPrivateFieldSet(this, _FilterIdSubscriber_filterIdPromise, null, "f"); + __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f")._recoverSubscriber(this, this._recover(__classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f"))); + return; + } + const network = yield __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").getNetwork(); + if (!__classPrivateFieldGet(this, _FilterIdSubscriber_network, "f")) { + __classPrivateFieldSet(this, _FilterIdSubscriber_network, network, "f"); + } + if (__classPrivateFieldGet(this, _FilterIdSubscriber_network, "f").chainId !== network.chainId) { + throw new Error("chaid changed"); + } + if (__classPrivateFieldGet(this, _FilterIdSubscriber_hault, "f")) { + return; + } + const result = yield __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").send("eth_getFilterChanges", [filterId]); + yield this._emitResults(__classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f"), result); + } + catch (error) { + console.log("@TODO", error); + } + __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").once("block", __classPrivateFieldGet(this, _FilterIdSubscriber_poller, "f")); + }); +}, _FilterIdSubscriber_teardown = function _FilterIdSubscriber_teardown() { + const filterIdPromise = __classPrivateFieldGet(this, _FilterIdSubscriber_filterIdPromise, "f"); + if (filterIdPromise) { + __classPrivateFieldSet(this, _FilterIdSubscriber_filterIdPromise, null, "f"); + filterIdPromise.then((filterId) => { + __classPrivateFieldGet(this, _FilterIdSubscriber_provider, "f").send("eth_uninstallFilter", [filterId]); + }); + } +}; +/** + * A **FilterIdSubscriber** for receiving contract events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdEventSubscriber extends FilterIdSubscriber { + /** + * Creates a new **FilterIdEventSubscriber** attached to %%provider%% + * listening for %%filter%%. + */ + constructor(provider, filter) { + super(provider); + _FilterIdEventSubscriber_event.set(this, void 0); + __classPrivateFieldSet(this, _FilterIdEventSubscriber_event, copy(filter), "f"); + } + _recover(provider) { + return new subscriber_polling_js_1.PollingEventSubscriber(provider, __classPrivateFieldGet(this, _FilterIdEventSubscriber_event, "f")); + } + _subscribe(provider) { + return __awaiter(this, void 0, void 0, function* () { + const filterId = yield provider.send("eth_newFilter", [__classPrivateFieldGet(this, _FilterIdEventSubscriber_event, "f")]); + return filterId; + }); + } + _emitResults(provider, results) { + return __awaiter(this, void 0, void 0, function* () { + for (const result of results) { + provider.emit(__classPrivateFieldGet(this, _FilterIdEventSubscriber_event, "f"), provider._wrapLog(result, provider._network)); + } + }); + } +} +exports.FilterIdEventSubscriber = FilterIdEventSubscriber; +_FilterIdEventSubscriber_event = new WeakMap(); +/** + * A **FilterIdSubscriber** for receiving pending transactions events. + * + * @_docloc: api/providers/abstract-provider + */ +class FilterIdPendingSubscriber extends FilterIdSubscriber { + _subscribe(provider) { + return __awaiter(this, void 0, void 0, function* () { + return yield provider.send("eth_newPendingTransactionFilter", []); + }); + } + _emitResults(provider, results) { + return __awaiter(this, void 0, void 0, function* () { + for (const result of results) { + provider.emit("pending", result); + } + }); + } +} +exports.FilterIdPendingSubscriber = FilterIdPendingSubscriber; +//# sourceMappingURL=subscriber-filterid.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-filterid.js.map b/dist/ethers.js/src.ts/providers/subscriber-filterid.js.map new file mode 100644 index 0000000..a2d436b --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-filterid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-filterid.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.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IAG3D;;;OAGG;IACH,YAAY,QAA4B,EAAE,MAAmB;QACzD,KAAK,CAAC,QAAQ,CAAC,CAAC;QAPpB,iDAAoB;QAQhB,uBAAA,IAAI,kCAAU,IAAI,CAAC,MAAM,CAAC,MAAA,CAAC;IAC/B,CAAC;IAED,QAAQ,CAAC,QAA0B;QAC/B,OAAO,IAAI,8CAAsB,CAAC,QAAQ,EAAE,uBAAA,IAAI,sCAAO,CAAC,CAAC;IAC7D,CAAC;IAEK,UAAU,CAAC,QAA4B;;YACzC,MAAM,QAAQ,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,eAAe,EAAE,CAAE,uBAAA,IAAI,sCAAO,CAAE,CAAC,CAAC;YACvE,OAAO,QAAQ,CAAC;QACpB,CAAC;KAAA;IAEK,YAAY,CAAC,QAA4B,EAAE,OAAmB;;YAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC1B,QAAQ,CAAC,IAAI,CAAC,uBAAA,IAAI,sCAAO,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC;aAC5E;QACL,CAAC;KAAA;CACJ;AA1BD,0DA0BC;;AAED;;;;GAIG;AACH,MAAa,yBAA0B,SAAQ,kBAAkB;IACvD,UAAU,CAAC,QAA4B;;YACzC,OAAO,MAAM,QAAQ,CAAC,IAAI,CAAC,iCAAiC,EAAE,EAAG,CAAC,CAAC;QACvE,CAAC;KAAA;IAEK,YAAY,CAAC,QAA4B,EAAE,OAAmB;;YAChE,KAAK,MAAM,MAAM,IAAI,OAAO,EAAE;gBAC1B,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;aACpC;QACL,CAAC;KAAA;CACJ;AAVD,8DAUC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts b/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts new file mode 100644 index 0000000..e751ba4 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts @@ -0,0 +1,100 @@ +import type { AbstractProvider, Subscriber } from "./abstract-provider.js"; +import type { EventFilter, OrphanFilter, ProviderEvent } from "./provider.js"; +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +export declare function getPollingSubscriber(provider: AbstractProvider, event: ProviderEvent): Subscriber; +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * The polling interval. + */ + get pollingInterval(): number; + set pollingInterval(value: number); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class OnBlockSubscriber implements Subscriber { + #private; + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider: AbstractProvider); + /** + * Called on every new block. + */ + _poll(blockNumber: number, provider: AbstractProvider): Promise; + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +export declare class PollingBlockTagSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, tag: string); + pause(dropWhilePaused?: boolean): void; + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingOrphanSubscriber extends OnBlockSubscriber { + #private; + constructor(provider: AbstractProvider, filter: OrphanFilter); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingTransactionSubscriber extends OnBlockSubscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider: AbstractProvider, hash: string); + _poll(blockNumber: number, provider: AbstractProvider): Promise; +} +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +export declare class PollingEventSubscriber implements Subscriber { + #private; + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider: AbstractProvider, filter: EventFilter); + start(): void; + stop(): void; + pause(dropWhilePaused?: boolean): void; + resume(): void; +} +//# sourceMappingURL=subscriber-polling.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts.map b/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts.map new file mode 100644 index 0000000..65e92d8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-polling.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,KAAK,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAM9E;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,KAAK,EAAE,aAAa,GAAG,UAAU,CAOjG;AAID;;;;;GAKG;AACH,qBAAa,sBAAuB,YAAW,UAAU;;IAUrD;;OAEG;gBACS,QAAQ,EAAE,gBAAgB;IAQtC;;OAEG;IACH,IAAI,eAAe,IAAI,MAAM,CAA2B;IACxD,IAAI,eAAe,CAAC,KAAK,EAAE,MAAM,EAA6B;IAqC9D,KAAK,IAAI,IAAI;IAMb,IAAI,IAAI,IAAI;IAMZ,KAAK,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,IAAI;IAKtC,MAAM,IAAI,IAAI;CAGjB;AAGD;;;;;GAKG;AACH,qB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IAAI;CAGjB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-polling.js b/dist/ethers.js/src.ts/providers/subscriber-polling.js new file mode 100644 index 0000000..135c8f5 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-polling.js @@ -0,0 +1,342 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _PollingBlockSubscriber_instances, _PollingBlockSubscriber_provider, _PollingBlockSubscriber_poller, _PollingBlockSubscriber_interval, _PollingBlockSubscriber_blockNumber, _PollingBlockSubscriber_poll, _OnBlockSubscriber_provider, _OnBlockSubscriber_poll, _OnBlockSubscriber_running, _PollingBlockTagSubscriber_tag, _PollingBlockTagSubscriber_lastBlock, _PollingOrphanSubscriber_filter, _PollingTransactionSubscriber_hash, _PollingEventSubscriber_instances, _PollingEventSubscriber_provider, _PollingEventSubscriber_filter, _PollingEventSubscriber_poller, _PollingEventSubscriber_running, _PollingEventSubscriber_blockNumber, _PollingEventSubscriber_poll; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.PollingEventSubscriber = exports.PollingTransactionSubscriber = exports.PollingOrphanSubscriber = exports.PollingBlockTagSubscriber = exports.OnBlockSubscriber = exports.PollingBlockSubscriber = exports.getPollingSubscriber = void 0; +const index_js_1 = require("../utils/index.js"); +function copy(obj) { + return JSON.parse(JSON.stringify(obj)); +} +/** + * Return the polling subscriber for common events. + * + * @_docloc: api/providers/abstract-provider + */ +function getPollingSubscriber(provider, event) { + if (event === "block") { + return new PollingBlockSubscriber(provider); + } + if ((0, index_js_1.isHexString)(event, 32)) { + return new PollingTransactionSubscriber(provider, event); + } + (0, index_js_1.assert)(false, "unsupported polling event", "UNSUPPORTED_OPERATION", { + operation: "getPollingSubscriber", info: { event } + }); +} +exports.getPollingSubscriber = getPollingSubscriber; +// @TODO: refactor this +/** + * A **PollingBlockSubscriber** polls at a regular interval for a change + * in the block number. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingBlockSubscriber { + /** + * Create a new **PollingBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + _PollingBlockSubscriber_instances.add(this); + _PollingBlockSubscriber_provider.set(this, void 0); + _PollingBlockSubscriber_poller.set(this, void 0); + _PollingBlockSubscriber_interval.set(this, void 0); + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + _PollingBlockSubscriber_blockNumber.set(this, void 0); + __classPrivateFieldSet(this, _PollingBlockSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _PollingBlockSubscriber_poller, null, "f"); + __classPrivateFieldSet(this, _PollingBlockSubscriber_interval, 4000, "f"); + __classPrivateFieldSet(this, _PollingBlockSubscriber_blockNumber, -2, "f"); + } + /** + * The polling interval. + */ + get pollingInterval() { return __classPrivateFieldGet(this, _PollingBlockSubscriber_interval, "f"); } + set pollingInterval(value) { __classPrivateFieldSet(this, _PollingBlockSubscriber_interval, value, "f"); } + start() { + if (__classPrivateFieldGet(this, _PollingBlockSubscriber_poller, "f")) { + return; + } + __classPrivateFieldSet(this, _PollingBlockSubscriber_poller, __classPrivateFieldGet(this, _PollingBlockSubscriber_provider, "f")._setTimeout(__classPrivateFieldGet(this, _PollingBlockSubscriber_instances, "m", _PollingBlockSubscriber_poll).bind(this), __classPrivateFieldGet(this, _PollingBlockSubscriber_interval, "f")), "f"); + __classPrivateFieldGet(this, _PollingBlockSubscriber_instances, "m", _PollingBlockSubscriber_poll).call(this); + } + stop() { + if (!__classPrivateFieldGet(this, _PollingBlockSubscriber_poller, "f")) { + return; + } + __classPrivateFieldGet(this, _PollingBlockSubscriber_provider, "f")._clearTimeout(__classPrivateFieldGet(this, _PollingBlockSubscriber_poller, "f")); + __classPrivateFieldSet(this, _PollingBlockSubscriber_poller, null, "f"); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + __classPrivateFieldSet(this, _PollingBlockSubscriber_blockNumber, -2, "f"); + } + } + resume() { + this.start(); + } +} +exports.PollingBlockSubscriber = PollingBlockSubscriber; +_PollingBlockSubscriber_provider = new WeakMap(), _PollingBlockSubscriber_poller = new WeakMap(), _PollingBlockSubscriber_interval = new WeakMap(), _PollingBlockSubscriber_blockNumber = new WeakMap(), _PollingBlockSubscriber_instances = new WeakSet(), _PollingBlockSubscriber_poll = function _PollingBlockSubscriber_poll() { + return __awaiter(this, void 0, void 0, function* () { + try { + const blockNumber = yield __classPrivateFieldGet(this, _PollingBlockSubscriber_provider, "f").getBlockNumber(); + // Bootstrap poll to setup our initial block number + if (__classPrivateFieldGet(this, _PollingBlockSubscriber_blockNumber, "f") === -2) { + __classPrivateFieldSet(this, _PollingBlockSubscriber_blockNumber, blockNumber, "f"); + return; + } + // @TODO: Put a cap on the maximum number of events per loop? + if (blockNumber !== __classPrivateFieldGet(this, _PollingBlockSubscriber_blockNumber, "f")) { + for (let b = __classPrivateFieldGet(this, _PollingBlockSubscriber_blockNumber, "f") + 1; b <= blockNumber; b++) { + // We have been stopped + if (__classPrivateFieldGet(this, _PollingBlockSubscriber_poller, "f") == null) { + return; + } + yield __classPrivateFieldGet(this, _PollingBlockSubscriber_provider, "f").emit("block", b); + } + __classPrivateFieldSet(this, _PollingBlockSubscriber_blockNumber, blockNumber, "f"); + } + } + catch (error) { + // @TODO: Minor bump, add an "error" event to let subscribers + // know things went awry. + //console.log(error); + } + // We have been stopped + if (__classPrivateFieldGet(this, _PollingBlockSubscriber_poller, "f") == null) { + return; + } + __classPrivateFieldSet(this, _PollingBlockSubscriber_poller, __classPrivateFieldGet(this, _PollingBlockSubscriber_provider, "f")._setTimeout(__classPrivateFieldGet(this, _PollingBlockSubscriber_instances, "m", _PollingBlockSubscriber_poll).bind(this), __classPrivateFieldGet(this, _PollingBlockSubscriber_interval, "f")), "f"); + }); +}; +/** + * An **OnBlockSubscriber** can be sub-classed, with a [[_poll]] + * implmentation which will be called on every new block. + * + * @_docloc: api/providers/abstract-provider + */ +class OnBlockSubscriber { + /** + * Create a new **OnBlockSubscriber** attached to %%provider%%. + */ + constructor(provider) { + _OnBlockSubscriber_provider.set(this, void 0); + _OnBlockSubscriber_poll.set(this, void 0); + _OnBlockSubscriber_running.set(this, void 0); + __classPrivateFieldSet(this, _OnBlockSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _OnBlockSubscriber_running, false, "f"); + __classPrivateFieldSet(this, _OnBlockSubscriber_poll, (blockNumber) => { + this._poll(blockNumber, __classPrivateFieldGet(this, _OnBlockSubscriber_provider, "f")); + }, "f"); + } + /** + * Called on every new block. + */ + _poll(blockNumber, provider) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("sub-classes must override this"); + }); + } + start() { + if (__classPrivateFieldGet(this, _OnBlockSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _OnBlockSubscriber_running, true, "f"); + __classPrivateFieldGet(this, _OnBlockSubscriber_poll, "f").call(this, -2); + __classPrivateFieldGet(this, _OnBlockSubscriber_provider, "f").on("block", __classPrivateFieldGet(this, _OnBlockSubscriber_poll, "f")); + } + stop() { + if (!__classPrivateFieldGet(this, _OnBlockSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _OnBlockSubscriber_running, false, "f"); + __classPrivateFieldGet(this, _OnBlockSubscriber_provider, "f").off("block", __classPrivateFieldGet(this, _OnBlockSubscriber_poll, "f")); + } + pause(dropWhilePaused) { this.stop(); } + resume() { this.start(); } +} +exports.OnBlockSubscriber = OnBlockSubscriber; +_OnBlockSubscriber_provider = new WeakMap(), _OnBlockSubscriber_poll = new WeakMap(), _OnBlockSubscriber_running = new WeakMap(); +class PollingBlockTagSubscriber extends OnBlockSubscriber { + constructor(provider, tag) { + super(provider); + _PollingBlockTagSubscriber_tag.set(this, void 0); + _PollingBlockTagSubscriber_lastBlock.set(this, void 0); + __classPrivateFieldSet(this, _PollingBlockTagSubscriber_tag, tag, "f"); + __classPrivateFieldSet(this, _PollingBlockTagSubscriber_lastBlock, -2, "f"); + } + pause(dropWhilePaused) { + if (dropWhilePaused) { + __classPrivateFieldSet(this, _PollingBlockTagSubscriber_lastBlock, -2, "f"); + } + super.pause(dropWhilePaused); + } + _poll(blockNumber, provider) { + return __awaiter(this, void 0, void 0, function* () { + const block = yield provider.getBlock(__classPrivateFieldGet(this, _PollingBlockTagSubscriber_tag, "f")); + if (block == null) { + return; + } + if (__classPrivateFieldGet(this, _PollingBlockTagSubscriber_lastBlock, "f") === -2) { + __classPrivateFieldSet(this, _PollingBlockTagSubscriber_lastBlock, block.number, "f"); + } + else if (block.number > __classPrivateFieldGet(this, _PollingBlockTagSubscriber_lastBlock, "f")) { + provider.emit(__classPrivateFieldGet(this, _PollingBlockTagSubscriber_tag, "f"), block.number); + __classPrivateFieldSet(this, _PollingBlockTagSubscriber_lastBlock, block.number, "f"); + } + }); + } +} +exports.PollingBlockTagSubscriber = PollingBlockTagSubscriber; +_PollingBlockTagSubscriber_tag = new WeakMap(), _PollingBlockTagSubscriber_lastBlock = new WeakMap(); +/** + * @_ignore: + * + * @_docloc: api/providers/abstract-provider + */ +class PollingOrphanSubscriber extends OnBlockSubscriber { + constructor(provider, filter) { + super(provider); + _PollingOrphanSubscriber_filter.set(this, void 0); + __classPrivateFieldSet(this, _PollingOrphanSubscriber_filter, copy(filter), "f"); + } + _poll(blockNumber, provider) { + return __awaiter(this, void 0, void 0, function* () { + throw new Error("@TODO"); + console.log(__classPrivateFieldGet(this, _PollingOrphanSubscriber_filter, "f")); + }); + } +} +exports.PollingOrphanSubscriber = PollingOrphanSubscriber; +_PollingOrphanSubscriber_filter = new WeakMap(); +/** + * A **PollingTransactionSubscriber** will poll for a given transaction + * hash for its receipt. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingTransactionSubscriber extends OnBlockSubscriber { + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%hash%%. + */ + constructor(provider, hash) { + super(provider); + _PollingTransactionSubscriber_hash.set(this, void 0); + __classPrivateFieldSet(this, _PollingTransactionSubscriber_hash, hash, "f"); + } + _poll(blockNumber, provider) { + return __awaiter(this, void 0, void 0, function* () { + const tx = yield provider.getTransactionReceipt(__classPrivateFieldGet(this, _PollingTransactionSubscriber_hash, "f")); + if (tx) { + provider.emit(__classPrivateFieldGet(this, _PollingTransactionSubscriber_hash, "f"), tx); + } + }); + } +} +exports.PollingTransactionSubscriber = PollingTransactionSubscriber; +_PollingTransactionSubscriber_hash = new WeakMap(); +/** + * A **PollingEventSubscriber** will poll for a given filter for its logs. + * + * @_docloc: api/providers/abstract-provider + */ +class PollingEventSubscriber { + /** + * Create a new **PollingTransactionSubscriber** attached to + * %%provider%%, listening for %%filter%%. + */ + constructor(provider, filter) { + _PollingEventSubscriber_instances.add(this); + _PollingEventSubscriber_provider.set(this, void 0); + _PollingEventSubscriber_filter.set(this, void 0); + _PollingEventSubscriber_poller.set(this, void 0); + _PollingEventSubscriber_running.set(this, void 0); + // The most recent block we have scanned for events. The value -2 + // indicates we still need to fetch an initial block number + _PollingEventSubscriber_blockNumber.set(this, void 0); + __classPrivateFieldSet(this, _PollingEventSubscriber_provider, provider, "f"); + __classPrivateFieldSet(this, _PollingEventSubscriber_filter, copy(filter), "f"); + __classPrivateFieldSet(this, _PollingEventSubscriber_poller, __classPrivateFieldGet(this, _PollingEventSubscriber_instances, "m", _PollingEventSubscriber_poll).bind(this), "f"); + __classPrivateFieldSet(this, _PollingEventSubscriber_running, false, "f"); + __classPrivateFieldSet(this, _PollingEventSubscriber_blockNumber, -2, "f"); + } + start() { + if (__classPrivateFieldGet(this, _PollingEventSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _PollingEventSubscriber_running, true, "f"); + if (__classPrivateFieldGet(this, _PollingEventSubscriber_blockNumber, "f") === -2) { + __classPrivateFieldGet(this, _PollingEventSubscriber_provider, "f").getBlockNumber().then((blockNumber) => { + __classPrivateFieldSet(this, _PollingEventSubscriber_blockNumber, blockNumber, "f"); + }); + } + __classPrivateFieldGet(this, _PollingEventSubscriber_provider, "f").on("block", __classPrivateFieldGet(this, _PollingEventSubscriber_poller, "f")); + } + stop() { + if (!__classPrivateFieldGet(this, _PollingEventSubscriber_running, "f")) { + return; + } + __classPrivateFieldSet(this, _PollingEventSubscriber_running, false, "f"); + __classPrivateFieldGet(this, _PollingEventSubscriber_provider, "f").off("block", __classPrivateFieldGet(this, _PollingEventSubscriber_poller, "f")); + } + pause(dropWhilePaused) { + this.stop(); + if (dropWhilePaused) { + __classPrivateFieldSet(this, _PollingEventSubscriber_blockNumber, -2, "f"); + } + } + resume() { + this.start(); + } +} +exports.PollingEventSubscriber = PollingEventSubscriber; +_PollingEventSubscriber_provider = new WeakMap(), _PollingEventSubscriber_filter = new WeakMap(), _PollingEventSubscriber_poller = new WeakMap(), _PollingEventSubscriber_running = new WeakMap(), _PollingEventSubscriber_blockNumber = new WeakMap(), _PollingEventSubscriber_instances = new WeakSet(), _PollingEventSubscriber_poll = function _PollingEventSubscriber_poll(blockNumber) { + return __awaiter(this, void 0, void 0, function* () { + // The initial block hasn't been determined yet + if (__classPrivateFieldGet(this, _PollingEventSubscriber_blockNumber, "f") === -2) { + return; + } + const filter = copy(__classPrivateFieldGet(this, _PollingEventSubscriber_filter, "f")); + filter.fromBlock = __classPrivateFieldGet(this, _PollingEventSubscriber_blockNumber, "f") + 1; + filter.toBlock = blockNumber; + const logs = yield __classPrivateFieldGet(this, _PollingEventSubscriber_provider, "f").getLogs(filter); + // No logs could just mean the node has not indexed them yet, + // so we keep a sliding window of 60 blocks to keep scanning + if (logs.length === 0) { + if (__classPrivateFieldGet(this, _PollingEventSubscriber_blockNumber, "f") < blockNumber - 60) { + __classPrivateFieldSet(this, _PollingEventSubscriber_blockNumber, blockNumber - 60, "f"); + } + return; + } + for (const log of logs) { + __classPrivateFieldGet(this, _PollingEventSubscriber_provider, "f").emit(__classPrivateFieldGet(this, _PollingEventSubscriber_filter, "f"), log); + // Only advance the block number when logs were found to + // account for networks (like BNB and Polygon) which may + // sacrifice event consistency for block event speed + __classPrivateFieldSet(this, _PollingEventSubscriber_blockNumber, log.blockNumber, "f"); + } + }); +}; +//# sourceMappingURL=subscriber-polling.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/subscriber-polling.js.map b/dist/ethers.js/src.ts/providers/subscriber-polling.js.map new file mode 100644 index 0000000..50698a6 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/subscriber-polling.js.map @@ -0,0 +1 @@ +{"version":3,"file":"subscriber-polling.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/subscriber-polling.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,gDAAwD;AAKxD,SAAS,IAAI,CAAC,GAAQ;IAClB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;GAIG;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QAE7B,MAAM,IAAI,GAAG,MAAM,uBAAA,IAAI,wCAAU,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QAElD,6DAA6D;QAC7D,4DAA4D;QAC5D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;YACnB,IAAI,uBAAA,IAAI,2CAAa,GAAG,WAAW,GAAG,EAAE,EAAE;gBACtC,uBAAA,IAAI,uCAAgB,WAAW,GAAG,EAAE,MAAA,CAAC;aACxC;YACD,OAAO;SACV;QAED,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACpB,uBAAA,IAAI,wCAAU,CAAC,IAAI,CAAC,uBAAA,IAAI,sCAAQ,EAAE,GAAG,CAAC,CAAC;YAEvC,wDAAwD;YACxD,wDAAwD;YACxD,oDAAoD;YACpD,uBAAA,IAAI,uCAAgB,GAAG,CAAC,WAAW,MAAA,CAAC;SACvC;IACL,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws-browser.d.ts b/dist/ethers.js/src.ts/providers/ws-browser.d.ts new file mode 100644 index 0000000..d927204 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws-browser.d.ts @@ -0,0 +1,3 @@ +declare const _WebSocket: any; +export { _WebSocket as WebSocket }; +//# sourceMappingURL=ws-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws-browser.d.ts.map b/dist/ethers.js/src.ts/providers/ws-browser.d.ts.map new file mode 100644 index 0000000..5f34bca --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ws-browser.ts"],"names":[],"mappings":"AAQA,QAAA,MAAM,UAAU,KAAwB,CAAC;AAEzC,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws-browser.js b/dist/ethers.js/src.ts/providers/ws-browser.js new file mode 100644 index 0000000..44b43a0 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws-browser.js @@ -0,0 +1,19 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocket = void 0; +function getGlobal() { + if (typeof self !== 'undefined') { + return self; + } + if (typeof window !== 'undefined') { + return window; + } + if (typeof global !== 'undefined') { + return global; + } + throw new Error('unable to locate global object'); +} +; +const _WebSocket = getGlobal().WebSocket; +exports.WebSocket = _WebSocket; +//# sourceMappingURL=ws-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws-browser.js.map b/dist/ethers.js/src.ts/providers/ws-browser.js.map new file mode 100644 index 0000000..7cdc1e8 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ws-browser.ts"],"names":[],"mappings":";;;AACA,SAAS,SAAS;IAChB,IAAI,OAAO,IAAI,KAAK,WAAW,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACjD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IACrD,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;AACpD,CAAC;AAAA,CAAC;AAEF,MAAM,UAAU,GAAG,SAAS,EAAE,CAAC,SAAS,CAAC;AAElB,+BAAS"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws.d.ts b/dist/ethers.js/src.ts/providers/ws.d.ts new file mode 100644 index 0000000..75d53b7 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws.d.ts @@ -0,0 +1,2 @@ +export { WebSocket } from "ws"; +//# sourceMappingURL=ws.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws.d.ts.map b/dist/ethers.js/src.ts/providers/ws.d.ts.map new file mode 100644 index 0000000..6a5c3d0 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ws.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws.js b/dist/ethers.js/src.ts/providers/ws.js new file mode 100644 index 0000000..c06b358 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WebSocket = void 0; +var ws_1 = require("ws"); +Object.defineProperty(exports, "WebSocket", { enumerable: true, get: function () { return ws_1.WebSocket; } }); +//# sourceMappingURL=ws.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/providers/ws.js.map b/dist/ethers.js/src.ts/providers/ws.js.map new file mode 100644 index 0000000..43bf859 --- /dev/null +++ b/dist/ethers.js/src.ts/providers/ws.js.map @@ -0,0 +1 @@ +{"version":3,"file":"ws.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/providers/ws.ts"],"names":[],"mappings":";;;AAAA,yBAA+B;AAAtB,+FAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/accesslist.d.ts b/dist/ethers.js/src.ts/transaction/accesslist.d.ts new file mode 100644 index 0000000..e30ac1c --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/accesslist.d.ts @@ -0,0 +1,6 @@ +import type { AccessList, AccessListish } from "./index.js"; +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +export declare function accessListify(value: AccessListish): AccessList; +//# sourceMappingURL=accesslist.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/accesslist.d.ts.map b/dist/ethers.js/src.ts/transaction/accesslist.d.ts.map new file mode 100644 index 0000000..826eacf --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/accesslist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/accesslist.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAa5D;;GAEG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,aAAa,GAAG,UAAU,CAuB9D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/accesslist.js b/dist/ethers.js/src.ts/transaction/accesslist.js new file mode 100644 index 0000000..77cf171 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/accesslist.js @@ -0,0 +1,41 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.accessListify = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../utils/index.js"); +function accessSetify(addr, storageKeys) { + return { + address: (0, index_js_1.getAddress)(addr), + storageKeys: storageKeys.map((storageKey, index) => { + (0, index_js_2.assertArgument)((0, index_js_2.isHexString)(storageKey, 32), "invalid slot", `storageKeys[${index}]`, storageKey); + return storageKey.toLowerCase(); + }) + }; +} +/** + * Returns a [[AccessList]] from any ethers-supported access-list structure. + */ +function accessListify(value) { + if (Array.isArray(value)) { + return value.map((set, index) => { + if (Array.isArray(set)) { + (0, index_js_2.assertArgument)(set.length === 2, "invalid slot set", `value[${index}]`, set); + return accessSetify(set[0], set[1]); + } + (0, index_js_2.assertArgument)(set != null && typeof (set) === "object", "invalid address-slot set", "value", value); + return accessSetify(set.address, set.storageKeys); + }); + } + (0, index_js_2.assertArgument)(value != null && typeof (value) === "object", "invalid access list", "value", value); + const result = Object.keys(value).map((addr) => { + const storageKeys = value[addr].reduce((accum, storageKey) => { + accum[storageKey] = true; + return accum; + }, {}); + return accessSetify(addr, Object.keys(storageKeys).sort()); + }); + result.sort((a, b) => (a.address.localeCompare(b.address))); + return result; +} +exports.accessListify = accessListify; +//# sourceMappingURL=accesslist.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/accesslist.js.map b/dist/ethers.js/src.ts/transaction/accesslist.js.map new file mode 100644 index 0000000..0c3b314 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/accesslist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"accesslist.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/accesslist.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,gDAAgE;AAKhE,SAAS,YAAY,CAAC,IAAY,EAAE,WAA0B;IAC1D,OAAO;QACH,OAAO,EAAE,IAAA,qBAAU,EAAC,IAAI,CAAC;QACzB,WAAW,EAAE,WAAW,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,KAAK,EAAE,EAAE;YAC/C,IAAA,yBAAc,EAAC,IAAA,sBAAW,EAAC,UAAU,EAAE,EAAE,CAAC,EAAE,cAAc,EAAE,eAAgB,KAAM,GAAG,EAAE,UAAU,CAAC,CAAC;YACnG,OAAO,UAAU,CAAC,WAAW,EAAE,CAAC;QACpC,CAAC,CAAC;KACL,CAAC;AACN,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAC,KAAoB;IAC9C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtB,OAA0F,KAAM,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,KAAK,EAAE,EAAE;YAChH,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;gBACpB,IAAA,yBAAc,EAAC,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE,kBAAkB,EAAE,SAAU,KAAM,GAAG,EAAE,GAAG,CAAC,CAAC;gBAC/E,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;aACtC;YACD,IAAA,yBAAc,EAAC,GAAG,IAAI,IAAI,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE,0BAA0B,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;YACpG,OAAO,YAAY,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,WAAW,CAAC,CAAC;QACtD,CAAC,CAAC,CAAC;KACN;IAED,IAAA,yBAAc,EAAC,KAAK,IAAI,IAAI,IAAI,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,qBAAqB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAEnG,MAAM,MAAM,GAA2D,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACnG,MAAM,WAAW,GAAyB,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;YAC/E,KAAK,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC,EAAwB,EAAG,CAAC,CAAC;QAC9B,OAAO,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;IAC9D,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC5D,OAAO,MAAM,CAAC;AAClB,CAAC;AAvBD,sCAuBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/address.d.ts b/dist/ethers.js/src.ts/transaction/address.d.ts new file mode 100644 index 0000000..0b86944 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/address.d.ts @@ -0,0 +1,15 @@ +import { SigningKey } from "../crypto/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +export declare function computeAddress(key: string | SigningKey): string; +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +export declare function recoverAddress(digest: BytesLike, signature: SignatureLike): string; +//# sourceMappingURL=address.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/address.d.ts.map b/dist/ethers.js/src.ts/transaction/address.d.ts.map new file mode 100644 index 0000000..8dc225d --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/address.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"address.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/address.ts"],"names":[],"mappings":"AACA,OAAO,EAAa,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAE3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,UAAU,GAAG,MAAM,CAQ/D;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,SAAS,EAAE,aAAa,GAAG,MAAM,CAElF"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/address.js b/dist/ethers.js/src.ts/transaction/address.js new file mode 100644 index 0000000..429e457 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/address.js @@ -0,0 +1,30 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.recoverAddress = exports.computeAddress = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +/** + * Returns the address for the %%key%%. + * + * The key may be any standard form of public key or a private key. + */ +function computeAddress(key) { + let pubkey; + if (typeof (key) === "string") { + pubkey = index_js_2.SigningKey.computePublicKey(key, false); + } + else { + pubkey = key.publicKey; + } + return (0, index_js_1.getAddress)((0, index_js_2.keccak256)("0x" + pubkey.substring(4)).substring(26)); +} +exports.computeAddress = computeAddress; +/** + * Returns the recovered address for the private key that was + * used to sign %%digest%% that resulted in %%signature%%. + */ +function recoverAddress(digest, signature) { + return computeAddress(index_js_2.SigningKey.recoverPublicKey(digest, signature)); +} +exports.recoverAddress = recoverAddress; +//# sourceMappingURL=address.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/address.js.map b/dist/ethers.js/src.ts/transaction/address.js.map new file mode 100644 index 0000000..991206e --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/address.js.map @@ -0,0 +1 @@ +{"version":3,"file":"address.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/address.ts"],"names":[],"mappings":";;;AAAA,kDAAiD;AACjD,iDAA2D;AAK3D;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAwB;IACnD,IAAI,MAAc,CAAC;IACnB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;QAC1B,MAAM,GAAG,qBAAU,CAAC,gBAAgB,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;KACpD;SAAM;QACH,MAAM,GAAG,GAAG,CAAC,SAAS,CAAC;KAC1B;IACD,OAAO,IAAA,qBAAU,EAAC,IAAA,oBAAS,EAAC,IAAI,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3E,CAAC;AARD,wCAQC;AAED;;;GAGG;AACH,SAAgB,cAAc,CAAC,MAAiB,EAAE,SAAwB;IACtE,OAAO,cAAc,CAAC,qBAAU,CAAC,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC;AAC1E,CAAC;AAFD,wCAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/index.d.ts b/dist/ethers.js/src.ts/transaction/index.d.ts new file mode 100644 index 0000000..d1c0fc5 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/index.d.ts @@ -0,0 +1,25 @@ +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +/** + * A single [[AccessList]] entry of storage keys (slots) for an address. + */ +export type AccessListEntry = { + address: string; + storageKeys: Array; +}; +/** + * An ordered collection of [[AccessList]] entries. + */ +export type AccessList = Array; +/** + * Any ethers-supported access list structure. + */ +export type AccessListish = AccessList | Array<[string, Array]> | Record>; +export { accessListify } from "./accesslist.js"; +export { computeAddress, recoverAddress } from "./address.js"; +export { Transaction } from "./transaction.js"; +export type { TransactionLike } from "./transaction.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/index.d.ts.map b/dist/ethers.js/src.ts/transaction/index.d.ts.map new file mode 100644 index 0000000..311b601 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,KAAK,CAAC,eAAe,CAAC,CAAC;AAEhD;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,UAAU,GACV,KAAK,CAAC,CAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAE,CAAC,GAChC,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAG1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,YAAY,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/index.js b/dist/ethers.js/src.ts/transaction/index.js new file mode 100644 index 0000000..bad49d7 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/index.js @@ -0,0 +1,17 @@ +"use strict"; +/** + * Each state-changing operation on Ethereum requires a transaction. + * + * @_section api/transaction:Transactions [about-transactions] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Transaction = exports.recoverAddress = exports.computeAddress = exports.accessListify = void 0; +null; +var accesslist_js_1 = require("./accesslist.js"); +Object.defineProperty(exports, "accessListify", { enumerable: true, get: function () { return accesslist_js_1.accessListify; } }); +var address_js_1 = require("./address.js"); +Object.defineProperty(exports, "computeAddress", { enumerable: true, get: function () { return address_js_1.computeAddress; } }); +Object.defineProperty(exports, "recoverAddress", { enumerable: true, get: function () { return address_js_1.recoverAddress; } }); +var transaction_js_1 = require("./transaction.js"); +Object.defineProperty(exports, "Transaction", { enumerable: true, get: function () { return transaction_js_1.Transaction; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/index.js.map b/dist/ethers.js/src.ts/transaction/index.js.map new file mode 100644 index 0000000..f26e76c --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/index.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAEH,IAAI,CAAC;AAoBL,iDAAgD;AAAvC,8GAAA,aAAa,OAAA;AACtB,2CAA8D;AAArD,4GAAA,cAAc,OAAA;AAAE,4GAAA,cAAc,OAAA;AACvC,mDAA+C;AAAtC,6GAAA,WAAW,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/transaction.d.ts b/dist/ethers.js/src.ts/transaction/transaction.d.ts new file mode 100644 index 0000000..a75b2f0 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/transaction.d.ts @@ -0,0 +1,269 @@ +import { Signature } from "../crypto/index.js"; +import type { BigNumberish, BytesLike } from "../utils/index.js"; +import type { SignatureLike } from "../crypto/index.js"; +import type { AccessList, AccessListish } from "./index.js"; +/** + * A **TransactionLike** is an object which is appropriate as a loose + * input for many operations which will populate missing properties of + * a transaction. + */ +export interface TransactionLike { + /** + * The type. + */ + type?: null | number; + /** + * The recipient address or ``null`` for an ``init`` transaction. + */ + to?: null | A; + /** + * The sender. + */ + from?: null | A; + /** + * The nonce. + */ + nonce?: null | number; + /** + * The maximum amount of gas that can be used. + */ + gasLimit?: null | BigNumberish; + /** + * The gas price for legacy and berlin transactions. + */ + gasPrice?: null | BigNumberish; + /** + * The maximum priority fee per gas for london transactions. + */ + maxPriorityFeePerGas?: null | BigNumberish; + /** + * The maximum total fee per gas for london transactions. + */ + maxFeePerGas?: null | BigNumberish; + /** + * The data. + */ + data?: null | string; + /** + * The value (in wei) to send. + */ + value?: null | BigNumberish; + /** + * The chain ID the transaction is valid on. + */ + chainId?: null | BigNumberish; + /** + * The transaction hash. + */ + hash?: null | string; + /** + * The signature provided by the sender. + */ + signature?: null | SignatureLike; + /** + * The access list for berlin and london transactions. + */ + accessList?: null | AccessListish; +} +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +export declare class Transaction implements TransactionLike { + #private; + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type(): null | number; + set type(value: null | number | string); + /** + * The name of the transaction type. + */ + get typeName(): null | string; + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to(): null | string; + set to(value: null | string); + /** + * The transaction nonce. + */ + get nonce(): number; + set nonce(value: BigNumberish); + /** + * The gas limit. + */ + get gasLimit(): bigint; + set gasLimit(value: BigNumberish); + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice(): null | bigint; + set gasPrice(value: null | BigNumberish); + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas(): null | bigint; + set maxPriorityFeePerGas(value: null | BigNumberish); + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas(): null | bigint; + set maxFeePerGas(value: null | BigNumberish); + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data(): string; + set data(value: BytesLike); + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value(): bigint; + set value(value: BigNumberish); + /** + * The chain ID this transaction is valid on. + */ + get chainId(): bigint; + set chainId(value: BigNumberish); + /** + * If signed, the signature for this transaction. + */ + get signature(): null | Signature; + set signature(value: null | SignatureLike); + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList(): null | AccessList; + set accessList(value: null | AccessListish); + /** + * Creates a new Transaction with default values. + */ + constructor(); + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash(): null | string; + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash(): string; + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from(): null | string; + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey(): null | string; + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned(): this is (Transaction & { + type: number; + typeName: string; + from: string; + signature: Signature; + }); + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized(): string; + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized(): string; + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType(): number; + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes(): Array; + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy(): this is (Transaction & { + type: 0; + gasPrice: bigint; + }); + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin(): this is (Transaction & { + type: 1; + gasPrice: bigint; + accessList: AccessList; + }); + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon(): this is (Transaction & { + type: 2; + accessList: AccessList; + maxFeePerGas: bigint; + maxPriorityFeePerGas: bigint; + }); + /** + * Create a copy of this transaciton. + */ + clone(): Transaction; + /** + * Return a JSON-friendly object. + */ + toJSON(): any; + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx?: string | TransactionLike): Transaction; +} +//# sourceMappingURL=transaction.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/transaction.d.ts.map b/dist/ethers.js/src.ts/transaction/transaction.d.ts.map new file mode 100644 index 0000000..9b3b7b9 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/transaction.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/transaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,SAAS,EAAc,MAAM,oBAAoB,CAAC;AAStE,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAExD,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAU5D;;;;GAIG;AACH,MAAM,WAAW,eAAe,CAAC,CAAC,GAAG,MA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AG,eAAe,CAAC,MAAM,CAAC,GAAG,WAAW;CA2ClE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/transaction.js b/dist/ethers.js/src.ts/transaction/transaction.js new file mode 100644 index 0000000..8ee7e47 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/transaction.js @@ -0,0 +1,721 @@ +"use strict"; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var _Transaction_type, _Transaction_to, _Transaction_data, _Transaction_nonce, _Transaction_gasLimit, _Transaction_gasPrice, _Transaction_maxPriorityFeePerGas, _Transaction_maxFeePerGas, _Transaction_value, _Transaction_chainId, _Transaction_sig, _Transaction_accessList; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Transaction = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../utils/index.js"); +const accesslist_js_1 = require("./accesslist.js"); +const address_js_1 = require("./address.js"); +const BN_0 = BigInt(0); +const BN_2 = BigInt(2); +const BN_27 = BigInt(27); +const BN_28 = BigInt(28); +const BN_35 = BigInt(35); +const BN_MAX_UINT = BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"); +function handleAddress(value) { + if (value === "0x") { + return null; + } + return (0, index_js_1.getAddress)(value); +} +function handleAccessList(value, param) { + try { + return (0, accesslist_js_1.accessListify)(value); + } + catch (error) { + (0, index_js_3.assertArgument)(false, error.message, param, value); + } +} +function handleNumber(_value, param) { + if (_value === "0x") { + return 0; + } + return (0, index_js_3.getNumber)(_value, param); +} +function handleUint(_value, param) { + if (_value === "0x") { + return BN_0; + } + const value = (0, index_js_3.getBigInt)(_value, param); + (0, index_js_3.assertArgument)(value <= BN_MAX_UINT, "value exceeds uint size", param, value); + return value; +} +function formatNumber(_value, name) { + const value = (0, index_js_3.getBigInt)(_value, "value"); + const result = (0, index_js_3.toBeArray)(value); + (0, index_js_3.assertArgument)(result.length <= 32, `value too large`, `tx.${name}`, value); + return result; +} +function formatAccessList(value) { + return (0, accesslist_js_1.accessListify)(value).map((set) => [set.address, set.storageKeys]); +} +function _parseLegacy(data) { + const fields = (0, index_js_3.decodeRlp)(data); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 9 || fields.length === 6), "invalid field count for legacy transaction", "data", data); + const tx = { + type: 0, + nonce: handleNumber(fields[0], "nonce"), + gasPrice: handleUint(fields[1], "gasPrice"), + gasLimit: handleUint(fields[2], "gasLimit"), + to: handleAddress(fields[3]), + value: handleUint(fields[4], "value"), + data: (0, index_js_3.hexlify)(fields[5]), + chainId: BN_0 + }; + // Legacy unsigned transaction + if (fields.length === 6) { + return tx; + } + const v = handleUint(fields[6], "v"); + const r = handleUint(fields[7], "r"); + const s = handleUint(fields[8], "s"); + if (r === BN_0 && s === BN_0) { + // EIP-155 unsigned transaction + tx.chainId = v; + } + else { + // Compute the EIP-155 chain ID (or 0 for legacy) + let chainId = (v - BN_35) / BN_2; + if (chainId < BN_0) { + chainId = BN_0; + } + tx.chainId = chainId; + // Signed Legacy Transaction + (0, index_js_3.assertArgument)(chainId !== BN_0 || (v === BN_27 || v === BN_28), "non-canonical legacy v", "v", fields[6]); + tx.signature = index_js_2.Signature.from({ + r: (0, index_js_3.zeroPadValue)(fields[7], 32), + s: (0, index_js_3.zeroPadValue)(fields[8], 32), + v + }); + tx.hash = (0, index_js_2.keccak256)(data); + } + return tx; +} +function _serializeLegacy(tx, sig) { + const fields = [ + formatNumber(tx.nonce || 0, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit || 0, "gasLimit"), + ((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"), + formatNumber(tx.value || 0, "value"), + (tx.data || "0x"), + ]; + let chainId = BN_0; + if (tx.chainId != BN_0) { + // A chainId was provided; if non-zero we'll use EIP-155 + chainId = (0, index_js_3.getBigInt)(tx.chainId, "tx.chainId"); + // We have a chainId in the tx and an EIP-155 v in the signature, + // make sure they agree with each other + (0, index_js_3.assertArgument)(!sig || sig.networkV == null || sig.legacyChainId === chainId, "tx.chainId/sig.v mismatch", "sig", sig); + } + else if (tx.signature) { + // No explicit chainId, but EIP-155 have a derived implicit chainId + const legacy = tx.signature.legacyChainId; + if (legacy != null) { + chainId = legacy; + } + } + // Requesting an unsigned transaction + if (!sig) { + // We have an EIP-155 transaction (chainId was specified and non-zero) + if (chainId !== BN_0) { + fields.push((0, index_js_3.toBeArray)(chainId)); + fields.push("0x"); + fields.push("0x"); + } + return (0, index_js_3.encodeRlp)(fields); + } + // @TODO: We should probably check that tx.signature, chainId, and sig + // match but that logic could break existing code, so schedule + // this for the next major bump. + // Compute the EIP-155 v + let v = BigInt(27 + sig.yParity); + if (chainId !== BN_0) { + v = index_js_2.Signature.getChainIdV(chainId, sig.v); + } + else if (BigInt(sig.v) !== v) { + (0, index_js_3.assertArgument)(false, "tx.chainId/sig.v mismatch", "sig", sig); + } + // Add the signature + fields.push((0, index_js_3.toBeArray)(v)); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + return (0, index_js_3.encodeRlp)(fields); +} +function _parseEipSignature(tx, fields) { + let yParity; + try { + yParity = handleNumber(fields[0], "yParity"); + if (yParity !== 0 && yParity !== 1) { + throw new Error("bad yParity"); + } + } + catch (error) { + (0, index_js_3.assertArgument)(false, "invalid yParity", "yParity", fields[0]); + } + const r = (0, index_js_3.zeroPadValue)(fields[1], 32); + const s = (0, index_js_3.zeroPadValue)(fields[2], 32); + const signature = index_js_2.Signature.from({ r, s, yParity }); + tx.signature = signature; +} +function _parseEip1559(data) { + const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 9 || fields.length === 12), "invalid field count for transaction type: 2", "data", (0, index_js_3.hexlify)(data)); + const maxPriorityFeePerGas = handleUint(fields[2], "maxPriorityFeePerGas"); + const maxFeePerGas = handleUint(fields[3], "maxFeePerGas"); + const tx = { + type: 2, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + maxPriorityFeePerGas: maxPriorityFeePerGas, + maxFeePerGas: maxFeePerGas, + gasPrice: null, + gasLimit: handleUint(fields[4], "gasLimit"), + to: handleAddress(fields[5]), + value: handleUint(fields[6], "value"), + data: (0, index_js_3.hexlify)(fields[7]), + accessList: handleAccessList(fields[8], "accessList"), + }; + // Unsigned EIP-1559 Transaction + if (fields.length === 9) { + return tx; + } + tx.hash = (0, index_js_2.keccak256)(data); + _parseEipSignature(tx, fields.slice(9)); + return tx; +} +function _serializeEip1559(tx, sig) { + const fields = [ + formatNumber(tx.chainId || 0, "chainId"), + formatNumber(tx.nonce || 0, "nonce"), + formatNumber(tx.maxPriorityFeePerGas || 0, "maxPriorityFeePerGas"), + formatNumber(tx.maxFeePerGas || 0, "maxFeePerGas"), + formatNumber(tx.gasLimit || 0, "gasLimit"), + ((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"), + formatNumber(tx.value || 0, "value"), + (tx.data || "0x"), + (formatAccessList(tx.accessList || [])) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "yParity")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + } + return (0, index_js_3.concat)(["0x02", (0, index_js_3.encodeRlp)(fields)]); +} +function _parseEip2930(data) { + const fields = (0, index_js_3.decodeRlp)((0, index_js_3.getBytes)(data).slice(1)); + (0, index_js_3.assertArgument)(Array.isArray(fields) && (fields.length === 8 || fields.length === 11), "invalid field count for transaction type: 1", "data", (0, index_js_3.hexlify)(data)); + const tx = { + type: 1, + chainId: handleUint(fields[0], "chainId"), + nonce: handleNumber(fields[1], "nonce"), + gasPrice: handleUint(fields[2], "gasPrice"), + gasLimit: handleUint(fields[3], "gasLimit"), + to: handleAddress(fields[4]), + value: handleUint(fields[5], "value"), + data: (0, index_js_3.hexlify)(fields[6]), + accessList: handleAccessList(fields[7], "accessList") + }; + // Unsigned EIP-2930 Transaction + if (fields.length === 8) { + return tx; + } + tx.hash = (0, index_js_2.keccak256)(data); + _parseEipSignature(tx, fields.slice(8)); + return tx; +} +function _serializeEip2930(tx, sig) { + const fields = [ + formatNumber(tx.chainId || 0, "chainId"), + formatNumber(tx.nonce || 0, "nonce"), + formatNumber(tx.gasPrice || 0, "gasPrice"), + formatNumber(tx.gasLimit || 0, "gasLimit"), + ((tx.to != null) ? (0, index_js_1.getAddress)(tx.to) : "0x"), + formatNumber(tx.value || 0, "value"), + (tx.data || "0x"), + (formatAccessList(tx.accessList || [])) + ]; + if (sig) { + fields.push(formatNumber(sig.yParity, "recoveryParam")); + fields.push((0, index_js_3.toBeArray)(sig.r)); + fields.push((0, index_js_3.toBeArray)(sig.s)); + } + return (0, index_js_3.concat)(["0x01", (0, index_js_3.encodeRlp)(fields)]); +} +/** + * A **Transaction** describes an operation to be executed on + * Ethereum by an Externally Owned Account (EOA). It includes + * who (the [[to]] address), what (the [[data]]) and how much (the + * [[value]] in ether) the operation should entail. + * + * @example: + * tx = new Transaction() + * //_result: + * + * tx.data = "0x1234"; + * //_result: + */ +class Transaction { + /** + * The transaction type. + * + * If null, the type will be automatically inferred based on + * explicit properties. + */ + get type() { return __classPrivateFieldGet(this, _Transaction_type, "f"); } + set type(value) { + switch (value) { + case null: + __classPrivateFieldSet(this, _Transaction_type, null, "f"); + break; + case 0: + case "legacy": + __classPrivateFieldSet(this, _Transaction_type, 0, "f"); + break; + case 1: + case "berlin": + case "eip-2930": + __classPrivateFieldSet(this, _Transaction_type, 1, "f"); + break; + case 2: + case "london": + case "eip-1559": + __classPrivateFieldSet(this, _Transaction_type, 2, "f"); + break; + default: + (0, index_js_3.assertArgument)(false, "unsupported transaction type", "type", value); + } + } + /** + * The name of the transaction type. + */ + get typeName() { + switch (this.type) { + case 0: return "legacy"; + case 1: return "eip-2930"; + case 2: return "eip-1559"; + } + return null; + } + /** + * The ``to`` address for the transaction or ``null`` if the + * transaction is an ``init`` transaction. + */ + get to() { return __classPrivateFieldGet(this, _Transaction_to, "f"); } + set to(value) { + __classPrivateFieldSet(this, _Transaction_to, (value == null) ? null : (0, index_js_1.getAddress)(value), "f"); + } + /** + * The transaction nonce. + */ + get nonce() { return __classPrivateFieldGet(this, _Transaction_nonce, "f"); } + set nonce(value) { __classPrivateFieldSet(this, _Transaction_nonce, (0, index_js_3.getNumber)(value, "value"), "f"); } + /** + * The gas limit. + */ + get gasLimit() { return __classPrivateFieldGet(this, _Transaction_gasLimit, "f"); } + set gasLimit(value) { __classPrivateFieldSet(this, _Transaction_gasLimit, (0, index_js_3.getBigInt)(value), "f"); } + /** + * The gas price. + * + * On legacy networks this defines the fee that will be paid. On + * EIP-1559 networks, this should be ``null``. + */ + get gasPrice() { + const value = __classPrivateFieldGet(this, _Transaction_gasPrice, "f"); + if (value == null && (this.type === 0 || this.type === 1)) { + return BN_0; + } + return value; + } + set gasPrice(value) { + __classPrivateFieldSet(this, _Transaction_gasPrice, (value == null) ? null : (0, index_js_3.getBigInt)(value, "gasPrice"), "f"); + } + /** + * The maximum priority fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxPriorityFeePerGas() { + const value = __classPrivateFieldGet(this, _Transaction_maxPriorityFeePerGas, "f"); + if (value == null) { + if (this.type === 2) { + return BN_0; + } + return null; + } + return value; + } + set maxPriorityFeePerGas(value) { + __classPrivateFieldSet(this, _Transaction_maxPriorityFeePerGas, (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxPriorityFeePerGas"), "f"); + } + /** + * The maximum total fee per unit of gas to pay. On legacy + * networks this should be ``null``. + */ + get maxFeePerGas() { + const value = __classPrivateFieldGet(this, _Transaction_maxFeePerGas, "f"); + if (value == null) { + if (this.type === 2) { + return BN_0; + } + return null; + } + return value; + } + set maxFeePerGas(value) { + __classPrivateFieldSet(this, _Transaction_maxFeePerGas, (value == null) ? null : (0, index_js_3.getBigInt)(value, "maxFeePerGas"), "f"); + } + /** + * The transaction data. For ``init`` transactions this is the + * deployment code. + */ + get data() { return __classPrivateFieldGet(this, _Transaction_data, "f"); } + set data(value) { __classPrivateFieldSet(this, _Transaction_data, (0, index_js_3.hexlify)(value), "f"); } + /** + * The amount of ether (in wei) to send in this transactions. + */ + get value() { return __classPrivateFieldGet(this, _Transaction_value, "f"); } + set value(value) { + __classPrivateFieldSet(this, _Transaction_value, (0, index_js_3.getBigInt)(value, "value"), "f"); + } + /** + * The chain ID this transaction is valid on. + */ + get chainId() { return __classPrivateFieldGet(this, _Transaction_chainId, "f"); } + set chainId(value) { __classPrivateFieldSet(this, _Transaction_chainId, (0, index_js_3.getBigInt)(value), "f"); } + /** + * If signed, the signature for this transaction. + */ + get signature() { return __classPrivateFieldGet(this, _Transaction_sig, "f") || null; } + set signature(value) { + __classPrivateFieldSet(this, _Transaction_sig, (value == null) ? null : index_js_2.Signature.from(value), "f"); + } + /** + * The access list. + * + * An access list permits discounted (but pre-paid) access to + * bytecode and state variable access within contract execution. + */ + get accessList() { + const value = __classPrivateFieldGet(this, _Transaction_accessList, "f") || null; + if (value == null) { + if (this.type === 1 || this.type === 2) { + return []; + } + return null; + } + return value; + } + set accessList(value) { + __classPrivateFieldSet(this, _Transaction_accessList, (value == null) ? null : (0, accesslist_js_1.accessListify)(value), "f"); + } + /** + * Creates a new Transaction with default values. + */ + constructor() { + _Transaction_type.set(this, void 0); + _Transaction_to.set(this, void 0); + _Transaction_data.set(this, void 0); + _Transaction_nonce.set(this, void 0); + _Transaction_gasLimit.set(this, void 0); + _Transaction_gasPrice.set(this, void 0); + _Transaction_maxPriorityFeePerGas.set(this, void 0); + _Transaction_maxFeePerGas.set(this, void 0); + _Transaction_value.set(this, void 0); + _Transaction_chainId.set(this, void 0); + _Transaction_sig.set(this, void 0); + _Transaction_accessList.set(this, void 0); + __classPrivateFieldSet(this, _Transaction_type, null, "f"); + __classPrivateFieldSet(this, _Transaction_to, null, "f"); + __classPrivateFieldSet(this, _Transaction_nonce, 0, "f"); + __classPrivateFieldSet(this, _Transaction_gasLimit, BigInt(0), "f"); + __classPrivateFieldSet(this, _Transaction_gasPrice, null, "f"); + __classPrivateFieldSet(this, _Transaction_maxPriorityFeePerGas, null, "f"); + __classPrivateFieldSet(this, _Transaction_maxFeePerGas, null, "f"); + __classPrivateFieldSet(this, _Transaction_data, "0x", "f"); + __classPrivateFieldSet(this, _Transaction_value, BigInt(0), "f"); + __classPrivateFieldSet(this, _Transaction_chainId, BigInt(0), "f"); + __classPrivateFieldSet(this, _Transaction_sig, null, "f"); + __classPrivateFieldSet(this, _Transaction_accessList, null, "f"); + } + /** + * The transaction hash, if signed. Otherwise, ``null``. + */ + get hash() { + if (this.signature == null) { + return null; + } + return (0, index_js_2.keccak256)(this.serialized); + } + /** + * The pre-image hash of this transaction. + * + * This is the digest that a [[Signer]] must sign to authorize + * this transaction. + */ + get unsignedHash() { + return (0, index_js_2.keccak256)(this.unsignedSerialized); + } + /** + * The sending address, if signed. Otherwise, ``null``. + */ + get from() { + if (this.signature == null) { + return null; + } + return (0, address_js_1.recoverAddress)(this.unsignedHash, this.signature); + } + /** + * The public key of the sender, if signed. Otherwise, ``null``. + */ + get fromPublicKey() { + if (this.signature == null) { + return null; + } + return index_js_2.SigningKey.recoverPublicKey(this.unsignedHash, this.signature); + } + /** + * Returns true if signed. + * + * This provides a Type Guard that properties requiring a signed + * transaction are non-null. + */ + isSigned() { + //isSigned(): this is SignedTransaction { + return this.signature != null; + } + /** + * The serialized transaction. + * + * This throws if the transaction is unsigned. For the pre-image, + * use [[unsignedSerialized]]. + */ + get serialized() { + (0, index_js_3.assert)(this.signature != null, "cannot serialize unsigned transaction; maybe you meant .unsignedSerialized", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + switch (this.inferType()) { + case 0: + return _serializeLegacy(this, this.signature); + case 1: + return _serializeEip2930(this, this.signature); + case 2: + return _serializeEip1559(this, this.signature); + } + (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".serialized" }); + } + /** + * The transaction pre-image. + * + * The hash of this is the digest which needs to be signed to + * authorize this transaction. + */ + get unsignedSerialized() { + switch (this.inferType()) { + case 0: + return _serializeLegacy(this); + case 1: + return _serializeEip2930(this); + case 2: + return _serializeEip1559(this); + } + (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: ".unsignedSerialized" }); + } + /** + * Return the most "likely" type; currently the highest + * supported transaction type. + */ + inferType() { + return (this.inferTypes().pop()); + } + /** + * Validates the explicit properties and returns a list of compatible + * transaction types. + */ + inferTypes() { + // Checks that there are no conflicting properties set + const hasGasPrice = this.gasPrice != null; + const hasFee = (this.maxFeePerGas != null || this.maxPriorityFeePerGas != null); + const hasAccessList = (this.accessList != null); + //if (hasGasPrice && hasFee) { + // throw new Error("transaction cannot have gasPrice and maxFeePerGas"); + //} + if (this.maxFeePerGas != null && this.maxPriorityFeePerGas != null) { + (0, index_js_3.assert)(this.maxFeePerGas >= this.maxPriorityFeePerGas, "priorityFee cannot be more than maxFee", "BAD_DATA", { value: this }); + } + //if (this.type === 2 && hasGasPrice) { + // throw new Error("eip-1559 transaction cannot have gasPrice"); + //} + (0, index_js_3.assert)(!hasFee || (this.type !== 0 && this.type !== 1), "transaction type cannot have maxFeePerGas or maxPriorityFeePerGas", "BAD_DATA", { value: this }); + (0, index_js_3.assert)(this.type !== 0 || !hasAccessList, "legacy transaction cannot have accessList", "BAD_DATA", { value: this }); + const types = []; + // Explicit type + if (this.type != null) { + types.push(this.type); + } + else { + if (hasFee) { + types.push(2); + } + else if (hasGasPrice) { + types.push(1); + if (!hasAccessList) { + types.push(0); + } + } + else if (hasAccessList) { + types.push(1); + types.push(2); + } + else { + types.push(0); + types.push(1); + types.push(2); + } + } + types.sort(); + return types; + } + /** + * Returns true if this transaction is a legacy transaction (i.e. + * ``type === 0``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLegacy() { + return (this.type === 0); + } + /** + * Returns true if this transaction is berlin hardform transaction (i.e. + * ``type === 1``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isBerlin() { + return (this.type === 1); + } + /** + * Returns true if this transaction is london hardform transaction (i.e. + * ``type === 2``). + * + * This provides a Type Guard that the related properties are + * non-null. + */ + isLondon() { + return (this.type === 2); + } + /** + * Create a copy of this transaciton. + */ + clone() { + return Transaction.from(this); + } + /** + * Return a JSON-friendly object. + */ + toJSON() { + const s = (v) => { + if (v == null) { + return null; + } + return v.toString(); + }; + return { + type: this.type, + to: this.to, + // from: this.from, + data: this.data, + nonce: this.nonce, + gasLimit: s(this.gasLimit), + gasPrice: s(this.gasPrice), + maxPriorityFeePerGas: s(this.maxPriorityFeePerGas), + maxFeePerGas: s(this.maxFeePerGas), + value: s(this.value), + chainId: s(this.chainId), + sig: this.signature ? this.signature.toJSON() : null, + accessList: this.accessList + }; + } + /** + * Create a **Transaction** from a serialized transaction or a + * Transaction-like object. + */ + static from(tx) { + if (tx == null) { + return new Transaction(); + } + if (typeof (tx) === "string") { + const payload = (0, index_js_3.getBytes)(tx); + if (payload[0] >= 0x7f) { // @TODO: > vs >= ?? + return Transaction.from(_parseLegacy(payload)); + } + switch (payload[0]) { + case 1: return Transaction.from(_parseEip2930(payload)); + case 2: return Transaction.from(_parseEip1559(payload)); + } + (0, index_js_3.assert)(false, "unsupported transaction type", "UNSUPPORTED_OPERATION", { operation: "from" }); + } + const result = new Transaction(); + if (tx.type != null) { + result.type = tx.type; + } + if (tx.to != null) { + result.to = tx.to; + } + if (tx.nonce != null) { + result.nonce = tx.nonce; + } + if (tx.gasLimit != null) { + result.gasLimit = tx.gasLimit; + } + if (tx.gasPrice != null) { + result.gasPrice = tx.gasPrice; + } + if (tx.maxPriorityFeePerGas != null) { + result.maxPriorityFeePerGas = tx.maxPriorityFeePerGas; + } + if (tx.maxFeePerGas != null) { + result.maxFeePerGas = tx.maxFeePerGas; + } + if (tx.data != null) { + result.data = tx.data; + } + if (tx.value != null) { + result.value = tx.value; + } + if (tx.chainId != null) { + result.chainId = tx.chainId; + } + if (tx.signature != null) { + result.signature = index_js_2.Signature.from(tx.signature); + } + if (tx.accessList != null) { + result.accessList = tx.accessList; + } + if (tx.hash != null) { + (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define hash", "tx", tx); + (0, index_js_3.assertArgument)(result.hash === tx.hash, "hash mismatch", "tx", tx); + } + if (tx.from != null) { + (0, index_js_3.assertArgument)(result.isSigned(), "unsigned transaction cannot define from", "tx", tx); + (0, index_js_3.assertArgument)(result.from.toLowerCase() === (tx.from || "").toLowerCase(), "from mismatch", "tx", tx); + } + return result; + } +} +exports.Transaction = Transaction; +_Transaction_type = new WeakMap(), _Transaction_to = new WeakMap(), _Transaction_data = new WeakMap(), _Transaction_nonce = new WeakMap(), _Transaction_gasLimit = new WeakMap(), _Transaction_gasPrice = new WeakMap(), _Transaction_maxPriorityFeePerGas = new WeakMap(), _Transaction_maxFeePerGas = new WeakMap(), _Transaction_value = new WeakMap(), _Transaction_chainId = new WeakMap(), _Transaction_sig = new WeakMap(), _Transaction_accessList = new WeakMap(); +//# sourceMappingURL=transaction.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/transaction/transaction.js.map b/dist/ethers.js/src.ts/transaction/transaction.js.map new file mode 100644 index 0000000..62384f5 --- /dev/null +++ b/dist/ethers.js/src.ts/transaction/transaction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/transaction/transaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,kDAAiD;AACjD,iDAAsE;AACtE,gDAG2B;AAE3B,mDAAgD;AAChD,6CAA8C;AAQ9C,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAA;AACxB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AACzB,MAAM,WAAW,GAAG,MAAM,CAAC,oEAAoE,CAAC,CAAC;AA+EjG,SAAS,aAAa,CAAC,KAAa;IAChC,IAAI,KAAK,KAAK,IAAI,EAAE;QAAE,OAAO,IAAI,CAAC;KAAE;IACpC,OAAO,IAAA,qBAAU,EAAC,KAAK,CAAC,CAAC;AAC7B,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAU,EAAE,KAAa;IAC/C,IAAI;QACA,OAAO,IAAA,6BAAa,EAAC,KAAK,CAAC,CAAC;KAC/B;IAAC,OAAO,KAAU,EAAE;QACjB,IAAA,yBAAc,EAAC,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;KACtD;AACL,CAAC;AAED,SAAS,YAAY,CAAC,MAAc,EAAE,KAAa;IAC/C,IAAI,MAAM,KAAK,IAAI,EAAE;QAAE,OAAO,CAAC,CAAC;KAAE;IAClC,OAAO,IAAA,oBAAS,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AACpC,CAAC;AAED,SAAS,UAAU,CAAC,MAAc,EAAE,KAAa;IAC7C,IAAI,MAAM,KAAK,IAAI,EAAE;QAAE,OA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vF,IAAA,yBAAc,EAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC;SAC1G;QAED,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ;AA7bD,kCA6bC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base58.d.ts b/dist/ethers.js/src.ts/utils/base58.d.ts new file mode 100644 index 0000000..8b37793 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base58.d.ts @@ -0,0 +1,23 @@ +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +import type { BytesLike } from "./index.js"; +/** + * Encode %%value%% as a Base58-encoded string. + */ +export declare function encodeBase58(_value: BytesLike): string; +/** + * Decode the Base58-encoded %%value%%. + */ +export declare function decodeBase58(value: string): bigint; +//# sourceMappingURL=base58.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base58.d.ts.map b/dist/ethers.js/src.ts/utils/base58.d.ts.map new file mode 100644 index 0000000..bc5a866 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base58.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base58.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAsB5C;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAQtD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAOlD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base58.js b/dist/ethers.js/src.ts/utils/base58.js new file mode 100644 index 0000000..16f4c24 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base58.js @@ -0,0 +1,60 @@ +"use strict"; +/** + * The [Base58 Encoding](link-base58) scheme allows a **numeric** value + * to be encoded as a compact string using a radix of 58 using only + * alpha-numeric characters. Confusingly similar characters are omitted + * (i.e. ``"l0O"``). + * + * Note that Base58 encodes a **numeric** value, not arbitrary bytes, + * since any zero-bytes on the left would get removed. To mitigate this + * issue most schemes that use Base58 choose specific high-order values + * to ensure non-zero prefixes. + * + * @_subsection: api/utils:Base58 Encoding [about-base58] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBase58 = exports.encodeBase58 = void 0; +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const maths_js_1 = require("./maths.js"); +const Alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"; +let Lookup = null; +function getAlpha(letter) { + if (Lookup == null) { + Lookup = {}; + for (let i = 0; i < Alphabet.length; i++) { + Lookup[Alphabet[i]] = BigInt(i); + } + } + const result = Lookup[letter]; + (0, errors_js_1.assertArgument)(result != null, `invalid base58 value`, "letter", letter); + return result; +} +const BN_0 = BigInt(0); +const BN_58 = BigInt(58); +/** + * Encode %%value%% as a Base58-encoded string. + */ +function encodeBase58(_value) { + let value = (0, maths_js_1.toBigInt)((0, data_js_1.getBytes)(_value)); + let result = ""; + while (value) { + result = Alphabet[Number(value % BN_58)] + result; + value /= BN_58; + } + return result; +} +exports.encodeBase58 = encodeBase58; +/** + * Decode the Base58-encoded %%value%%. + */ +function decodeBase58(value) { + let result = BN_0; + for (let i = 0; i < value.length; i++) { + result *= BN_58; + result += getAlpha(value[i]); + } + return result; +} +exports.decodeBase58 = decodeBase58; +//# sourceMappingURL=base58.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base58.js.map b/dist/ethers.js/src.ts/utils/base58.js.map new file mode 100644 index 0000000..0a10d97 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base58.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base58.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base58.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;GAYG;;;AAEH,uCAAqC;AACrC,2CAA6C;AAC7C,yCAAsC;AAKtC,MAAM,QAAQ,GAAG,4DAA4D,CAAC;AAC9E,IAAI,MAAM,GAAkC,IAAI,CAAC;AAEjD,SAAS,QAAQ,CAAC,MAAc;IAC5B,IAAI,MAAM,IAAI,IAAI,EAAE;QAChB,MAAM,GAAG,EAAG,CAAC;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YACtC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;SACnC;KACJ;IACD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAC9B,IAAA,0BAAc,EAAC,MAAM,IAAI,IAAI,EAAE,sBAAsB,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;IACzE,OAAO,MAAM,CAAC;AAClB,CAAC;AAGD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,KAAK,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC;AAEzB;;GAEG;AACH,SAAgB,YAAY,CAAC,MAAiB;IAC1C,IAAI,KAAK,GAAG,IAAA,mBAAQ,EAAC,IAAA,kBAAQ,EAAC,MAAM,CAAC,CAAC,CAAC;IACvC,IAAI,MAAM,GAAG,EAAE,CAAC;IAChB,OAAO,KAAK,EAAE;QACV,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,GAAG,MAAM,CAAC;QAClD,KAAK,IAAI,KAAK,CAAC;KAClB;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AARD,oCAQC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,IAAI,MAAM,GAAG,IAAI,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACnC,MAAM,IAAI,KAAK,CAAC;QAChB,MAAM,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;KAChC;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64-browser.d.ts b/dist/ethers.js/src.ts/utils/base64-browser.d.ts new file mode 100644 index 0000000..ea96c44 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64-browser.d.ts @@ -0,0 +1,4 @@ +import type { BytesLike } from "./data.js"; +export declare function decodeBase64(textData: string): Uint8Array; +export declare function encodeBase64(_data: BytesLike): string; +//# sourceMappingURL=base64-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64-browser.d.ts.map b/dist/ethers.js/src.ts/utils/base64-browser.d.ts.map new file mode 100644 index 0000000..f894759 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base64-browser.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C,wBAAgB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAOzD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAOrD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64-browser.js b/dist/ethers.js/src.ts/utils/base64-browser.js new file mode 100644 index 0000000..ecab4a5 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64-browser.js @@ -0,0 +1,24 @@ +"use strict"; +// utils/base64-browser +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeBase64 = exports.decodeBase64 = void 0; +const data_js_1 = require("./data.js"); +function decodeBase64(textData) { + textData = atob(textData); + const data = new Uint8Array(textData.length); + for (let i = 0; i < textData.length; i++) { + data[i] = textData.charCodeAt(i); + } + return (0, data_js_1.getBytes)(data); +} +exports.decodeBase64 = decodeBase64; +function encodeBase64(_data) { + const data = (0, data_js_1.getBytes)(_data); + let textData = ""; + for (let i = 0; i < data.length; i++) { + textData += String.fromCharCode(data[i]); + } + return btoa(textData); +} +exports.encodeBase64 = encodeBase64; +//# sourceMappingURL=base64-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64-browser.js.map b/dist/ethers.js/src.ts/utils/base64-browser.js.map new file mode 100644 index 0000000..8a08575 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base64-browser.ts"],"names":[],"mappings":";AACA,uBAAuB;;;AAEvB,uCAAqC;AAKrC,SAAgB,YAAY,CAAC,QAAgB;IACzC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC;IAC1B,MAAM,IAAI,GAAG,IAAI,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IAC7C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,QAAQ,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACtC,IAAI,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;KACpC;IACD,OAAO,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAPD,oCAOC;AAED,SAAgB,YAAY,CAAC,KAAgB;IACzC,MAAM,IAAI,GAAG,IAAA,kBAAQ,EAAC,KAAK,CAAC,CAAC;IAC7B,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,QAAQ,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC5C;IACD,OAAO,IAAI,CAAC,QAAQ,CAAC,CAAC;AAC1B,CAAC;AAPD,oCAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64.d.ts b/dist/ethers.js/src.ts/utils/base64.d.ts new file mode 100644 index 0000000..0cab532 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64.d.ts @@ -0,0 +1,40 @@ +import type { BytesLike } from "./data.js"; +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +export declare function decodeBase64(value: string): Uint8Array; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +export declare function encodeBase64(data: BytesLike): string; +//# sourceMappingURL=base64.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64.d.ts.map b/dist/ethers.js/src.ts/utils/base64.d.ts.map new file mode 100644 index 0000000..6470c6a --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base64.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAG3C;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,UAAU,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAEpD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64.js b/dist/ethers.js/src.ts/utils/base64.js new file mode 100644 index 0000000..bdef6a3 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64.js @@ -0,0 +1,58 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeBase64 = exports.decodeBase64 = void 0; +/** + * [Base64 encoding](link-wiki-base64) using 6-bit words to encode + * arbitrary bytes into a string using 65 printable symbols, the + * upper-case and lower-case alphabet, the digits ``0`` through ``9``, + * ``"+"`` and ``"/"`` with the ``"="`` used for padding. + * + * @_subsection: api/utils:Base64 Encoding [about-base64] + */ +const data_js_1 = require("./data.js"); +/** + * Decodes the base-64 encoded %%value%%. + * + * @example: + * // The decoded value is always binary data... + * result = decodeBase64("SGVsbG8gV29ybGQhIQ==") + * //_result: + * + * // ...use toUtf8String to convert it to a string. + * toUtf8String(result) + * //_result: + * + * // Decoding binary data + * decodeBase64("EjQ=") + * //_result: + */ +function decodeBase64(value) { + return (0, data_js_1.getBytesCopy)(Buffer.from(value, "base64")); +} +exports.decodeBase64 = decodeBase64; +; +/** + * Encodes %%data%% as a base-64 encoded string. + * + * @example: + * // Encoding binary data as a hexstring + * encodeBase64("0x1234") + * //_result: + * + * // Encoding binary data as a Uint8Array + * encodeBase64(new Uint8Array([ 0x12, 0x34 ])) + * //_result: + * + * // The input MUST be data... + * encodeBase64("Hello World!!") + * //_error: + * + * // ...use toUtf8Bytes for this. + * encodeBase64(toUtf8Bytes("Hello World!!")) + * //_result: + */ +function encodeBase64(data) { + return Buffer.from((0, data_js_1.getBytes)(data)).toString("base64"); +} +exports.encodeBase64 = encodeBase64; +//# sourceMappingURL=base64.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/base64.js.map b/dist/ethers.js/src.ts/utils/base64.js.map new file mode 100644 index 0000000..24ac233 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/base64.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base64.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/base64.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAmD;AAKnD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,YAAY,CAAC,KAAa;IACtC,OAAO,IAAA,sBAAY,EAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC;AAFD,oCAEC;AAAA,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,SAAgB,YAAY,CAAC,IAAe;IACxC,OAAO,MAAM,CAAC,IAAI,CAAC,IAAA,kBAAQ,EAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;AAC1D,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/data.d.ts b/dist/ethers.js/src.ts/utils/data.d.ts new file mode 100644 index 0000000..59f4fc0 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/data.d.ts @@ -0,0 +1,93 @@ +/** + * A [[HexString]] whose length is even, which ensures it is a valid + * representation of binary data. + */ +export type DataHexString = string; +/** + * A string which is prefixed with ``0x`` and followed by any number + * of case-agnostic hexadecimal characters. + * + * It must match the regular expression ``/0x[0-9A-Fa-f]*\/``. + */ +export type HexString = string; +/** + * An object that can be used to represent binary data. + */ +export type BytesLike = DataHexString | Uint8Array; +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +export declare function getBytes(value: BytesLike, name?: string): Uint8Array; +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +export declare function getBytesCopy(value: BytesLike, name?: string): Uint8Array; +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +export declare function isHexString(value: any, length?: number | boolean): value is `0x${string}`; +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +export declare function isBytesLike(value: any): value is BytesLike; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +export declare function hexlify(data: BytesLike): string; +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +export declare function concat(datas: ReadonlyArray): string; +/** + * Returns the length of %%data%%, in bytes. + */ +export declare function dataLength(data: BytesLike): number; +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +export declare function dataSlice(data: BytesLike, start?: number, end?: number): string; +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +export declare function stripZerosLeft(data: BytesLike): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +export declare function zeroPadValue(data: BytesLike, length: number): string; +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +export declare function zeroPadBytes(data: BytesLike, length: number): string; +//# sourceMappingURL=data.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/data.d.ts.map b/dist/ethers.js/src.ts/utils/data.d.ts.map new file mode 100644 index 0000000..c9d30c7 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/data.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"data.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/data.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,UAAU,CAAC;AAqBnD;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAEpE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,UAAU,CAExE;AAGD;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,KAAK,IAAI,KAAM,MAAO,EAAE,CAS3F;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,GAAG,GAAG,KAAK,IAAI,SAAS,CAE1D;AAID;;GAEG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAS/C;AAED;;;GAGG;AACH,wBAAgB,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,GAAG,MAAM,CAE9D;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAGlD;AAED;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAQ/E;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAItD;AAqBD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE;AAED;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEpE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/data.js b/dist/ethers.js/src.ts/utils/data.js new file mode 100644 index 0000000..bc1fa15 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/data.js @@ -0,0 +1,184 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = void 0; +/** + * Some data helpers. + * + * + * @_subsection api/utils:Data Helpers [about-data] + */ +const errors_js_1 = require("./errors.js"); +function _getBytes(value, name, copy) { + if (value instanceof Uint8Array) { + if (copy) { + return new Uint8Array(value); + } + return value; + } + if (typeof (value) === "string" && value.match(/^0x([0-9a-f][0-9a-f])*$/i)) { + const result = new Uint8Array((value.length - 2) / 2); + let offset = 2; + for (let i = 0; i < result.length; i++) { + result[i] = parseInt(value.substring(offset, offset + 2), 16); + offset += 2; + } + return result; + } + (0, errors_js_1.assertArgument)(false, "invalid BytesLike value", name || "value", value); +} +/** + * Get a typed Uint8Array for %%value%%. If already a Uint8Array + * the original %%value%% is returned; if a copy is required use + * [[getBytesCopy]]. + * + * @see: getBytesCopy + */ +function getBytes(value, name) { + return _getBytes(value, name, false); +} +exports.getBytes = getBytes; +/** + * Get a typed Uint8Array for %%value%%, creating a copy if necessary + * to prevent any modifications of the returned value from being + * reflected elsewhere. + * + * @see: getBytes + */ +function getBytesCopy(value, name) { + return _getBytes(value, name, true); +} +exports.getBytesCopy = getBytesCopy; +/** + * Returns true if %%value%% is a valid [[HexString]]. + * + * If %%length%% is ``true`` or a //number//, it also checks that + * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//) + * bytes of data (e.g. ``0x1234`` is 2 bytes). + */ +function isHexString(value, length) { + if (typeof (value) !== "string" || !value.match(/^0x[0-9A-Fa-f]*$/)) { + return false; + } + if (typeof (length) === "number" && value.length !== 2 + 2 * length) { + return false; + } + if (length === true && (value.length % 2) !== 0) { + return false; + } + return true; +} +exports.isHexString = isHexString; +/** + * Returns true if %%value%% is a valid representation of arbitrary + * data (i.e. a valid [[DataHexString]] or a Uint8Array). + */ +function isBytesLike(value) { + return (isHexString(value, true) || (value instanceof Uint8Array)); +} +exports.isBytesLike = isBytesLike; +const HexCharacters = "0123456789abcdef"; +/** + * Returns a [[DataHexString]] representation of %%data%%. + */ +function hexlify(data) { + const bytes = getBytes(data); + let result = "0x"; + for (let i = 0; i < bytes.length; i++) { + const v = bytes[i]; + result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f]; + } + return result; +} +exports.hexlify = hexlify; +/** + * Returns a [[DataHexString]] by concatenating all values + * within %%data%%. + */ +function concat(datas) { + return "0x" + datas.map((d) => hexlify(d).substring(2)).join(""); +} +exports.concat = concat; +/** + * Returns the length of %%data%%, in bytes. + */ +function dataLength(data) { + if (isHexString(data, true)) { + return (data.length - 2) / 2; + } + return getBytes(data).length; +} +exports.dataLength = dataLength; +/** + * Returns a [[DataHexString]] by slicing %%data%% from the %%start%% + * offset to the %%end%% offset. + * + * By default %%start%% is 0 and %%end%% is the length of %%data%%. + */ +function dataSlice(data, start, end) { + const bytes = getBytes(data); + if (end != null && end > bytes.length) { + (0, errors_js_1.assert)(false, "cannot slice beyond data bounds", "BUFFER_OVERRUN", { + buffer: bytes, length: bytes.length, offset: end + }); + } + return hexlify(bytes.slice((start == null) ? 0 : start, (end == null) ? bytes.length : end)); +} +exports.dataSlice = dataSlice; +/** + * Return the [[DataHexString]] result by stripping all **leading** + ** zero bytes from %%data%%. + */ +function stripZerosLeft(data) { + let bytes = hexlify(data).substring(2); + while (bytes.startsWith("00")) { + bytes = bytes.substring(2); + } + return "0x" + bytes; +} +exports.stripZerosLeft = stripZerosLeft; +function zeroPad(data, length, left) { + const bytes = getBytes(data); + (0, errors_js_1.assert)(length >= bytes.length, "padding exceeds data length", "BUFFER_OVERRUN", { + buffer: new Uint8Array(bytes), + length: length, + offset: length + 1 + }); + const result = new Uint8Array(length); + result.fill(0); + if (left) { + result.set(bytes, length - bytes.length); + } + else { + result.set(bytes, 0); + } + return hexlify(result); +} +/** + * Return the [[DataHexString]] of %%data%% padded on the **left** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **values** are in Solidity + * (e.g. ``uint128``). + */ +function zeroPadValue(data, length) { + return zeroPad(data, length, true); +} +exports.zeroPadValue = zeroPadValue; +/** + * Return the [[DataHexString]] of %%data%% padded on the **right** + * to %%length%% bytes. + * + * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is + * thrown. + * + * This pads data the same as **bytes** are in Solidity + * (e.g. ``bytes16``). + */ +function zeroPadBytes(data, length) { + return zeroPad(data, length, false); +} +exports.zeroPadBytes = zeroPadBytes; +//# sourceMappingURL=data.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/data.js.map b/dist/ethers.js/src.ts/utils/data.js.map new file mode 100644 index 0000000..606ad2b --- /dev/null +++ b/dist/ethers.js/src.ts/utils/data.js.map @@ -0,0 +1 @@ +{"version":3,"file":"data.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/data.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AI,CAAC,EAAE;QAAE,KAAK,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAAE;IAC9D,OAAO,IAAI,GAAG,KAAK,CAAC;AACxB,CAAC;AAJD,wCAIC;AAED,SAAS,OAAO,CAAC,IAAe,EAAE,MAAc,EAAE,IAAa;IAC3D,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;IAC7B,IAAA,kBAAM,EAAC,MAAM,IAAI,KAAK,CAAC,MAAM,EAAE,6BAA6B,EAAE,gBAAgB,EAAE;QAC5E,MAAM,EAAE,IAAI,UAAU,CAAC,KAAK,CAAC;QAC7B,MAAM,EAAE,MAAM;QACd,MAAM,EAAE,MAAM,GAAG,CAAC;KACrB,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACf,IAAI,IAAI,EAAE;QACN,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;KAC5C;SAAM;QACH,MAAM,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;KACxB;IAED,OAAO,OAAO,CAAC,MAAM,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;AACvC,CAAC;AAFD,oCAEC;AAED;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAAC,IAAe,EAAE,MAAc;IACxD,OAAO,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;AACxC,CAAC;AAFD,oCAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/errors.d.ts b/dist/ethers.js/src.ts/utils/errors.d.ts new file mode 100644 index 0000000..a7bab0d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/errors.d.ts @@ -0,0 +1,512 @@ +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +import type { TransactionRequest, TransactionReceipt, TransactionResponse } from "../providers/index.js"; +import type { FetchRequest, FetchResponse } from "./fetch.js"; +/** + * An error may contain additional properties, but those must not + * conflict with any implicit properties. + */ +export type ErrorInfo = Omit & { + shortMessage?: string; +}; +/** + * All errors emitted by ethers have an **ErrorCode** to help + * identify and coalesce errors to simplify programmatic analysis. + * + * Each **ErrorCode** is the %%code%% proerty of a coresponding + * [[EthersError]]. + * + * **Generic Errors** + * + * **``"UNKNOWN_ERROR"``** - see [[UnknownError]] + * + * **``"NOT_IMPLEMENTED"``** - see [[NotImplementedError]] + * + * **``"UNSUPPORTED_OPERATION"``** - see [[UnsupportedOperationError]] + * + * **``"NETWORK_ERROR"``** - see [[NetworkError]] + * + * **``"SERVER_ERROR"``** - see [[ServerError]] + * + * **``"TIMEOUT"``** - see [[TimeoutError]] + * + * **``"BAD_DATA"``** - see [[BadDataError]] + * + * **``"CANCELLED"``** - see [[CancelledError]] + * + * **Operational Errors** + * + * **``"BUFFER_OVERRUN"``** - see [[BufferOverrunError]] + * + * **``"NUMERIC_FAULT"``** - see [[NumericFaultError]] + * + * **Argument Errors** + * + * **``"INVALID_ARGUMENT"``** - see [[InvalidArgumentError]] + * + * **``"MISSING_ARGUMENT"``** - see [[MissingArgumentError]] + * + * **``"UNEXPECTED_ARGUMENT"``** - see [[UnexpectedArgumentError]] + * + * **``"VALUE_MISMATCH"``** - //unused// + * + * **Blockchain Errors** + * + * **``"CALL_EXCEPTION"``** - see [[CallExceptionError]] + * + * **``"INSUFFICIENT_FUNDS"``** - see [[InsufficientFundsError]] + * + * **``"NONCE_EXPIRED"``** - see [[NonceExpiredError]] + * + * **``"REPLACEMENT_UNDERPRICED"``** - see [[ReplacementUnderpricedError]] + * + * **``"TRANSACTION_REPLACED"``** - see [[TransactionReplacedError]] + * + * **``"UNCONFIGURED_NAME"``** - see [[UnconfiguredNameError]] + * + * **``"OFFCHAIN_FAULT"``** - see [[OffchainFaultError]] + * + * **User Interaction Errors** + * + * **``"ACTION_REJECTED"``** - see [[ActionRejectedError]] + */ +export type ErrorCode = "UNKNOWN_ERROR" | "NOT_IMPLEMENTED" | "UNSUPPORTED_OPERATION" | "NETWORK_ERROR" | "SERVER_ERROR" | "TIMEOUT" | "BAD_DATA" | "CANCELLED" | "BUFFER_OVERRUN" | "NUMERIC_FAULT" | "INVALID_ARGUMENT" | "MISSING_ARGUMENT" | "UNEXPECTED_ARGUMENT" | "VALUE_MISMATCH" | "CALL_EXCEPTION" | "INSUFFICIENT_FUNDS" | "NONCE_EXPIRED" | "REPLACEMENT_UNDERPRICED" | "TRANSACTION_REPLACED" | "UNCONFIGURED_NAME" | "OFFCHAIN_FAULT" | "ACTION_REJECTED"; +/** + * All errors in Ethers include properties to assist in + * machine-readable errors. + */ +export interface EthersError extends Error { + /** + * The string error code. + */ + code: ErrorCode; + /** + * A short message describing the error, with minimal additional + * details. + */ + shortMessage: string; + /** + * Additional info regarding the error that may be useful. + * + * This is generally helpful mostly for human-based debugging. + */ + info?: Record; + /** + * Any related error. + */ + error?: Error; +} +/** + * This Error is a catch-all for when there is no way for Ethers to + * know what the underlying problem is. + */ +export interface UnknownError extends EthersError<"UNKNOWN_ERROR"> { + [key: string]: any; +} +/** + * This Error is mostly used as a stub for functionality that is + * intended for the future, but is currently not implemented. + */ +export interface NotImplementedError extends EthersError<"NOT_IMPLEMENTED"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates that the attempted operation is not supported. + * + * This could range from a specific JSON-RPC end-point not supporting + * a feature to a specific configuration of an object prohibiting the + * operation. + * + * For example, a [[Wallet]] with no connected [[Provider]] is unable + * to send a transaction. + */ +export interface UnsupportedOperationError extends EthersError<"UNSUPPORTED_OPERATION"> { + /** + * The attempted operation. + */ + operation: string; +} +/** + * This Error indicates a problem connecting to a network. + */ +export interface NetworkError extends EthersError<"NETWORK_ERROR"> { + /** + * The network event. + */ + event: string; +} +/** + * This Error indicates there was a problem fetching a resource from + * a server. + */ +export interface ServerError extends EthersError<"SERVER_ERROR"> { + /** + * The requested resource. + */ + request: FetchRequest | string; + /** + * The response received from the server, if available. + */ + response?: FetchResponse; +} +/** + * This Error indicates that the timeout duration has expired and + * that the operation has been implicitly cancelled. + * + * The side-effect of the operation may still occur, as this + * generally means a request has been sent and there has simply + * been no response to indicate whether it was processed or not. + */ +export interface TimeoutError extends EthersError<"TIMEOUT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The reason. + */ + reason: string; + /** + * The resource request, if available. + */ + request?: FetchRequest; +} +/** + * This Error indicates that a provided set of data cannot + * be correctly interpreted. + */ +export interface BadDataError extends EthersError<"BAD_DATA"> { + /** + * The data. + */ + value: any; +} +/** + * This Error indicates that the operation was cancelled by a + * programmatic call, for example to ``cancel()``. + */ +export interface CancelledError extends EthersError<"CANCELLED"> { +} +/** + * This Error indicates an attempt was made to read outside the bounds + * of protected data. + * + * Most operations in Ethers are protected by bounds checks, to mitigate + * exploits when parsing data. + */ +export interface BufferOverrunError extends EthersError<"BUFFER_OVERRUN"> { + /** + * The buffer that was overrun. + */ + buffer: Uint8Array; + /** + * The length of the buffer. + */ + length: number; + /** + * The offset that was requested. + */ + offset: number; +} +/** + * This Error indicates an operation which would result in incorrect + * arithmetic output has occurred. + * + * For example, trying to divide by zero or using a ``uint8`` to store + * a negative value. + */ +export interface NumericFaultError extends EthersError<"NUMERIC_FAULT"> { + /** + * The attempted operation. + */ + operation: string; + /** + * The fault reported. + */ + fault: string; + /** + * The value the operation was attempted against. + */ + value: any; +} +/** + * This Error indicates an incorrect type or value was passed to + * a function or method. + */ +export interface InvalidArgumentError extends EthersError<"INVALID_ARGUMENT"> { + /** + * The name of the argument. + */ + argument: string; + /** + * The value that was provided. + */ + value: any; + info?: Record; +} +/** + * This Error indicates there were too few arguments were provided. + */ +export interface MissingArgumentError extends EthersError<"MISSING_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * This Error indicates too many arguments were provided. + */ +export interface UnexpectedArgumentError extends EthersError<"UNEXPECTED_ARGUMENT"> { + /** + * The number of arguments received. + */ + count: number; + /** + * The number of arguments expected. + */ + expectedCount: number; +} +/** + * The action that resulted in the call exception. + */ +export type CallExceptionAction = "call" | "estimateGas" | "getTransactionResult" | "sendTransaction" | "unknown"; +/** + * The related transaction that caused the error. + */ +export type CallExceptionTransaction = { + to: null | string; + from?: string; + data: string; +}; +/** + * This **Error** indicates a transaction reverted. + */ +export interface CallExceptionError extends EthersError<"CALL_EXCEPTION"> { + /** + * The action being performed when the revert was encountered. + */ + action: CallExceptionAction; + /** + * The revert data returned. + */ + data: null | string; + /** + * A human-readable representation of data, if possible. + */ + reason: null | string; + /** + * The transaction that triggered the exception. + */ + transaction: CallExceptionTransaction; + /** + * The contract invocation details, if available. + */ + invocation: null | { + method: string; + signature: string; + args: Array; + }; + /** + * The built-in or custom revert error, if available + */ + revert: null | { + signature: string; + name: string; + args: Array; + }; + /** + * If the error occurred in a transaction that was mined + * (with a status of ``0``), this is the receipt. + */ + receipt?: TransactionReceipt; +} +/** + * The sending account has insufficient funds to cover the + * entire transaction cost. + */ +export interface InsufficientFundsError extends EthersError<"INSUFFICIENT_FUNDS"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * The sending account has already used this nonce in a + * transaction that has been included. + */ +export interface NonceExpiredError extends EthersError<"NONCE_EXPIRED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A CCIP-read exception, which cannot be recovered from or + * be further processed. + */ +export interface OffchainFaultError extends EthersError<"OFFCHAIN_FAULT"> { + /** + * The transaction. + */ + transaction?: TransactionRequest; + /** + * The reason the CCIP-read failed. + */ + reason: string; +} +/** + * An attempt was made to replace a transaction, but with an + * insufficient additional fee to afford evicting the old + * transaction from the memory pool. + */ +export interface ReplacementUnderpricedError extends EthersError<"REPLACEMENT_UNDERPRICED"> { + /** + * The transaction. + */ + transaction: TransactionRequest; +} +/** + * A pending transaction was replaced by another. + */ +export interface TransactionReplacedError extends EthersError<"TRANSACTION_REPLACED"> { + /** + * If the transaction was cancelled, such that the original + * effects of the transaction cannot be assured. + */ + cancelled: boolean; + /** + * The reason the transaction was replaced. + */ + reason: "repriced" | "cancelled" | "replaced"; + /** + * The hash of the replaced transaction. + */ + hash: string; + /** + * The transaction that replaced the transaction. + */ + replacement: TransactionResponse; + /** + * The receipt of the transaction that replace the transaction. + */ + receipt: TransactionReceipt; +} +/** + * This Error indicates an ENS name was used, but the name has not + * been configured. + * + * This could indicate an ENS name is unowned or that the current + * address being pointed to is the [[ZeroAddress]]. + */ +export interface UnconfiguredNameError extends EthersError<"UNCONFIGURED_NAME"> { + /** + * The ENS name that was requested + */ + value: string; +} +/** + * This Error indicates a request was rejected by the user. + * + * In most clients (such as MetaMask), when an operation requires user + * authorization (such as ``signer.sendTransaction``), the client + * presents a dialog box to the user. If the user denies the request + * this error is thrown. + */ +export interface ActionRejectedError extends EthersError<"ACTION_REJECTED"> { + /** + * The requested action. + */ + action: "requestAccess" | "sendTransaction" | "signMessage" | "signTransaction" | "signTypedData" | "unknown"; + /** + * The reason the action was rejected. + * + * If there is already a pending request, some clients may indicate + * there is already a ``"pending"`` action. This prevents an app + * from spamming the user. + */ + reason: "expired" | "rejected" | "pending"; +} +/** + * A conditional type that transforms the [[ErrorCode]] T into + * its EthersError type. + * + * @flatworm-skip-docs + */ +export type CodedEthersError = T extends "UNKNOWN_ERROR" ? UnknownError : T extends "NOT_IMPLEMENTED" ? NotImplementedError : T extends "UNSUPPORTED_OPERATION" ? UnsupportedOperationError : T extends "NETWORK_ERROR" ? NetworkError : T extends "SERVER_ERROR" ? ServerError : T extends "TIMEOUT" ? TimeoutError : T extends "BAD_DATA" ? BadDataError : T extends "CANCELLED" ? CancelledError : T extends "BUFFER_OVERRUN" ? BufferOverrunError : T extends "NUMERIC_FAULT" ? NumericFaultError : T extends "INVALID_ARGUMENT" ? InvalidArgumentError : T extends "MISSING_ARGUMENT" ? MissingArgumentError : T extends "UNEXPECTED_ARGUMENT" ? UnexpectedArgumentError : T extends "CALL_EXCEPTION" ? CallExceptionError : T extends "INSUFFICIENT_FUNDS" ? InsufficientFundsError : T extends "NONCE_EXPIRED" ? NonceExpiredError : T extends "OFFCHAIN_FAULT" ? OffchainFaultError : T extends "REPLACEMENT_UNDERPRICED" ? ReplacementUnderpricedError : T extends "TRANSACTION_REPLACED" ? TransactionReplacedError : T extends "UNCONFIGURED_NAME" ? UnconfiguredNameError : T extends "ACTION_REJECTED" ? ActionRejectedError : never; +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +export declare function isError>(error: any, code: K): error is T; +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +export declare function isCallException(error: any): error is CallExceptionError; +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +export declare function makeError>(message: string, code: K, info?: ErrorInfo): T; +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +export declare function assert>(check: unknown, message: string, code: K, info?: ErrorInfo): asserts check; +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +export declare function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check; +export declare function assertArgumentCount(count: number, expectedCount: number, message?: string): void; +/** + * Throws if the normalization %%form%% is not supported. + */ +export declare function assertNormalize(form: string): void; +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +export declare function assertPrivate(givenGuard: any, guard: any, className?: string): void; +//# sourceMappingURL=errors.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/errors.d.ts.map b/dist/ethers.js/src.ts/utils/errors.d.ts.map new file mode 100644 index 0000000..77da4ed --- /dev/null +++ b/dist/ethers.js/src.ts/utils/errors.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,OAAO,KAAK,EACR,kBAAkB,EAAE,kBAAkB,EAAE,mBAAmB,EAC9D,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE9D;;;GAGG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,GAAG,cAAc,CAAC,GAAG;IAAE,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AA2C7G;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,MAAM,SAAS,GAGjB,eAAe,GAAG,iBAAiB,GAAG,uBAAuB,GAC7D,eAAe,GAAG,cAAc,GAAG,SAAS,GAAG,UAAU,GACzD,WAAW,GAG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;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,CAAC,SAAS,SAAS,EAAE,CAAC,SAAS,gBAAgB,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAEvJ;AAGD;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,CAE3G;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAahG;AAuBD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAIlD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAYnF"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/errors.js b/dist/ethers.js/src.ts/utils/errors.js new file mode 100644 index 0000000..0cb66df --- /dev/null +++ b/dist/ethers.js/src.ts/utils/errors.js @@ -0,0 +1,235 @@ +"use strict"; +/** + * All errors in ethers include properties to ensure they are both + * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``). + * + * The [[isError]] function can be used to check the error ``code`` and + * provide a type guard for the properties present on that error interface. + * + * @_section: api/utils/errors:Errors [about-errors] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.assertPrivate = exports.assertNormalize = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.makeError = exports.isCallException = exports.isError = void 0; +const _version_js_1 = require("../_version.js"); +const properties_js_1 = require("./properties.js"); +function stringify(value) { + if (value == null) { + return "null"; + } + if (Array.isArray(value)) { + return "[ " + (value.map(stringify)).join(", ") + " ]"; + } + if (value instanceof Uint8Array) { + const HEX = "0123456789abcdef"; + let result = "0x"; + for (let i = 0; i < value.length; i++) { + result += HEX[value[i] >> 4]; + result += HEX[value[i] & 0xf]; + } + return result; + } + if (typeof (value) === "object" && typeof (value.toJSON) === "function") { + return stringify(value.toJSON()); + } + switch (typeof (value)) { + case "boolean": + case "symbol": + return value.toString(); + case "bigint": + return BigInt(value).toString(); + case "number": + return (value).toString(); + case "string": + return JSON.stringify(value); + case "object": { + const keys = Object.keys(value); + keys.sort(); + return "{ " + keys.map((k) => `${stringify(k)}: ${stringify(value[k])}`).join(", ") + " }"; + } + } + return `[ COULD NOT SERIALIZE ]`; +} +/** + * Returns true if the %%error%% matches an error thrown by ethers + * that matches the error %%code%%. + * + * In TypeScript environments, this can be used to check that %%error%% + * matches an EthersError type, which means the expected properties will + * be set. + * + * @See [ErrorCodes](api:ErrorCode) + * @example + * try { + * // code.... + * } catch (e) { + * if (isError(e, "CALL_EXCEPTION")) { + * // The Type Guard has validated this object + * console.log(e.data); + * } + * } + */ +function isError(error, code) { + return (error && error.code === code); +} +exports.isError = isError; +/** + * Returns true if %%error%% is a [[CallExceptionError]. + */ +function isCallException(error) { + return isError(error, "CALL_EXCEPTION"); +} +exports.isCallException = isCallException; +/** + * Returns a new Error configured to the format ethers emits errors, with + * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties + * for the corresponding EthersError. + * + * Each error in ethers includes the version of ethers, a + * machine-readable [[ErrorCode]], and depending on %%code%%, additional + * required properties. The error message will also include the %%message%%, + * ethers version, %%code%% and all additional properties, serialized. + */ +function makeError(message, code, info) { + let shortMessage = message; + { + const details = []; + if (info) { + if ("message" in info || "code" in info || "name" in info) { + throw new Error(`value will overwrite populated values: ${stringify(info)}`); + } + for (const key in info) { + if (key === "shortMessage") { + continue; + } + const value = (info[key]); + // try { + details.push(key + "=" + stringify(value)); + // } catch (error: any) { + // console.log("MMM", error.message); + // details.push(key + "=[could not serialize object]"); + // } + } + } + details.push(`code=${code}`); + details.push(`version=${_version_js_1.version}`); + if (details.length) { + message += " (" + details.join(", ") + ")"; + } + } + let error; + switch (code) { + case "INVALID_ARGUMENT": + error = new TypeError(message); + break; + case "NUMERIC_FAULT": + case "BUFFER_OVERRUN": + error = new RangeError(message); + break; + default: + error = new Error(message); + } + (0, properties_js_1.defineProperties)(error, { code }); + if (info) { + Object.assign(error, info); + } + if (error.shortMessage == null) { + (0, properties_js_1.defineProperties)(error, { shortMessage }); + } + return error; +} +exports.makeError = makeError; +/** + * Throws an EthersError with %%message%%, %%code%% and additional error + * %%info%% when %%check%% is falsish.. + * + * @see [[api:makeError]] + */ +function assert(check, message, code, info) { + if (!check) { + throw makeError(message, code, info); + } +} +exports.assert = assert; +/** + * A simple helper to simply ensuring provided arguments match expected + * constraints, throwing if not. + * + * In TypeScript environments, the %%check%% has been asserted true, so + * any further code does not need additional compile-time checks. + */ +function assertArgument(check, message, name, value) { + assert(check, message, "INVALID_ARGUMENT", { argument: name, value: value }); +} +exports.assertArgument = assertArgument; +function assertArgumentCount(count, expectedCount, message) { + if (message == null) { + message = ""; + } + if (message) { + message = ": " + message; + } + assert(count >= expectedCount, "missing arguemnt" + message, "MISSING_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); + assert(count <= expectedCount, "too many arguemnts" + message, "UNEXPECTED_ARGUMENT", { + count: count, + expectedCount: expectedCount + }); +} +exports.assertArgumentCount = assertArgumentCount; +const _normalizeForms = ["NFD", "NFC", "NFKD", "NFKC"].reduce((accum, form) => { + try { + // General test for normalize + /* c8 ignore start */ + if ("test".normalize(form) !== "test") { + throw new Error("bad"); + } + ; + /* c8 ignore stop */ + if (form === "NFD") { + const check = String.fromCharCode(0xe9).normalize("NFD"); + const expected = String.fromCharCode(0x65, 0x0301); + /* c8 ignore start */ + if (check !== expected) { + throw new Error("broken"); + } + /* c8 ignore stop */ + } + accum.push(form); + } + catch (error) { } + return accum; +}, []); +/** + * Throws if the normalization %%form%% is not supported. + */ +function assertNormalize(form) { + assert(_normalizeForms.indexOf(form) >= 0, "platform missing String.prototype.normalize", "UNSUPPORTED_OPERATION", { + operation: "String.prototype.normalize", info: { form } + }); +} +exports.assertNormalize = assertNormalize; +/** + * Many classes use file-scoped values to guard the constructor, + * making it effectively private. This facilitates that pattern + * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%, + * throwing if not, indicating the %%className%% if provided. + */ +function assertPrivate(givenGuard, guard, className) { + if (className == null) { + className = ""; + } + if (givenGuard !== guard) { + let method = className, operation = "new"; + if (className) { + method += "."; + operation += " " + className; + } + assert(false, `private constructor; use ${method}from* methods`, "UNSUPPORTED_OPERATION", { + operation + }); + } +} +exports.assertPrivate = assertPrivate; +//# sourceMappingURL=errors.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/errors.js.map b/dist/ethers.js/src.ts/utils/errors.js.map new file mode 100644 index 0000000..9a7605d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/errors.js.map @@ -0,0 +1 @@ +{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/errors.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;;AAEH,gDAAyC;AAEzC,mDAAmD;AAenD,SAAS,SAAS,CAAC,KAAU;IACzB,IAAI,KAAK,IAAI,IAAI,EAAE;QAAE,OAAO,MAAM,CAAC;KAAE;IAErC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACtB,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;KAC1D;IAED,IAAI,KAAK,YAAY,UAAU,EAAE;QAC7B,MAAM,GAAG,GAAG,kBAAkB,CAAC;QAC/B,IAAI,MAAM,GAAG,IAAI,CAAC;QAClB,KAAK,IAAI,CAAC,GAAG,CAAC,E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eAAe,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,6CAA6C,EAAE,uBAAuB,EAAE;QAC/G,SAAS,EAAE,4BAA4B,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE;KAC1D,CAAC,CAAC;AACP,CAAC;AAJD,0CAIC;AAED;;;;;GAKG;AACH,SAAgB,aAAa,CAAC,UAAe,EAAE,KAAU,EAAE,SAAkB;IACzE,IAAI,SAAS,IAAI,IAAI,EAAE;QAAE,SAAS,GAAG,EAAE,CAAC;KAAE;IAC1C,IAAI,UAAU,KAAK,KAAK,EAAE;QACtB,IAAI,MAAM,GAAG,SAAS,EAAE,SAAS,GAAG,KAAK,CAAC;QAC1C,IAAI,SAAS,EAAE;YACX,MAAM,IAAI,GAAG,CAAC;YACd,SAAS,IAAI,GAAG,GAAG,SAAS,CAAC;SAChC;QACD,MAAM,CAAC,KAAK,EAAE,4BAA6B,MAAO,eAAe,EAAE,uBAAuB,EAAE;YACxF,SAAS;SACZ,CAAC,CAAC;KACN;AACL,CAAC;AAZD,sCAYC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/events.d.ts b/dist/ethers.js/src.ts/utils/events.d.ts new file mode 100644 index 0000000..5da0889 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/events.d.ts @@ -0,0 +1,77 @@ +/** + * A callback function called when a an event is triggered. + */ +export type Listener = (...args: Array) => void; +/** + * An **EventEmitterable** behaves similar to an EventEmitter + * except provides async access to its methods. + * + * An EventEmitter implements the observer pattern. + */ +export interface EventEmitterable { + /** + * Registers a %%listener%% that is called whenever the + * %%event%% occurs until unregistered. + */ + on(event: T, listener: Listener): Promise; + /** + * Registers a %%listener%% that is called the next time + * %%event%% occurs. + */ + once(event: T, listener: Listener): Promise; + /** + * Triggers each listener for %%event%% with the %%args%%. + */ + emit(event: T, ...args: Array): Promise; + /** + * Resolves to the number of listeners for %%event%%. + */ + listenerCount(event?: T): Promise; + /** + * Resolves to the listeners for %%event%%. + */ + listeners(event?: T): Promise>; + /** + * Unregister the %%listener%% for %%event%%. If %%listener%% + * is unspecified, all listeners are unregistered. + */ + off(event: T, listener?: Listener): Promise; + /** + * Unregister all listeners for %%event%%. + */ + removeAllListeners(event?: T): Promise; + /** + * Alias for [[on]]. + */ + addListener(event: T, listener: Listener): Promise; + /** + * Alias for [[off]]. + */ + removeListener(event: T, listener: Listener): Promise; +} +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +export declare class EventPayload { + #private; + /** + * The event filter. + */ + readonly filter: T; + /** + * The **EventEmitterable**. + */ + readonly emitter: EventEmitterable; + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter: EventEmitterable, listener: null | Listener, filter: T); + /** + * Unregister the triggered listener for future events. + */ + removeListener(): Promise; +} +//# sourceMappingURL=events.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/events.d.ts.map b/dist/ethers.js/src.ts/utils/events.d.ts.map new file mode 100644 index 0000000..b54da37 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/events.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/events.ts"],"names":[],"mappings":"AASA;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AAErD;;;;;GAKG;AACH,MAAM,WAAW,gBAAgB,CAAC,CAAC;IAC/B;;;OAGG;IACH,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEhD;;;OAGG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,IAAI,CAAC,KAAK,EAAE,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAEtD;;OAEG;IACH,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAE1C;;OAEG;IACH,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,GAAG,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAElD;;OAEG;IACH,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7C;;OAEG;IACH,WAAW,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD;;OAEG;IACH,cAAc,CAAC,KAAK,EAAE,CAAC,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC/D;AAED;;;;GAIG;AACH,qBAAa,YAAY,CAAC,CAAC;;IACvB;;OAEG;IACH,QAAQ,CAAC,MAAM,EAAG,CAAC,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC;IAIvC;;;OAGG;gBACS,OAAO,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ,EAAE,MAAM,EAAE,CAAC;IAK9E;;OAEG;IACG,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC;CAIxC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/events.js b/dist/ethers.js/src.ts/utils/events.js new file mode 100644 index 0000000..52e89bd --- /dev/null +++ b/dist/ethers.js/src.ts/utils/events.js @@ -0,0 +1,62 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _EventPayload_listener; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.EventPayload = void 0; +/** + * Events allow for applications to use the observer pattern, which + * allows subscribing and publishing events, outside the normal + * execution paths. + * + * @_section api/utils/events:Events [about-events] + */ +const properties_js_1 = require("./properties.js"); +/** + * When an [[EventEmitterable]] triggers a [[Listener]], the + * callback always ahas one additional argument passed, which is + * an **EventPayload**. + */ +class EventPayload { + /** + * Create a new **EventPayload** for %%emitter%% with + * the %%listener%% and for %%filter%%. + */ + constructor(emitter, listener, filter) { + _EventPayload_listener.set(this, void 0); + __classPrivateFieldSet(this, _EventPayload_listener, listener, "f"); + (0, properties_js_1.defineProperties)(this, { emitter, filter }); + } + /** + * Unregister the triggered listener for future events. + */ + removeListener() { + return __awaiter(this, void 0, void 0, function* () { + if (__classPrivateFieldGet(this, _EventPayload_listener, "f") == null) { + return; + } + yield this.emitter.off(this.filter, __classPrivateFieldGet(this, _EventPayload_listener, "f")); + }); + } +} +exports.EventPayload = EventPayload; +_EventPayload_listener = new WeakMap(); +//# sourceMappingURL=events.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/events.js.map b/dist/ethers.js/src.ts/utils/events.js.map new file mode 100644 index 0000000..6ccc5fc --- /dev/null +++ b/dist/ethers.js/src.ts/utils/events.js.map @@ -0,0 +1 @@ +{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/events.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,mDAAmD;AA+DnD;;;;GAIG;AACH,MAAa,YAAY;IAarB;;;OAGG;IACH,YAAY,OAA4B,EAAE,QAAyB,EAAE,MAAS;QANrE,yCAA2B;QAOhC,uBAAA,IAAI,0BAAa,QAAQ,MAAA,CAAC;QAC1B,IAAA,gCAAgB,EAAoB,IAAI,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC;IACnE,CAAC;IAED;;OAEG;IACG,cAAc;;YAChB,IAAI,uBAAA,IAAI,8BAAU,IAAI,IAAI,EAAE;gBAAE,OAAO;aAAE;YACvC,MAAM,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,uBAAA,IAAI,8BAAU,CAAC,CAAC;QACxD,CAAC;KAAA;CACJ;AA7BD,oCA6BC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fetch.d.ts b/dist/ethers.js/src.ts/utils/fetch.d.ts new file mode 100644 index 0000000..d125792 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fetch.d.ts @@ -0,0 +1,363 @@ +/** + * An environment's implementation of ``getUrl`` must return this type. + */ +export type GetUrlResponse = { + statusCode: number; + statusMessage: string; + headers: Record; + body: null | Uint8Array; +}; +/** + * This can be used to control how throttling is handled in + * [[FetchRequest-setThrottleParams]]. + */ +export type FetchThrottleParams = { + maxAttempts?: number; + slotInterval?: number; +}; +/** + * Called before any network request, allowing updated headers (e.g. Bearer tokens), etc. + */ +export type FetchPreflightFunc = (req: FetchRequest) => Promise; +/** + * Called on the response, allowing client-based throttling logic or post-processing. + */ +export type FetchProcessFunc = (req: FetchRequest, resp: FetchResponse) => Promise; +/** + * Called prior to each retry; return true to retry, false to abort. + */ +export type FetchRetryFunc = (req: FetchRequest, resp: FetchResponse, attempt: number) => Promise; +/** + * Called on Gateway URLs. + */ +export type FetchGatewayFunc = (url: string, signal?: FetchCancelSignal) => Promise; +/** + * Used to perform a fetch; use this to override the underlying network + * fetch layer. In NodeJS, the default uses the "http" and "https" libraries + * and in the browser ``fetch`` is used. If you wish to use Axios, this is + * how you would register it. + */ +export type FetchGetUrlFunc = (req: FetchRequest, signal?: FetchCancelSignal) => Promise; +/** + * @_ignore + */ +export declare class FetchCancelSignal { + #private; + constructor(request: FetchRequest); + addListener(listener: () => void): void; + get cancelled(): boolean; + checkSignal(): void; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +export declare class FetchRequest implements Iterable<[key: string, value: string]> { + #private; + /** + * The fetch URL to request. + */ + get url(): string; + set url(url: string); + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body(): null | Uint8Array; + set body(body: null | string | Readonly | Readonly); + /** + * Returns true if the request has a body. + */ + hasBody(): this is (FetchRequest & { + body: Uint8Array; + }); + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method(): string; + set method(method: null | string); + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers(): Record; + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key: string, value: string | number): void; + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders(): void; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials(): null | string; + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username: string, password: string): void; + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip(): boolean; + set allowGzip(value: boolean); + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication(): boolean; + set allowInsecureAuthentication(value: boolean); + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout(): number; + set timeout(timeout: number); + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc(): null | FetchPreflightFunc; + set preflightFunc(preflight: null | FetchPreflightFunc); + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc(): null | FetchProcessFunc; + set processFunc(process: null | FetchProcessFunc); + /** + * This function is called on each retry attempt. + */ + get retryFunc(): null | FetchRetryFunc; + set retryFunc(retry: null | FetchRetryFunc); + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc(): FetchGetUrlFunc; + set getUrlFunc(value: null | FetchGetUrlFunc); + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url: string); + toString(): string; + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params: FetchThrottleParams): void; + /** + * Resolves to the response by sending the request. + */ + send(): Promise; + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel(): void; + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location: string): FetchRequest; + /** + * Create a new copy of this request. + */ + clone(): FetchRequest; + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig(): void; + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme: string): null | FetchGatewayFunc; + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme: string, func: FetchGatewayFunc): void; + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl: FetchGetUrlFunc): void; + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options?: Record): FetchGetUrlFunc; + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway(): FetchGatewayFunc; + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl: string): FetchGatewayFunc; +} +/** + * The response for a FetchRequest. + */ +export declare class FetchResponse implements Iterable<[key: string, value: string]> { + #private; + toString(): string; + /** + * The response status code. + */ + get statusCode(): number; + /** + * The response status message. + */ + get statusMessage(): string; + /** + * The response headers. All keys are lower-case. + */ + get headers(): Record; + /** + * The response body, or ``null`` if there was no body. + */ + get body(): null | Readonly; + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText(): string; + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson(): any; + [Symbol.iterator](): Iterator<[key: string, value: string]>; + constructor(statusCode: number, statusMessage: string, headers: Readonly>, body: null | Uint8Array, request?: FetchRequest); + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message?: string, error?: Error): FetchResponse; + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message?: string, stall?: number): never; + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key: string): string; + /** + * Returns true if the response has a body. + */ + hasBody(): this is (FetchResponse & { + body: Uint8Array; + }); + /** + * The request made for this response. + */ + get request(): null | FetchRequest; + /** + * Returns true if this response was a success statusCode. + */ + ok(): boolean; + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk(): void; +} +//# sourceMappingURL=fetch.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fetch.d.ts.map b/dist/ethers.js/src.ts/utils/fetch.d.ts.map new file mode 100644 index 0000000..6485458 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fetch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/fetch.ts"],"names":[],"mappings":"AA2BA;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,IAAI,EAAE,IAAI,GAAG,UAAU,CAAA;CAC1B,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG;IAC9B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,CAAC,GAAG,EAAE,YAAY,KAAK,OAAO,CAAC,YAAY,CAAC,CAAC;AAE9E;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;AAElG;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE3G;;GAEG;AACH,MAAM,MAAM,gBAAgB,GAAG,CAAC,GAAG,EAAE,MAAM,E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AG,QAAQ,CAAC,UAAU,CAAC,CAEtC;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,MAAM,CAQrB;IAED;;;;;OAKG;IACH,IAAI,QAAQ,IAAI,GAAG,CAQlB;IAED,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,QAAQ,CAAC,CAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAE,CAAC;gBAiBjD,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,YAAY;IAajJ;;;;OAIG;IACH,eAAe,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,KAAK,GAAG,aAAa;IAc/D;;;;OAIG;IACH,kBAAkB,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,KAAK;IAc3D;;OAEG;IACH,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM;IAI9B;;OAEG;IACH,OAAO,IAAI,IAAI,IAAI,CAAC,aAAa,GAAG;QAAE,IAAI,EAAE,UAAU,CAAA;KAAE,CAAC;IAIzD;;OAEG;IACH,IAAI,OAAO,IAAI,IAAI,GAAG,YAAY,CAA0B;IAE5D;;OAEG;IACH,EAAE,IAAI,OAAO;IAIb;;OAEG;IACH,QAAQ,IAAI,IAAI;CAUnB"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fetch.js b/dist/ethers.js/src.ts/utils/fetch.js new file mode 100644 index 0000000..cd25640 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fetch.js @@ -0,0 +1,872 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _FetchCancelSignal_listeners, _FetchCancelSignal_cancelled, _FetchRequest_instances, _FetchRequest_allowInsecure, _FetchRequest_gzip, _FetchRequest_headers, _FetchRequest_method, _FetchRequest_timeout, _FetchRequest_url, _FetchRequest_body, _FetchRequest_bodyType, _FetchRequest_creds, _FetchRequest_preflight, _FetchRequest_process, _FetchRequest_retry, _FetchRequest_signal, _FetchRequest_throttle, _FetchRequest_getUrlFunc, _FetchRequest_send, _FetchResponse_statusCode, _FetchResponse_statusMessage, _FetchResponse_headers, _FetchResponse_body, _FetchResponse_request, _FetchResponse_error; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FetchResponse = exports.FetchRequest = exports.FetchCancelSignal = void 0; +/** + * Fetching content from the web is environment-specific, so Ethers + * provides an abstraction that each environment can implement to provide + * this service. + * + * On [Node.js](link-node), the ``http`` and ``https`` libs are used to + * create a request object, register event listeners and process data + * and populate the [[FetchResponse]]. + * + * In a browser, the [DOM fetch](link-js-fetch) is used, and the resulting + * ``Promise`` is waited on to retrieve the payload. + * + * The [[FetchRequest]] is responsible for handling many common situations, + * such as redirects, server throttling, authentication, etc. + * + * It also handles common gateways, such as IPFS and data URIs. + * + * @_section api/utils/fetching:Fetching Web Content [about-fetch] + */ +const base64_js_1 = require("./base64.js"); +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const properties_js_1 = require("./properties.js"); +const utf8_js_1 = require("./utf8.js"); +const geturl_js_1 = require("./geturl.js"); +const MAX_ATTEMPTS = 12; +const SLOT_INTERVAL = 250; +// The global FetchGetUrlFunc implementation. +let defaultGetUrlFunc = (0, geturl_js_1.createGetUrl)(); +const reData = new RegExp("^data:([^;:]*)?(;base64)?,(.*)$", "i"); +const reIpfs = new RegExp("^ipfs:/\/(ipfs/)?(.*)$", "i"); +// If locked, new Gateways cannot be added +let locked = false; +// https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs +function dataGatewayFunc(url, signal) { + return __awaiter(this, void 0, void 0, function* () { + try { + const match = url.match(reData); + if (!match) { + throw new Error("invalid data"); + } + return new FetchResponse(200, "OK", { + "content-type": (match[1] || "text/plain"), + }, (match[2] ? (0, base64_js_1.decodeBase64)(match[3]) : unpercent(match[3]))); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid data: URI)", {}, null, new FetchRequest(url)); + } + }); +} +/** + * Returns a [[FetchGatewayFunc]] for fetching content from a standard + * IPFS gateway hosted at %%baseUrl%%. + */ +function getIpfsGatewayFunc(baseUrl) { + function gatewayIpfs(url, signal) { + return __awaiter(this, void 0, void 0, function* () { + try { + const match = url.match(reIpfs); + if (!match) { + throw new Error("invalid link"); + } + return new FetchRequest(`${baseUrl}${match[2]}`); + } + catch (error) { + return new FetchResponse(599, "BAD REQUEST (invalid IPFS URI)", {}, null, new FetchRequest(url)); + } + }); + } + return gatewayIpfs; +} +const Gateways = { + "data": dataGatewayFunc, + "ipfs": getIpfsGatewayFunc("https:/\/gateway.ipfs.io/ipfs/") +}; +const fetchSignals = new WeakMap(); +/** + * @_ignore + */ +class FetchCancelSignal { + constructor(request) { + _FetchCancelSignal_listeners.set(this, void 0); + _FetchCancelSignal_cancelled.set(this, void 0); + __classPrivateFieldSet(this, _FetchCancelSignal_listeners, [], "f"); + __classPrivateFieldSet(this, _FetchCancelSignal_cancelled, false, "f"); + fetchSignals.set(request, () => { + if (__classPrivateFieldGet(this, _FetchCancelSignal_cancelled, "f")) { + return; + } + __classPrivateFieldSet(this, _FetchCancelSignal_cancelled, true, "f"); + for (const listener of __classPrivateFieldGet(this, _FetchCancelSignal_listeners, "f")) { + setTimeout(() => { listener(); }, 0); + } + __classPrivateFieldSet(this, _FetchCancelSignal_listeners, [], "f"); + }); + } + addListener(listener) { + (0, errors_js_1.assert)(!__classPrivateFieldGet(this, _FetchCancelSignal_cancelled, "f"), "singal already cancelled", "UNSUPPORTED_OPERATION", { + operation: "fetchCancelSignal.addCancelListener" + }); + __classPrivateFieldGet(this, _FetchCancelSignal_listeners, "f").push(listener); + } + get cancelled() { return __classPrivateFieldGet(this, _FetchCancelSignal_cancelled, "f"); } + checkSignal() { + (0, errors_js_1.assert)(!this.cancelled, "cancelled", "CANCELLED", {}); + } +} +exports.FetchCancelSignal = FetchCancelSignal; +_FetchCancelSignal_listeners = new WeakMap(), _FetchCancelSignal_cancelled = new WeakMap(); +// Check the signal, throwing if it is cancelled +function checkSignal(signal) { + if (signal == null) { + throw new Error("missing signal; should not happen"); + } + signal.checkSignal(); + return signal; +} +/** + * Represents a request for a resource using a URI. + * + * By default, the supported schemes are ``HTTP``, ``HTTPS``, ``data:``, + * and ``IPFS:``. + * + * Additional schemes can be added globally using [[registerGateway]]. + * + * @example: + * req = new FetchRequest("https://www.ricmoo.com") + * resp = await req.send() + * resp.body.length + * //_result: + */ +class FetchRequest { + /** + * The fetch URL to request. + */ + get url() { return __classPrivateFieldGet(this, _FetchRequest_url, "f"); } + set url(url) { + __classPrivateFieldSet(this, _FetchRequest_url, String(url), "f"); + } + /** + * The fetch body, if any, to send as the request body. //(default: null)// + * + * When setting a body, the intrinsic ``Content-Type`` is automatically + * set and will be used if **not overridden** by setting a custom + * header. + * + * If %%body%% is null, the body is cleared (along with the + * intrinsic ``Content-Type``). + * + * If %%body%% is a string, the intrinsic ``Content-Type`` is set to + * ``text/plain``. + * + * If %%body%% is a Uint8Array, the intrinsic ``Content-Type`` is set to + * ``application/octet-stream``. + * + * If %%body%% is any other object, the intrinsic ``Content-Type`` is + * set to ``application/json``. + */ + get body() { + if (__classPrivateFieldGet(this, _FetchRequest_body, "f") == null) { + return null; + } + return new Uint8Array(__classPrivateFieldGet(this, _FetchRequest_body, "f")); + } + set body(body) { + if (body == null) { + __classPrivateFieldSet(this, _FetchRequest_body, undefined, "f"); + __classPrivateFieldSet(this, _FetchRequest_bodyType, undefined, "f"); + } + else if (typeof (body) === "string") { + __classPrivateFieldSet(this, _FetchRequest_body, (0, utf8_js_1.toUtf8Bytes)(body), "f"); + __classPrivateFieldSet(this, _FetchRequest_bodyType, "text/plain", "f"); + } + else if (body instanceof Uint8Array) { + __classPrivateFieldSet(this, _FetchRequest_body, body, "f"); + __classPrivateFieldSet(this, _FetchRequest_bodyType, "application/octet-stream", "f"); + } + else if (typeof (body) === "object") { + __classPrivateFieldSet(this, _FetchRequest_body, (0, utf8_js_1.toUtf8Bytes)(JSON.stringify(body)), "f"); + __classPrivateFieldSet(this, _FetchRequest_bodyType, "application/json", "f"); + } + else { + throw new Error("invalid body"); + } + } + /** + * Returns true if the request has a body. + */ + hasBody() { + return (__classPrivateFieldGet(this, _FetchRequest_body, "f") != null); + } + /** + * The HTTP method to use when requesting the URI. If no method + * has been explicitly set, then ``GET`` is used if the body is + * null and ``POST`` otherwise. + */ + get method() { + if (__classPrivateFieldGet(this, _FetchRequest_method, "f")) { + return __classPrivateFieldGet(this, _FetchRequest_method, "f"); + } + if (this.hasBody()) { + return "POST"; + } + return "GET"; + } + set method(method) { + if (method == null) { + method = ""; + } + __classPrivateFieldSet(this, _FetchRequest_method, String(method).toUpperCase(), "f"); + } + /** + * The headers that will be used when requesting the URI. All + * keys are lower-case. + * + * This object is a copy, so any changes will **NOT** be reflected + * in the ``FetchRequest``. + * + * To set a header entry, use the ``setHeader`` method. + */ + get headers() { + const headers = Object.assign({}, __classPrivateFieldGet(this, _FetchRequest_headers, "f")); + if (__classPrivateFieldGet(this, _FetchRequest_creds, "f")) { + headers["authorization"] = `Basic ${(0, base64_js_1.encodeBase64)((0, utf8_js_1.toUtf8Bytes)(__classPrivateFieldGet(this, _FetchRequest_creds, "f")))}`; + } + ; + if (this.allowGzip) { + headers["accept-encoding"] = "gzip"; + } + if (headers["content-type"] == null && __classPrivateFieldGet(this, _FetchRequest_bodyType, "f")) { + headers["content-type"] = __classPrivateFieldGet(this, _FetchRequest_bodyType, "f"); + } + if (this.body) { + headers["content-length"] = String(this.body.length); + } + return headers; + } + /** + * Get the header for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Set the header for %%key%% to %%value%%. All values are coerced + * to a string. + */ + setHeader(key, value) { + __classPrivateFieldGet(this, _FetchRequest_headers, "f")[String(key).toLowerCase()] = String(value); + } + /** + * Clear all headers, resetting all intrinsic headers. + */ + clearHeaders() { + __classPrivateFieldSet(this, _FetchRequest_headers, {}, "f"); + } + [(_FetchRequest_allowInsecure = new WeakMap(), _FetchRequest_gzip = new WeakMap(), _FetchRequest_headers = new WeakMap(), _FetchRequest_method = new WeakMap(), _FetchRequest_timeout = new WeakMap(), _FetchRequest_url = new WeakMap(), _FetchRequest_body = new WeakMap(), _FetchRequest_bodyType = new WeakMap(), _FetchRequest_creds = new WeakMap(), _FetchRequest_preflight = new WeakMap(), _FetchRequest_process = new WeakMap(), _FetchRequest_retry = new WeakMap(), _FetchRequest_signal = new WeakMap(), _FetchRequest_throttle = new WeakMap(), _FetchRequest_getUrlFunc = new WeakMap(), _FetchRequest_instances = new WeakSet(), Symbol.iterator)]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + /** + * The value that will be sent for the ``Authorization`` header. + * + * To set the credentials, use the ``setCredentials`` method. + */ + get credentials() { + return __classPrivateFieldGet(this, _FetchRequest_creds, "f") || null; + } + /** + * Sets an ``Authorization`` for %%username%% with %%password%%. + */ + setCredentials(username, password) { + (0, errors_js_1.assertArgument)(!username.match(/:/), "invalid basic authentication username", "username", "[REDACTED]"); + __classPrivateFieldSet(this, _FetchRequest_creds, `${username}:${password}`, "f"); + } + /** + * Enable and request gzip-encoded responses. The response will + * automatically be decompressed. //(default: true)// + */ + get allowGzip() { + return __classPrivateFieldGet(this, _FetchRequest_gzip, "f"); + } + set allowGzip(value) { + __classPrivateFieldSet(this, _FetchRequest_gzip, !!value, "f"); + } + /** + * Allow ``Authentication`` credentials to be sent over insecure + * channels. //(default: false)// + */ + get allowInsecureAuthentication() { + return !!__classPrivateFieldGet(this, _FetchRequest_allowInsecure, "f"); + } + set allowInsecureAuthentication(value) { + __classPrivateFieldSet(this, _FetchRequest_allowInsecure, !!value, "f"); + } + /** + * The timeout (in milliseconds) to wait for a complete response. + * //(default: 5 minutes)// + */ + get timeout() { return __classPrivateFieldGet(this, _FetchRequest_timeout, "f"); } + set timeout(timeout) { + (0, errors_js_1.assertArgument)(timeout >= 0, "timeout must be non-zero", "timeout", timeout); + __classPrivateFieldSet(this, _FetchRequest_timeout, timeout, "f"); + } + /** + * This function is called prior to each request, for example + * during a redirection or retry in case of server throttling. + * + * This offers an opportunity to populate headers or update + * content before sending a request. + */ + get preflightFunc() { + return __classPrivateFieldGet(this, _FetchRequest_preflight, "f") || null; + } + set preflightFunc(preflight) { + __classPrivateFieldSet(this, _FetchRequest_preflight, preflight, "f"); + } + /** + * This function is called after each response, offering an + * opportunity to provide client-level throttling or updating + * response data. + * + * Any error thrown in this causes the ``send()`` to throw. + * + * To schedule a retry attempt (assuming the maximum retry limit + * has not been reached), use [[response.throwThrottleError]]. + */ + get processFunc() { + return __classPrivateFieldGet(this, _FetchRequest_process, "f") || null; + } + set processFunc(process) { + __classPrivateFieldSet(this, _FetchRequest_process, process, "f"); + } + /** + * This function is called on each retry attempt. + */ + get retryFunc() { + return __classPrivateFieldGet(this, _FetchRequest_retry, "f") || null; + } + set retryFunc(retry) { + __classPrivateFieldSet(this, _FetchRequest_retry, retry, "f"); + } + /** + * This function is called to fetch content from HTTP and + * HTTPS URLs and is platform specific (e.g. nodejs vs + * browsers). + * + * This is by default the currently registered global getUrl + * function, which can be changed using [[registerGetUrl]]. + * If this has been set, setting is to ``null`` will cause + * this FetchRequest (and any future clones) to revert back to + * using the currently registered global getUrl function. + * + * Setting this is generally not necessary, but may be useful + * for developers that wish to intercept requests or to + * configurege a proxy or other agent. + */ + get getUrlFunc() { + return __classPrivateFieldGet(this, _FetchRequest_getUrlFunc, "f") || defaultGetUrlFunc; + } + set getUrlFunc(value) { + __classPrivateFieldSet(this, _FetchRequest_getUrlFunc, value, "f"); + } + /** + * Create a new FetchRequest instance with default values. + * + * Once created, each property may be set before issuing a + * ``.send()`` to make the request. + */ + constructor(url) { + _FetchRequest_instances.add(this); + _FetchRequest_allowInsecure.set(this, void 0); + _FetchRequest_gzip.set(this, void 0); + _FetchRequest_headers.set(this, void 0); + _FetchRequest_method.set(this, void 0); + _FetchRequest_timeout.set(this, void 0); + _FetchRequest_url.set(this, void 0); + _FetchRequest_body.set(this, void 0); + _FetchRequest_bodyType.set(this, void 0); + _FetchRequest_creds.set(this, void 0); + // Hooks + _FetchRequest_preflight.set(this, void 0); + _FetchRequest_process.set(this, void 0); + _FetchRequest_retry.set(this, void 0); + _FetchRequest_signal.set(this, void 0); + _FetchRequest_throttle.set(this, void 0); + _FetchRequest_getUrlFunc.set(this, void 0); + __classPrivateFieldSet(this, _FetchRequest_url, String(url), "f"); + __classPrivateFieldSet(this, _FetchRequest_allowInsecure, false, "f"); + __classPrivateFieldSet(this, _FetchRequest_gzip, true, "f"); + __classPrivateFieldSet(this, _FetchRequest_headers, {}, "f"); + __classPrivateFieldSet(this, _FetchRequest_method, "", "f"); + __classPrivateFieldSet(this, _FetchRequest_timeout, 300000, "f"); + __classPrivateFieldSet(this, _FetchRequest_throttle, { + slotInterval: SLOT_INTERVAL, + maxAttempts: MAX_ATTEMPTS + }, "f"); + __classPrivateFieldSet(this, _FetchRequest_getUrlFunc, null, "f"); + } + toString() { + return ``; + } + /** + * Update the throttle parameters used to determine maximum + * attempts and exponential-backoff properties. + */ + setThrottleParams(params) { + if (params.slotInterval != null) { + __classPrivateFieldGet(this, _FetchRequest_throttle, "f").slotInterval = params.slotInterval; + } + if (params.maxAttempts != null) { + __classPrivateFieldGet(this, _FetchRequest_throttle, "f").maxAttempts = params.maxAttempts; + } + } + /** + * Resolves to the response by sending the request. + */ + send() { + (0, errors_js_1.assert)(__classPrivateFieldGet(this, _FetchRequest_signal, "f") == null, "request already sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.send" }); + __classPrivateFieldSet(this, _FetchRequest_signal, new FetchCancelSignal(this), "f"); + return __classPrivateFieldGet(this, _FetchRequest_instances, "m", _FetchRequest_send).call(this, 0, getTime() + this.timeout, 0, this, new FetchResponse(0, "", {}, null, this)); + } + /** + * Cancels the inflight response, causing a ``CANCELLED`` + * error to be rejected from the [[send]]. + */ + cancel() { + (0, errors_js_1.assert)(__classPrivateFieldGet(this, _FetchRequest_signal, "f") != null, "request has not been sent", "UNSUPPORTED_OPERATION", { operation: "fetchRequest.cancel" }); + const signal = fetchSignals.get(this); + if (!signal) { + throw new Error("missing signal; should not happen"); + } + signal(); + } + /** + * Returns a new [[FetchRequest]] that represents the redirection + * to %%location%%. + */ + redirect(location) { + // Redirection; for now we only support absolute locations + const current = this.url.split(":")[0].toLowerCase(); + const target = location.split(":")[0].toLowerCase(); + // Don't allow redirecting: + // - non-GET requests + // - downgrading the security (e.g. https => http) + // - to non-HTTP (or non-HTTPS) protocols [this could be relaxed?] + (0, errors_js_1.assert)(this.method === "GET" && (current !== "https" || target !== "http") && location.match(/^https?:/), `unsupported redirect`, "UNSUPPORTED_OPERATION", { + operation: `redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(location)})` + }); + // Create a copy of this request, with a new URL + const req = new FetchRequest(location); + req.method = "GET"; + req.allowGzip = this.allowGzip; + req.timeout = this.timeout; + __classPrivateFieldSet(req, _FetchRequest_headers, Object.assign({}, __classPrivateFieldGet(this, _FetchRequest_headers, "f")), "f"); + if (__classPrivateFieldGet(this, _FetchRequest_body, "f")) { + __classPrivateFieldSet(req, _FetchRequest_body, new Uint8Array(__classPrivateFieldGet(this, _FetchRequest_body, "f")), "f"); + } + __classPrivateFieldSet(req, _FetchRequest_bodyType, __classPrivateFieldGet(this, _FetchRequest_bodyType, "f"), "f"); + // Do not forward credentials unless on the same domain; only absolute + //req.allowInsecure = false; + // paths are currently supported; may want a way to specify to forward? + //setStore(req.#props, "creds", getStore(this.#pros, "creds")); + return req; + } + /** + * Create a new copy of this request. + */ + clone() { + const clone = new FetchRequest(this.url); + // Preserve "default method" (i.e. null) + __classPrivateFieldSet(clone, _FetchRequest_method, __classPrivateFieldGet(this, _FetchRequest_method, "f"), "f"); + // Preserve "default body" with type, copying the Uint8Array is present + if (__classPrivateFieldGet(this, _FetchRequest_body, "f")) { + __classPrivateFieldSet(clone, _FetchRequest_body, __classPrivateFieldGet(this, _FetchRequest_body, "f"), "f"); + } + __classPrivateFieldSet(clone, _FetchRequest_bodyType, __classPrivateFieldGet(this, _FetchRequest_bodyType, "f"), "f"); + // Preserve "default headers" + __classPrivateFieldSet(clone, _FetchRequest_headers, Object.assign({}, __classPrivateFieldGet(this, _FetchRequest_headers, "f")), "f"); + // Credentials is readonly, so we copy internally + __classPrivateFieldSet(clone, _FetchRequest_creds, __classPrivateFieldGet(this, _FetchRequest_creds, "f"), "f"); + if (this.allowGzip) { + clone.allowGzip = true; + } + clone.timeout = this.timeout; + if (this.allowInsecureAuthentication) { + clone.allowInsecureAuthentication = true; + } + __classPrivateFieldSet(clone, _FetchRequest_preflight, __classPrivateFieldGet(this, _FetchRequest_preflight, "f"), "f"); + __classPrivateFieldSet(clone, _FetchRequest_process, __classPrivateFieldGet(this, _FetchRequest_process, "f"), "f"); + __classPrivateFieldSet(clone, _FetchRequest_retry, __classPrivateFieldGet(this, _FetchRequest_retry, "f"), "f"); + __classPrivateFieldSet(clone, _FetchRequest_getUrlFunc, __classPrivateFieldGet(this, _FetchRequest_getUrlFunc, "f"), "f"); + return clone; + } + /** + * Locks all static configuration for gateways and FetchGetUrlFunc + * registration. + */ + static lockConfig() { + locked = true; + } + /** + * Get the current Gateway function for %%scheme%%. + */ + static getGateway(scheme) { + return Gateways[scheme.toLowerCase()] || null; + } + /** + * Use the %%func%% when fetching URIs using %%scheme%%. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGateway(scheme, func) { + scheme = scheme.toLowerCase(); + if (scheme === "http" || scheme === "https") { + throw new Error(`cannot intercept ${scheme}; use registerGetUrl`); + } + if (locked) { + throw new Error("gateways locked"); + } + Gateways[scheme] = func; + } + /** + * Use %%getUrl%% when fetching URIs over HTTP and HTTPS requests. + * + * This method affects all requests globally. + * + * If [[lockConfig]] has been called, no change is made and this + * throws. + */ + static registerGetUrl(getUrl) { + if (locked) { + throw new Error("gateways locked"); + } + defaultGetUrlFunc = getUrl; + } + /** + * Creates a getUrl function that fetches content from HTTP and + * HTTPS URLs. + * + * The available %%options%% are dependent on the platform + * implementation of the default getUrl function. + * + * This is not generally something that is needed, but is useful + * when trying to customize simple behaviour when fetching HTTP + * content. + */ + static createGetUrlFunc(options) { + return (0, geturl_js_1.createGetUrl)(options); + } + /** + * Creates a function that can "fetch" data URIs. + * + * Note that this is automatically done internally to support + * data URIs, so it is not necessary to register it. + * + * This is not generally something that is needed, but may + * be useful in a wrapper to perfom custom data URI functionality. + */ + static createDataGateway() { + return dataGatewayFunc; + } + /** + * Creates a function that will fetch IPFS (unvalidated) from + * a custom gateway baseUrl. + * + * The default IPFS gateway used internally is + * ``"https:/\/gateway.ipfs.io/ipfs/"``. + */ + static createIpfsGatewayFunc(baseUrl) { + return getIpfsGatewayFunc(baseUrl); + } +} +exports.FetchRequest = FetchRequest; +_FetchRequest_send = function _FetchRequest_send(attempt, expires, delay, _request, _response) { + var _a, _b, _c; + return __awaiter(this, void 0, void 0, function* () { + if (attempt >= __classPrivateFieldGet(this, _FetchRequest_throttle, "f").maxAttempts) { + return _response.makeServerError("exceeded maximum retry limit"); + } + (0, errors_js_1.assert)(getTime() <= expires, "timeout", "TIMEOUT", { + operation: "request.send", reason: "timeout", request: _request + }); + if (delay > 0) { + yield wait(delay); + } + let req = this.clone(); + const scheme = (req.url.split(":")[0] || "").toLowerCase(); + // Process any Gateways + if (scheme in Gateways) { + const result = yield Gateways[scheme](req.url, checkSignal(__classPrivateFieldGet(_request, _FetchRequest_signal, "f"))); + if (result instanceof FetchResponse) { + let response = result; + if (this.processFunc) { + checkSignal(__classPrivateFieldGet(_request, _FetchRequest_signal, "f")); + try { + response = yield this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Ignore throttling + } + } + return response; + } + req = result; + } + // We have a preflight function; update the request + if (this.preflightFunc) { + req = yield this.preflightFunc(req); + } + const resp = yield this.getUrlFunc(req, checkSignal(__classPrivateFieldGet(_request, _FetchRequest_signal, "f"))); + let response = new FetchResponse(resp.statusCode, resp.statusMessage, resp.headers, resp.body, _request); + if (response.statusCode === 301 || response.statusCode === 302) { + // Redirect + try { + const location = response.headers.location || ""; + return __classPrivateFieldGet((_a = req.redirect(location)), _FetchRequest_instances, "m", _FetchRequest_send).call(_a, attempt + 1, expires, 0, _request, response); + } + catch (error) { } + // Things won't get any better on another attempt; abort + return response; + } + else if (response.statusCode === 429) { + // Throttle + if (this.retryFunc == null || (yield this.retryFunc(req, response, attempt))) { + const retryAfter = response.headers["retry-after"]; + let delay = __classPrivateFieldGet(this, _FetchRequest_throttle, "f").slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + if (typeof (retryAfter) === "string" && retryAfter.match(/^[1-9][0-9]*$/)) { + delay = parseInt(retryAfter); + } + return __classPrivateFieldGet((_b = req.clone()), _FetchRequest_instances, "m", _FetchRequest_send).call(_b, attempt + 1, expires, delay, _request, response); + } + } + if (this.processFunc) { + checkSignal(__classPrivateFieldGet(_request, _FetchRequest_signal, "f")); + try { + response = yield this.processFunc(req, response); + } + catch (error) { + // Something went wrong during processing; throw a 5xx server error + if (error.throttle == null || typeof (error.stall) !== "number") { + response.makeServerError("error in post-processing function", error).assertOk(); + } + // Throttle + let delay = __classPrivateFieldGet(this, _FetchRequest_throttle, "f").slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt)); + ; + if (error.stall >= 0) { + delay = error.stall; + } + return __classPrivateFieldGet((_c = req.clone()), _FetchRequest_instances, "m", _FetchRequest_send).call(_c, attempt + 1, expires, delay, _request, response); + } + } + return response; + }); +}; +; +/** + * The response for a FetchRequest. + */ +class FetchResponse { + toString() { + return ``; + } + /** + * The response status code. + */ + get statusCode() { return __classPrivateFieldGet(this, _FetchResponse_statusCode, "f"); } + /** + * The response status message. + */ + get statusMessage() { return __classPrivateFieldGet(this, _FetchResponse_statusMessage, "f"); } + /** + * The response headers. All keys are lower-case. + */ + get headers() { return Object.assign({}, __classPrivateFieldGet(this, _FetchResponse_headers, "f")); } + /** + * The response body, or ``null`` if there was no body. + */ + get body() { + return (__classPrivateFieldGet(this, _FetchResponse_body, "f") == null) ? null : new Uint8Array(__classPrivateFieldGet(this, _FetchResponse_body, "f")); + } + /** + * The response body as a UTF-8 encoded string, or the empty + * string (i.e. ``""``) if there was no body. + * + * An error is thrown if the body is invalid UTF-8 data. + */ + get bodyText() { + try { + return (__classPrivateFieldGet(this, _FetchResponse_body, "f") == null) ? "" : (0, utf8_js_1.toUtf8String)(__classPrivateFieldGet(this, _FetchResponse_body, "f")); + } + catch (error) { + (0, errors_js_1.assert)(false, "response body is not valid UTF-8 data", "UNSUPPORTED_OPERATION", { + operation: "bodyText", info: { response: this } + }); + } + } + /** + * The response body, decoded as JSON. + * + * An error is thrown if the body is invalid JSON-encoded data + * or if there was no body. + */ + get bodyJson() { + try { + return JSON.parse(this.bodyText); + } + catch (error) { + (0, errors_js_1.assert)(false, "response body is not valid JSON", "UNSUPPORTED_OPERATION", { + operation: "bodyJson", info: { response: this } + }); + } + } + [(_FetchResponse_statusCode = new WeakMap(), _FetchResponse_statusMessage = new WeakMap(), _FetchResponse_headers = new WeakMap(), _FetchResponse_body = new WeakMap(), _FetchResponse_request = new WeakMap(), _FetchResponse_error = new WeakMap(), Symbol.iterator)]() { + const headers = this.headers; + const keys = Object.keys(headers); + let index = 0; + return { + next: () => { + if (index < keys.length) { + const key = keys[index++]; + return { + value: [key, headers[key]], done: false + }; + } + return { value: undefined, done: true }; + } + }; + } + constructor(statusCode, statusMessage, headers, body, request) { + _FetchResponse_statusCode.set(this, void 0); + _FetchResponse_statusMessage.set(this, void 0); + _FetchResponse_headers.set(this, void 0); + _FetchResponse_body.set(this, void 0); + _FetchResponse_request.set(this, void 0); + _FetchResponse_error.set(this, void 0); + __classPrivateFieldSet(this, _FetchResponse_statusCode, statusCode, "f"); + __classPrivateFieldSet(this, _FetchResponse_statusMessage, statusMessage, "f"); + __classPrivateFieldSet(this, _FetchResponse_headers, Object.keys(headers).reduce((accum, k) => { + accum[k.toLowerCase()] = String(headers[k]); + return accum; + }, {}), "f"); + __classPrivateFieldSet(this, _FetchResponse_body, ((body == null) ? null : new Uint8Array(body)), "f"); + __classPrivateFieldSet(this, _FetchResponse_request, (request || null), "f"); + __classPrivateFieldSet(this, _FetchResponse_error, { message: "" }, "f"); + } + /** + * Return a Response with matching headers and body, but with + * an error status code (i.e. 599) and %%message%% with an + * optional %%error%%. + */ + makeServerError(message, error) { + let statusMessage; + if (!message) { + message = `${this.statusCode} ${this.statusMessage}`; + statusMessage = `CLIENT ESCALATED SERVER ERROR (${message})`; + } + else { + statusMessage = `CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${message})`; + } + const response = new FetchResponse(599, statusMessage, this.headers, this.body, __classPrivateFieldGet(this, _FetchResponse_request, "f") || undefined); + __classPrivateFieldSet(response, _FetchResponse_error, { message, error }, "f"); + return response; + } + /** + * If called within a [request.processFunc](FetchRequest-processFunc) + * call, causes the request to retry as if throttled for %%stall%% + * milliseconds. + */ + throwThrottleError(message, stall) { + if (stall == null) { + stall = -1; + } + else { + (0, errors_js_1.assertArgument)(Number.isInteger(stall) && stall >= 0, "invalid stall timeout", "stall", stall); + } + const error = new Error(message || "throttling requests"); + (0, properties_js_1.defineProperties)(error, { stall, throttle: true }); + throw error; + } + /** + * Get the header value for %%key%%, ignoring case. + */ + getHeader(key) { + return this.headers[key.toLowerCase()]; + } + /** + * Returns true if the response has a body. + */ + hasBody() { + return (__classPrivateFieldGet(this, _FetchResponse_body, "f") != null); + } + /** + * The request made for this response. + */ + get request() { return __classPrivateFieldGet(this, _FetchResponse_request, "f"); } + /** + * Returns true if this response was a success statusCode. + */ + ok() { + return (__classPrivateFieldGet(this, _FetchResponse_error, "f").message === "" && this.statusCode >= 200 && this.statusCode < 300); + } + /** + * Throws a ``SERVER_ERROR`` if this response is not ok. + */ + assertOk() { + if (this.ok()) { + return; + } + let { message, error } = __classPrivateFieldGet(this, _FetchResponse_error, "f"); + if (message === "") { + message = `server response ${this.statusCode} ${this.statusMessage}`; + } + (0, errors_js_1.assert)(false, message, "SERVER_ERROR", { + request: (this.request || "unknown request"), response: this, error + }); + } +} +exports.FetchResponse = FetchResponse; +function getTime() { return (new Date()).getTime(); } +function unpercent(value) { + return (0, utf8_js_1.toUtf8Bytes)(value.replace(/%([0-9a-f][0-9a-f])/gi, (all, code) => { + return String.fromCharCode(parseInt(code, 16)); + })); +} +function wait(delay) { + return new Promise((resolve) => setTimeout(resolve, delay)); +} +//# sourceMappingURL=fetch.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fetch.js.map b/dist/ethers.js/src.ts/utils/fetch.js.map new file mode 100644 index 0000000..63506da --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fetch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fetch.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/fetch.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,2CAAyD;AACzD,uCAAoC;AACpC,2CAAqD;AACrD,mDAAmD;AACnD,uCAAsD;AAEtD,2CAA2C;AAkD3C,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,6CAA6C;AAC7C,IAAI,iBAAiB,GAAoB,IAAA,wBAAY,GAAE,CAAC;AAExD,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,iCAAiC,EAAE,GAAG,CAAC,CAAC;AAClE,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,wBAAwB,EAAE,GAAG,CAAC,CAAC;AAEzD,0CAA0C;AAC1C,IAAI,MAAM,GAAG,KAAK,CAAC;AAEnB,6EAA6E;AAC7E,SAAe,eAAe,CAAC,GAAW,EAAE,MAA0B;;QAClE,IAAI;YACA,MAAM,KAAK,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;YAChC,IAAI,CAAC,KAAK,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,cAAc,CAAC,CAAC;aAAE;YAChD,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,IAAI,EAAE;gBAChC,cAAc,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,YAAY,CAAC;aAC7C,EAAE,CAAC,KA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AQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC,CAAC,CAAC;AACR,CAAC;AAED,SAAS,IAAI,CAAC,KAAa;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AAChE,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fixednumber.d.ts b/dist/ethers.js/src.ts/utils/fixednumber.d.ts new file mode 100644 index 0000000..901dd9b --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fixednumber.d.ts @@ -0,0 +1,252 @@ +import type { BigNumberish, BytesLike, Numeric } from "./index.js"; +/** + * A description of a fixed-point arithmetic field. + * + * When specifying the fixed format, the values override the default of + * a ``fixed128x18``, which implies a signed 128-bit value with 18 + * decimals of precision. + * + * The alias ``fixed`` and ``ufixed`` can be used for ``fixed128x18`` and + * ``ufixed128x18`` respectively. + * + * When a fixed format string begins with a ``u``, it indicates the field + * is unsigned, so any negative values will overflow. The first number + * indicates the bit-width and the second number indicates the decimal + * precision. + * + * When a ``number`` is used for a fixed format, it indicates the number + * of decimal places, and the default width and signed-ness will be used. + * + * The bit-width must be byte aligned and the decimals can be at most 80. + */ +export type FixedFormat = number | string | { + signed?: boolean; + width?: number; + decimals?: number; +}; +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, an value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +export declare class FixedNumber { + #private; + /** + * The specific fixed-point arithmetic field for this value. + */ + readonly format: string; + /** + * This is a property so console.log shows a human-meaningful value. + * + * @private + */ + readonly _value: string; + /** + * @private + */ + constructor(guard: any, value: bigint, format: any); + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed(): boolean; + /** + * The number of bits available to store the value. + */ + get width(): number; + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals(): number; + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value(): bigint; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other: FixedNumber): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other: FixedNumber): FixedNumber; + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other: FixedNumber): number; + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other: FixedNumber): boolean; + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other: FixedNumber): boolean; + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor(): FixedNumber; + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling(): FixedNumber; + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals?: number): FixedNumber; + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero(): boolean; + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative(): boolean; + /** + * Returns the string representation of %%this%%. + */ + toString(): string; + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat(): number; + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value: BigNumberish, _decimals?: Numeric, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value: string, _format?: FixedFormat): FixedNumber; + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value: BytesLike, _format?: FixedFormat): FixedNumber; +} +//# sourceMappingURL=fixednumber.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fixednumber.d.ts.map b/dist/ethers.js/src.ts/utils/fixednumber.d.ts.map new file mode 100644 index 0000000..794f0f8 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fixednumber.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/fixednumber.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA2CnE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,WAAW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index 0000000..fa6b90b --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fixednumber.js @@ -0,0 +1,528 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _FixedNumber_instances, _FixedNumber_format, _FixedNumber_val, _FixedNumber_tens, _FixedNumber_checkFormat, _FixedNumber_checkValue, _FixedNumber_add, _FixedNumber_sub, _FixedNumber_mul, _FixedNumber_div; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.FixedNumber = void 0; +/** + * The **FixedNumber** class permits using values with decimal places, + * using fixed-pont math. + * + * Fixed-point math is still based on integers under-the-hood, but uses an + * internal offset to store fractional components below, and each operation + * corrects for this after each operation. + * + * @_section: api/utils/fixed-point-math:Fixed-Point Maths [about-fixed-point-math] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const maths_js_1 = require("./maths.js"); +const properties_js_1 = require("./properties.js"); +const BN_N1 = BigInt(-1); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +const BN_5 = BigInt(5); +const _guard = {}; +// Constant to pull zeros from for multipliers +let Zeros = "0000"; +while (Zeros.length < 80) { + Zeros += Zeros; +} +// Returns a string "1" followed by decimal "0"s +function getTens(decimals) { + let result = Zeros; + while (result.length < decimals) { + result += result; + } + return BigInt("1" + result.substring(0, decimals)); +} +function checkValue(val, format, safeOp) { + const width = BigInt(format.width); + if (format.signed) { + const limit = (BN_1 << (width - BN_1)); + (0, errors_js_1.assert)(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + if (val > BN_0) { + val = (0, maths_js_1.fromTwos)((0, maths_js_1.mask)(val, width), width); + } + else { + val = -(0, maths_js_1.fromTwos)((0, maths_js_1.mask)(-val, width), width); + } + } + else { + const limit = (BN_1 << width); + (0, errors_js_1.assert)(safeOp == null || (val >= 0 && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = (((val % limit) + limit) % limit) & (limit - BN_1); + } + return val; +} +function getFormat(value) { + if (typeof (value) === "number") { + value = `fixed128x${value}`; + } + let signed = true; + let width = 128; + let decimals = 18; + if (typeof (value) === "string") { + // Parse the format string + if (value === "fixed") { + // defaults... + } + else if (value === "ufixed") { + signed = false; + } + else { + const match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/); + (0, errors_js_1.assertArgument)(match, "invalid fixed format", "format", value); + signed = (match[1] !== "u"); + width = parseInt(match[2]); + decimals = parseInt(match[3]); + } + } + else if (value) { + // Extract the values from the object + const v = value; + const check = (key, type, defaultValue) => { + if (v[key] == null) { + return defaultValue; + } + (0, errors_js_1.assertArgument)(typeof (v[key]) === type, "invalid fixed format (" + key + " not " + type + ")", "format." + key, v[key]); + return v[key]; + }; + signed = check("signed", "boolean", signed); + width = check("width", "number", width); + decimals = check("decimals", "number", decimals); + } + (0, errors_js_1.assertArgument)((width % 8) === 0, "invalid FixedNumber width (not byte aligned)", "format.width", width); + (0, errors_js_1.assertArgument)(decimals <= 80, "invalid FixedNumber decimals (too large)", "format.decimals", decimals); + const name = (signed ? "" : "u") + "fixed" + String(width) + "x" + String(decimals); + return { signed, width, decimals, name }; +} +function toString(val, decimals) { + let negative = ""; + if (val < BN_0) { + negative = "-"; + val *= BN_N1; + } + let str = val.toString(); + // No decimal point for whole values + if (decimals === 0) { + return (negative + str); + } + // Pad out to the whole component (including a whole digit) + while (str.length <= decimals) { + str = Zeros + str; + } + // Insert the decimal point + const index = str.length - decimals; + str = str.substring(0, index) + "." + str.substring(index); + // Trim the whole component (leaving at least one 0) + while (str[0] === "0" && str[1] !== ".") { + str = str.substring(1); + } + // Trim the decimal component (leaving at least one 0) + while (str[str.length - 1] === "0" && str[str.length - 2] !== ".") { + str = str.substring(0, str.length - 1); + } + return (negative + str); +} +/** + * A FixedNumber represents a value over its [[FixedFormat]] + * arithmetic field. + * + * A FixedNumber can be used to perform math, losslessly, on + * values which have decmial places. + * + * A FixedNumber has a fixed bit-width to store values in, and stores all + * values internally by multiplying the value by 10 raised to the power of + * %%decimals%%. + * + * If operations are performed that cause a value to grow too high (close to + * positive infinity) or too low (close to negative infinity), the value + * is said to //overflow//. + * + * For example, an 8-bit signed value, with 0 decimals may only be within + * the range ``-128`` to ``127``; so ``-128 - 1`` will overflow and become + * ``127``. Likewise, ``127 + 1`` will overflow and become ``-127``. + * + * Many operation have a normal and //unsafe// variant. The normal variant + * will throw a [[NumericFaultError]] on any overflow, while the //unsafe// + * variant will silently allow overflow, corrupting its value value. + * + * If operations are performed that cause a value to become too small + * (close to zero), the value loses precison and is said to //underflow//. + * + * For example, an value with 1 decimal place may store a number as small + * as ``0.1``, but the value of ``0.1 / 2`` is ``0.05``, which cannot fit + * into 1 decimal place, so underflow occurs which means precision is lost + * and the value becomes ``0``. + * + * Some operations have a normal and //signalling// variant. The normal + * variant will silently ignore underflow, while the //signalling// variant + * will thow a [[NumericFaultError]] on underflow. + */ +class FixedNumber { + // Use this when changing this file to get some typing info, + // but then switch to any to mask the internal type + //constructor(guard: any, value: bigint, format: _FixedFormat) { + /** + * @private + */ + constructor(guard, value, format) { + _FixedNumber_instances.add(this); + _FixedNumber_format.set(this, void 0); + // The actual value (accounting for decimals) + _FixedNumber_val.set(this, void 0); + // A base-10 value to multiple values by to maintain the magnitude + _FixedNumber_tens.set(this, void 0); + (0, errors_js_1.assertPrivate)(guard, _guard, "FixedNumber"); + __classPrivateFieldSet(this, _FixedNumber_val, value, "f"); + __classPrivateFieldSet(this, _FixedNumber_format, format, "f"); + const _value = toString(value, format.decimals); + (0, properties_js_1.defineProperties)(this, { format: format.name, _value }); + __classPrivateFieldSet(this, _FixedNumber_tens, getTens(format.decimals), "f"); + } + /** + * If true, negative values are permitted, otherwise only + * positive values and zero are allowed. + */ + get signed() { return __classPrivateFieldGet(this, _FixedNumber_format, "f").signed; } + /** + * The number of bits available to store the value. + */ + get width() { return __classPrivateFieldGet(this, _FixedNumber_format, "f").width; } + /** + * The number of decimal places in the fixed-point arithment field. + */ + get decimals() { return __classPrivateFieldGet(this, _FixedNumber_format, "f").decimals; } + /** + * The value as an integer, based on the smallest unit the + * [[decimals]] allow. + */ + get value() { return __classPrivateFieldGet(this, _FixedNumber_val, "f"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%, ignoring overflow. + */ + addUnsafe(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_add).call(this, other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% added + * to %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + add(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_add).call(this, other, "add"); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%, ignoring overflow. + */ + subUnsafe(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_sub).call(this, other); } + /** + * Returns a new [[FixedNumber]] with the result of %%other%% subtracted + * from %%this%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + sub(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_sub).call(this, other, "sub"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%, ignoring overflow and underflow (precision loss). + */ + mulUnsafe(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_mul).call(this, other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs. + */ + mul(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_mul).call(this, other, "mul"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% multiplied + * by %%other%%. A [[NumericFaultError]] is thrown if overflow + * occurs or if underflow (precision loss) occurs. + */ + mulSignal(other) { + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, other); + const value = __classPrivateFieldGet(this, _FixedNumber_val, "f") * __classPrivateFieldGet(other, _FixedNumber_val, "f"); + (0, errors_js_1.assert)((value % __classPrivateFieldGet(this, _FixedNumber_tens, "f")) === BN_0, "precision lost during signalling mul", "NUMERIC_FAULT", { + operation: "mulSignal", fault: "underflow", value: this + }); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, value / __classPrivateFieldGet(this, _FixedNumber_tens, "f"), "mulSignal"); + } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + divUnsafe(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_div).call(this, other); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%, ignoring underflow (precision loss). A + * [[NumericFaultError]] is thrown if overflow occurs. + */ + div(other) { return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_div).call(this, other, "div"); } + /** + * Returns a new [[FixedNumber]] with the result of %%this%% divided + * by %%other%%. A [[NumericFaultError]] is thrown if underflow + * (precision loss) occurs. + */ + divSignal(other) { + (0, errors_js_1.assert)(__classPrivateFieldGet(other, _FixedNumber_val, "f") !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, other); + const value = (__classPrivateFieldGet(this, _FixedNumber_val, "f") * __classPrivateFieldGet(this, _FixedNumber_tens, "f")); + (0, errors_js_1.assert)((value % __classPrivateFieldGet(other, _FixedNumber_val, "f")) === BN_0, "precision lost during signalling div", "NUMERIC_FAULT", { + operation: "divSignal", fault: "underflow", value: this + }); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, value / __classPrivateFieldGet(other, _FixedNumber_val, "f"), "divSignal"); + } + /** + * Returns a comparison result between %%this%% and %%other%%. + * + * This is suitable for use in sorting, where ``-1`` implies %%this%% + * is smaller, ``1`` implies %%this%% is larger and ``0`` implies + * both are equal. + */ + cmp(other) { + let a = this.value, b = other.value; + // Coerce a and b to the same magnitude + const delta = this.decimals - other.decimals; + if (delta > 0) { + b *= getTens(delta); + } + else if (delta < 0) { + a *= getTens(-delta); + } + // Comnpare + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + /** + * Returns true if %%other%% is equal to %%this%%. + */ + eq(other) { return this.cmp(other) === 0; } + /** + * Returns true if %%other%% is less than to %%this%%. + */ + lt(other) { return this.cmp(other) < 0; } + /** + * Returns true if %%other%% is less than or equal to %%this%%. + */ + lte(other) { return this.cmp(other) <= 0; } + /** + * Returns true if %%other%% is greater than to %%this%%. + */ + gt(other) { return this.cmp(other) > 0; } + /** + * Returns true if %%other%% is greater than or equal to %%this%%. + */ + gte(other) { return this.cmp(other) >= 0; } + /** + * Returns a new [[FixedNumber]] which is the largest **integer** + * that is less than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + floor() { + let val = __classPrivateFieldGet(this, _FixedNumber_val, "f"); + if (__classPrivateFieldGet(this, _FixedNumber_val, "f") < BN_0) { + val -= __classPrivateFieldGet(this, _FixedNumber_tens, "f") - BN_1; + } + val = (__classPrivateFieldGet(this, _FixedNumber_val, "f") / __classPrivateFieldGet(this, _FixedNumber_tens, "f")) * __classPrivateFieldGet(this, _FixedNumber_tens, "f"); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, val, "floor"); + } + /** + * Returns a new [[FixedNumber]] which is the smallest **integer** + * that is greater than or equal to %%this%%. + * + * The decimal component of the result will always be ``0``. + */ + ceiling() { + let val = __classPrivateFieldGet(this, _FixedNumber_val, "f"); + if (__classPrivateFieldGet(this, _FixedNumber_val, "f") > BN_0) { + val += __classPrivateFieldGet(this, _FixedNumber_tens, "f") - BN_1; + } + val = (__classPrivateFieldGet(this, _FixedNumber_val, "f") / __classPrivateFieldGet(this, _FixedNumber_tens, "f")) * __classPrivateFieldGet(this, _FixedNumber_tens, "f"); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, val, "ceiling"); + } + /** + * Returns a new [[FixedNumber]] with the decimal component + * rounded up on ties at %%decimals%% places. + */ + round(decimals) { + if (decimals == null) { + decimals = 0; + } + // Not enough precision to not already be rounded + if (decimals >= this.decimals) { + return this; + } + const delta = this.decimals - decimals; + const bump = BN_5 * getTens(delta - 1); + let value = this.value + bump; + const tens = getTens(delta); + value = (value / tens) * tens; + checkValue(value, __classPrivateFieldGet(this, _FixedNumber_format, "f"), "round"); + return new FixedNumber(_guard, value, __classPrivateFieldGet(this, _FixedNumber_format, "f")); + } + /** + * Returns true if %%this%% is equal to ``0``. + */ + isZero() { return (__classPrivateFieldGet(this, _FixedNumber_val, "f") === BN_0); } + /** + * Returns true if %%this%% is less than ``0``. + */ + isNegative() { return (__classPrivateFieldGet(this, _FixedNumber_val, "f") < BN_0); } + /** + * Returns the string representation of %%this%%. + */ + toString() { return this._value; } + /** + * Returns a float approximation. + * + * Due to IEEE 754 precission (or lack thereof), this function + * can only return an approximation and most values will contain + * rounding errors. + */ + toUnsafeFloat() { return parseFloat(this.toString()); } + /** + * Return a new [[FixedNumber]] with the same value but has had + * its field set to %%format%%. + * + * This will throw if the value cannot fit into %%format%%. + */ + toFormat(format) { + return FixedNumber.fromString(this.toString(), format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% divided by + * %%decimal%% places with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% (once adjusted + * for %%decimals%%) cannot fit in %%format%%, either due to overflow + * or underflow (precision loss). + */ + static fromValue(_value, _decimals, _format) { + const decimals = (_decimals == null) ? 0 : (0, maths_js_1.getNumber)(_decimals); + const format = getFormat(_format); + let value = (0, maths_js_1.getBigInt)(_value, "value"); + const delta = decimals - format.decimals; + if (delta > 0) { + const tens = getTens(delta); + (0, errors_js_1.assert)((value % tens) === BN_0, "value loses precision for format", "NUMERIC_FAULT", { + operation: "fromValue", fault: "underflow", value: _value + }); + value /= tens; + } + else if (delta < 0) { + value *= getTens(-delta); + } + checkValue(value, format, "fromValue"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] for %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%%, either due to overflow or underflow (precision loss). + */ + static fromString(_value, _format) { + const match = _value.match(/^(-?)([0-9]*)\.?([0-9]*)$/); + (0, errors_js_1.assertArgument)(match && (match[2].length + match[3].length) > 0, "invalid FixedNumber string value", "value", _value); + const format = getFormat(_format); + let whole = (match[2] || "0"), decimal = (match[3] || ""); + // Pad out the decimals + while (decimal.length < format.decimals) { + decimal += Zeros; + } + // Check precision is safe + (0, errors_js_1.assert)(decimal.substring(format.decimals).match(/^0*$/), "too many decimals for format", "NUMERIC_FAULT", { + operation: "fromString", fault: "underflow", value: _value + }); + // Remove extra padding + decimal = decimal.substring(0, format.decimals); + const value = BigInt(match[1] + whole + decimal); + checkValue(value, format, "fromString"); + return new FixedNumber(_guard, value, format); + } + /** + * Creates a new [[FixedNumber]] with the big-endian representation + * %%value%% with %%format%%. + * + * This will throw a [[NumericFaultError]] if %%value%% cannot fit + * in %%format%% due to overflow. + */ + static fromBytes(_value, _format) { + let value = (0, maths_js_1.toBigInt)((0, data_js_1.getBytes)(_value, "value")); + const format = getFormat(_format); + if (format.signed) { + value = (0, maths_js_1.fromTwos)(value, format.width); + } + checkValue(value, format, "fromBytes"); + return new FixedNumber(_guard, value, format); + } +} +exports.FixedNumber = FixedNumber; +_FixedNumber_format = new WeakMap(), _FixedNumber_val = new WeakMap(), _FixedNumber_tens = new WeakMap(), _FixedNumber_instances = new WeakSet(), _FixedNumber_checkFormat = function _FixedNumber_checkFormat(other) { + (0, errors_js_1.assertArgument)(this.format === other.format, "incompatible format; use fixedNumber.toFormat", "other", other); +}, _FixedNumber_checkValue = function _FixedNumber_checkValue(val, safeOp) { + /* + const width = BigInt(this.width); + if (this.signed) { + const limit = (BN_1 << (width - BN_1)); + assert(safeOp == null || (val >= -limit && val < limit), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + + if (val > BN_0) { + val = fromTwos(mask(val, width), width); + } else { + val = -fromTwos(mask(-val, width), width); + } + + } else { + const masked = mask(val, width); + assert(safeOp == null || (val >= 0 && val === masked), "overflow", "NUMERIC_FAULT", { + operation: safeOp, fault: "overflow", value: val + }); + val = masked; + } + */ + val = checkValue(val, __classPrivateFieldGet(this, _FixedNumber_format, "f"), safeOp); + return new FixedNumber(_guard, val, __classPrivateFieldGet(this, _FixedNumber_format, "f")); +}, _FixedNumber_add = function _FixedNumber_add(o, safeOp) { + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, o); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, __classPrivateFieldGet(this, _FixedNumber_val, "f") + __classPrivateFieldGet(o, _FixedNumber_val, "f"), safeOp); +}, _FixedNumber_sub = function _FixedNumber_sub(o, safeOp) { + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, o); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, __classPrivateFieldGet(this, _FixedNumber_val, "f") - __classPrivateFieldGet(o, _FixedNumber_val, "f"), safeOp); +}, _FixedNumber_mul = function _FixedNumber_mul(o, safeOp) { + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, o); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, (__classPrivateFieldGet(this, _FixedNumber_val, "f") * __classPrivateFieldGet(o, _FixedNumber_val, "f")) / __classPrivateFieldGet(this, _FixedNumber_tens, "f"), safeOp); +}, _FixedNumber_div = function _FixedNumber_div(o, safeOp) { + (0, errors_js_1.assert)(__classPrivateFieldGet(o, _FixedNumber_val, "f") !== BN_0, "division by zero", "NUMERIC_FAULT", { + operation: "div", fault: "divide-by-zero", value: this + }); + __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkFormat).call(this, o); + return __classPrivateFieldGet(this, _FixedNumber_instances, "m", _FixedNumber_checkValue).call(this, (__classPrivateFieldGet(this, _FixedNumber_val, "f") * __classPrivateFieldGet(this, _FixedNumber_tens, "f")) / __classPrivateFieldGet(o, _FixedNumber_val, "f"), safeOp); +}; +//const f1 = FixedNumber.fromString("12.56", "fixed16x2"); +//const f2 = FixedNumber.fromString("0.3", "fixed16x2"); +//console.log(f1.divSignal(f2)); +//const BUMP = FixedNumber.from("0.5"); +//# sourceMappingURL=fixednumber.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/fixednumber.js.map b/dist/ethers.js/src.ts/utils/fixednumber.js.map new file mode 100644 index 0000000..0c77d6d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/fixednumber.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixednumber.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/fixednumber.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;GASG;AACH,uCAAqC;AACrC,2CAAoE;AACpE,yCAEoB;AACpB,mDAAmD;AAInD,MAAM,KAAK,GAAG,MAAM,CAAC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,IAAI,EAAa,uBAAA,IAAI,wBAAK,GAAG,uBAAA,CAAC,wBAAK,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC,+CAeI,CAAc,EAAE,MAAe;IAChC,uBAAA,IAAI,wDAAa,MAAjB,IAAI,EAAc,CAAC,CAAC,CAAC;IACrB,OAAO,uBAAA,IAAI,uDAAY,MAAhB,IAAI,EAAa,uBAAA,IAAI,wBAAK,GAAG,uBAAA,CAAC,wBAAK,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC,+CAeI,CAAc,EAAE,MAAe;IAChC,uBAAA,IAAI,wDAAa,MAAjB,IAAI,EAAc,CAAC,CAAC,CAAC;IACrB,OAAO,uBAAA,IAAI,uDAAY,MAAhB,IAAI,EAAa,CAAC,uBAAA,IAAI,wBAAK,GAAG,uBAAA,CAAC,wBAAK,CAAC,GAAG,uBAAA,IAAI,yBAAM,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC,+CA6BI,CAAc,EAAE,MAAe;IAChC,IAAA,kBAAM,EAAC,uBAAA,CAAC,wBAAK,KAAK,IAAI,EAAE,kBAAkB,EAAE,eAAe,EAAE;QACzD,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,IAAI;KACzD,CAAC,CAAC;IACH,uBAAA,IAAI,wDAAa,MAAjB,IAAI,EAAc,CAAC,CAAC,CAAC;IACrB,OAAO,uBAAA,IAAI,uDAAY,MAAhB,IAAI,EAAa,CAAC,uBAAA,IAAI,wBAAK,GAAG,uBAAA,IAAI,yBAAM,CAAC,GAAG,uBAAA,CAAC,wBAAK,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC;AAqPL,0DAA0D;AAC1D,wDAAwD;AACxD,gCAAgC;AAChC,uCAAuC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl-browser.d.ts b/dist/ethers.js/src.ts/utils/geturl-browser.d.ts new file mode 100644 index 0000000..eea23c2 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl-browser.d.ts @@ -0,0 +1,22 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +declare global { + class Headers { + constructor(values: Array<[string, string]>); + forEach(func: (v: string, k: string) => void): void; + } + class Response { + status: number; + statusText: string; + headers: Headers; + arrayBuffer(): Promise; + } + type FetchInit = { + method?: string; + headers?: Headers; + body?: Uint8Array; + }; + function fetch(url: string, init: FetchInit): Promise; +} +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +export declare function getUrl(req: FetchRequest, _signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl-browser.d.ts.map b/dist/ethers.js/src.ts/utils/geturl-browser.d.ts.map new file mode 100644 index 0000000..87b9420 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/geturl-browser.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAGpB,OAAO,CAAC,MAAM,CAAC;IACX,MAAM,OAAO;oBACG,MAAM,EAAE,KAAK,CAAC,CAAE,MAAM,EAAE,MAAM,CAAE,CAAC;QAC7C,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,IAAI,GAAG,IAAI;KACtD;IAED,MAAM,QAAQ;QACV,MAAM,EAAE,MAAM,CAAC;QACf,UAAU,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,OAAO,CAAC;QACjB,WAAW,IAAI,OAAO,CAAC,WAAW,CAAC;KACtC;IAED,KAAK,SAAS,GAAG;QACb,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,OAAO,CAAC;QAClB,IAAI,CAAC,EAAE,UAAU,CAAA;KACpB,CAAC;IAEF,SAAS,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACnE;AAID,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA8C3E;AAKD,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEpG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl-browser.js b/dist/ethers.js/src.ts/utils/geturl-browser.js new file mode 100644 index 0000000..a584766 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl-browser.js @@ -0,0 +1,63 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUrl = exports.createGetUrl = void 0; +const errors_js_1 = require("./errors.js"); +// @TODO: timeout is completely ignored; start a Promise.any with a reject? +function createGetUrl(options) { + function getUrl(req, _signal) { + return __awaiter(this, void 0, void 0, function* () { + const protocol = req.url.split(":")[0].toLowerCase(); + (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + let signal = undefined; + if (_signal) { + const controller = new AbortController(); + signal = controller.signal; + _signal.addListener(() => { controller.abort(); }); + } + const init = { + method: req.method, + headers: new Headers(Array.from(req)), + body: req.body || undefined, + signal + }; + const resp = yield fetch(req.url, init); + const headers = {}; + resp.headers.forEach((value, key) => { + headers[key.toLowerCase()] = value; + }); + const respBody = yield resp.arrayBuffer(); + const body = (respBody == null) ? null : new Uint8Array(respBody); + return { + statusCode: resp.status, + statusMessage: resp.statusText, + headers, body + }; + }); + } + return getUrl; +} +exports.createGetUrl = createGetUrl; +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +function getUrl(req, _signal) { + return __awaiter(this, void 0, void 0, function* () { + return defaultGetUrl(req, _signal); + }); +} +exports.getUrl = getUrl; +//# sourceMappingURL=geturl-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl-browser.js.map b/dist/ethers.js/src.ts/utils/geturl-browser.js.map new file mode 100644 index 0000000..958bc01 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/geturl-browser.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAAqC;AA6BrC,2EAA2E;AAE3E,SAAgB,YAAY,CAAC,OAA6B;IAEtD,SAAe,MAAM,CAAC,GAAiB,EAAE,OAA2B;;YAChE,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;YAErD,IAAA,kBAAM,EAAC,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,OAAO,EAAE,wBAAyB,QAAS,EAAE,EAAE,uBAAuB,EAAE;gBAC/G,IAAI,EAAE,EAAE,QAAQ,EAAE;gBAClB,SAAS,EAAE,SAAS;aACvB,CAAC,CA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AAU;gBAC9B,OAAO,EAAE,IAAI;aAChB,CAAC;QACN,CAAC;KAAA;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA9CD,oCA8CC;AAED,qDAAqD;AACrD,MAAM,aAAa,GAAoB,YAAY,CAAC,EAAG,CAAC,CAAC;AAEzD,SAAsB,MAAM,CAAC,GAAiB,EAAE,OAA2B;;QACvE,OAAO,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACvC,CAAC;CAAA;AAFD,wBAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl.d.ts b/dist/ethers.js/src.ts/utils/geturl.d.ts new file mode 100644 index 0000000..8d0d978 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl.d.ts @@ -0,0 +1,10 @@ +import type { FetchGetUrlFunc, FetchRequest, FetchCancelSignal, GetUrlResponse } from "./fetch.js"; +/** + * @_ignore: + */ +export declare function createGetUrl(options?: Record): FetchGetUrlFunc; +/** + * @_ignore: + */ +export declare function getUrl(req: FetchRequest, signal?: FetchCancelSignal): Promise; +//# sourceMappingURL=geturl.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl.d.ts.map b/dist/ethers.js/src.ts/utils/geturl.d.ts.map new file mode 100644 index 0000000..7c6de58 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/geturl.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACR,eAAe,EAAE,YAAY,EAAE,iBAAiB,EAAE,cAAc,EACnE,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,eAAe,CA0F3E;AAKD;;GAEG;AACH,wBAAsB,MAAM,CAAC,GAAG,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,cAAc,CAAC,CAEnG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl.js b/dist/ethers.js/src.ts/utils/geturl.js new file mode 100644 index 0000000..5bd2039 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl.js @@ -0,0 +1,115 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getUrl = exports.createGetUrl = void 0; +const http_1 = __importDefault(require("http")); +const https_1 = __importDefault(require("https")); +const zlib_1 = require("zlib"); +const errors_js_1 = require("./errors.js"); +const data_js_1 = require("./data.js"); +/** + * @_ignore: + */ +function createGetUrl(options) { + function getUrl(req, signal) { + return __awaiter(this, void 0, void 0, function* () { + const protocol = req.url.split(":")[0].toLowerCase(); + (0, errors_js_1.assert)(protocol === "http" || protocol === "https", `unsupported protocol ${protocol}`, "UNSUPPORTED_OPERATION", { + info: { protocol }, + operation: "request" + }); + (0, errors_js_1.assert)(protocol === "https" || !req.credentials || req.allowInsecureAuthentication, "insecure authorized connections unsupported", "UNSUPPORTED_OPERATION", { + operation: "request" + }); + const method = req.method; + const headers = Object.assign({}, req.headers); + const reqOptions = { method, headers }; + if (options) { + if (options.agent) { + reqOptions.agent = options.agent; + } + } + const request = ((protocol === "http") ? http_1.default : https_1.default).request(req.url, reqOptions); + request.setTimeout(req.timeout); + const body = req.body; + if (body) { + request.write(Buffer.from(body)); + } + request.end(); + return new Promise((resolve, reject) => { + // @TODO: Node 15 added AbortSignal; once we drop support for + // Node14, we can add that in here too + request.once("response", (resp) => { + const statusCode = resp.statusCode || 0; + const statusMessage = resp.statusMessage || ""; + const headers = Object.keys(resp.headers || {}).reduce((accum, name) => { + let value = resp.headers[name] || ""; + if (Array.isArray(value)) { + value = value.join(", "); + } + accum[name] = value; + return accum; + }, {}); + let body = null; + //resp.setEncoding("utf8"); + resp.on("data", (chunk) => { + if (signal) { + try { + signal.checkSignal(); + } + catch (error) { + return reject(error); + } + } + if (body == null) { + body = chunk; + } + else { + const newBody = new Uint8Array(body.length + chunk.length); + newBody.set(body, 0); + newBody.set(chunk, body.length); + body = newBody; + } + }); + resp.on("end", () => { + if (headers["content-encoding"] === "gzip" && body) { + body = (0, data_js_1.getBytes)((0, zlib_1.gunzipSync)(body)); + } + resolve({ statusCode, statusMessage, headers, body }); + }); + resp.on("error", (error) => { + //@TODO: Should this just return nornal response with a server error? + error.response = { statusCode, statusMessage, headers, body }; + reject(error); + }); + }); + request.on("error", (error) => { reject(error); }); + }); + }); + } + return getUrl; +} +exports.createGetUrl = createGetUrl; +// @TODO: remove in v7; provided for backwards compat +const defaultGetUrl = createGetUrl({}); +/** + * @_ignore: + */ +function getUrl(req, signal) { + return __awaiter(this, void 0, void 0, function* () { + return defaultGetUrl(req, signal); + }); +} +exports.getUrl = getUrl; +//# sourceMappingURL=geturl.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/geturl.js.map b/dist/ethers.js/src.ts/utils/geturl.js.map new file mode 100644 index 0000000..d85fbce --- /dev/null +++ b/dist/ethers.js/src.ts/utils/geturl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/geturl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gDAAwB;AACxB,kDAA0B;AAC1B,+BAAkC;AAElC,2CAAqC;AACrC,uCAAqC;AAM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A0B;;QACtE,OAAO,aAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;IACtC,CAAC;CAAA;AAFD,wBAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/index.d.ts b/dist/ethers.js/src.ts/utils/index.d.ts new file mode 100644 index 0000000..b6d51e0 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/index.d.ts @@ -0,0 +1,30 @@ +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +export { decodeBase58, encodeBase58 } from "./base58.js"; +export { decodeBase64, encodeBase64 } from "./base64.js"; +export { getBytes, getBytesCopy, isHexString, isBytesLike, hexlify, concat, dataLength, dataSlice, stripZerosLeft, zeroPadValue, zeroPadBytes } from "./data.js"; +export { isCallException, isError, assert, assertArgument, assertArgumentCount, assertPrivate, assertNormalize, makeError } from "./errors.js"; +export { EventPayload } from "./events.js"; +export { FetchRequest, FetchResponse, FetchCancelSignal, } from "./fetch.js"; +export { FixedNumber } from "./fixednumber.js"; +export { fromTwos, toTwos, mask, getBigInt, getNumber, getUint, toBigInt, toNumber, toBeHex, toBeArray, toQuantity } from "./maths.js"; +export { resolveProperties, defineProperties } from "./properties.js"; +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +export { formatEther, parseEther, formatUnits, parseUnits } from "./units.js"; +export { toUtf8Bytes, toUtf8CodePoints, toUtf8String, Utf8ErrorFuncs, } from "./utf8.js"; +export { uuidV4 } from "./uuid.js"; +export type { BytesLike } from "./data.js"; +export type { ErrorCode, EthersError, UnknownError, NotImplementedError, UnsupportedOperationError, NetworkError, ServerError, TimeoutError, BadDataError, CancelledError, BufferOverrunError, NumericFaultError, InvalidArgumentError, MissingArgumentError, UnexpectedArgumentError, CallExceptionError, InsufficientFundsError, NonceExpiredError, OffchainFaultError, ReplacementUnderpricedError, TransactionReplacedError, UnconfiguredNameError, ActionRejectedError, CallExceptionAction, CallExceptionTransaction, CodedEthersError } from "./errors.js"; +export type { EventEmitterable, Listener } from "./events.js"; +export type { GetUrlResponse, FetchPreflightFunc, FetchProcessFunc, FetchRetryFunc, FetchGatewayFunc, FetchGetUrlFunc } from "./fetch.js"; +export type { FixedFormat } from "./fixednumber.js"; +export type { BigNumberish, Numeric } from "./maths.js"; +export type { RlpStructuredData, RlpStructuredDataish } from "./rlp.js"; +export type { Utf8ErrorFunc, UnicodeNormalizationForm, Utf8ErrorReason } from "./utf8.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/index.d.ts.map b/dist/ethers.js/src.ts/utils/index.d.ts.map new file mode 100644 index 0000000..46afba7 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EACH,QAAQ,EAAE,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EACxF,cAAc,EAAE,YAAY,EAAE,YAAY,EAC7C,MAAM,WAAW,CAAC;AAEnB,OAAO,EACH,eAAe,EAAE,OAAO,EACxB,MAAM,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EACzF,MAAM,aAAa,CAAA;AAEpB,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACH,YAAY,EAAE,aAAa,EAAE,iBAAiB,GACjD,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,OAAO,EACH,Q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AY,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAExD,YAAY,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAExE,YAAY,EACR,aAAa,EACb,wBAAwB,EACxB,eAAe,EAClB,MAAM,WAAW,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/index.js b/dist/ethers.js/src.ts/utils/index.js new file mode 100644 index 0000000..333cecf --- /dev/null +++ b/dist/ethers.js/src.ts/utils/index.js @@ -0,0 +1,78 @@ +"use strict"; +/** + * There are many simple utilities required to interact with + * Ethereum and to simplify the library, without increasing + * the library dependencies for simple functions. + * + * @_section api/utils:Utilities [about-utils] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUtf8String = exports.toUtf8CodePoints = exports.toUtf8Bytes = exports.parseUnits = exports.formatUnits = exports.parseEther = exports.formatEther = exports.encodeRlp = exports.decodeRlp = exports.defineProperties = exports.resolveProperties = exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.toBigInt = exports.getUint = exports.getNumber = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = exports.FixedNumber = exports.FetchCancelSignal = exports.FetchResponse = exports.FetchRequest = exports.EventPayload = exports.makeError = exports.assertNormalize = exports.assertPrivate = exports.assertArgumentCount = exports.assertArgument = exports.assert = exports.isError = exports.isCallException = exports.zeroPadBytes = exports.zeroPadValue = exports.stripZerosLeft = exports.dataSlice = exports.dataLength = exports.concat = exports.hexlify = exports.isBytesLike = exports.isHexString = exports.getBytesCopy = exports.getBytes = exports.encodeBase64 = exports.decodeBase64 = exports.encodeBase58 = exports.decodeBase58 = void 0; +exports.uuidV4 = exports.Utf8ErrorFuncs = void 0; +var base58_js_1 = require("./base58.js"); +Object.defineProperty(exports, "decodeBase58", { enumerable: true, get: function () { return base58_js_1.decodeBase58; } }); +Object.defineProperty(exports, "encodeBase58", { enumerable: true, get: function () { return base58_js_1.encodeBase58; } }); +var base64_js_1 = require("./base64.js"); +Object.defineProperty(exports, "decodeBase64", { enumerable: true, get: function () { return base64_js_1.decodeBase64; } }); +Object.defineProperty(exports, "encodeBase64", { enumerable: true, get: function () { return base64_js_1.encodeBase64; } }); +var data_js_1 = require("./data.js"); +Object.defineProperty(exports, "getBytes", { enumerable: true, get: function () { return data_js_1.getBytes; } }); +Object.defineProperty(exports, "getBytesCopy", { enumerable: true, get: function () { return data_js_1.getBytesCopy; } }); +Object.defineProperty(exports, "isHexString", { enumerable: true, get: function () { return data_js_1.isHexString; } }); +Object.defineProperty(exports, "isBytesLike", { enumerable: true, get: function () { return data_js_1.isBytesLike; } }); +Object.defineProperty(exports, "hexlify", { enumerable: true, get: function () { return data_js_1.hexlify; } }); +Object.defineProperty(exports, "concat", { enumerable: true, get: function () { return data_js_1.concat; } }); +Object.defineProperty(exports, "dataLength", { enumerable: true, get: function () { return data_js_1.dataLength; } }); +Object.defineProperty(exports, "dataSlice", { enumerable: true, get: function () { return data_js_1.dataSlice; } }); +Object.defineProperty(exports, "stripZerosLeft", { enumerable: true, get: function () { return data_js_1.stripZerosLeft; } }); +Object.defineProperty(exports, "zeroPadValue", { enumerable: true, get: function () { return data_js_1.zeroPadValue; } }); +Object.defineProperty(exports, "zeroPadBytes", { enumerable: true, get: function () { return data_js_1.zeroPadBytes; } }); +var errors_js_1 = require("./errors.js"); +Object.defineProperty(exports, "isCallException", { enumerable: true, get: function () { return errors_js_1.isCallException; } }); +Object.defineProperty(exports, "isError", { enumerable: true, get: function () { return errors_js_1.isError; } }); +Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errors_js_1.assert; } }); +Object.defineProperty(exports, "assertArgument", { enumerable: true, get: function () { return errors_js_1.assertArgument; } }); +Object.defineProperty(exports, "assertArgumentCount", { enumerable: true, get: function () { return errors_js_1.assertArgumentCount; } }); +Object.defineProperty(exports, "assertPrivate", { enumerable: true, get: function () { return errors_js_1.assertPrivate; } }); +Object.defineProperty(exports, "assertNormalize", { enumerable: true, get: function () { return errors_js_1.assertNormalize; } }); +Object.defineProperty(exports, "makeError", { enumerable: true, get: function () { return errors_js_1.makeError; } }); +var events_js_1 = require("./events.js"); +Object.defineProperty(exports, "EventPayload", { enumerable: true, get: function () { return events_js_1.EventPayload; } }); +var fetch_js_1 = require("./fetch.js"); +Object.defineProperty(exports, "FetchRequest", { enumerable: true, get: function () { return fetch_js_1.FetchRequest; } }); +Object.defineProperty(exports, "FetchResponse", { enumerable: true, get: function () { return fetch_js_1.FetchResponse; } }); +Object.defineProperty(exports, "FetchCancelSignal", { enumerable: true, get: function () { return fetch_js_1.FetchCancelSignal; } }); +var fixednumber_js_1 = require("./fixednumber.js"); +Object.defineProperty(exports, "FixedNumber", { enumerable: true, get: function () { return fixednumber_js_1.FixedNumber; } }); +var maths_js_1 = require("./maths.js"); +Object.defineProperty(exports, "fromTwos", { enumerable: true, get: function () { return maths_js_1.fromTwos; } }); +Object.defineProperty(exports, "toTwos", { enumerable: true, get: function () { return maths_js_1.toTwos; } }); +Object.defineProperty(exports, "mask", { enumerable: true, get: function () { return maths_js_1.mask; } }); +Object.defineProperty(exports, "getBigInt", { enumerable: true, get: function () { return maths_js_1.getBigInt; } }); +Object.defineProperty(exports, "getNumber", { enumerable: true, get: function () { return maths_js_1.getNumber; } }); +Object.defineProperty(exports, "getUint", { enumerable: true, get: function () { return maths_js_1.getUint; } }); +Object.defineProperty(exports, "toBigInt", { enumerable: true, get: function () { return maths_js_1.toBigInt; } }); +Object.defineProperty(exports, "toNumber", { enumerable: true, get: function () { return maths_js_1.toNumber; } }); +Object.defineProperty(exports, "toBeHex", { enumerable: true, get: function () { return maths_js_1.toBeHex; } }); +Object.defineProperty(exports, "toBeArray", { enumerable: true, get: function () { return maths_js_1.toBeArray; } }); +Object.defineProperty(exports, "toQuantity", { enumerable: true, get: function () { return maths_js_1.toQuantity; } }); +var properties_js_1 = require("./properties.js"); +Object.defineProperty(exports, "resolveProperties", { enumerable: true, get: function () { return properties_js_1.resolveProperties; } }); +Object.defineProperty(exports, "defineProperties", { enumerable: true, get: function () { return properties_js_1.defineProperties; } }); +var rlp_decode_js_1 = require("./rlp-decode.js"); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); +var rlp_encode_js_1 = require("./rlp-encode.js"); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); +var units_js_1 = require("./units.js"); +Object.defineProperty(exports, "formatEther", { enumerable: true, get: function () { return units_js_1.formatEther; } }); +Object.defineProperty(exports, "parseEther", { enumerable: true, get: function () { return units_js_1.parseEther; } }); +Object.defineProperty(exports, "formatUnits", { enumerable: true, get: function () { return units_js_1.formatUnits; } }); +Object.defineProperty(exports, "parseUnits", { enumerable: true, get: function () { return units_js_1.parseUnits; } }); +var utf8_js_1 = require("./utf8.js"); +Object.defineProperty(exports, "toUtf8Bytes", { enumerable: true, get: function () { return utf8_js_1.toUtf8Bytes; } }); +Object.defineProperty(exports, "toUtf8CodePoints", { enumerable: true, get: function () { return utf8_js_1.toUtf8CodePoints; } }); +Object.defineProperty(exports, "toUtf8String", { enumerable: true, get: function () { return utf8_js_1.toUtf8String; } }); +Object.defineProperty(exports, "Utf8ErrorFuncs", { enumerable: true, get: function () { return utf8_js_1.Utf8ErrorFuncs; } }); +var uuid_js_1 = require("./uuid.js"); +Object.defineProperty(exports, "uuidV4", { enumerable: true, get: function () { return uuid_js_1.uuidV4; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/index.js.map b/dist/ethers.js/src.ts/utils/index.js.map new file mode 100644 index 0000000..4909a2c --- /dev/null +++ b/dist/ethers.js/src.ts/utils/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;AAEH,yCAAyD;AAAhD,yGAAA,YAAY,OAAA;AAAE,yGA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B,uCAA8E;AAArE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,sGAAA,UAAU,OAAA;AAEzD,qCAMmB;AALf,sGAAA,WAAW,OAAA;AACX,2GAAA,gBAAgB,OAAA;AAChB,uGAAA,YAAY,OAAA;AAEZ,yGAAA,cAAc,OAAA;AAGlB,qCAAmC;AAA1B,iGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/maths.d.ts b/dist/ethers.js/src.ts/utils/maths.d.ts new file mode 100644 index 0000000..661f0df --- /dev/null +++ b/dist/ethers.js/src.ts/utils/maths.d.ts @@ -0,0 +1,66 @@ +import type { BytesLike } from "./data.js"; +/** + * Any type that can be used where a numeric value is needed. + */ +export type Numeric = number | bigint; +/** + * Any type that can be used where a big number is needed. + */ +export type BigNumberish = string | Numeric; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +export declare function fromTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +export declare function toTwos(_value: BigNumberish, _width: Numeric): bigint; +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +export declare function mask(_value: BigNumberish, _bits: Numeric): bigint; +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getBigInt(value: BigNumberish, name?: string): bigint; +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +export declare function getUint(value: BigNumberish, name?: string): bigint; +export declare function toBigInt(value: BigNumberish | Uint8Array): bigint; +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +export declare function getNumber(value: BigNumberish, name?: string): number; +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +export declare function toNumber(value: BigNumberish | Uint8Array): number; +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +export declare function toBeHex(_value: BigNumberish, _width?: Numeric): string; +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +export declare function toBeArray(_value: BigNumberish): Uint8Array; +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +export declare function toQuantity(value: BytesLike | BigNumberish): string; +//# sourceMappingURL=maths.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/maths.d.ts.map b/dist/ethers.js/src.ts/utils/maths.d.ts.map new file mode 100644 index 0000000..eea71c6 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/maths.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"maths.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/maths.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;AAEtC;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAY5C;;;;;GAKG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAetE;AAED;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,GAAG,MAAM,CAoBpE;AAED;;GAEG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,YAAY,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAIjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAmBpE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAMlE;AAQD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAWjE;AAED;;;GAGG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAkBpE;AAGD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,YAAY,GAAG,UAAU,GAAG,MAAM,CAEjE;AAED;;;GAGG;AACH,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,CAAC,EAAE,OAAO,GAAG,MAAM,CAsBtE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAe1D;AAED;;;;;;GAMG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,CAKlE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/maths.js b/dist/ethers.js/src.ts/utils/maths.js new file mode 100644 index 0000000..6ceb9fb --- /dev/null +++ b/dist/ethers.js/src.ts/utils/maths.js @@ -0,0 +1,229 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toQuantity = exports.toBeArray = exports.toBeHex = exports.toNumber = exports.getNumber = exports.toBigInt = exports.getUint = exports.getBigInt = exports.mask = exports.toTwos = exports.fromTwos = void 0; +/** + * Some mathematic operations. + * + * @_subsection: api/utils:Math Helpers [about-maths] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const BN_0 = BigInt(0); +const BN_1 = BigInt(1); +//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1; +// IEEE 754 support 53-bits of mantissa +const maxValue = 0x1fffffffffffff; +/** + * Convert %%value%% from a twos-compliment representation of %%width%% + * bits to its value. + * + * If the highest bit is ``1``, the result will be negative. + */ +function fromTwos(_value, _width) { + const value = getUint(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + (0, errors_js_1.assert)((value >> width) === BN_0, "overflow", "NUMERIC_FAULT", { + operation: "fromTwos", fault: "overflow", value: _value + }); + // Top bit set; treat as a negative value + if (value >> (width - BN_1)) { + const mask = (BN_1 << width) - BN_1; + return -(((~value) & mask) + BN_1); + } + return value; +} +exports.fromTwos = fromTwos; +/** + * Convert %%value%% to a twos-compliment representation of + * %%width%% bits. + * + * The result will always be positive. + */ +function toTwos(_value, _width) { + let value = getBigInt(_value, "value"); + const width = BigInt(getNumber(_width, "width")); + const limit = (BN_1 << (width - BN_1)); + if (value < BN_0) { + value = -value; + (0, errors_js_1.assert)(value <= limit, "too low", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + const mask = (BN_1 << width) - BN_1; + return ((~value) & mask) + BN_1; + } + else { + (0, errors_js_1.assert)(value < limit, "too high", "NUMERIC_FAULT", { + operation: "toTwos", fault: "overflow", value: _value + }); + } + return value; +} +exports.toTwos = toTwos; +/** + * Mask %%value%% with a bitmask of %%bits%% ones. + */ +function mask(_value, _bits) { + const value = getUint(_value, "value"); + const bits = BigInt(getNumber(_bits, "bits")); + return value & ((BN_1 << bits) - BN_1); +} +exports.mask = mask; +/** + * Gets a BigInt from %%value%%. If it is an invalid value for + * a BigInt, then an ArgumentError will be thrown for %%name%%. + */ +function getBigInt(value, name) { + switch (typeof (value)) { + case "bigint": return value; + case "number": + (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return BigInt(value); + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + if (value[0] === "-" && value[1] !== "-") { + return -BigInt(value.substring(1)); + } + return BigInt(value); + } + catch (e) { + (0, errors_js_1.assertArgument)(false, `invalid BigNumberish string: ${e.message}`, name || "value", value); + } + } + (0, errors_js_1.assertArgument)(false, "invalid BigNumberish value", name || "value", value); +} +exports.getBigInt = getBigInt; +/** + * Returns %%value%% as a bigint, validating it is valid as a bigint + * value and that it is positive. + */ +function getUint(value, name) { + const result = getBigInt(value, name); + (0, errors_js_1.assert)(result >= BN_0, "unsigned value cannot be negative", "NUMERIC_FAULT", { + fault: "overflow", operation: "getUint", value + }); + return result; +} +exports.getUint = getUint; +const Nibbles = "0123456789abcdef"; +/* + * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. + */ +function toBigInt(value) { + if (value instanceof Uint8Array) { + let result = "0x0"; + for (const v of value) { + result += Nibbles[v >> 4]; + result += Nibbles[v & 0x0f]; + } + return BigInt(result); + } + return getBigInt(value); +} +exports.toBigInt = toBigInt; +/** + * Gets a //number// from %%value%%. If it is an invalid value for + * a //number//, then an ArgumentError will be thrown for %%name%%. + */ +function getNumber(value, name) { + switch (typeof (value)) { + case "bigint": + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return Number(value); + case "number": + (0, errors_js_1.assertArgument)(Number.isInteger(value), "underflow", name || "value", value); + (0, errors_js_1.assertArgument)(value >= -maxValue && value <= maxValue, "overflow", name || "value", value); + return value; + case "string": + try { + if (value === "") { + throw new Error("empty string"); + } + return getNumber(BigInt(value), name); + } + catch (e) { + (0, errors_js_1.assertArgument)(false, `invalid numeric string: ${e.message}`, name || "value", value); + } + } + (0, errors_js_1.assertArgument)(false, "invalid numeric value", name || "value", value); +} +exports.getNumber = getNumber; +/** + * Converts %%value%% to a number. If %%value%% is a Uint8Array, it + * is treated as Big Endian data. Throws if the value is not safe. + */ +function toNumber(value) { + return getNumber(toBigInt(value)); +} +exports.toNumber = toNumber; +/** + * Converts %%value%% to a Big Endian hexstring, optionally padded to + * %%width%% bytes. + */ +function toBeHex(_value, _width) { + const value = getUint(_value, "value"); + let result = value.toString(16); + if (_width == null) { + // Ensure the value is of even length + if (result.length % 2) { + result = "0" + result; + } + } + else { + const width = getNumber(_width, "width"); + (0, errors_js_1.assert)(width * 2 >= result.length, `value exceeds width (${width} bytes)`, "NUMERIC_FAULT", { + operation: "toBeHex", + fault: "overflow", + value: _value + }); + // Pad the value to the required width + while (result.length < (width * 2)) { + result = "0" + result; + } + } + return "0x" + result; +} +exports.toBeHex = toBeHex; +/** + * Converts %%value%% to a Big Endian Uint8Array. + */ +function toBeArray(_value) { + const value = getUint(_value, "value"); + if (value === BN_0) { + return new Uint8Array([]); + } + let hex = value.toString(16); + if (hex.length % 2) { + hex = "0" + hex; + } + const result = new Uint8Array(hex.length / 2); + for (let i = 0; i < result.length; i++) { + const offset = i * 2; + result[i] = parseInt(hex.substring(offset, offset + 2), 16); + } + return result; +} +exports.toBeArray = toBeArray; +/** + * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//. + * + * A //Quantity// does not have and leading 0 values unless the value is + * the literal value `0x0`. This is most commonly used for JSSON-RPC + * numeric values. + */ +function toQuantity(value) { + let result = (0, data_js_1.hexlify)((0, data_js_1.isBytesLike)(value) ? value : toBeArray(value)).substring(2); + while (result.startsWith("0")) { + result = result.substring(1); + } + if (result === "") { + result = "0"; + } + return "0x" + result; +} +exports.toQuantity = toQuantity; +//# sourceMappingURL=maths.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/maths.js.map b/dist/ethers.js/src.ts/utils/maths.js.map new file mode 100644 index 0000000..cc5092d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/maths.js.map @@ -0,0 +1 @@ +{"version":3,"file":"maths.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/maths.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAAiD;AACjD,2CAAqD;AAerD,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AACvB,MAAM,IAAI,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;AAEvB,iDAAiD;AAGjD,uCAAuC;AACvC,MAAM,QAAQ,G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GAAG,CAAC,EAAE;QAAE,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;KAAE;IAExC,MAAM,MAAM,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAC9C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QACpC,MAAM,MAAM,GAAG,CAAC,GAAG,CAAC,CAAC;QACrB,MAAM,CAAC,CAAC,CAAC,GAAG,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;KAC/D;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAfD,8BAeC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,KAA+B;IACtD,IAAI,MAAM,GAAG,IAAA,iBAAO,EAAC,IAAA,qBAAW,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAA,CAAC,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;IAChF,OAAO,MAAM,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;KAAE;IAChE,IAAI,MAAM,KAAK,EAAE,EAAE;QAAE,MAAM,GAAG,GAAG,CAAC;KAAE;IACpC,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;AALD,gCAKC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/properties.d.ts b/dist/ethers.js/src.ts/utils/properties.d.ts new file mode 100644 index 0000000..9f0daad --- /dev/null +++ b/dist/ethers.js/src.ts/utils/properties.d.ts @@ -0,0 +1,23 @@ +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +export declare function resolveProperties(value: { + [P in keyof T]: T[P] | Promise; +}): Promise; +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +export declare function defineProperties(target: T, values: { + [K in keyof T]?: T[K]; +}, types?: { + [K in keyof T]?: string; +}): void; +//# sourceMappingURL=properties.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/properties.d.ts.map b/dist/ethers.js/src.ts/utils/properties.d.ts.map new file mode 100644 index 0000000..f483f66 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/properties.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/properties.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAwBH;;;GAGG;AACH,wBAAsB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAOvG;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EACjC,MAAM,EAAE,CAAC,EACT,MAAM,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;CAAE,EACnC,KAAK,CAAC,EAAE;KAAI,CAAC,IAAI,MAAM,CAAC,CAAE,CAAC,EAAE,MAAM;CAAE,GAAG,IAAI,CAU5C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/properties.js b/dist/ethers.js/src.ts/utils/properties.js new file mode 100644 index 0000000..163b5c1 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/properties.js @@ -0,0 +1,70 @@ +"use strict"; +/** + * Property helper functions. + * + * @_subsection api/utils:Properties [about-properties] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.defineProperties = exports.resolveProperties = void 0; +function checkType(value, type, name) { + const types = type.split("|").map(t => t.trim()); + for (let i = 0; i < types.length; i++) { + switch (type) { + case "any": + return; + case "bigint": + case "boolean": + case "number": + case "string": + if (typeof (value) === type) { + return; + } + } + } + const error = new Error(`invalid value for type ${type}`); + error.code = "INVALID_ARGUMENT"; + error.argument = `value.${name}`; + error.value = value; + throw error; +} +/** + * Resolves to a new object that is a copy of %%value%%, but with all + * values resolved. + */ +function resolveProperties(value) { + return __awaiter(this, void 0, void 0, function* () { + const keys = Object.keys(value); + const results = yield Promise.all(keys.map((k) => Promise.resolve(value[k]))); + return results.reduce((accum, v, index) => { + accum[keys[index]] = v; + return accum; + }, {}); + }); +} +exports.resolveProperties = resolveProperties; +/** + * Assigns the %%values%% to %%target%% as read-only values. + * + * It %%types%% is specified, the values are checked. + */ +function defineProperties(target, values, types) { + for (let key in values) { + let value = values[key]; + const type = (types ? types[key] : null); + if (type) { + checkType(value, type, key); + } + Object.defineProperty(target, key, { enumerable: true, value, writable: false }); + } +} +exports.defineProperties = defineProperties; +//# sourceMappingURL=properties.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/properties.js.map b/dist/ethers.js/src.ts/utils/properties.js.map new file mode 100644 index 0000000..9731303 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/properties.js.map @@ -0,0 +1 @@ +{"version":3,"file":"properties.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/properties.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;;;;;;;;;;AAEH,SAA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C;QACjB,CAAC,EAA6B,EAAG,CAAC,CAAC;IACvC,CAAC;CAAA;AAPD,8CAOC;AAED;;;;GAIG;AACH,SAAgB,gBAAgB,CAC/B,MAAS,EACT,MAAmC,EACnC,KAAqC;IAElC,KAAK,IAAI,GAAG,IAAI,MAAM,EAAE;QACpB,IAAI,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;QAExB,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,IAAI,CAAC,CAAC;QACxC,IAAI,IAAI,EAAE;YAAE,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;SAAE;QAE1C,MAAM,CAAC,cAAc,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,UAAU,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC;KACpF;AACL,CAAC;AAbD,4CAaC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-decode.d.ts b/dist/ethers.js/src.ts/utils/rlp-decode.d.ts new file mode 100644 index 0000000..b77b08b --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-decode.d.ts @@ -0,0 +1,6 @@ +import type { BytesLike, RlpStructuredData } from "./index.js"; +/** + * Decodes %%data%% into the structured data it represents. + */ +export declare function decodeRlp(_data: BytesLike): RlpStructuredData; +//# sourceMappingURL=rlp-decode.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-decode.d.ts.map b/dist/ethers.js/src.ts/utils/rlp-decode.d.ts.map new file mode 100644 index 0000000..1edbe9d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-decode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp-decode.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAwF/D;;GAEG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,iBAAiB,CAK7D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-decode.js b/dist/ethers.js/src.ts/utils/rlp-decode.js new file mode 100644 index 0000000..9d3c3b7 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-decode.js @@ -0,0 +1,83 @@ +"use strict"; +//See: https://github.com/ethereum/wiki/wiki/RLP +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeRlp = void 0; +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +const data_js_2 = require("./data.js"); +function hexlifyByte(value) { + let result = value.toString(16); + while (result.length < 2) { + result = "0" + result; + } + return "0x" + result; +} +function unarrayifyInteger(data, offset, length) { + let result = 0; + for (let i = 0; i < length; i++) { + result = (result * 256) + data[offset + i]; + } + return result; +} +function _decodeChildren(data, offset, childOffset, length) { + const result = []; + while (childOffset < offset + 1 + length) { + const decoded = _decode(data, childOffset); + result.push(decoded.result); + childOffset += decoded.consumed; + (0, errors_js_1.assert)(childOffset <= offset + 1 + length, "child data too short", "BUFFER_OVERRUN", { + buffer: data, length, offset + }); + } + return { consumed: (1 + length), result: result }; +} +// returns { consumed: number, result: Object } +function _decode(data, offset) { + (0, errors_js_1.assert)(data.length !== 0, "data too short", "BUFFER_OVERRUN", { + buffer: data, length: 0, offset: 1 + }); + const checkOffset = (offset) => { + (0, errors_js_1.assert)(offset <= data.length, "data short segment too short", "BUFFER_OVERRUN", { + buffer: data, length: data.length, offset + }); + }; + // Array with extra length prefix + if (data[offset] >= 0xf8) { + const lengthLength = data[offset] - 0xf7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + return _decodeChildren(data, offset, offset + 1 + lengthLength, lengthLength + length); + } + else if (data[offset] >= 0xc0) { + const length = data[offset] - 0xc0; + checkOffset(offset + 1 + length); + return _decodeChildren(data, offset, offset + 1, length); + } + else if (data[offset] >= 0xb8) { + const lengthLength = data[offset] - 0xb7; + checkOffset(offset + 1 + lengthLength); + const length = unarrayifyInteger(data, offset + 1, lengthLength); + checkOffset(offset + 1 + lengthLength + length); + const result = (0, data_js_1.hexlify)(data.slice(offset + 1 + lengthLength, offset + 1 + lengthLength + length)); + return { consumed: (1 + lengthLength + length), result: result }; + } + else if (data[offset] >= 0x80) { + const length = data[offset] - 0x80; + checkOffset(offset + 1 + length); + const result = (0, data_js_1.hexlify)(data.slice(offset + 1, offset + 1 + length)); + return { consumed: (1 + length), result: result }; + } + return { consumed: 1, result: hexlifyByte(data[offset]) }; +} +/** + * Decodes %%data%% into the structured data it represents. + */ +function decodeRlp(_data) { + const data = (0, data_js_2.getBytes)(_data, "data"); + const decoded = _decode(data, 0); + (0, errors_js_1.assertArgument)(decoded.consumed === data.length, "unexpected junk after rlp payload", "data", _data); + return decoded.result; +} +exports.decodeRlp = decodeRlp; +//# sourceMappingURL=rlp-decode.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-decode.js.map b/dist/ethers.js/src.ts/utils/rlp-decode.js.map new file mode 100644 index 0000000..e647e86 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-decode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-decode.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp-decode.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAEhD,uCAAoC;AACpC,2CAAqD;AACrD,uCAAqC;AAKrC,SAAS,WAAW,CAAC,KAAa;IAC9B,IAAI,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAChC,OAAO,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE;QAAE,MAAM,GAAG,GAAG,GAAG,MAAM,CAAC;KAAE;IACpD,OAAO,IAAI,GAAG,MAAM,CAAC;AACzB,CAAC;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AM,CAAC;AAC1B,CAAC;AALD,8BAKC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-encode.d.ts b/dist/ethers.js/src.ts/utils/rlp-encode.d.ts new file mode 100644 index 0000000..089b1c3 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-encode.d.ts @@ -0,0 +1,6 @@ +import type { RlpStructuredDataish } from "./rlp.js"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +export declare function encodeRlp(object: RlpStructuredDataish): string; +//# sourceMappingURL=rlp-encode.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-encode.d.ts.map b/dist/ethers.js/src.ts/utils/rlp-encode.d.ts.map new file mode 100644 index 0000000..9face6d --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-encode.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-encode.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp-encode.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAiDrD;;GAEG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAO9D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-encode.js b/dist/ethers.js/src.ts/utils/rlp-encode.js new file mode 100644 index 0000000..77cf3c5 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-encode.js @@ -0,0 +1,53 @@ +"use strict"; +//See: https://github.com/ethereum/wiki/wiki/RLP +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeRlp = void 0; +const data_js_1 = require("./data.js"); +function arrayifyInteger(value) { + const result = []; + while (value) { + result.unshift(value & 0xff); + value >>= 8; + } + return result; +} +function _encode(object) { + if (Array.isArray(object)) { + let payload = []; + object.forEach(function (child) { + payload = payload.concat(_encode(child)); + }); + if (payload.length <= 55) { + payload.unshift(0xc0 + payload.length); + return payload; + } + const length = arrayifyInteger(payload.length); + length.unshift(0xf7 + length.length); + return length.concat(payload); + } + const data = Array.prototype.slice.call((0, data_js_1.getBytes)(object, "object")); + if (data.length === 1 && data[0] <= 0x7f) { + return data; + } + else if (data.length <= 55) { + data.unshift(0x80 + data.length); + return data; + } + const length = arrayifyInteger(data.length); + length.unshift(0xb7 + length.length); + return length.concat(data); +} +const nibbles = "0123456789abcdef"; +/** + * Encodes %%object%% as an RLP-encoded [[DataHexString]]. + */ +function encodeRlp(object) { + let result = "0x"; + for (const v of _encode(object)) { + result += nibbles[v >> 4]; + result += nibbles[v & 0xf]; + } + return result; +} +exports.encodeRlp = encodeRlp; +//# sourceMappingURL=rlp-encode.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp-encode.js.map b/dist/ethers.js/src.ts/utils/rlp-encode.js.map new file mode 100644 index 0000000..f3a34a8 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp-encode.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp-encode.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp-encode.ts"],"names":[],"mappings":";AAAA,gDAAgD;;;AAEhD,uCAAqC;AAKrC,SAAS,eAAe,CAAC,KAAa;IAClC,MAAM,MAAM,GAAkB,EAAE,CAAC;IACjC,OAAO,KAAK,EAAE;QACV,MAAM,CAAC,OAAO,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;QAC7B,KAAK,KAAK,CAAC,CAAC;KACf;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAS,OAAO,CAAC,MAAwC;IACrD,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE;QACvB,IAAI,OAAO,GAAkB,EAAE,CAAC;QAChC,MAAM,CAAC,OAAO,CAAC,UAAS,KAAK;YACzB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAC7C,CAAC,CAAC,CAAC;QAEH,IAAI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AAG,CAAC,CAAC;KAC9B;IACD,OAAO,MAAM,CAAC;AAClB,CAAC;AAPD,8BAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp.d.ts b/dist/ethers.js/src.ts/utils/rlp.d.ts new file mode 100644 index 0000000..bdc7e82 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp.d.ts @@ -0,0 +1,17 @@ +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +export { decodeRlp } from "./rlp-decode.js"; +export { encodeRlp } from "./rlp-encode.js"; +/** + * An RLP-encoded structure. + */ +export type RlpStructuredData = string | Array; +/** + * An RLP-encoded structure, which allows Uint8Array. + */ +export type RlpStructuredDataish = string | Uint8Array | Array; +//# sourceMappingURL=rlp.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp.d.ts.map b/dist/ethers.js/src.ts/utils/rlp.d.ts.map new file mode 100644 index 0000000..f2efa0a --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,UAAU,GAAG,KAAK,CAAC,oBAAoB,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp.js b/dist/ethers.js/src.ts/utils/rlp.js new file mode 100644 index 0000000..0952606 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp.js @@ -0,0 +1,14 @@ +"use strict"; +/** + * The [[link-rlp]] (RLP) encoding is used throughout Ethereum + * to serialize nested structures of Arrays and data. + * + * @_subsection api/utils:Recursive-Length Prefix [about-rlp] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeRlp = exports.decodeRlp = void 0; +var rlp_decode_js_1 = require("./rlp-decode.js"); +Object.defineProperty(exports, "decodeRlp", { enumerable: true, get: function () { return rlp_decode_js_1.decodeRlp; } }); +var rlp_encode_js_1 = require("./rlp-encode.js"); +Object.defineProperty(exports, "encodeRlp", { enumerable: true, get: function () { return rlp_encode_js_1.encodeRlp; } }); +//# sourceMappingURL=rlp.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/rlp.js.map b/dist/ethers.js/src.ts/utils/rlp.js.map new file mode 100644 index 0000000..e3f89fc --- /dev/null +++ b/dist/ethers.js/src.ts/utils/rlp.js.map @@ -0,0 +1 @@ +{"version":3,"file":"rlp.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/rlp.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEH,iDAA4C;AAAnC,0GAAA,SAAS,OAAA;AAClB,iDAA4C;AAAnC,0GAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/units.d.ts b/dist/ethers.js/src.ts/utils/units.d.ts new file mode 100644 index 0000000..7f6ce17 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/units.d.ts @@ -0,0 +1,24 @@ +import type { BigNumberish, Numeric } from "../utils/index.js"; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +export declare function formatUnits(value: BigNumberish, unit?: string | Numeric): string; +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +export declare function parseUnits(value: string, unit?: string | Numeric): bigint; +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +export declare function formatEther(wei: BigNumberish): string; +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +export declare function parseEther(ether: string): bigint; +//# sourceMappingURL=units.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/units.d.ts.map b/dist/ethers.js/src.ts/utils/units.d.ts.map new file mode 100644 index 0000000..062fa8e --- /dev/null +++ b/dist/ethers.js/src.ts/utils/units.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"units.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/units.ts"],"names":[],"mappings":"AAyBA,OAAO,KAAK,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAa/D;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAWhF;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,GAAG,MAAM,CAazE;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,CAErD;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEhD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/units.js b/dist/ethers.js/src.ts/utils/units.js new file mode 100644 index 0000000..fe2c898 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/units.js @@ -0,0 +1,90 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.parseEther = exports.formatEther = exports.parseUnits = exports.formatUnits = void 0; +/** + * Most interactions with Ethereum requires integer values, which use + * the smallest magnitude unit. + * + * For example, imagine dealing with dollars and cents. Since dollars + * are divisible, non-integer values are possible, such as ``$10.77``. + * By using the smallest indivisible unit (i.e. cents), the value can + * be kept as the integer ``1077``. + * + * When receiving decimal input from the user (as a decimal string), + * the value should be converted to an integer and when showing a user + * a value, the integer value should be converted to a decimal string. + * + * This creates a clear distinction, between values to be used by code + * (integers) and values used for display logic to users (decimals). + * + * The native unit in Ethereum, //ether// is divisible to 18 decimal places, + * where each individual unit is called a //wei//. + * + * @_subsection api/utils:Unit Conversion [about-units] + */ +const errors_js_1 = require("./errors.js"); +const fixednumber_js_1 = require("./fixednumber.js"); +const maths_js_1 = require("./maths.js"); +const names = [ + "wei", + "kwei", + "mwei", + "gwei", + "szabo", + "finney", + "ether", +]; +/** + * Converts %%value%% into a //decimal string//, assuming %%unit%% decimal + * places. The %%unit%% may be the number of decimal places or the name of + * a unit (e.g. ``"gwei"`` for 9 decimal places). + * + */ +function formatUnits(value, unit) { + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = (0, maths_js_1.getNumber)(unit, "unit"); + } + return fixednumber_js_1.FixedNumber.fromValue(value, decimals, { decimals, width: 512 }).toString(); +} +exports.formatUnits = formatUnits; +/** + * Converts the //decimal string// %%value%% to a BigInt, assuming + * %%unit%% decimal places. The %%unit%% may the number of decimal places + * or the name of a unit (e.g. ``"gwei"`` for 9 decimal places). + */ +function parseUnits(value, unit) { + (0, errors_js_1.assertArgument)(typeof (value) === "string", "value must be a string", "value", value); + let decimals = 18; + if (typeof (unit) === "string") { + const index = names.indexOf(unit); + (0, errors_js_1.assertArgument)(index >= 0, "invalid unit", "unit", unit); + decimals = 3 * index; + } + else if (unit != null) { + decimals = (0, maths_js_1.getNumber)(unit, "unit"); + } + return fixednumber_js_1.FixedNumber.fromString(value, { decimals, width: 512 }).value; +} +exports.parseUnits = parseUnits; +/** + * Converts %%value%% into a //decimal string// using 18 decimal places. + */ +function formatEther(wei) { + return formatUnits(wei, 18); +} +exports.formatEther = formatEther; +/** + * Converts the //decimal string// %%ether%% to a BigInt, using 18 + * decimal places. + */ +function parseEther(ether) { + return parseUnits(ether, 18); +} +exports.parseEther = parseEther; +//# sourceMappingURL=units.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/units.js.map b/dist/ethers.js/src.ts/utils/units.js.map new file mode 100644 index 0000000..6690d30 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/units.js.map @@ -0,0 +1 @@ +{"version":3,"file":"units.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/units.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,2CAA6C;AAC7C,qDAA+C;AAC/C,yCAAuC;AAKvC,MAAM,KAAK,GAAG;IACV,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACV,CAAC;AAEF;;;;;GAKG;AACH,SAAgB,WAAW,CAAC,KAAmB,EAAE,IAAuB;IACpE,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAA,0BAAc,EAAC,KAAK,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzD,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;KACxB;SAAM,IAAI,IAAI,IAAI,IAAI,EAAE;QACrB,QAAQ,GAAG,IAAA,oBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACtC;IAED,OAAO,4BAAW,CAAC,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC;AACvF,CAAC;AAXD,kCAWC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,KAAa,EAAE,IAAuB;IAC7D,IAAA,0BAAc,EAAC,OAAM,CAAC,KAAK,CAAC,KAAK,QAAQ,EAAE,wBAAwB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAErF,IAAI,QAAQ,GAAG,EAAE,CAAC;IAClB,IAAI,OAAM,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE;QAC3B,MAAM,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAClC,IAAA,0BAAc,EAAC,KAAK,IAAI,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;QACzD,QAAQ,GAAG,CAAC,GAAG,KAAK,CAAC;KACxB;SAAM,IAAI,IAAI,IAAI,IAAI,EAAE;QACrB,QAAQ,GAAG,IAAA,oBAAS,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;KACtC;IAED,OAAO,4BAAW,CAAC,UAAU,CAAC,KAAK,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC,KAAK,CAAC;AACzE,CAAC;AAbD,gCAaC;AAED;;GAEG;AACH,SAAgB,WAAW,CAAC,GAAiB;IACzC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,UAAU,CAAC,KAAa;IACpC,OAAO,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC;AAFD,gCAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/utf8.d.ts b/dist/ethers.js/src.ts/utils/utf8.d.ts new file mode 100644 index 0000000..7bb87cc --- /dev/null +++ b/dist/ethers.js/src.ts/utils/utf8.d.ts @@ -0,0 +1,96 @@ +import type { BytesLike } from "./index.js"; +/** + * The stanard normalization forms. + */ +export type UnicodeNormalizationForm = "NFC" | "NFD" | "NFKC" | "NFKD"; +/** + * When using the UTF-8 error API the following errors can be intercepted + * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]]. + * + * **``"UNEXPECTED_CONTINUE"``** - a continuation byte was present where there + * was nothing to continue. + * + * **``"BAD_PREFIX"``** - an invalid (non-continuation) byte to start a + * UTF-8 codepoint was found. + * + * **``"OVERRUN"``** - the string is too short to process the expected + * codepoint length. + * + * **``"MISSING_CONTINUE"``** - a missing continuation byte was expected but + * not found. The %%offset%% indicates the index the continuation byte + * was expected at. + * + * **``"OUT_OF_RANGE"``** - the computed code point is outside the range + * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was + * outside the valid UTF-8 range. + * + * **``"UTF16_SURROGATE"``** - the UTF-8 strings contained a UTF-16 surrogate + * pair. The %%badCodepoint%% is the computed codepoint, which was inside the + * UTF-16 surrogate range. + * + * **``"OVERLONG"``** - the string is an overlong representation. The + * %%badCodepoint%% indicates the computed codepoint, which has already + * been bounds checked. + * + * + * @returns string + */ +export type Utf8ErrorReason = "UNEXPECTED_CONTINUE" | "BAD_PREFIX" | "OVERRUN" | "MISSING_CONTINUE" | "OUT_OF_RANGE" | "UTF16_SURROGATE" | "OVERLONG"; +/** + * A callback that can be used with [[toUtf8String]] to analysis or + * recovery from invalid UTF-8 data. + * + * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM) + * which calls the ``Utf8ErrorFunc`` if a fault is detected. + * + * The %%reason%% indicates where in the FSM execution the fault + * occurred and the %%offset%% indicates where the input failed. + * + * The %%bytes%% represents the raw UTF-8 data that was provided and + * %%output%% is the current array of UTF-8 code-points, which may + * be updated by the ``Utf8ErrorFunc``. + * + * The value of the %%badCodepoint%% depends on the %%reason%%. See + * [[Utf8ErrorReason]] for details. + * + * The function should return the number of bytes that should be skipped + * when control resumes to the FSM. + */ +export type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array, badCodepoint?: number) => number; +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +export declare const Utf8ErrorFuncs: Readonly>; +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array; +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +export declare function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string; +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +export declare function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array; +//# sourceMappingURL=utf8.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/utf8.d.ts.map b/dist/ethers.js/src.ts/utils/utf8.d.ts.map new file mode 100644 index 0000000..65c95a6 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/utf8.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/utf8.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAK5C;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,CAAC;AAEvE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,MAAM,MAAM,eAAe,GAAG,qBAAqB,GAAG,YAAY,GAAG,SAAS,GAC1E,kBAAkB,GAAG,cAAc,GAAG,iBAAiB,GAAG,UAAU,CAAC;AAGzE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC,EAAE,MAAM,KAAK,MAAM,CAAC;AA6CjJ;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,cAAc,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,GAAG,QAAQ,GAAG,SAAS,EAAE,aAAa,CAAC,CAIzF,CAAC;AAsGH;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,UAAU,CAwCpF;AAgBD;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,MAAM,CAE9E;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,KAAK,CAAC,MAAM,CAAC,CAE5F"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/utf8.js b/dist/ethers.js/src.ts/utils/utf8.js new file mode 100644 index 0000000..40ddc73 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/utf8.js @@ -0,0 +1,226 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.toUtf8CodePoints = exports.toUtf8String = exports.toUtf8Bytes = exports.Utf8ErrorFuncs = void 0; +/** + * Using strings in Ethereum (or any security-basd system) requires + * additional care. These utilities attempt to mitigate some of the + * safety issues as well as provide the ability to recover and analyse + * strings. + * + * @_subsection api/utils:Strings and UTF-8 [about-strings] + */ +const data_js_1 = require("./data.js"); +const errors_js_1 = require("./errors.js"); +function errorFunc(reason, offset, bytes, output, badCodepoint) { + (0, errors_js_1.assertArgument)(false, `invalid codepoint at offset ${offset}; ${reason}`, "bytes", bytes); +} +function ignoreFunc(reason, offset, bytes, output, badCodepoint) { + // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes + if (reason === "BAD_PREFIX" || reason === "UNEXPECTED_CONTINUE") { + let i = 0; + for (let o = offset + 1; o < bytes.length; o++) { + if (bytes[o] >> 6 !== 0x02) { + break; + } + i++; + } + return i; + } + // This byte runs us past the end of the string, so just jump to the end + // (but the first byte was read already read and therefore skipped) + if (reason === "OVERRUN") { + return bytes.length - offset - 1; + } + // Nothing to skip + return 0; +} +function replaceFunc(reason, offset, bytes, output, badCodepoint) { + // Overlong representations are otherwise "valid" code points; just non-deistingtished + if (reason === "OVERLONG") { + (0, errors_js_1.assertArgument)(typeof (badCodepoint) === "number", "invalid bad code point for replacement", "badCodepoint", badCodepoint); + output.push(badCodepoint); + return 0; + } + // Put the replacement character into the output + output.push(0xfffd); + // Otherwise, process as if ignoring errors + return ignoreFunc(reason, offset, bytes, output, badCodepoint); +} +/** + * A handful of popular, built-in UTF-8 error handling strategies. + * + * **``"error"``** - throws on ANY illegal UTF-8 sequence or + * non-canonical (overlong) codepoints (this is the default) + * + * **``"ignore"``** - silently drops any illegal UTF-8 sequence + * and accepts non-canonical (overlong) codepoints + * + * **``"replace"``** - replace any illegal UTF-8 sequence with the + * UTF-8 replacement character (i.e. ``"\\ufffd"``) and accepts + * non-canonical (overlong) codepoints + * + * @returns: Record<"error" | "ignore" | "replace", Utf8ErrorFunc> + */ +exports.Utf8ErrorFuncs = Object.freeze({ + error: errorFunc, + ignore: ignoreFunc, + replace: replaceFunc +}); +// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499 +function getUtf8CodePoints(_bytes, onError) { + if (onError == null) { + onError = exports.Utf8ErrorFuncs.error; + } + const bytes = (0, data_js_1.getBytes)(_bytes, "bytes"); + const result = []; + let i = 0; + // Invalid bytes are ignored + while (i < bytes.length) { + const c = bytes[i++]; + // 0xxx xxxx + if (c >> 7 === 0) { + result.push(c); + continue; + } + // Multibyte; how many bytes left for this character? + let extraLength = null; + let overlongMask = null; + // 110x xxxx 10xx xxxx + if ((c & 0xe0) === 0xc0) { + extraLength = 1; + overlongMask = 0x7f; + // 1110 xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf0) === 0xe0) { + extraLength = 2; + overlongMask = 0x7ff; + // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx + } + else if ((c & 0xf8) === 0xf0) { + extraLength = 3; + overlongMask = 0xffff; + } + else { + if ((c & 0xc0) === 0x80) { + i += onError("UNEXPECTED_CONTINUE", i - 1, bytes, result); + } + else { + i += onError("BAD_PREFIX", i - 1, bytes, result); + } + continue; + } + // Do we have enough bytes in our data? + if (i - 1 + extraLength >= bytes.length) { + i += onError("OVERRUN", i - 1, bytes, result); + continue; + } + // Remove the length prefix from the char + let res = c & ((1 << (8 - extraLength - 1)) - 1); + for (let j = 0; j < extraLength; j++) { + let nextChar = bytes[i]; + // Invalid continuation byte + if ((nextChar & 0xc0) != 0x80) { + i += onError("MISSING_CONTINUE", i, bytes, result); + res = null; + break; + } + ; + res = (res << 6) | (nextChar & 0x3f); + i++; + } + // See above loop for invalid continuation byte + if (res === null) { + continue; + } + // Maximum code point + if (res > 0x10ffff) { + i += onError("OUT_OF_RANGE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Reserved for UTF-16 surrogate halves + if (res >= 0xd800 && res <= 0xdfff) { + i += onError("UTF16_SURROGATE", i - 1 - extraLength, bytes, result, res); + continue; + } + // Check for overlong sequences (more bytes than needed) + if (res <= overlongMask) { + i += onError("OVERLONG", i - 1 - extraLength, bytes, result, res); + continue; + } + result.push(res); + } + return result; +} +// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array +/** + * Returns the UTF-8 byte representation of %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8Bytes(str, form) { + if (form != null) { + (0, errors_js_1.assertNormalize)(form); + str = str.normalize(form); + } + let result = []; + for (let i = 0; i < str.length; i++) { + const c = str.charCodeAt(i); + if (c < 0x80) { + result.push(c); + } + else if (c < 0x800) { + result.push((c >> 6) | 0xc0); + result.push((c & 0x3f) | 0x80); + } + else if ((c & 0xfc00) == 0xd800) { + i++; + const c2 = str.charCodeAt(i); + (0, errors_js_1.assertArgument)(i < str.length && ((c2 & 0xfc00) === 0xdc00), "invalid surrogate pair", "str", str); + // Surrogate Pair + const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff); + result.push((pair >> 18) | 0xf0); + result.push(((pair >> 12) & 0x3f) | 0x80); + result.push(((pair >> 6) & 0x3f) | 0x80); + result.push((pair & 0x3f) | 0x80); + } + else { + result.push((c >> 12) | 0xe0); + result.push(((c >> 6) & 0x3f) | 0x80); + result.push((c & 0x3f) | 0x80); + } + } + return new Uint8Array(result); +} +exports.toUtf8Bytes = toUtf8Bytes; +; +//export +function _toUtf8String(codePoints) { + return codePoints.map((codePoint) => { + if (codePoint <= 0xffff) { + return String.fromCharCode(codePoint); + } + codePoint -= 0x10000; + return String.fromCharCode((((codePoint >> 10) & 0x3ff) + 0xd800), ((codePoint & 0x3ff) + 0xdc00)); + }).join(""); +} +/** + * Returns the string represented by the UTF-8 data %%bytes%%. + * + * When %%onError%% function is specified, it is called on UTF-8 + * errors allowing recovery using the [[Utf8ErrorFunc]] API. + * (default: [error](Utf8ErrorFuncs)) + */ +function toUtf8String(bytes, onError) { + return _toUtf8String(getUtf8CodePoints(bytes, onError)); +} +exports.toUtf8String = toUtf8String; +/** + * Returns the UTF-8 code-points for %%str%%. + * + * If %%form%% is specified, the string is normalized. + */ +function toUtf8CodePoints(str, form) { + return getUtf8CodePoints(toUtf8Bytes(str, form)); +} +exports.toUtf8CodePoints = toUtf8CodePoints; +//# sourceMappingURL=utf8.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/utf8.js.map b/dist/ethers.js/src.ts/utils/utf8.js.map new file mode 100644 index 0000000..7f06490 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/utf8.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utf8.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/utf8.ts"],"names":[],"mappings":";;;AAAA;;;;;;;GAOG;AACH,uCAAqC;AACrC,2CAA8D;AAuE9D,SAAS,SAAS,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IACvH,IAAA,0BAAc,EAAC,KAAK,EAAE,+BAAgC,MAAO,KAAM,MAAO,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;AAClG,CAAC;AAED,SAAS,UAAU,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IAExH,uGAAuG;IACvG,IAAI,MAAM,KAAK,YAAY,IAAI,MAAM,KAAK,qBAAqB,EAAE;QAC7D,IAAI,CAAC,GAAG,CAAC,CAAC;QACV,KAAK,IAAI,CAAC,GAAG,MAAM,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;YAC5C,IAAI,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE;gBAAE,MAAM;aAAE;YACtC,CAAC,EAAE,CAAC;SACP;QACD,OAAO,CAAC,CAAC;KACZ;IAED,wEAAwE;IACxE,mEAAmE;IACnE,IAAI,MAAM,KAAK,SAAS,EAAE;QACtB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,GAAG,CAAC,CAAC;KACpC;IAED,kBAAkB;IAClB,OAAO,CAAC,CAAC;AACb,CAAC;AAED,SAAS,WAAW,CAAC,MAAuB,EAAE,MAAc,EAAE,KAAiB,EAAE,MAAqB,EAAE,YAAqB;IAEzH,sFAAsF;IACtF,IAAI,MAAM,KAAK,UAAU,EAAE;QACvB,IAAA,0BAAc,EAAC,OAAM,CAAC,YAAY,CAAC,KAAK,QAAQ,E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AACrD,CAAC;AAFD,4CAEC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/uuid.d.ts b/dist/ethers.js/src.ts/utils/uuid.d.ts new file mode 100644 index 0000000..7b74651 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/uuid.d.ts @@ -0,0 +1,8 @@ +import type { BytesLike } from "./index.js"; +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +export declare function uuidV4(randomBytes: BytesLike): string; +//# sourceMappingURL=uuid.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/uuid.d.ts.map b/dist/ethers.js/src.ts/utils/uuid.d.ts.map new file mode 100644 index 0000000..1a2eb38 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/uuid.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/uuid.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAE5C;;;;GAIG;AACH,wBAAgB,MAAM,CAAC,WAAW,EAAE,SAAS,GAAG,MAAM,CAqBrD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/uuid.js b/dist/ethers.js/src.ts/utils/uuid.js new file mode 100644 index 0000000..b02f3b6 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/uuid.js @@ -0,0 +1,34 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.uuidV4 = void 0; +/** + * Explain UUID and link to RFC here. + * + * @_subsection: api/utils:UUID [about-uuid] + */ +const data_js_1 = require("./data.js"); +/** + * Returns the version 4 [[link-uuid]] for the %%randomBytes%%. + * + * @see: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) + */ +function uuidV4(randomBytes) { + const bytes = (0, data_js_1.getBytes)(randomBytes, "randomBytes"); + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + const value = (0, data_js_1.hexlify)(bytes); + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +exports.uuidV4 = uuidV4; +//# sourceMappingURL=uuid.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/utils/uuid.js.map b/dist/ethers.js/src.ts/utils/uuid.js.map new file mode 100644 index 0000000..5414be6 --- /dev/null +++ b/dist/ethers.js/src.ts/utils/uuid.js.map @@ -0,0 +1 @@ +{"version":3,"file":"uuid.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/utils/uuid.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,uCAA8C;AAI9C;;;;GAIG;AACH,SAAgB,MAAM,CAAC,WAAsB;IACzC,MAAM,KAAK,GAAG,IAAA,kBAAQ,EAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IAEnD,kBAAkB;IAClB,wCAAwC;IACxC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,cAAc;IACd,uCAAuC;IACvC,uCAAuC;IACvC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,KAAK,GAAG,IAAA,iBAAO,EAAC,KAAK,CAAC,CAAC;IAE7B,OAAO;QACJ,KAAK,CAAC,SAAS,CAAC,CAAC,EAAE,EAAE,CAAC;QACtB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;QACvB,KAAK,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC;KACzB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAChB,CAAC;AArBD,wBAqBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/base-wallet.d.ts b/dist/ethers.js/src.ts/wallet/base-wallet.d.ts new file mode 100644 index 0000000..f94fb22 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/base-wallet.d.ts @@ -0,0 +1,48 @@ +import { AbstractSigner } from "../providers/index.js"; +import type { SigningKey } from "../crypto/index.js"; +import type { TypedDataDomain, TypedDataField } from "../hash/index.js"; +import type { Provider, TransactionRequest } from "../providers/index.js"; +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +export declare class BaseWallet extends AbstractSigner { + #private; + /** + * The wallet address. + */ + readonly address: string; + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey: SigningKey, provider?: null | Provider); + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey(): SigningKey; + /** + * The private key for this wallet. + */ + get privateKey(): string; + getAddress(): Promise; + connect(provider: null | Provider): BaseWallet; + signTransaction(tx: TransactionRequest): Promise; + signMessage(message: string | Uint8Array): Promise; + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message: string | Uint8Array): string; + signTypedData(domain: TypedDataDomain, types: Record>, value: Record): Promise; +} +//# sourceMappingURL=base-wallet.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/base-wallet.d.ts.map b/dist/ethers.js/src.ts/wallet/base-wallet.d.ts.map new file mode 100644 index 0000000..2e5192f --- /dev/null +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I"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/base-wallet.js b/dist/ethers.js/src.ts/wallet/base-wallet.js new file mode 100644 index 0000000..986325a --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/base-wallet.js @@ -0,0 +1,131 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _BaseWallet_signingKey; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.BaseWallet = void 0; +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../hash/index.js"); +const index_js_3 = require("../providers/index.js"); +const index_js_4 = require("../transaction/index.js"); +const index_js_5 = require("../utils/index.js"); +/** + * The **BaseWallet** is a stream-lined implementation of a + * [[Signer]] that operates with a private key. + * + * It is preferred to use the [[Wallet]] class, as it offers + * additional functionality and simplifies loading a variety + * of JSON formats, Mnemonic Phrases, etc. + * + * This class may be of use for those attempting to implement + * a minimal Signer. + */ +class BaseWallet extends index_js_3.AbstractSigner { + /** + * Creates a new BaseWallet for %%privateKey%%, optionally + * connected to %%provider%%. + * + * If %%provider%% is not specified, only offline methods can + * be used. + */ + constructor(privateKey, provider) { + super(provider); + _BaseWallet_signingKey.set(this, void 0); + (0, index_js_5.assertArgument)(privateKey && typeof (privateKey.sign) === "function", "invalid private key", "privateKey", "[ REDACTED ]"); + __classPrivateFieldSet(this, _BaseWallet_signingKey, privateKey, "f"); + const address = (0, index_js_4.computeAddress)(this.signingKey.publicKey); + (0, index_js_5.defineProperties)(this, { address }); + } + // Store private values behind getters to reduce visibility + // in console.log + /** + * The [[SigningKey]] used for signing payloads. + */ + get signingKey() { return __classPrivateFieldGet(this, _BaseWallet_signingKey, "f"); } + /** + * The private key for this wallet. + */ + get privateKey() { return this.signingKey.privateKey; } + getAddress() { + return __awaiter(this, void 0, void 0, function* () { return this.address; }); + } + connect(provider) { + return new BaseWallet(__classPrivateFieldGet(this, _BaseWallet_signingKey, "f"), provider); + } + signTransaction(tx) { + return __awaiter(this, void 0, void 0, function* () { + // Replace any Addressable or ENS name with an address + const { to, from } = yield (0, index_js_5.resolveProperties)({ + to: (tx.to ? (0, index_js_1.resolveAddress)(tx.to, this.provider) : undefined), + from: (tx.from ? (0, index_js_1.resolveAddress)(tx.from, this.provider) : undefined) + }); + if (to != null) { + tx.to = to; + } + if (from != null) { + tx.from = from; + } + if (tx.from != null) { + (0, index_js_5.assertArgument)((0, index_js_1.getAddress)((tx.from)) === this.address, "transaction from address mismatch", "tx.from", tx.from); + delete tx.from; + } + // Build the transaction + const btx = index_js_4.Transaction.from(tx); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + }); + } + signMessage(message) { + return __awaiter(this, void 0, void 0, function* () { + return this.signMessageSync(message); + }); + } + // @TODO: Add a secialized signTx and signTyped sync that enforces + // all parameters are known? + /** + * Returns the signature for %%message%% signed with this wallet. + */ + signMessageSync(message) { + return this.signingKey.sign((0, index_js_2.hashMessage)(message)).serialized; + } + signTypedData(domain, types, value) { + return __awaiter(this, void 0, void 0, function* () { + // Populate any ENS names + const populated = yield index_js_2.TypedDataEncoder.resolveNames(domain, types, value, (name) => __awaiter(this, void 0, void 0, function* () { + // @TODO: this should use resolveName; addresses don't + // need a provider + (0, index_js_5.assert)(this.provider != null, "cannot resolve ENS names without a provider", "UNSUPPORTED_OPERATION", { + operation: "resolveName", + info: { name } + }); + const address = yield this.provider.resolveName(name); + (0, index_js_5.assert)(address != null, "unconfigured ENS name", "UNCONFIGURED_NAME", { + value: name + }); + return address; + })); + return this.signingKey.sign(index_js_2.TypedDataEncoder.hash(populated.domain, types, populated.value)).serialized; + }); + } +} +exports.BaseWallet = BaseWallet; +_BaseWallet_signingKey = new WeakMap(); +//# sourceMappingURL=base-wallet.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/base-wallet.js.map b/dist/ethers.js/src.ts/wallet/base-wallet.js.map new file mode 100644 index 0000000..dfd3fec --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/base-wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"base-wallet.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/base-wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,kDAAiE;AACjE,+CAAiE;AACjE,oDAAuD;AACvD,sDAAsE;AACtE,gDAE2B;AAQ3B;;;;;;;;;;GAUG;AACH,MAAa,UAAW,SAAQ,yBAAc;IAQ1C;;;;;;OAMG;IACH,YAAY,UAAsB,EAAE,QAA0B;QAC1D,KAAK,CAAC,QAAQ,CAAC,CAAC;QAVX,yCAAwB;QAY7B,IAAA,yBAAc,EAAC,UAAU,IAAI,OAAM,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,UAAU,EAAE,qBAAqB,EAAE,YAAY,EAAE,cAAc,C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AAC,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtD,IAAA,iBAAM,EAAC,OAAO,IAAI,IAAI,EAAE,uBAAuB,EAAE,mBAAmB,EAAE;oBAClE,KAAK,EAAE,IAAI;iBACd,CAAC,CAAC;gBAEH,OAAO,OAAO,CAAC;YACnB,CAAC,CAAA,CAAC,CAAC;YAEH,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,2BAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,UAAU,CAAC;QAC5G,CAAC;KAAA;CACJ;AAxGD,gCAwGC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/hdwallet.d.ts b/dist/ethers.js/src.ts/wallet/hdwallet.d.ts new file mode 100644 index 0000000..c48f585 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/hdwallet.d.ts @@ -0,0 +1,248 @@ +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +import { SigningKey } from "../crypto/index.js"; +import { VoidSigner } from "../providers/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { Mnemonic } from "./mnemonic.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +import type { BytesLike, Numeric } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +export declare const defaultPath: string; +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +export declare class HDNodeWallet extends BaseWallet { + #private; + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent fingerprint. + */ + readonly parentFingerprint: string; + /** + * The mnemonic used to create this HD Node, if available. + * + * Sources such as extended keys do not encode the mnemonic, in + * which case this will be ``null``. + */ + readonly mnemonic: null | Mnemonic; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, signingKey: SigningKey, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, mnemonic: null | Mnemonic, provider: null | Provider); + connect(provider: null | Provider): HDNodeWallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter(): HDNodeVoidWallet; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeWallet; + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path: string): HDNodeWallet; + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey: string): HDNodeWallet | HDNodeVoidWallet; + /** + * Creates a new random HDNode. + */ + static createRandom(password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic: Mnemonic, path?: string): HDNodeWallet; + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase: string, password?: string, path?: string, wordlist?: Wordlist): HDNodeWallet; + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed: BytesLike): HDNodeWallet; +} +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +export declare class HDNodeVoidWallet extends VoidSigner { + /** + * The compressed public key. + */ + readonly publicKey: string; + /** + * The fingerprint. + * + * A fingerprint allows quick qay to detect parent and child nodes, + * but developers should be prepared to deal with collisions as it + * is only 4 bytes. + */ + readonly fingerprint: string; + /** + * The parent node fingerprint. + */ + readonly parentFingerprint: string; + /** + * The chaincode, which is effectively a public key used + * to derive children. + */ + readonly chainCode: string; + /** + * The derivation path of this wallet. + * + * Since extended keys do not provider full path details, this + * may be ``null``, if instantiated from a source that does not + * enocde it. + */ + readonly path: null | string; + /** + * The child index of this wallet. Values over ``2 *\* 31`` indicate + * the node is hardened. + */ + readonly index: number; + /** + * The depth of this wallet, which is the number of components + * in its path. + */ + readonly depth: number; + /** + * @private + */ + constructor(guard: any, address: string, publicKey: string, parentFingerprint: string, chainCode: string, path: null | string, index: number, depth: number, provider: null | Provider); + connect(provider: null | Provider): HDNodeVoidWallet; + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey(): string; + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath(): this is { + path: string; + }; + /** + * Return the child for %%index%%. + */ + deriveChild(_index: Numeric): HDNodeVoidWallet; + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path: string): HDNodeVoidWallet; +} +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +export declare function getAccountPath(_index: Numeric): string; +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +export declare function getIndexedAccountPath(_index: Numeric): string; +//# sourceMappingURL=hdwallet.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/hdwallet.d.ts.map b/dist/ethers.js/src.ts/wallet/hdwallet.d.ts.map new file mode 100644 index 0000000..3ecdec4 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/hdwallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"hdwallet.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/hdwallet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAuC,UAAU,EAAU,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAUnD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAKzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAA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AG,IAAI,GAAG,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAG,MAAM,CAAC;IAExB;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,GAAG,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,GAAG,QAAQ;IAYtL,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,gBAAgB;IAKpD;;;;;OAKG;IACH,IAAI,WAAW,IAAI,MAAM,CAiBxB;IAED;;;OAGG;IACH,OAAO,IAAI,IAAI,IAAI;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;IAEnC;;OAEG;IACH,WAAW,CAAC,MAAM,EAAE,OAAO,GAAG,gBAAgB;IAqB9C;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB;CAG7C;AAmBD;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAItD;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,MAAM,CAI7D"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/hdwallet.js b/dist/ethers.js/src.ts/wallet/hdwallet.js new file mode 100644 index 0000000..0f459b2 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/hdwallet.js @@ -0,0 +1,437 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _HDNodeWallet_instances, _a, _HDNodeWallet_account, _HDNodeWallet_fromSeed; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.getIndexedAccountPath = exports.getAccountPath = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.defaultPath = void 0; +/** + * Explain HD Wallets.. + * + * @_subsection: api/wallet:HD Wallets [hd-wallets] + */ +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../providers/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const lang_en_js_1 = require("../wordlists/lang-en.js"); +const base_wallet_js_1 = require("./base-wallet.js"); +const mnemonic_js_1 = require("./mnemonic.js"); +const json_keystore_js_1 = require("./json-keystore.js"); +/** + * The default derivation path for Ethereum HD Nodes. (i.e. ``"m/44'/60'/0'/0/0"``) + */ +exports.defaultPath = "m/44'/60'/0'/0/0"; +// "Bitcoin seed" +const MasterSecret = new Uint8Array([66, 105, 116, 99, 111, 105, 110, 32, 115, 101, 101, 100]); +const HardenedBit = 0x80000000; +const N = BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"); +const Nibbles = "0123456789abcdef"; +function zpad(value, length) { + let result = ""; + while (value) { + result = Nibbles[value % 16] + result; + value = Math.trunc(value / 16); + } + while (result.length < length * 2) { + result = "0" + result; + } + return "0x" + result; +} +function encodeBase58Check(_value) { + const value = (0, index_js_4.getBytes)(_value); + const check = (0, index_js_4.dataSlice)((0, index_js_1.sha256)((0, index_js_1.sha256)(value)), 0, 4); + const bytes = (0, index_js_4.concat)([value, check]); + return (0, index_js_4.encodeBase58)(bytes); +} +const _guard = {}; +function ser_I(index, chainCode, publicKey, privateKey) { + const data = new Uint8Array(37); + if (index & HardenedBit) { + (0, index_js_4.assert)(privateKey != null, "cannot derive child of neutered node", "UNSUPPORTED_OPERATION", { + operation: "deriveChild" + }); + // Data = 0x00 || ser_256(k_par) + data.set((0, index_js_4.getBytes)(privateKey), 1); + } + else { + // Data = ser_p(point(k_par)) + data.set((0, index_js_4.getBytes)(publicKey)); + } + // Data += ser_32(i) + for (let i = 24; i >= 0; i -= 8) { + data[33 + (i >> 3)] = ((index >> (24 - i)) & 0xff); + } + const I = (0, index_js_4.getBytes)((0, index_js_1.computeHmac)("sha512", chainCode, data)); + return { IL: I.slice(0, 32), IR: I.slice(32) }; +} +function derivePath(node, path) { + const components = path.split("/"); + (0, index_js_4.assertArgument)(components.length > 0 && (components[0] === "m" || node.depth > 0), "invalid path", "path", path); + if (components[0] === "m") { + components.shift(); + } + let result = node; + for (let i = 0; i < components.length; i++) { + const component = components[i]; + if (component.match(/^[0-9]+'$/)) { + const index = parseInt(component.substring(0, component.length - 1)); + (0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(HardenedBit + index); + } + else if (component.match(/^[0-9]+$/)) { + const index = parseInt(component); + (0, index_js_4.assertArgument)(index < HardenedBit, "invalid path index", `path[${i}]`, component); + result = result.deriveChild(index); + } + else { + (0, index_js_4.assertArgument)(false, "invalid path component", `path[${i}]`, component); + } + } + return result; +} +/** + * An **HDNodeWallet** is a [[Signer]] backed by the private key derived + * from an HD Node using the [[link-bip-32]] stantard. + * + * An HD Node forms a hierarchal structure with each HD Node having a + * private key and the ability to derive child HD Nodes, defined by + * a path indicating the index of each child. + */ +class HDNodeWallet extends base_wallet_js_1.BaseWallet { + /** + * @private + */ + constructor(guard, signingKey, parentFingerprint, chainCode, path, index, depth, mnemonic, provider) { + super(signingKey, provider); + _HDNodeWallet_instances.add(this); + (0, index_js_4.assertPrivate)(guard, _guard, "HDNodeWallet"); + (0, index_js_4.defineProperties)(this, { publicKey: signingKey.compressedPublicKey }); + const fingerprint = (0, index_js_4.dataSlice)((0, index_js_1.ripemd160)((0, index_js_1.sha256)(this.publicKey)), 0, 4); + (0, index_js_4.defineProperties)(this, { + parentFingerprint, fingerprint, + chainCode, path, index, depth + }); + (0, index_js_4.defineProperties)(this, { mnemonic }); + } + connect(provider) { + return new HDNodeWallet(_guard, this.signingKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.mnemonic, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password, progressCallback) { + return __awaiter(this, void 0, void 0, function* () { + return yield (0, json_keystore_js_1.encryptKeystoreJson)(__classPrivateFieldGet(this, _HDNodeWallet_instances, "m", _HDNodeWallet_account).call(this), password, { progressCallback }); + }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + return (0, json_keystore_js_1.encryptKeystoreJsonSync)(__classPrivateFieldGet(this, _HDNodeWallet_instances, "m", _HDNodeWallet_account).call(this), password); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpriv`` and can be used to + * reconstruct this HD Node to derive its children. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + (0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check((0, index_js_4.concat)([ + "0x0488ADE4", zpad(this.depth, 1), this.parentFingerprint, + zpad(this.index, 4), this.chainCode, + (0, index_js_4.concat)(["0x00", this.privateKey]) + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Returns a neutered HD Node, which removes the private details + * of an HD Node. + * + * A neutered node has no private key, but can be used to derive + * child addresses and other public data about the HD Node. + */ + neuter() { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, this.provider); + } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, this.privateKey); + const ki = new index_js_1.SigningKey((0, index_js_4.toBeHex)(((0, index_js_4.toBigInt)(IL) + BigInt(this.privateKey)) % N, 32)); + return new HDNodeWallet(_guard, ki, this.fingerprint, (0, index_js_4.hexlify)(IR), path, index, this.depth + 1, this.mnemonic, this.provider); + } + /** + * Return the HDNode for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } + /** + * Creates a new HD Node from %%extendedKey%%. + * + * If the %%extendedKey%% will either have a prefix or ``xpub`` or + * ``xpriv``, returning a neutered HD Node ([[HDNodeVoidWallet]]) + * or full HD Node ([[HDNodeWallet) respectively. + */ + static fromExtendedKey(extendedKey) { + const bytes = (0, index_js_4.toBeArray)((0, index_js_4.decodeBase58)(extendedKey)); // @TODO: redact + (0, index_js_4.assertArgument)(bytes.length === 82 || encodeBase58Check(bytes.slice(0, 78)) === extendedKey, "invalid extended key", "extendedKey", "[ REDACTED ]"); + const depth = bytes[4]; + const parentFingerprint = (0, index_js_4.hexlify)(bytes.slice(5, 9)); + const index = parseInt((0, index_js_4.hexlify)(bytes.slice(9, 13)).substring(2), 16); + const chainCode = (0, index_js_4.hexlify)(bytes.slice(13, 45)); + const key = bytes.slice(45, 78); + switch ((0, index_js_4.hexlify)(bytes.slice(0, 4))) { + // Public Key + case "0x0488b21e": + case "0x043587cf": { + const publicKey = (0, index_js_4.hexlify)(key); + return new HDNodeVoidWallet(_guard, (0, index_js_3.computeAddress)(publicKey), publicKey, parentFingerprint, chainCode, null, index, depth, null); + } + // Private Key + case "0x0488ade4": + case "0x04358394 ": + if (key[0] !== 0) { + break; + } + return new HDNodeWallet(_guard, new index_js_1.SigningKey(key.slice(1)), parentFingerprint, chainCode, null, index, depth, null, null); + } + (0, index_js_4.assertArgument)(false, "invalid extended key prefix", "extendedKey", "[ REDACTED ]"); + } + /** + * Creates a new random HDNode. + */ + static createRandom(password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = exports.defaultPath; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy((0, index_js_1.randomBytes)(16), password, wordlist); + return __classPrivateFieldGet(HDNodeWallet, _a, "m", _HDNodeWallet_fromSeed).call(HDNodeWallet, mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Create an HD Node from %%mnemonic%%. + */ + static fromMnemonic(mnemonic, path) { + if (!path) { + path = exports.defaultPath; + } + return __classPrivateFieldGet(HDNodeWallet, _a, "m", _HDNodeWallet_fromSeed).call(HDNodeWallet, mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a mnemonic %%phrase%%. + */ + static fromPhrase(phrase, password, path, wordlist) { + if (password == null) { + password = ""; + } + if (path == null) { + path = exports.defaultPath; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const mnemonic = mnemonic_js_1.Mnemonic.fromPhrase(phrase, password, wordlist); + return __classPrivateFieldGet(HDNodeWallet, _a, "m", _HDNodeWallet_fromSeed).call(HDNodeWallet, mnemonic.computeSeed(), mnemonic).derivePath(path); + } + /** + * Creates an HD Node from a %%seed%%. + */ + static fromSeed(seed) { + return __classPrivateFieldGet(HDNodeWallet, _a, "m", _HDNodeWallet_fromSeed).call(HDNodeWallet, seed, null); + } +} +exports.HDNodeWallet = HDNodeWallet; +_a = HDNodeWallet, _HDNodeWallet_instances = new WeakSet(), _HDNodeWallet_account = function _HDNodeWallet_account() { + const account = { address: this.address, privateKey: this.privateKey }; + const m = this.mnemonic; + if (this.path && m && m.wordlist.locale === "en" && m.password === "") { + account.mnemonic = { + path: this.path, + locale: "en", + entropy: m.entropy + }; + } + return account; +}, _HDNodeWallet_fromSeed = function _HDNodeWallet_fromSeed(_seed, mnemonic) { + (0, index_js_4.assertArgument)((0, index_js_4.isBytesLike)(_seed), "invalid seed", "seed", "[REDACTED]"); + const seed = (0, index_js_4.getBytes)(_seed, "seed"); + (0, index_js_4.assertArgument)(seed.length >= 16 && seed.length <= 64, "invalid seed", "seed", "[REDACTED]"); + const I = (0, index_js_4.getBytes)((0, index_js_1.computeHmac)("sha512", MasterSecret, seed)); + const signingKey = new index_js_1.SigningKey((0, index_js_4.hexlify)(I.slice(0, 32))); + return new HDNodeWallet(_guard, signingKey, "0x00000000", (0, index_js_4.hexlify)(I.slice(32)), "m", 0, 0, mnemonic, null); +}; +/** + * A **HDNodeVoidWallet** cannot sign, but provides access to + * the children nodes of a [[link-bip-32]] HD wallet addresses. + * + * The can be created by using an extended ``xpub`` key to + * [[HDNodeWallet_fromExtendedKey]] or by + * [nuetering](HDNodeWallet-neuter) a [[HDNodeWallet]]. + */ +class HDNodeVoidWallet extends index_js_2.VoidSigner { + /** + * @private + */ + constructor(guard, address, publicKey, parentFingerprint, chainCode, path, index, depth, provider) { + super(address, provider); + (0, index_js_4.assertPrivate)(guard, _guard, "HDNodeVoidWallet"); + (0, index_js_4.defineProperties)(this, { publicKey }); + const fingerprint = (0, index_js_4.dataSlice)((0, index_js_1.ripemd160)((0, index_js_1.sha256)(publicKey)), 0, 4); + (0, index_js_4.defineProperties)(this, { + publicKey, fingerprint, parentFingerprint, chainCode, path, index, depth + }); + } + connect(provider) { + return new HDNodeVoidWallet(_guard, this.address, this.publicKey, this.parentFingerprint, this.chainCode, this.path, this.index, this.depth, provider); + } + /** + * The extended key. + * + * This key will begin with the prefix ``xpub`` and can be used to + * reconstruct this neutered key to derive its children addresses. + */ + get extendedKey() { + // We only support the mainnet values for now, but if anyone needs + // testnet values, let me know. I believe current sentiment is that + // we should always use mainnet, and use BIP-44 to derive the network + // - Mainnet: public=0x0488B21E, private=0x0488ADE4 + // - Testnet: public=0x043587CF, private=0x04358394 + (0, index_js_4.assert)(this.depth < 256, "Depth too deep", "UNSUPPORTED_OPERATION", { operation: "extendedKey" }); + return encodeBase58Check((0, index_js_4.concat)([ + "0x0488B21E", + zpad(this.depth, 1), + this.parentFingerprint, + zpad(this.index, 4), + this.chainCode, + this.publicKey, + ])); + } + /** + * Returns true if this wallet has a path, providing a Type Guard + * that the path is non-null. + */ + hasPath() { return (this.path != null); } + /** + * Return the child for %%index%%. + */ + deriveChild(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index <= 0xffffffff, "invalid index", "index", index); + // Base path + let path = this.path; + if (path) { + path += "/" + (index & ~HardenedBit); + if (index & HardenedBit) { + path += "'"; + } + } + const { IR, IL } = ser_I(index, this.chainCode, this.publicKey, null); + const Ki = index_js_1.SigningKey.addPoints(IL, this.publicKey, true); + const address = (0, index_js_3.computeAddress)(Ki); + return new HDNodeVoidWallet(_guard, address, Ki, this.fingerprint, (0, index_js_4.hexlify)(IR), path, index, this.depth + 1, this.provider); + } + /** + * Return the signer for %%path%% from this node. + */ + derivePath(path) { + return derivePath(this, path); + } +} +exports.HDNodeVoidWallet = HDNodeVoidWallet; +/* +export class HDNodeWalletManager { + #root: HDNodeWallet; + + constructor(phrase: string, password?: null | string, path?: null | string, locale?: null | Wordlist) { + if (password == null) { password = ""; } + if (path == null) { path = "m/44'/60'/0'/0"; } + if (locale == null) { locale = LangEn.wordlist(); } + this.#root = HDNodeWallet.fromPhrase(phrase, password, path, locale); + } + + getSigner(index?: number): HDNodeWallet { + return this.#root.deriveChild((index == null) ? 0: index); + } +} +*/ +/** + * Returns the [[link-bip-32]] path for the account at %%index%%. + * + * This is the pattern used by wallets like Ledger. + * + * There is also an [alternate pattern](getIndexedAccountPath) used by + * some software. + */ +function getAccountPath(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/${index}'/0/0`; +} +exports.getAccountPath = getAccountPath; +/** + * Returns the path using an alternative pattern for deriving accounts, + * at %%index%%. + * + * This derivation path uses the //index// component rather than the + * //account// component to derive sequential accounts. + * + * This is the pattern used by wallets like MetaMask. + */ +function getIndexedAccountPath(_index) { + const index = (0, index_js_4.getNumber)(_index, "index"); + (0, index_js_4.assertArgument)(index >= 0 && index < HardenedBit, "invalid account index", "index", index); + return `m/44'/60'/0'/0/${index}`; +} +exports.getIndexedAccountPath = getIndexedAccountPath; +//# sourceMappingURL=hdwallet.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/hdwallet.js.map b/dist/ethers.js/src.ts/wallet/hdwallet.js.map new file mode 100644 index 0000000..1cc0416 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/hdwallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"hdwallet.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/hdwallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;GAIG;AACH,iDAA6F;AAC7F,oDAAmD;AACnD,sDAAyD;AACzD,gDAK2B;AAC3B,wDAAiD;AAEjD,qDAA8C;AAC9C,+CAAyC;AACzC,yDAE4B;AAS5B;;GAEG;AACU,QAAA,WAAW,GAAW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C,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,WAAW,EAAE,uBAAuB,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;IAC3F,OAAO,kBAAmB,KAAK,EAAE,CAAC;AACtC,CAAC;AAJD,sDAIC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/index.d.ts b/dist/ethers.js/src.ts/wallet/index.d.ts new file mode 100644 index 0000000..8156435 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/index.d.ts @@ -0,0 +1,27 @@ +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +export { BaseWallet } from "./base-wallet.js"; +export { defaultPath, getAccountPath, getIndexedAccountPath, HDNodeWallet, HDNodeVoidWallet, } from "./hdwallet.js"; +export { isCrowdsaleJson, decryptCrowdsaleJson } from "./json-crowdsale.js"; +export { isKeystoreJson, decryptKeystoreJsonSync, decryptKeystoreJson, encryptKeystoreJson, encryptKeystoreJsonSync } from "./json-keystore.js"; +export { Mnemonic } from "./mnemonic.js"; +export { Wallet } from "./wallet.js"; +export type { CrowdsaleAccount } from "./json-crowdsale.js"; +export type { KeystoreAccount, EncryptOptions } from "./json-keystore.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/index.d.ts.map b/dist/ethers.js/src.ts/wallet/index.d.ts.map new file mode 100644 index 0000000..4452c98 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EACH,WAAW,EAEX,cAAc,EAAE,qBAAqB,EAErC,YAAY,EACZ,gBAAgB,GACnB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAE5E,OAAO,EACH,cAAc,EACd,uBAAuB,EAAE,mBAAmB,EAC5C,mBAAmB,EAAE,uBAAuB,EAC/C,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAC5D,YAAY,EACR,eAAe,EAAE,cAAc,EAClC,MAAM,oBAAoB,CAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/index.js b/dist/ethers.js/src.ts/wallet/index.js new file mode 100644 index 0000000..1cfe56c --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/index.js @@ -0,0 +1,43 @@ +"use strict"; +/** + * When interacting with Ethereum, it is necessary to use a private + * key authenticate actions by signing a payload. + * + * Wallets are the simplest way to expose the concept of an + * //Externally Owner Account// (EOA) as it wraps a private key + * and supports high-level methods to sign common types of interaction + * and send transactions. + * + * The class most developers will want to use is [[Wallet]], which + * can load a private key directly or from any common wallet format. + * + * The [[HDNodeWallet]] can be used when it is necessary to access + * low-level details of how an HD wallets are derived, exported + * or imported. + * + * @_section: api/wallet:Wallets [about-wallets] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wallet = exports.Mnemonic = exports.encryptKeystoreJsonSync = exports.encryptKeystoreJson = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = exports.HDNodeVoidWallet = exports.HDNodeWallet = exports.getIndexedAccountPath = exports.getAccountPath = exports.defaultPath = exports.BaseWallet = void 0; +var base_wallet_js_1 = require("./base-wallet.js"); +Object.defineProperty(exports, "BaseWallet", { enumerable: true, get: function () { return base_wallet_js_1.BaseWallet; } }); +var hdwallet_js_1 = require("./hdwallet.js"); +Object.defineProperty(exports, "defaultPath", { enumerable: true, get: function () { return hdwallet_js_1.defaultPath; } }); +Object.defineProperty(exports, "getAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getAccountPath; } }); +Object.defineProperty(exports, "getIndexedAccountPath", { enumerable: true, get: function () { return hdwallet_js_1.getIndexedAccountPath; } }); +Object.defineProperty(exports, "HDNodeWallet", { enumerable: true, get: function () { return hdwallet_js_1.HDNodeWallet; } }); +Object.defineProperty(exports, "HDNodeVoidWallet", { enumerable: true, get: function () { return hdwallet_js_1.HDNodeVoidWallet; } }); +var json_crowdsale_js_1 = require("./json-crowdsale.js"); +Object.defineProperty(exports, "isCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.isCrowdsaleJson; } }); +Object.defineProperty(exports, "decryptCrowdsaleJson", { enumerable: true, get: function () { return json_crowdsale_js_1.decryptCrowdsaleJson; } }); +var json_keystore_js_1 = require("./json-keystore.js"); +Object.defineProperty(exports, "isKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.isKeystoreJson; } }); +Object.defineProperty(exports, "decryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJsonSync; } }); +Object.defineProperty(exports, "decryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.decryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJson", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJson; } }); +Object.defineProperty(exports, "encryptKeystoreJsonSync", { enumerable: true, get: function () { return json_keystore_js_1.encryptKeystoreJsonSync; } }); +var mnemonic_js_1 = require("./mnemonic.js"); +Object.defineProperty(exports, "Mnemonic", { enumerable: true, get: function () { return mnemonic_js_1.Mnemonic; } }); +var wallet_js_1 = require("./wallet.js"); +Object.defineProperty(exports, "Wallet", { enumerable: true, get: function () { return wallet_js_1.Wallet; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/index.js.map b/dist/ethers.js/src.ts/wallet/index.js.map new file mode 100644 index 0000000..a4d57b7 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;GAiBG;;;AAEH,mDAA8C;AAArC,4GAAA,UAAU,OAAA;AAEnB,6CAOuB;AANnB,0GAAA,WAAW,OAAA;AAEX,6GAAA,cAAc,OAAA;AAAE,oHAAA,qBAAqB,OAAA;AAErC,2GAAA,YAAY,OAAA;AACZ,+GAAA,gBAAgB,OAAA;AAGpB,yDAA4E;AAAnE,oHAAA,eAAe,OAAA;AAAE,yHAAA,oBAAoB,OAAA;AAE9C,uDAI4B;AAHxB,kHAAA,cAAc,OAAA;AACd,2HAAA,uBAAuB,OAAA;AAAE,uHAAA,mBAAmB,OAAA;AAC5C,uHAAA,mBAAmB,OAAA;AAAE,2HAAA,uBAAuB,OAAA;AAGhD,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AAEjB,yCAAqC;AAA5B,mGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts b/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts new file mode 100644 index 0000000..3d7f4a2 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts @@ -0,0 +1,27 @@ +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +/** + * The data stored within a JSON Crowdsale wallet is fairly + * minimal. + */ +export type CrowdsaleAccount = { + privateKey: string; + address: string; +}; +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +export declare function isCrowdsaleJson(json: string): boolean; +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +export declare function decryptCrowdsaleJson(json: string, _password: string | Uint8Array): CrowdsaleAccount; +//# sourceMappingURL=json-crowdsale.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts.map b/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts.map new file mode 100644 index 0000000..dbe1cef --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-crowdsale.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC3B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACnB,CAAA;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAMrD;AAID;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,gBAAgB,CA2BnG"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-crowdsale.js b/dist/ethers.js/src.ts/wallet/json-crowdsale.js new file mode 100644 index 0000000..7dfa761 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-crowdsale.js @@ -0,0 +1,60 @@ +"use strict"; +/** + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decryptCrowdsaleJson = exports.isCrowdsaleJson = void 0; +const aes_js_1 = require("aes-js"); +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../hash/index.js"); +const index_js_4 = require("../utils/index.js"); +const utils_js_1 = require("./utils.js"); +/** + * Returns true if %%json%% is a valid JSON Crowdsale wallet. + */ +function isCrowdsaleJson(json) { + try { + const data = JSON.parse(json); + if (data.encseed) { + return true; + } + } + catch (error) { } + return false; +} +exports.isCrowdsaleJson = isCrowdsaleJson; +// See: https://github.com/ethereum/pyethsaletool +/** + * Before Ethereum launched, it was necessary to create a wallet + * format for backers to use, which would be used to receive ether + * as a reward for contributing to the project. + * + * The [[link-crowdsale]] format is now obsolete, but it is still + * useful to support and the additional code is fairly trivial as + * all the primitives required are used through core portions of + * the library. + */ +function decryptCrowdsaleJson(json, _password) { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + // Ethereum Address + const address = (0, index_js_1.getAddress)((0, utils_js_1.spelunk)(data, "ethaddr:string!")); + // Encrypted Seed + const encseed = (0, utils_js_1.looseArrayify)((0, utils_js_1.spelunk)(data, "encseed:string!")); + (0, index_js_4.assertArgument)(encseed && (encseed.length % 16) === 0, "invalid encseed", "json", json); + const key = (0, index_js_4.getBytes)((0, index_js_2.pbkdf2)(password, password, 2000, 32, "sha256")).slice(0, 16); + const iv = encseed.slice(0, 16); + const encryptedSeed = encseed.slice(16); + // Decrypt the seed + const aesCbc = new aes_js_1.CBC(key, iv); + const seed = (0, aes_js_1.pkcs7Strip)((0, index_js_4.getBytes)(aesCbc.decrypt(encryptedSeed))); + // This wallet format is weird... Convert the binary encoded hex to a string. + let seedHex = ""; + for (let i = 0; i < seed.length; i++) { + seedHex += String.fromCharCode(seed[i]); + } + return { address, privateKey: (0, index_js_3.id)(seedHex) }; +} +exports.decryptCrowdsaleJson = decryptCrowdsaleJson; +//# sourceMappingURL=json-crowdsale.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-crowdsale.js.map b/dist/ethers.js/src.ts/wallet/json-crowdsale.js.map new file mode 100644 index 0000000..927405d --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-crowdsale.js.map @@ -0,0 +1 @@ +{"version":3,"file":"json-crowdsale.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/json-crowdsale.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,mCAAyC;AAEzC,kDAAiD;AACjD,iDAA4C;AAC5C,+CAAsC;AACtC,gDAA6D;AAE7D,yCAAiE;AAYjE;;GAEG;AACH,SAAgB,eAAe,CAAC,IAAY;IACxC,IAAI;QACA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QAC9B,IAAI,IAAI,CAAC,OAAO,EAAE;YAAE,OAAO,IAAI,CAAC;SAAE;KACrC;IAAC,OAAO,KAAK,EAAE,GAAG;IACnB,OAAO,KAAK,CAAC;AACjB,CAAC;AAND,0CAMC;AAED,iDAAiD;AAEjD;;;;;;;;;GASG;AACH,SAAgB,oBAAoB,CAAC,IAAY,EAAE,SAA8B;IAC7E,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC9B,MAAM,QAAQ,GAAG,IAAA,sBAAW,EAAC,SAAS,CAAC,CAAC;IAExC,mBAAmB;IACnB,MAAM,OAAO,GAAG,IAAA,qBAAU,EAAC,IAAA,kBAAO,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAE7D,iBAAiB;IACjB,MAAM,OAAO,GAAG,IAAA,wBAAa,EAAC,IAAA,kBAAO,EAAC,IAAI,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAChE,IAAA,yBAAc,EAAC,OAAO,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,CAAC,EAAE,iBAAiB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAExF,MAAM,GAAG,GAAG,IAAA,mBAAQ,EAAC,IAAA,iBAAM,EAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAElF,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAExC,mBAAmB;IACnB,MAAM,MAAM,GAAG,IAAI,YAAG,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAChC,MAAM,IAAI,GAAG,IAAA,mBAAU,EAAC,IAAA,mBAAQ,EAAC,MAAM,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAEjE,6EAA6E;IAC7E,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAClC,OAAO,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;KAC3C;IAED,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAA,aAAE,EAAC,OAAO,CAAC,EAAE,CAAC;AAChD,CAAC;AA3BD,oDA2BC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-keystore.d.ts b/dist/ethers.js/src.ts/wallet/json-keystore.d.ts new file mode 100644 index 0000000..c01076f --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-keystore.d.ts @@ -0,0 +1,89 @@ +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +import type { ProgressCallback } from "../crypto/index.js"; +import type { BytesLike } from "../utils/index.js"; +/** + * The contents of a JSON Keystore Wallet. + */ +export type KeystoreAccount = { + address: string; + privateKey: string; + mnemonic?: { + path?: string; + locale?: string; + entropy: string; + }; +}; +/** + * The parameters to use when encrypting a JSON Keystore Wallet. + */ +export type EncryptOptions = { + progressCallback?: ProgressCallback; + iv?: BytesLike; + entropy?: BytesLike; + client?: string; + salt?: BytesLike; + uuid?: string; + scrypt?: { + N?: number; + r?: number; + p?: number; + }; +}; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +export declare function isKeystoreJson(json: string): boolean; +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +export declare function decryptKeystoreJsonSync(json: string, _password: string | Uint8Array): KeystoreAccount; +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +export declare function decryptKeystoreJson(json: string, _password: string | Uint8Array, progress?: ProgressCallback): Promise; +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +export declare function encryptKeystoreJsonSync(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): string; +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +export declare function encryptKeystoreJson(account: KeystoreAccount, password: string | Uint8Array, options?: EncryptOptions): Promise; +//# sourceMappingURL=json-keystore.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-keystore.d.ts.map b/dist/ethers.js/src.ts/wallet/json-keystore.d.ts.map new file mode 100644 index 0000000..062f241 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-keystore.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"json-keystore.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/json-keystore.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAaH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAOnD;;GAEG;AACH,MAAM,MAAM,eAAe,GAAG;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE;QACP,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,MAAM,CAAC;KACnB,CAAA;CACJ,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG;IAC1B,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,EAAE,CAAC,EAAE,SAAS,CAAC;IACf,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE;QACL,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;QACX,CAAC,CAAC,EAAE,MAAM,CAAC;KACd,CAAA;CACH,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOpD;AA+GD;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,eAAe,CAiBrG;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,eAAe,CAAC,CAyB7I;AAsGD;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,MAAM,CAOjI;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAO5I"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-keystore.js b/dist/ethers.js/src.ts/wallet/json-keystore.js new file mode 100644 index 0000000..5cbc6ab --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-keystore.js @@ -0,0 +1,308 @@ +"use strict"; +/** + * The JSON Wallet formats allow a simple way to store the private + * keys needed in Ethereum along with related information and allows + * for extensible forms of encryption. + * + * These utilities facilitate decrypting and encrypting the most common + * JSON Wallet formats. + * + * @_subsection: api/wallet:JSON Wallets [json-wallets] + */ +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encryptKeystoreJson = exports.encryptKeystoreJsonSync = exports.decryptKeystoreJson = exports.decryptKeystoreJsonSync = exports.isKeystoreJson = void 0; +const aes_js_1 = require("aes-js"); +const index_js_1 = require("../address/index.js"); +const index_js_2 = require("../crypto/index.js"); +const index_js_3 = require("../transaction/index.js"); +const index_js_4 = require("../utils/index.js"); +const utils_js_1 = require("./utils.js"); +const _version_js_1 = require("../_version.js"); +const defaultPath = "m/44'/60'/0'/0/0"; +/** + * Returns true if %%json%% is a valid JSON Keystore Wallet. + */ +function isKeystoreJson(json) { + try { + const data = JSON.parse(json); + const version = ((data.version != null) ? parseInt(data.version) : 0); + if (version === 3) { + return true; + } + } + catch (error) { } + return false; +} +exports.isKeystoreJson = isKeystoreJson; +function decrypt(data, key, ciphertext) { + const cipher = (0, utils_js_1.spelunk)(data, "crypto.cipher:string"); + if (cipher === "aes-128-ctr") { + const iv = (0, utils_js_1.spelunk)(data, "crypto.cipherparams.iv:data!"); + const aesCtr = new aes_js_1.CTR(key, iv); + return (0, index_js_4.hexlify)(aesCtr.decrypt(ciphertext)); + } + (0, index_js_4.assert)(false, "unsupported cipher", "UNSUPPORTED_OPERATION", { + operation: "decrypt" + }); +} +function getAccount(data, _key) { + const key = (0, index_js_4.getBytes)(_key); + const ciphertext = (0, utils_js_1.spelunk)(data, "crypto.ciphertext:data!"); + const computedMAC = (0, index_js_4.hexlify)((0, index_js_2.keccak256)((0, index_js_4.concat)([key.slice(16, 32), ciphertext]))).substring(2); + (0, index_js_4.assertArgument)(computedMAC === (0, utils_js_1.spelunk)(data, "crypto.mac:string!").toLowerCase(), "incorrect password", "password", "[ REDACTED ]"); + const privateKey = decrypt(data, key.slice(0, 16), ciphertext); + const address = (0, index_js_3.computeAddress)(privateKey); + if (data.address) { + let check = data.address.toLowerCase(); + if (!check.startsWith("0x")) { + check = "0x" + check; + } + (0, index_js_4.assertArgument)((0, index_js_1.getAddress)(check) === address, "keystore address/privateKey mismatch", "address", data.address); + } + const account = { address, privateKey }; + // Version 0.1 x-ethers metadata must contain an encrypted mnemonic phrase + const version = (0, utils_js_1.spelunk)(data, "x-ethers.version:string"); + if (version === "0.1") { + const mnemonicKey = key.slice(32, 64); + const mnemonicCiphertext = (0, utils_js_1.spelunk)(data, "x-ethers.mnemonicCiphertext:data!"); + const mnemonicIv = (0, utils_js_1.spelunk)(data, "x-ethers.mnemonicCounter:data!"); + const mnemonicAesCtr = new aes_js_1.CTR(mnemonicKey, mnemonicIv); + account.mnemonic = { + path: ((0, utils_js_1.spelunk)(data, "x-ethers.path:string") || defaultPath), + locale: ((0, utils_js_1.spelunk)(data, "x-ethers.locale:string") || "en"), + entropy: (0, index_js_4.hexlify)((0, index_js_4.getBytes)(mnemonicAesCtr.decrypt(mnemonicCiphertext))) + }; + } + return account; +} +function getDecryptKdfParams(data) { + const kdf = (0, utils_js_1.spelunk)(data, "crypto.kdf:string"); + if (kdf && typeof (kdf) === "string") { + if (kdf.toLowerCase() === "scrypt") { + const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); + const N = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.n:int!"); + const r = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.r:int!"); + const p = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.p:int!"); + // Make sure N is a power of 2 + (0, index_js_4.assertArgument)(N > 0 && (N & (N - 1)) === 0, "invalid kdf.N", "kdf.N", N); + (0, index_js_4.assertArgument)(r > 0 && p > 0, "invalid kdf", "kdf", kdf); + const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); + (0, index_js_4.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dflen", dkLen); + return { name: "scrypt", salt, N, r, p, dkLen: 64 }; + } + else if (kdf.toLowerCase() === "pbkdf2") { + const salt = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.salt:data!"); + const prf = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.prf:string!"); + const algorithm = prf.split("-").pop(); + (0, index_js_4.assertArgument)(algorithm === "sha256" || algorithm === "sha512", "invalid kdf.pdf", "kdf.pdf", prf); + const count = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.c:int!"); + const dkLen = (0, utils_js_1.spelunk)(data, "crypto.kdfparams.dklen:int!"); + (0, index_js_4.assertArgument)(dkLen === 32, "invalid kdf.dklen", "kdf.dklen", dkLen); + return { name: "pbkdf2", salt, count, dkLen, algorithm }; + } + } + (0, index_js_4.assertArgument)(false, "unsupported key-derivation function", "kdf", kdf); +} +/** + * Returns the account details for the JSON Keystore Wallet %%json%% + * using %%password%%. + * + * It is preferred to use the [async version](decryptKeystoreJson) + * instead, which allows a [[ProgressCallback]] to keep the user informed + * as to the decryption status. + * + * This method will block the event loop (freezing all UI) until decryption + * is complete, which can take quite some time, depending on the wallet + * paramters and platform. + */ +function decryptKeystoreJsonSync(json, _password) { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + const { salt, count, dkLen, algorithm } = params; + const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); + return getAccount(data, key); + } + (0, index_js_4.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = (0, index_js_2.scryptSync)(password, salt, N, r, p, dkLen); + return getAccount(data, key); +} +exports.decryptKeystoreJsonSync = decryptKeystoreJsonSync; +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * Resolves to the decrypted JSON Keystore Wallet %%json%% using the + * %%password%%. + * + * If provided, %%progress%% will be called periodically during the + * decrpytion to provide feedback, and if the function returns + * ``false`` will halt decryption. + * + * The %%progressCallback%% will **always** receive ``0`` before + * decryption begins and ``1`` when complete. + */ +function decryptKeystoreJson(json, _password, progress) { + return __awaiter(this, void 0, void 0, function* () { + const data = JSON.parse(json); + const password = (0, utils_js_1.getPassword)(_password); + const params = getDecryptKdfParams(data); + if (params.name === "pbkdf2") { + if (progress) { + progress(0); + yield stall(0); + } + const { salt, count, dkLen, algorithm } = params; + const key = (0, index_js_2.pbkdf2)(password, salt, count, dkLen, algorithm); + if (progress) { + progress(1); + yield stall(0); + } + return getAccount(data, key); + } + (0, index_js_4.assert)(params.name === "scrypt", "cannot be reached", "UNKNOWN_ERROR", { params }); + const { salt, N, r, p, dkLen } = params; + const key = yield (0, index_js_2.scrypt)(password, salt, N, r, p, dkLen, progress); + return getAccount(data, key); + }); +} +exports.decryptKeystoreJson = decryptKeystoreJson; +function getEncryptKdfParams(options) { + // Check/generate the salt + const salt = (options.salt != null) ? (0, index_js_4.getBytes)(options.salt, "options.salt") : (0, index_js_2.randomBytes)(32); + // Override the scrypt password-based key derivation function parameters + let N = (1 << 17), r = 8, p = 1; + if (options.scrypt) { + if (options.scrypt.N) { + N = options.scrypt.N; + } + if (options.scrypt.r) { + r = options.scrypt.r; + } + if (options.scrypt.p) { + p = options.scrypt.p; + } + } + (0, index_js_4.assertArgument)(typeof (N) === "number" && N > 0 && Number.isSafeInteger(N) && (BigInt(N) & BigInt(N - 1)) === BigInt(0), "invalid scrypt N parameter", "options.N", N); + (0, index_js_4.assertArgument)(typeof (r) === "number" && r > 0 && Number.isSafeInteger(r), "invalid scrypt r parameter", "options.r", r); + (0, index_js_4.assertArgument)(typeof (p) === "number" && p > 0 && Number.isSafeInteger(p), "invalid scrypt p parameter", "options.p", p); + return { name: "scrypt", dkLen: 32, salt, N, r, p }; +} +function _encryptKeystore(key, kdf, account, options) { + const privateKey = (0, index_js_4.getBytes)(account.privateKey, "privateKey"); + // Override initialization vector + const iv = (options.iv != null) ? (0, index_js_4.getBytes)(options.iv, "options.iv") : (0, index_js_2.randomBytes)(16); + (0, index_js_4.assertArgument)(iv.length === 16, "invalid options.iv length", "options.iv", options.iv); + // Override the uuid + const uuidRandom = (options.uuid != null) ? (0, index_js_4.getBytes)(options.uuid, "options.uuid") : (0, index_js_2.randomBytes)(16); + (0, index_js_4.assertArgument)(uuidRandom.length === 16, "invalid options.uuid length", "options.uuid", options.iv); + // This will be used to encrypt the wallet (as per Web3 secret storage) + // - 32 bytes As normal for the Web3 secret storage (derivedKey, macPrefix) + // - 32 bytes AES key to encrypt mnemonic with (required here to be Ethers Wallet) + const derivedKey = key.slice(0, 16); + const macPrefix = key.slice(16, 32); + // Encrypt the private key + const aesCtr = new aes_js_1.CTR(derivedKey, iv); + const ciphertext = (0, index_js_4.getBytes)(aesCtr.encrypt(privateKey)); + // Compute the message authentication code, used to check the password + const mac = (0, index_js_2.keccak256)((0, index_js_4.concat)([macPrefix, ciphertext])); + // See: https://github.com/ethereum/wiki/wiki/Web3-Secret-Storage-Definition + const data = { + address: account.address.substring(2).toLowerCase(), + id: (0, index_js_4.uuidV4)(uuidRandom), + version: 3, + Crypto: { + cipher: "aes-128-ctr", + cipherparams: { + iv: (0, index_js_4.hexlify)(iv).substring(2), + }, + ciphertext: (0, index_js_4.hexlify)(ciphertext).substring(2), + kdf: "scrypt", + kdfparams: { + salt: (0, index_js_4.hexlify)(kdf.salt).substring(2), + n: kdf.N, + dklen: 32, + p: kdf.p, + r: kdf.r + }, + mac: mac.substring(2) + } + }; + // If we have a mnemonic, encrypt it into the JSON wallet + if (account.mnemonic) { + const client = (options.client != null) ? options.client : `ethers/${_version_js_1.version}`; + const path = account.mnemonic.path || defaultPath; + const locale = account.mnemonic.locale || "en"; + const mnemonicKey = key.slice(32, 64); + const entropy = (0, index_js_4.getBytes)(account.mnemonic.entropy, "account.mnemonic.entropy"); + const mnemonicIv = (0, index_js_2.randomBytes)(16); + const mnemonicAesCtr = new aes_js_1.CTR(mnemonicKey, mnemonicIv); + const mnemonicCiphertext = (0, index_js_4.getBytes)(mnemonicAesCtr.encrypt(entropy)); + const now = new Date(); + const timestamp = (now.getUTCFullYear() + "-" + + (0, utils_js_1.zpad)(now.getUTCMonth() + 1, 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCDate(), 2) + "T" + + (0, utils_js_1.zpad)(now.getUTCHours(), 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCMinutes(), 2) + "-" + + (0, utils_js_1.zpad)(now.getUTCSeconds(), 2) + ".0Z"); + const gethFilename = ("UTC--" + timestamp + "--" + data.address); + data["x-ethers"] = { + client, gethFilename, path, locale, + mnemonicCounter: (0, index_js_4.hexlify)(mnemonicIv).substring(2), + mnemonicCiphertext: (0, index_js_4.hexlify)(mnemonicCiphertext).substring(2), + version: "0.1" + }; + } + return JSON.stringify(data); +} +/** + * Return the JSON Keystore Wallet for %%account%% encrypted with + * %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used. Any provided [[ProgressCallback]] is ignord. + */ +function encryptKeystoreJsonSync(account, password, options) { + if (options == null) { + options = {}; + } + const passwordBytes = (0, utils_js_1.getPassword)(password); + const kdf = getEncryptKdfParams(options); + const key = (0, index_js_2.scryptSync)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64); + return _encryptKeystore((0, index_js_4.getBytes)(key), kdf, account, options); +} +exports.encryptKeystoreJsonSync = encryptKeystoreJsonSync; +/** + * Resolved to the JSON Keystore Wallet for %%account%% encrypted + * with %%password%%. + * + * The %%options%% can be used to tune the password-based key + * derivation function parameters, explicitly set the random values + * used and provide a [[ProgressCallback]] to receive periodic updates + * on the completion status.. + */ +function encryptKeystoreJson(account, password, options) { + return __awaiter(this, void 0, void 0, function* () { + if (options == null) { + options = {}; + } + const passwordBytes = (0, utils_js_1.getPassword)(password); + const kdf = getEncryptKdfParams(options); + const key = yield (0, index_js_2.scrypt)(passwordBytes, kdf.salt, kdf.N, kdf.r, kdf.p, 64, options.progressCallback); + return _encryptKeystore((0, index_js_4.getBytes)(key), kdf, account, options); + }); +} +exports.encryptKeystoreJson = encryptKeystoreJson; +//# sourceMappingURL=json-keystore.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/json-keystore.js.map b/dist/ethers.js/src.ts/wallet/json-keystore.js.map new file mode 100644 index 0000000..837c3ff --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/json-keystore.js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,0DAOC;AAED;;;;;;;;GAQG;AACH,SAAsB,mBAAmB,CAAC,OAAwB,EAAE,QAA6B,EAAE,OAAwB;;QACvH,IAAI,OAAO,IAAI,IAAI,EAAE;YAAE,OAAO,GAAG,EAAG,CAAC;SAAE;QAEvC,MAAM,aAAa,GAAG,IAAA,sBAAW,EAAC,QAAQ,CAAC,CAAC;QAC5C,MAAM,GAAG,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;QACzC,MAAM,GAAG,GAAG,MAAM,IAAA,iBAAM,EAAC,aAAa,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,CAAC,gBAAgB,CAAC,CAAC;QACrG,OAAO,gBAAgB,CAAC,IAAA,mBAAQ,EAAC,GAAG,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;CAAA;AAPD,kDAOC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/mnemonic.d.ts b/dist/ethers.js/src.ts/wallet/mnemonic.d.ts new file mode 100644 index 0000000..b160112 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/mnemonic.d.ts @@ -0,0 +1,65 @@ +import type { BytesLike } from "../utils/index.js"; +import type { Wordlist } from "../wordlists/index.js"; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +export declare class Mnemonic { + /** + * The mnemonic phrase of 12, 15, 18, 21 or 24 words. + * + * Use the [[wordlist]] ``split`` method to get the individual words. + */ + readonly phrase: string; + /** + * The password used for this mnemonic. If no password is used this + * is the empty string (i.e. ``""``) as per the specification. + */ + readonly password: string; + /** + * The wordlist for this mnemonic. + */ + readonly wordlist: Wordlist; + /** + * The underlying entropy which the mnemonic encodes. + */ + readonly entropy: string; + /** + * @private + */ + constructor(guard: any, entropy: string, phrase: string, password?: null | string, wordlist?: null | Wordlist); + /** + * Returns the seed for the mnemonic. + */ + computeSeed(): string; + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase: string, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy: BytesLike, password?: null | string, wordlist?: null | Wordlist): Mnemonic; + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy: BytesLike, wordlist?: null | Wordlist): string; + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase: string, wordlist?: null | Wordlist): string; + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase: string, wordlist?: null | Wordlist): boolean; +} +//# sourceMappingURL=mnemonic.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/mnemonic.d.ts.map b/dist/ethers.js/src.ts/wallet/mnemonic.d.ts.map new file mode 100644 index 0000000..71c9005 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/mnemonic.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/mnemonic.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAgGtD;;;GAGG;AACH,qBAAa,QAAQ;IACjB;;;;OAIG;IACH,QAAQ,CAAC,MAAM,EAAG,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,QAAQ,EAAG,MAAM,CAAC;IAE3B;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAG,QAAQ,CAAC;IAE7B;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAG,MAAM,CAAC;IAE1B;;OAEG;gBACS,KAAK,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAO7G;;OAEG;IACH,WAAW,IAAI,MAAM;IAKrB;;;;;OAKG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAOjG;;;;;OAKG;IACH,MAAM,CAAC,WAAW,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,QAAQ;IAMvG;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAK/E;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1E;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO;CAO9E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/mnemonic.js b/dist/ethers.js/src.ts/wallet/mnemonic.js new file mode 100644 index 0000000..accd674 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/mnemonic.js @@ -0,0 +1,150 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Mnemonic = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const lang_en_js_1 = require("../wordlists/lang-en.js"); +// Returns a byte with the MSB bits set +function getUpperMask(bits) { + return ((1 << bits) - 1) << (8 - bits) & 0xff; +} +// Returns a byte with the LSB bits set +function getLowerMask(bits) { + return ((1 << bits) - 1) & 0xff; +} +function mnemonicToEntropy(mnemonic, wordlist) { + (0, index_js_2.assertNormalize)("NFKD"); + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const words = wordlist.split(mnemonic); + (0, index_js_2.assertArgument)((words.length % 3) === 0 && words.length >= 12 && words.length <= 24, "invalid mnemonic length", "mnemonic", "[ REDACTED ]"); + const entropy = new Uint8Array(Math.ceil(11 * words.length / 8)); + let offset = 0; + for (let i = 0; i < words.length; i++) { + let index = wordlist.getWordIndex(words[i].normalize("NFKD")); + (0, index_js_2.assertArgument)(index >= 0, `invalid mnemonic word at index ${i}`, "mnemonic", "[ REDACTED ]"); + for (let bit = 0; bit < 11; bit++) { + if (index & (1 << (10 - bit))) { + entropy[offset >> 3] |= (1 << (7 - (offset % 8))); + } + offset++; + } + } + const entropyBits = 32 * words.length / 3; + const checksumBits = words.length / 3; + const checksumMask = getUpperMask(checksumBits); + const checksum = (0, index_js_2.getBytes)((0, index_js_1.sha256)(entropy.slice(0, entropyBits / 8)))[0] & checksumMask; + (0, index_js_2.assertArgument)(checksum === (entropy[entropy.length - 1] & checksumMask), "invalid mnemonic checksum", "mnemonic", "[ REDACTED ]"); + return (0, index_js_2.hexlify)(entropy.slice(0, entropyBits / 8)); +} +function entropyToMnemonic(entropy, wordlist) { + (0, index_js_2.assertArgument)((entropy.length % 4) === 0 && entropy.length >= 16 && entropy.length <= 32, "invalid entropy size", "entropy", "[ REDACTED ]"); + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + const indices = [0]; + let remainingBits = 11; + for (let i = 0; i < entropy.length; i++) { + // Consume the whole byte (with still more to go) + if (remainingBits > 8) { + indices[indices.length - 1] <<= 8; + indices[indices.length - 1] |= entropy[i]; + remainingBits -= 8; + // This byte will complete an 11-bit index + } + else { + indices[indices.length - 1] <<= remainingBits; + indices[indices.length - 1] |= entropy[i] >> (8 - remainingBits); + // Start the next word + indices.push(entropy[i] & getLowerMask(8 - remainingBits)); + remainingBits += 3; + } + } + // Compute the checksum bits + const checksumBits = entropy.length / 4; + const checksum = parseInt((0, index_js_1.sha256)(entropy).substring(2, 4), 16) & getUpperMask(checksumBits); + // Shift the checksum into the word indices + indices[indices.length - 1] <<= checksumBits; + indices[indices.length - 1] |= (checksum >> (8 - checksumBits)); + return wordlist.join(indices.map((index) => wordlist.getWord(index))); +} +const _guard = {}; +/** + * A **Mnemonic** wraps all properties required to compute [[link-bip-39]] + * seeds and convert between phrases and entropy. + */ +class Mnemonic { + /** + * @private + */ + constructor(guard, entropy, phrase, password, wordlist) { + if (password == null) { + password = ""; + } + if (wordlist == null) { + wordlist = lang_en_js_1.LangEn.wordlist(); + } + (0, index_js_2.assertPrivate)(guard, _guard, "Mnemonic"); + (0, index_js_2.defineProperties)(this, { phrase, password, wordlist, entropy }); + } + /** + * Returns the seed for the mnemonic. + */ + computeSeed() { + const salt = (0, index_js_2.toUtf8Bytes)("mnemonic" + this.password, "NFKD"); + return (0, index_js_1.pbkdf2)((0, index_js_2.toUtf8Bytes)(this.phrase, "NFKD"), salt, 2048, 64, "sha512"); + } + /** + * Creates a new Mnemonic for the %%phrase%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromPhrase(phrase, password, wordlist) { + // Normalize the case and space; throws if invalid + const entropy = mnemonicToEntropy(phrase, wordlist); + phrase = entropyToMnemonic((0, index_js_2.getBytes)(entropy), wordlist); + return new Mnemonic(_guard, entropy, phrase, password, wordlist); + } + /** + * Create a new **Mnemonic** from the %%entropy%%. + * + * The default %%password%% is the empty string and the default + * wordlist is the [English wordlists](LangEn). + */ + static fromEntropy(_entropy, password, wordlist) { + const entropy = (0, index_js_2.getBytes)(_entropy, "entropy"); + const phrase = entropyToMnemonic(entropy, wordlist); + return new Mnemonic(_guard, (0, index_js_2.hexlify)(entropy), phrase, password, wordlist); + } + /** + * Returns the phrase for %%mnemonic%%. + */ + static entropyToPhrase(_entropy, wordlist) { + const entropy = (0, index_js_2.getBytes)(_entropy, "entropy"); + return entropyToMnemonic(entropy, wordlist); + } + /** + * Returns the entropy for %%phrase%%. + */ + static phraseToEntropy(phrase, wordlist) { + return mnemonicToEntropy(phrase, wordlist); + } + /** + * Returns true if %%phrase%% is a valid [[link-bip-39]] phrase. + * + * This checks all the provided words belong to the %%wordlist%%, + * that the length is valid and the checksum is correct. + */ + static isValidMnemonic(phrase, wordlist) { + try { + mnemonicToEntropy(phrase, wordlist); + return true; + } + catch (error) { } + return false; + } +} +exports.Mnemonic = Mnemonic; +//# sourceMappingURL=mnemonic.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/mnemonic.js.map b/dist/ethers.js/src.ts/wallet/mnemonic.js.map new file mode 100644 index 0000000..c224b16 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/mnemonic.js.map @@ -0,0 +1 @@ +{"version":3,"file":"mnemonic.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/mnemonic.ts"],"names":[],"mappings":";;;AAAA,iDAAoD;AACpD,gDAE2B;AAC3B,wDAAiD;AAMjD,uCAAuC;AACvC,SAAS,YAAY,CAAC,IAAY;IAC/B,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;AACjD,CAAC;AAED,uCAAuC;AACvC,SAAS,YAAY,CAAC,IAAY;IAC/B,OAAO,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC;AACnC,CAAC;AAGD,SAAS,iBAAiB,CAAC,QAAgB,EAAE,QAA0B;IACnE,IAAA,0BAAe,EAAC,MAAM,CAAC,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;QAC9C,MAAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;QACpD,OAAO,IAAI,QAAQ,CAAC,MAAM,EAAE,IAAA,kBAAO,EAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;IAC9E,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,QAAmB,EAAE,QAA0B;QAClE,MAAM,OAAO,GAAG,IAAA,mBAAQ,EAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;QAC9C,OAAO,iBAAiB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IAChD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC7D,OAAO,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC/C,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,eAAe,CAAC,MAAc,EAAE,QAA0B;QAC7D,IAAI;YACA,iBAAiB,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;SACf;QAAC,OAAO,KAAK,EAAE,GAAG;QACnB,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ;AA/FD,4BA+FC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/utils.d.ts b/dist/ethers.js/src.ts/wallet/utils.d.ts new file mode 100644 index 0000000..0d4baab --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/utils.d.ts @@ -0,0 +1,8 @@ +/** + * @_ignore + */ +export declare function looseArrayify(hexString: string): Uint8Array; +export declare function zpad(value: String | number, length: number): String; +export declare function getPassword(password: string | Uint8Array): Uint8Array; +export declare function spelunk(object: any, _path: string): T; +//# sourceMappingURL=utils.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/utils.d.ts.map b/dist/ethers.js/src.ts/wallet/utils.d.ts.map new file mode 100644 index 0000000..0d37f30 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/utils.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/utils.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,CAK3D;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAInE;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,GAAG,UAAU,CAKrE;AAED,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,GAAG,CAAC,CA8DxD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/utils.js b/dist/ethers.js/src.ts/wallet/utils.js new file mode 100644 index 0000000..fe4650e --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/utils.js @@ -0,0 +1,149 @@ +"use strict"; +/** + * @_ignore + */ +Object.defineProperty(exports, "__esModule", { value: true }); +exports.spelunk = exports.getPassword = exports.zpad = exports.looseArrayify = void 0; +const index_js_1 = require("../utils/index.js"); +function looseArrayify(hexString) { + if (typeof (hexString) === "string" && !hexString.startsWith("0x")) { + hexString = "0x" + hexString; + } + return (0, index_js_1.getBytesCopy)(hexString); +} +exports.looseArrayify = looseArrayify; +function zpad(value, length) { + value = String(value); + while (value.length < length) { + value = '0' + value; + } + return value; +} +exports.zpad = zpad; +function getPassword(password) { + if (typeof (password) === 'string') { + return (0, index_js_1.toUtf8Bytes)(password, "NFKC"); + } + return (0, index_js_1.getBytesCopy)(password); +} +exports.getPassword = getPassword; +function spelunk(object, _path) { + const match = _path.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i); + (0, index_js_1.assertArgument)(match != null, "invalid path", "path", _path); + const path = match[1]; + const type = match[3]; + const reqd = (match[4] === "!"); + let cur = object; + for (const comp of path.toLowerCase().split('.')) { + // Search for a child object with a case-insensitive matching key + if (Array.isArray(cur)) { + if (!comp.match(/^[0-9]+$/)) { + break; + } + cur = cur[parseInt(comp)]; + } + else if (typeof (cur) === "object") { + let found = null; + for (const key in cur) { + if (key.toLowerCase() === comp) { + found = cur[key]; + break; + } + } + cur = found; + } + else { + cur = null; + } + if (cur == null) { + break; + } + } + (0, index_js_1.assertArgument)(!reqd || cur != null, "missing required value", "path", path); + if (type && cur != null) { + if (type === "int") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9]+$/)) { + return parseInt(cur); + } + else if (Number.isSafeInteger(cur)) { + return cur; + } + } + if (type === "number") { + if (typeof (cur) === "string" && cur.match(/^-?[0-9.]*$/)) { + return parseFloat(cur); + } + } + if (type === "data") { + if (typeof (cur) === "string") { + return looseArrayify(cur); + } + } + if (type === "array" && Array.isArray(cur)) { + return cur; + } + if (type === typeof (cur)) { + return cur; + } + (0, index_js_1.assertArgument)(false, `wrong type found for ${type} `, "path", path); + } + return cur; +} +exports.spelunk = spelunk; +/* +export function follow(object: any, path: string): null | string { + let currentChild = object; + + for (const comp of path.toLowerCase().split('/')) { + + // Search for a child object with a case-insensitive matching key + let matchingChild = null; + for (const key in currentChild) { + if (key.toLowerCase() === comp) { + matchingChild = currentChild[key]; + break; + } + } + + if (matchingChild === null) { return null; } + + currentChild = matchingChild; + } + + return currentChild; +} + +// "path/to/something:type!" +export function followRequired(data: any, path: string): string { + const value = follow(data, path); + if (value != null) { return value; } + return logger.throwArgumentError("invalid value", `data:${ path }`, + JSON.stringify(data)); +} +*/ +// See: https://www.ietf.org/rfc/rfc4122.txt (Section 4.4) +/* +export function uuidV4(randomBytes: BytesLike): string { + const bytes = getBytes(randomBytes, "randomBytes"); + + // Section: 4.1.3: + // - time_hi_and_version[12:16] = 0b0100 + bytes[6] = (bytes[6] & 0x0f) | 0x40; + + // Section 4.4 + // - clock_seq_hi_and_reserved[6] = 0b0 + // - clock_seq_hi_and_reserved[7] = 0b1 + bytes[8] = (bytes[8] & 0x3f) | 0x80; + + const value = hexlify(bytes); + + return [ + value.substring(2, 10), + value.substring(10, 14), + value.substring(14, 18), + value.substring(18, 22), + value.substring(22, 34), + ].join("-"); +} +*/ +//# sourceMappingURL=utils.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/utils.js.map b/dist/ethers.js/src.ts/wallet/utils.js.map new file mode 100644 index 0000000..1978c5f --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/utils.js.map @@ -0,0 +1 @@ +{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/utils.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,gDAE2B;AAE3B,SAAgB,aAAa,CAAC,SAAiB;IAC3C,IAAI,OAAM,CAAC,SAAS,CAAC,KAAK,QAAQ,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;QAC/D,SAAS,GAAG,IAAI,GAAG,SAAS,CAAC;KAChC;IACD,OAAO,IAAA,uBAAY,EAAC,SAAS,CAAC,CAAC;AACnC,CAAC;AALD,sCAKC;AAED,SAAgB,IAAI,CAAC,KAAsB,EAAE,MAAc;IACvD,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACtB,OAAO,KAAK,CAAC,MAAM,GAAG,MAAM,EAAE;QAAE,KAAK,GAAG,GAAG,GAAG,KAAK,CAAC;KAAE;IACtD,OAAO,KAAK,CAAC;AACjB,CAAC;AAJD,oBAIC;AAED,SAAgB,WAAW,CAAC,QAA6B;IACrD,IAAI,OAAM,CAAC,QAAQ,CAAC,KAAK,QAAQ,EAAE;QAC/B,OAAO,IAAA,sBAAW,EAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;KACxC;IACD,OAAO,IAAA,uBAAY,EAAC,QAAQ,CAAC,CAAC;AAClC,CAAC;AALD,kCAKC;AAED,SAAgB,OAAO,CAAI,MAAW,EAAE,KAAa;IAEjD,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G,IAAI,IAAI,EAAE;QACrB,IAAI,IAAI,KAAK,KAAK,EAAE;YAChB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,EAAE;gBACrD,OAAmB,QAAQ,CAAC,GAAG,CAAC,CAAC;aACpC;iBAAM,IAAI,MAAM,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE;gBAClC,OAAO,GAAG,CAAC;aACd;SACJ;QAED,IAAI,IAAI,KAAK,QAAQ,EAAE;YACnB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,GAAG,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE;gBACtD,OAAmB,UAAU,CAAC,GAAG,CAAC,CAAC;aACtC;SACJ;QAED,IAAI,IAAI,KAAK,MAAM,EAAE;YACjB,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,EAAE;gBAAE,OAAmB,aAAa,CAAC,GAAG,CAAC,CAAC;aAAE;SAC3E;QAED,IAAI,IAAI,KAAK,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE;YAAE,OAAmB,GAAG,CAAC;SAAE;QACvE,IAAI,IAAI,KAAK,OAAM,CAAC,GAAG,CAAC,EAAE;YAAE,OAAO,GAAG,CAAC;SAAE;QAEzC,IAAA,yBAAc,EAAC,KAAK,EAAE,wBAAyB,IAAK,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;KAC1E;IAED,OAAO,GAAG,CAAC;AACf,CAAC;AA9DD,0BA8DC;AACD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BE;AACF,0DAA0D;AAC1D;;;;;;;;;;;;;;;;;;;;;;;EAuBE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/wallet.d.ts b/dist/ethers.js/src.ts/wallet/wallet.d.ts new file mode 100644 index 0000000..91fa609 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/wallet.d.ts @@ -0,0 +1,71 @@ +import { SigningKey } from "../crypto/index.js"; +import { BaseWallet } from "./base-wallet.js"; +import { HDNodeWallet } from "./hdwallet.js"; +import type { ProgressCallback } from "../crypto/index.js"; +import type { Provider } from "../providers/index.js"; +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +export declare class Wallet extends BaseWallet { + #private; + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key: string | SigningKey, provider?: null | Provider); + connect(provider: null | Provider): Wallet; + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password: Uint8Array | string, progressCallback?: ProgressCallback): Promise; + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password: Uint8Array | string): string; + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static fromEncryptedJson(json: string, password: Uint8Array | string, progress?: ProgressCallback): Promise; + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json: string, password: Uint8Array | string): HDNodeWallet | Wallet; + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider?: null | Provider): HDNodeWallet; + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase: string, provider?: Provider): HDNodeWallet; +} +//# sourceMappingURL=wallet.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/wallet.d.ts.map b/dist/ethers.js/src.ts/wallet/wallet.d.ts.map new file mode 100644 index 0000000..521894d --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/wallet.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAS7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAUtD;;;;;;;;;GASG;AACH,qBAAa,MAAO,SAAQ,UAAU;;IAElC;;;OAGG;gBACS,GAAG,EAAE,MAAM,GAAG,UAAU,EAAE,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ;IAShE,OAAO,CAAC,QAAQ,EAAE,IAAI,GAAG,QAAQ,GAAG,MAAM;IAI1C;;;;;;OAMG;IACG,OAAO,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,gBAAgB,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,MAAM,CAAC;IAKlG;;;;;;;;;OASG;IACH,WAAW,CAAC,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,MAAM;IAyBlD;;;;;;OAMG;WACU,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,EAAE,QAAQ,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,YAAY,GAAG,MAAM,CAAC;IAexI;;;;;;OAMG;IACH,MAAM,CAAC,qBAAqB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,MAAM,GAAG,YAAY,GAAG,MAAM;IAahG;;;;;OAKG;IACH,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAG,YAAY;IAM7D;;OAEG;IACH,MAAM,CAAC,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,QAAQ,GAAG,YAAY;CAKvE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/wallet.js b/dist/ethers.js/src.ts/wallet/wallet.js new file mode 100644 index 0000000..6ab44a3 --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/wallet.js @@ -0,0 +1,167 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _a, _Wallet_fromAccount; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wallet = void 0; +const index_js_1 = require("../crypto/index.js"); +const index_js_2 = require("../utils/index.js"); +const base_wallet_js_1 = require("./base-wallet.js"); +const hdwallet_js_1 = require("./hdwallet.js"); +const json_crowdsale_js_1 = require("./json-crowdsale.js"); +const json_keystore_js_1 = require("./json-keystore.js"); +const mnemonic_js_1 = require("./mnemonic.js"); +function stall(duration) { + return new Promise((resolve) => { setTimeout(() => { resolve(); }, duration); }); +} +/** + * A **Wallet** manages a single private key which is used to sign + * transactions, messages and other common payloads. + * + * This class is generally the main entry point for developers + * that wish to use a private key directly, as it can create + * instances from a large variety of common sources, including + * raw private key, [[link-bip-39]] mnemonics and encrypte JSON + * wallets. + */ +class Wallet extends base_wallet_js_1.BaseWallet { + /** + * Create a new wallet for the private %%key%%, optionally connected + * to %%provider%%. + */ + constructor(key, provider) { + if (typeof (key) === "string" && !key.startsWith("0x")) { + key = "0x" + key; + } + let signingKey = (typeof (key) === "string") ? new index_js_1.SigningKey(key) : key; + super(signingKey, provider); + } + connect(provider) { + return new Wallet(this.signingKey, provider); + } + /** + * Resolves to a [JSON Keystore Wallet](json-wallets) encrypted with + * %%password%%. + * + * If %%progressCallback%% is specified, it will receive periodic + * updates as the encryption process progreses. + */ + encrypt(password, progressCallback) { + return __awaiter(this, void 0, void 0, function* () { + const account = { address: this.address, privateKey: this.privateKey }; + return yield (0, json_keystore_js_1.encryptKeystoreJson)(account, password, { progressCallback }); + }); + } + /** + * Returns a [JSON Keystore Wallet](json-wallets) encryped with + * %%password%%. + * + * It is preferred to use the [async version](encrypt) instead, + * which allows a [[ProgressCallback]] to keep the user informed. + * + * This method will block the event loop (freezing all UI) until + * it is complete, which may be a non-trivial duration. + */ + encryptSync(password) { + const account = { address: this.address, privateKey: this.privateKey }; + return (0, json_keystore_js_1.encryptKeystoreJsonSync)(account, password); + } + /** + * Creates (asynchronously) a **Wallet** by decrypting the %%json%% + * with %%password%%. + * + * If %%progress%% is provided, it is called periodically during + * decryption so that any UI can be updated. + */ + static fromEncryptedJson(json, password, progress) { + return __awaiter(this, void 0, void 0, function* () { + let account = null; + if ((0, json_keystore_js_1.isKeystoreJson)(json)) { + account = yield (0, json_keystore_js_1.decryptKeystoreJson)(json, password, progress); + } + else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { + if (progress) { + progress(0); + yield stall(0); + } + account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); + if (progress) { + progress(1); + yield stall(0); + } + } + return __classPrivateFieldGet(Wallet, _a, "m", _Wallet_fromAccount).call(Wallet, account); + }); + } + /** + * Creates a **Wallet** by decrypting the %%json%% with %%password%%. + * + * The [[fromEncryptedJson]] method is preferred, as this method + * will lock up and freeze the UI during decryption, which may take + * some time. + */ + static fromEncryptedJsonSync(json, password) { + let account = null; + if ((0, json_keystore_js_1.isKeystoreJson)(json)) { + account = (0, json_keystore_js_1.decryptKeystoreJsonSync)(json, password); + } + else if ((0, json_crowdsale_js_1.isCrowdsaleJson)(json)) { + account = (0, json_crowdsale_js_1.decryptCrowdsaleJson)(json, password); + } + else { + (0, index_js_2.assertArgument)(false, "invalid JSON wallet", "json", "[ REDACTED ]"); + } + return __classPrivateFieldGet(Wallet, _a, "m", _Wallet_fromAccount).call(Wallet, account); + } + /** + * Creates a new random [[HDNodeWallet]] using the available + * [cryptographic random source](randomBytes). + * + * If there is no crytographic random source, this will throw. + */ + static createRandom(provider) { + const wallet = hdwallet_js_1.HDNodeWallet.createRandom(); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } + /** + * Creates a [[HDNodeWallet]] for %%phrase%%. + */ + static fromPhrase(phrase, provider) { + const wallet = hdwallet_js_1.HDNodeWallet.fromPhrase(phrase); + if (provider) { + return wallet.connect(provider); + } + return wallet; + } +} +exports.Wallet = Wallet; +_a = Wallet, _Wallet_fromAccount = function _Wallet_fromAccount(account) { + (0, index_js_2.assertArgument)(account, "invalid JSON wallet", "json", "[ REDACTED ]"); + if ("mnemonic" in account && account.mnemonic && account.mnemonic.locale === "en") { + const mnemonic = mnemonic_js_1.Mnemonic.fromEntropy(account.mnemonic.entropy); + const wallet = hdwallet_js_1.HDNodeWallet.fromMnemonic(mnemonic, account.mnemonic.path); + if (wallet.address === account.address && wallet.privateKey === account.privateKey) { + return wallet; + } + console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key"); + } + const wallet = new Wallet(account.privateKey); + (0, index_js_2.assertArgument)(wallet.address === account.address, "address/privateKey mismatch", "json", "[ REDACTED ]"); + return wallet; +}; +//# sourceMappingURL=wallet.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wallet/wallet.js.map b/dist/ethers.js/src.ts/wallet/wallet.js.map new file mode 100644 index 0000000..0a35a4a --- /dev/null +++ b/dist/ethers.js/src.ts/wallet/wallet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wallet.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wallet/wallet.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA,iDAAgD;AAChD,gDAAmD;AAEnD,qDAA8C;AAC9C,+CAA6C;AAC7C,2DAA6E;AAC7E,yDAI4B;AAC5B,+CAAyC;AASzC,SAAS,KAAK,CAAC,QAAgB;IAC3B,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,GAAG,UAAU,CAAC,GAAG,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACrF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAa,MAAO,SAAQ,2BAAU;IAElC;;;OAGG;IACH,YAAY,GAAwB,EAAE,QAA0B;QAC5D,IAAI,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,EAAE;YACnD,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;SACpB;QAED,IAAI,UAAU,GAAG,CAAC,OAAM,CAAC,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,qBAAU,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,GAAG,CAAC;QACvE,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED,OAAO,CAAC,QAAyB;QAC7B,OAAO,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O,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,KAAK,IAAI,EAAE;QAC/E,MAAM,QAAQ,GAAG,sBAAQ,CAAC,WAAW,CAAC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;QAChE,MAAM,MAAM,GAAG,0BAAY,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAC1E,IAAI,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,IAAI,MAAM,CAAC,UAAU,KAAK,OAAO,CAAC,UAAU,EAAE;YAChF,OAAO,MAAM,CAAC;SACjB;QACD,OAAO,CAAC,GAAG,CAAC,kFAAkF,CAAC,CAAC;KACnG;IAED,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAE9C,IAAA,yBAAc,EAAC,MAAM,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAC7C,6BAA6B,EAAE,MAAM,EAAE,cAAc,CAAC,CAAC;IAE3D,OAAO,MAAM,CAAC;AAClB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts b/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts new file mode 100644 index 0000000..1aa8495 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeBits(width: number, data: string): Array; +//# sourceMappingURL=bit-reader.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts.map b/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts.map new file mode 100644 index 0000000..ef1a853 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/bit-reader.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CA6BrE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/bit-reader.js b/dist/ethers.js/src.ts/wordlists/bit-reader.js new file mode 100644 index 0000000..706eaa9 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/bit-reader.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeBits = void 0; +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +/** + * @_ignore + */ +function decodeBits(width, data) { + const maxValue = (1 << width) - 1; + const result = []; + let accum = 0, bits = 0, flood = 0; + for (let i = 0; i < data.length; i++) { + // Accumulate 6 bits of data + accum = ((accum << 6) | Base64.indexOf(data[i])); + bits += 6; + // While we have enough for a word... + while (bits >= width) { + // ...read the word + const value = (accum >> (bits - width)); + accum &= (1 << (bits - width)) - 1; + bits -= width; + // A value of 0 indicates we exceeded maxValue, it + // floods over into the next value + if (value === 0) { + flood += maxValue; + } + else { + result.push(value + flood); + flood = 0; + } + } + } + return result; +} +exports.decodeBits = decodeBits; +//# sourceMappingURL=bit-reader.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/bit-reader.js.map b/dist/ethers.js/src.ts/wordlists/bit-reader.js.map new file mode 100644 index 0000000..8440bf3 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/bit-reader.js.map @@ -0,0 +1 @@ +{"version":3,"file":"bit-reader.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/bit-reader.ts"],"names":[],"mappings":";;;AAAA,MAAM,MAAM,GAAG,kEAAkE,CAAC;AAElF;;GAEG;AACH,SAAgB,UAAU,CAAC,KAAa,EAAE,IAAY;IAClD,MAAM,QAAQ,GAAG,CAAC,CAAC,IAAI,KAAK,CAAC,GAAG,CAAC,CAAC;IAClC,MAAM,MAAM,GAAkB,EAAG,CAAC;IAClC,IAAI,KAAK,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC;IACnC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE;QAElC,4BAA4B;QAC5B,KAAK,GAAG,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,CAAC;QAEV,qCAAqC;QACrC,OAAO,IAAI,IAAI,KAAK,EAAE;YAClB,mBAAmB;YACnB,MAAM,KAAK,GAAG,CAAC,KAAK,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC;YACxC,KAAK,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,IAAI,KAAK,CAAC;YAEd,kDAAkD;YAClD,kCAAkC;YAClC,IAAI,KAAK,KAAK,CAAC,EAAE;gBACb,KAAK,IAAI,QAAQ,CAAC;aACrB;iBAAM;gBACH,MAAM,CAAC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;gBAC3B,KAAK,GAAG,CAAC,CAAC;aACb;SACJ;KACJ;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AA7BD,gCA6BC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts b/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts new file mode 100644 index 0000000..8822086 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts @@ -0,0 +1,9 @@ +/** + * @_ignore + */ +export declare function decode(data: string, subs: string): Array; +/** + * @_ignore + */ +export declare function decodeOwl(data: string): Array; +//# sourceMappingURL=decode-owl.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts.map b/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts.map new file mode 100644 index 0000000..d3e382d --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owl.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAsBhE;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAMrD"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owl.js b/dist/ethers.js/src.ts/wordlists/decode-owl.js new file mode 100644 index 0000000..9ee1c18 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owl.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeOwl = exports.decode = void 0; +const index_js_1 = require("../utils/index.js"); +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z]*$/i; +function unfold(words, sep) { + let initial = 97; + return words.reduce((accum, word) => { + if (word === sep) { + initial++; + } + else if (word.match(Word)) { + accum.push(String.fromCharCode(initial) + word); + } + else { + initial = 97; + accum.push(word); + } + return accum; + }, []); +} +/** + * @_ignore + */ +function decode(data, subs) { + // Replace all the substitutions with their expanded form + for (let i = subsChrs.length - 1; i >= 0; i--) { + data = data.split(subsChrs[i]).join(subs.substring(2 * i, 2 * i + 2)); + } + // Get all tle clumps; each suffix, first-increment and second-increment + const clumps = []; + const leftover = data.replace(/(:|([0-9])|([A-Z][a-z]*))/g, (all, item, semi, word) => { + if (semi) { + for (let i = parseInt(semi); i >= 0; i--) { + clumps.push(";"); + } + } + else { + clumps.push(item.toLowerCase()); + } + return ""; + }); + /* c8 ignore start */ + if (leftover) { + throw new Error(`leftovers: ${JSON.stringify(leftover)}`); + } + /* c8 ignore stop */ + return unfold(unfold(clumps, ";"), ":"); +} +exports.decode = decode; +/** + * @_ignore + */ +function decodeOwl(data) { + (0, index_js_1.assertArgument)(data[0] === "0", "unsupported auwl data", "data", data); + return decode(data.substring(1 + 2 * subsChrs.length), data.substring(1, 1 + 2 * subsChrs.length)); +} +exports.decodeOwl = decodeOwl; +//# sourceMappingURL=decode-owl.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owl.js.map b/dist/ethers.js/src.ts/wordlists/decode-owl.js.map new file mode 100644 index 0000000..ff1bec7 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owl.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/decode-owl.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAGnD,MAAM,QAAQ,GAAG,+BAA+B,CAAC;AACjD,MAAM,IAAI,GAAG,WAAW,CAAC;AAEzB,SAAS,MAAM,CAAC,KAAoB,EAAE,GAAW;IAC7C,IAAI,OAAO,GAAG,EAAE,CAAC;IACjB,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;QAChC,IAAI,IAAI,KAAK,GAAG,EAAE;YACd,OAAO,EAAE,CAAC;SACb;aAAM,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;YACzB,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC;SACnD;aAAM;YACH,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;SACpB;QACD,OAAO,KAAK,CAAC;IACjB,CAA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,IAAI,CAAC,CAAC,CAAC,KAAK,GAAG,EAAE,uBAAuB,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IAEvE,OAAO,MAAM,CACT,IAAI,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,EACvC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AACpD,CAAC;AAND,8BAMC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts b/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts new file mode 100644 index 0000000..479e6c5 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts @@ -0,0 +1,5 @@ +/** + * @_ignore + */ +export declare function decodeOwlA(data: string, accents: string): Array; +//# sourceMappingURL=decode-owla.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts.map b/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts.map new file mode 100644 index 0000000..3bd07c3 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owla.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":"AAKA;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC,CAwBvE"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owla.js b/dist/ethers.js/src.ts/wordlists/decode-owla.js new file mode 100644 index 0000000..59dab29 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owla.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.decodeOwlA = void 0; +const index_js_1 = require("../utils/index.js"); +const bit_reader_js_1 = require("./bit-reader.js"); +const decode_owl_js_1 = require("./decode-owl.js"); +/** + * @_ignore + */ +function decodeOwlA(data, accents) { + let words = (0, decode_owl_js_1.decodeOwl)(data).join(","); + // Inject the accents + accents.split(/,/g).forEach((accent) => { + const match = accent.match(/^([a-z]*)([0-9]+)([0-9])(.*)$/); + (0, index_js_1.assertArgument)(match !== null, "internal error parsing accents", "accents", accents); + let posOffset = 0; + const positions = (0, bit_reader_js_1.decodeBits)(parseInt(match[3]), match[4]); + const charCode = parseInt(match[2]); + const regex = new RegExp(`([${match[1]}])`, "g"); + words = words.replace(regex, (all, letter) => { + const rem = --positions[posOffset]; + if (rem === 0) { + letter = String.fromCharCode(letter.charCodeAt(0), charCode); + posOffset++; + } + return letter; + }); + }); + return words.split(","); +} +exports.decodeOwlA = decodeOwlA; +//# sourceMappingURL=decode-owla.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/decode-owla.js.map b/dist/ethers.js/src.ts/wordlists/decode-owla.js.map new file mode 100644 index 0000000..e6fec66 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/decode-owla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"decode-owla.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/decode-owla.ts"],"names":[],"mappings":";;;AAAA,gDAAmD;AAEnD,mDAA6C;AAC7C,mDAA4C;AAE5C;;GAEG;AACH,SAAgB,UAAU,CAAC,IAAY,EAAE,OAAe;IACpD,IAAI,KAAK,GAAG,IAAA,yBAAS,EAAC,IAAI,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAEtC,qBAAqB;IACrB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;QAEnC,MAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,+BAA+B,CAAC,CAAC;QAC5D,IAAA,yBAAc,EAAC,KAAK,KAAK,IAAI,EAAE,gCAAgC,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;QAErF,IAAI,SAAS,GAAG,CAAC,CAAC;QAClB,MAAM,SAAS,GAAG,IAAA,0BAAU,EAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;QACpC,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,KAAM,KAAK,CAAC,CAAC,CAAE,IAAI,EAAE,GAAG,CAAC,CAAC;QACnD,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,EAAE;YACzC,MAAM,GAAG,GAAG,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;YACnC,IAAI,GAAG,KAAK,CAAC,EAAE;gBACX,MAAM,GAAG,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC;gBAC7D,SAAS,EAAE,CAAC;aACf;YACD,OAAO,MAAM,CAAC;QAClB,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;IAEH,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC;AAxBD,gCAwBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts new file mode 100644 index 0000000..a646e82 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts @@ -0,0 +1,25 @@ +export declare class BitWriter { + #private; + readonly width: number; + constructor(width: number); + write(value: number): void; + get length(): number; + get data(): string; +} +export interface AccentSet { + accent: number; + follows: string; + positions: Array; + positionsLength: number; + positionData: string; + positionDataLength: number; +} +export declare function extractAccents(words: Array): { + accents: Array; + words: Array; +}; +export declare function encodeOwl(words: Array): { + subs: string; + data: string; +}; +//# sourceMappingURL=encode-latin.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts.map b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts.map new file mode 100644 index 0000000..a026d56 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":"AAuIA,qBAAa,SAAS;;IAClB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAKX,KAAK,EAAE,MAAM;IAMzB,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW1B,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CA4BjB;CACJ;AAED,MAAM,WAAW,SAAS;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAWD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CAAE,CAyExG;AAGD,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CA4C9E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js new file mode 100644 index 0000000..9669685 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js @@ -0,0 +1,365 @@ +"use strict"; +// OWL Data Format +// +// The Official WordList data format exported by this encoder +// encodes sorted latin-1 words (letters only) based on the +// fact that sorted words have prefixes with substantial +// overlap. +// +// For example, the words: +// [ Another, Apple, Apricot, Bread ] +// could be folded once with a single special character, such +// as ":" to yield: +// [ nother, pple, pricot, :, read ]. +// The First letter has been removed, but can be inferred by +// starting at A and incrementing to the next letter when ":" +// is encountered. +// +// The fold operation can be repeated for large sets as even within +// each folded set, there is substatial overlap in prefix. With the +// second special symbol ";", we get: +// [ ; x 13, other, :, ple, ricot, :, ; x 18, ead ] +// which can be further compressed by using numbers instead of the +// special character: +// [ 13, other, :, ple, ricot, :, 18, ead ] +// and to keep all values within a single byte, we only allow a +// maximum value of 10 (using 0 through 9 to represent 1 through 10), +// we get: +// [ 9, 2, other, :, ple, ricot, :, 9, 7, ead ] +// and we use camel-case to imply the bounrary, giving the final string: +// "92Other:PleRicot:97Ead" +// +// Once the entire latin-1 set has been collapsed, we use the remaining +// printable characters (except " and \, which require 2 bytes to represent +// in string) to substiture for the most common 2-letter pairs of letters +// in the string. +// +// OWLA Accent Format +// +// OWLA first removes all accents, and encodes that data using the OWL +// data format and encodes the accents as a base-64 series of 6-bit +// packed bits representing the distance from one followed letter to the +// next. +// +// For example, the acute accent in a given language may follow either +// a or e, in which case the follow-set is "ae". Each letter in the entire +// set is indexed, so the set of words with the accents: +// "thisA/ppleDoe/sNotMa/tterToMe/" +// " 1^ 2^ 3^ 4^ 5^ 6^ " <-- follow-set members, ALL a's and e's +// which gives the positions: +// [ 0, 2, 3, 4, 6 ] +// which then reduce to the distances +// [ 0, 2, 1, 1, 2 ] +// each of which fit into a 2-bit value, so this can be encoded as the +// base-64 encoded string: +// 00 10 01 01 10 = 001001 1010xx +// +// The base-64 set used has all number replaced with their +// shifted-counterparts to prevent comflicting with the numbers used in +// the fold operation to indicate the number of ";". +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +var _BitWriter_data, _BitWriter_bitLength; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.encodeOwl = exports.extractAccents = exports.BitWriter = void 0; +const fs_1 = __importDefault(require("fs")); +const id_js_1 = require("../../hash/id.js"); +const decode_owl_js_1 = require("../decode-owl.js"); +const decode_owla_js_1 = require("../decode-owla.js"); +const subsChrs = " !#$%&'()*+,-./<=>?@[]^_`{|}~"; +const Word = /^[a-z'`]*$/i; +function fold(words, sep) { + const output = []; + let initial = 97; + for (const word of words) { + if (word.match(Word)) { + while (initial < word.charCodeAt(0)) { + initial++; + output.push(sep); + } + output.push(word.substring(1)); + } + else { + initial = 97; + output.push(word); + } + } + return output; +} +function camelcase(words) { + return words.map((word) => { + if (word.match(Word)) { + return word[0].toUpperCase() + word.substring(1); + } + else { + return word; + } + }).join(""); +} +//let cc = 0, ce = 0; +/* +function getChar(c: string): string { + //if (c === "e") { ce++; } + if (c >= 'a' && c <= 'z') { return c; } + if (c.charCodeAt(1)) { + throw new Error(`bad char: "${ c }"`); + } + //cc++; + return ""; + if (c.charCodeAt(0) === 768) { return "`"; } + if (c.charCodeAt(0) === 769) { return "'"; } + if (c.charCodeAt(0) === 771) { return "~"; } + throw new Error(`Unsupported character: ${ c } (${ c.charCodeAt(0) }, ${ c.charCodeAt(1) })`); +} +function mangle(text: string): { word: string, special: string } { + const result: Array = [ ]; + for (let i = 0; i < text.length; i++) { + const c = getChar(text[i]); + result.push(c); + } + + const word = result.join(""); + if (word[1] >= 'a' && word[1] <= 'z') { return { word, special: " " }; } + return { word: word[0] + word.substring(2), special: word[1] }; +} +*/ +/* + Store: [ accent ][ targets ][ rle data; base64-tail ] + ` ae 3, 100 = (63, 37), 15 + ~ n 63, 64 = (63, 1), 27 +*/ +const Base64 = ")!@#$%^&*(ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_"; +class BitWriter { + constructor(width) { + _BitWriter_data.set(this, void 0); + _BitWriter_bitLength.set(this, void 0); + this.width = width; + __classPrivateFieldSet(this, _BitWriter_data, [], "f"); + __classPrivateFieldSet(this, _BitWriter_bitLength, 0, "f"); + } + write(value) { + const maxValue = ((1 << this.width) - 1); + while (value > maxValue) { + __classPrivateFieldGet(this, _BitWriter_data, "f").push(0); + __classPrivateFieldSet(this, _BitWriter_bitLength, __classPrivateFieldGet(this, _BitWriter_bitLength, "f") + this.width, "f"); + value -= maxValue; + } + __classPrivateFieldGet(this, _BitWriter_data, "f").push(value); + __classPrivateFieldSet(this, _BitWriter_bitLength, __classPrivateFieldGet(this, _BitWriter_bitLength, "f") + this.width, "f"); + } + get length() { + return 1 + Math.trunc((__classPrivateFieldGet(this, _BitWriter_bitLength, "f") + 5) / 6); + } + get data() { + let result = String(this.width); + let bits = 0; + let accum = 0; + const data = __classPrivateFieldGet(this, _BitWriter_data, "f").slice(); + let bitMod = __classPrivateFieldGet(this, _BitWriter_bitLength, "f") % 6; + while (bitMod !== 0 && bitMod < 6) { + data.push(0); + bitMod += this.width; + } + for (const value of data) { + accum <<= this.width; + accum |= value; + bits += this.width; + if (bits < 6) { + continue; + } + result += Base64[accum >> (bits - 6)]; + bits -= 6; + accum &= ((1 << bits) - 1); + } + if (result.length !== this.length) { + throw new Error(`Hmm: ${this.length} ${result.length} ${result}`); + } + return result; + } +} +exports.BitWriter = BitWriter; +_BitWriter_data = new WeakMap(), _BitWriter_bitLength = new WeakMap(); +; +function sorted(text) { + const letters = text.split(""); + letters.sort(); + return letters.join(""); +} +// if (c.charCodeAt(0) === 768) { return "`"; } +// if (c.charCodeAt(0) === 769) { return "'"; } +// if (c.charCodeAt(0) === 771) { return "~"; } +function extractAccents(words) { + // Build a list that maps accents to the letters it can follow + const followsMap = new Map(); + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + continue; + } + // Make sure this positions and codepoint make sense + if (c.charCodeAt(1)) { + throw new Error(`unsupported codepoint: "${c}"`); + } + if (i === 0) { + throw new Error(`unmatched accent: ${c}`); + } + const ac = c.charCodeAt(0), lastLetter = word[i - 1]; + ; + const follows = (followsMap.get(ac) || ""); + if (follows.indexOf(lastLetter) === -1) { + followsMap.set(ac, sorted(follows + lastLetter)); + } + } + } + // Build the positions of each follow-set for those accents + const positionsMap = new Map(); + for (const [accent, follows] of followsMap) { + let count = 0; + for (const word of words) { + for (let i = 0; i < word.length; i++) { + const c = word[i], ac = c.charCodeAt(0); + if (follows.indexOf(c) >= 0) { + count++; + } + if (ac === accent) { + const pos = positionsMap.get(ac) || []; + pos.push(count); + positionsMap.set(ac, pos); + } + } + } + } + const accents = []; + for (const [accent, follows] of followsMap) { + let last = -1; + const positions = (positionsMap.get(accent) || []).map((value, index) => { + const delta = value - last; + last = value; + if (index === 0) { + return value; + } + return delta; + }); + // Find the best encoding of the position data + let positionData = ""; + for (let i = 2; i < 7; i++) { + const bitWriter = new BitWriter(i); + for (const p of positions) { + bitWriter.write(p); + } + if (positionData === "" || bitWriter.length < positionData.length) { + positionData = bitWriter.data; + } + } + const positionsLength = positions.length; + const positionDataLength = positionData.length; + accents.push({ accent, follows, positions, positionsLength, positionData, positionDataLength }); + } + words = words.map((word) => { + let result = ""; + for (let i = 0; i < word.length; i++) { + const c = word[i]; + if (c >= 'a' && c <= 'z') { + result += c; + } + } + return result; + }); + return { accents, words }; +} +exports.extractAccents = extractAccents; +// Encode Official WordList +function encodeOwl(words) { + // Fold the sorted words by indicating delta for the first 2 letters + let data = camelcase(fold(fold(words, ":"), ";")); + // Replace semicolons with counts (e.g. ";;;" with "3") + data = data.replace(/(;+)/g, (all, semis) => { + let result = ""; + while (semis.length) { + let count = semis.length; + if (count > 10) { + count = 10; + } + result += String(count - 1); + semis = semis.substring(count); + } + return result; + }); + // Finds the best option for a shortcut replacement using the + // unused ascii7 characters + function findBest() { + const tally = {}; + const l = 2; + for (let i = l; i < data.length; i++) { + const key = data.substring(i - l, i); + tally[key] = (tally[key] || 0) + 1; + } + const sorted = Object.keys(tally).map((text) => { + return { text, count: tally[text], save: (tally[text] * (text.length - 1)) }; + }); + sorted.sort((a, b) => (b.save - a.save)); + return sorted[0].text; + } + // Make substitutions + let subs = ""; + for (let i = 0; i < subsChrs.length; i++) { + const n = subsChrs[i], o = findBest(); + subs += o; + data = data.split(o).join(n); + } + return { data, subs }; +} +exports.encodeOwl = encodeOwl; +// Returns either: +// - OWL data for accent-free latin-1: { data, accentds: "" } +// - OWLA data for accented latin-1: { data, accents } +function encodeWords(_words) { + const { accents, words } = extractAccents(_words); + const { data, subs } = encodeOwl(words); + const accentData = accents.map(({ accent, follows, positionData }) => { + return `${follows}${accent}${positionData}`; + }).join(","); + return { + data: `0${subs}${data}`, + accents: accentData + }; +} +// CLI +const content = fs_1.default.readFileSync(process.argv[2]).toString(); +const words = content.split("\n").filter(Boolean); +const { data, accents } = encodeWords(words); +if (accents) { + const rec = (0, decode_owla_js_1.decodeOwlA)(data, accents); + console.log("DATA: ", JSON.stringify(data)); + console.log("ACCENTS: ", JSON.stringify(accents)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", (0, id_js_1.id)(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +else { + const rec = (0, decode_owl_js_1.decodeOwl)(data); + console.log("DATA: ", JSON.stringify(data)); + console.log("LENGTH: ", data.length); + console.log("CHECKSUM: ", (0, id_js_1.id)(content)); + console.log("RATIO: ", Math.trunc(100 * data.length / content.length) + "%"); + if (rec.join("\n") !== words.join("\n")) { + throw new Error("no match!"); + } +} +//# sourceMappingURL=encode-latin.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js.map b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js.map new file mode 100644 index 0000000..4e3bc39 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/generation/encode-latin.js.map @@ -0,0 +1 @@ +{"version":3,"file":"encode-latin.js","sourceRoot":"","sources":["../../../../../src/ethers.js/src.ts/wordlists/generation/encode-latin.ts"],"names":[],"mappings":";AACA,kBAAkB;AAClB,EAAE;AACF,6DAA6D;AAC7D,2DAA2D;AAC3D,wDAAwD;AACxD,WAAW;AACX,EAAE;AACF,0BAA0B;AAC1B,uCAAuC;AACvC,6DAA6D;AAC7D,mBAAmB;AACnB,uCAAuC;AACvC,4DAA4D;AAC5D,6DAA6D;AAC7D,kBAAkB;AAClB,EAAE;AACF,mEAAmE;AACnE,mEAAmE;AACnE,qCAAqC;AACrC,qDAAqD;AACrD,kEAAkE;AAClE,qBAAqB;AACrB,6CAA6C;AAC7C,+DAA+D;AAC/D,qEAAqE;AACrE,UAAU;AACV,iDAAiD;AACjD,wEAAwE;AACxE,6BAA6B;AAC7B,EAAE;AACF,uEAAuE;AACvE,2EAA2E;AAC3E,yEAAyE;AACzE,iBAAiB;AACjB,EAAE;AACF,qBAAqB;AACrB,EAAE;AACF,sEAAsE;AACtE,mEAAmE;AACnE,wEAAwE;AACxE,QAAQ;AACR,EAAE;AACF,sEAAsE;AACtE,0EAA0E;AAC1E,wDAAwD;AACxD,qCAAqC;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KAAK,CAAC,WAAW,CAAC,CAAC;KAAE;CAC7E"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/index.d.ts b/dist/ethers.js/src.ts/wordlists/index.d.ts new file mode 100644 index 0000000..04a911c --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/index.d.ts @@ -0,0 +1,25 @@ +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +export { Wordlist } from "./wordlist.js"; +export { LangEn } from "./lang-en.js"; +export { WordlistOwl } from "./wordlist-owl.js"; +export { WordlistOwlA } from "./wordlist-owla.js"; +export { wordlists } from "./wordlists.js"; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/index.d.ts.map b/dist/ethers.js/src.ts/wordlists/index.d.ts.map new file mode 100644 index 0000000..1f8e867 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/index.js b/dist/ethers.js/src.ts/wordlists/index.js new file mode 100644 index 0000000..26e29cf --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/index.js @@ -0,0 +1,33 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = exports.WordlistOwlA = exports.WordlistOwl = exports.LangEn = exports.Wordlist = void 0; +/** + * A Wordlist is a set of 2048 words used to encode private keys + * (or other binary data) that is easier for humans to write down, + * transcribe and dictate. + * + * The [[link-bip-39]] standard includes several checksum bits, + * depending on the size of the mnemonic phrase. + * + * A mnemonic phrase may be 12, 15, 18, 21 or 24 words long. For + * most purposes 12 word mnemonics should be used, as including + * additional words increases the difficulty and potential for + * mistakes and does not offer any effective improvement on security. + * + * There are a variety of [[link-bip39-wordlists]] for different + * languages, but for maximal compatibility, the + * [English Wordlist](LangEn) is recommended. + * + * @_section: api/wordlists:Wordlists [about-wordlists] + */ +var wordlist_js_1 = require("./wordlist.js"); +Object.defineProperty(exports, "Wordlist", { enumerable: true, get: function () { return wordlist_js_1.Wordlist; } }); +var lang_en_js_1 = require("./lang-en.js"); +Object.defineProperty(exports, "LangEn", { enumerable: true, get: function () { return lang_en_js_1.LangEn; } }); +var wordlist_owl_js_1 = require("./wordlist-owl.js"); +Object.defineProperty(exports, "WordlistOwl", { enumerable: true, get: function () { return wordlist_owl_js_1.WordlistOwl; } }); +var wordlist_owla_js_1 = require("./wordlist-owla.js"); +Object.defineProperty(exports, "WordlistOwlA", { enumerable: true, get: function () { return wordlist_owla_js_1.WordlistOwlA; } }); +var wordlists_js_1 = require("./wordlists.js"); +Object.defineProperty(exports, "wordlists", { enumerable: true, get: function () { return wordlists_js_1.wordlists; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/index.js.map b/dist/ethers.js/src.ts/wordlists/index.js.map new file mode 100644 index 0000000..aa5254b --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/index.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,6CAAyC;AAAhC,uGAAA,QAAQ,OAAA;AACjB,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AAEf,qDAAgD;AAAvC,8GAAA,WAAW,OAAA;AACpB,uDAAkD;AAAzC,gHAAA,YAAY,OAAA;AAErB,+CAA2C;AAAlC,yGAAA,SAAS,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts b/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts new file mode 100644 index 0000000..c199d4f --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangCz extends WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist(): LangCz; +} +//# sourceMappingURL=lang-cz.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts.map new file mode 100644 index 0000000..3a19bce --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-cz.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-cz.js b/dist/ethers.js/src.ts/wordlists/lang-cz.js new file mode 100644 index 0000000..405c456 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-cz.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangCz = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0itatkastcenaovo$taouleraeki&chor*teci%enbalodaeladet'!Chn=0Di#%E%^1Resa2Rese3CeT'#0EjKohol0Pu)%0A&sDul#Ekdo)Ke)Ti#Ul|3}aOgan%0FaltI$@tPi,%TmaTronom0LasL{i#Ol0Tobus4Yl:B#}R'?TaUb_U/!U^U+Ur!Xer2A^v#Ambo,An#AtrEp)Ike)KoLohOnzOskevUn{#Usin#Z^Zy2Bl.Bn|})D _D#D'aF{Jar(Kv?LdokLvaN^NkrRzaTikVolZola3D+tL.T'#0Ukot:PartRev&3DrDu+J/JnLaLerLkemLn?N.Nn(N'#NtrumNzZ(2O&2KolivUv!4It_N(0Dn(Ke)KrPot0Ak~AlIkRkot2Kli$a:L-oRe[T_Tum1E,1B!a}'#Cib_Fic Fla%KlKr{Mokr!PreseRbyS#T-tiv3Kob,zKt|O^P]mSkSp+jV`]Vo/2AhaOuhoUhopis1Es0BroByt-C@t}ut DnesH+dHo^H,JemJn?Kl`KolaKtAzeDolObn(OgerieOzdSn(T Z(2B@}'noD-HaH'#S SnoT(0Oj?Or>2Nam :9O]gOnomie0EktronIpsa0AilIseO%P!ie2Izo^O/aOpejOs2EjEn%K<)Kymo0Ike)0FR&S]Zky3StOhOup(T!Ub.U/o)0AtO)Yz0IsOjivoOut0Bl.Boj}DinyDl!Dno)D|Jn(KejLin#L#LubMo+N [No,%RalR^RizontRkoRliv>RmonRn.RoskopR$vo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up0Ip4Bav Br!}|D!D,Fot H+d!H~Hod H,d Hub Jasn J{Jm=K]p Kon!L-!Maz!Mez Miz{Mys+tNe/!Nik!Nut P`!Pl! P,v Pu$ Raz R'n!Rv!Sl' SokoS)v Su~Syp!Tas Tes!Tr! Vi~Vol!Vrh_Zdob Zn!0AduBud }op DJ{Ji$ K+p!K*p Lep Mez Mot!Mys+tNe/!Nik!Pl! Poj Ps!Raz S)v Su~Taj Temn Tk~Ujm=Val Ve+tVin Vol!Vrt!Zvon 0Av RusuUd|Yt-1A+#ArmaAtn(IvoOb RojVihYm`]0L@.ManM.Pt!Z`uZdola2At Lt~Lubo#Ot' Ru[0MaMn?0Emn 0Lam!Oum!R!#Umav#0AtoEh#O[OmO$Ozvyk0Ap|ArAt-IjeIz{Ocn Odr!Rzl.Ut|0AkAl(Am@!Ovu0B,z Tav Ub-Ufa+0Lod Omal RavaR( Rud#Rvu1A^An C`]N (NoOv&Y/l Zav(1I/aR! 0B'.Br0Ed~EnkuEs_aOnR!Uk'odYk"; +const checksum = "0x25f44555f4af25b51a711136e1c7d6e50ce9f8917d39d6b1f076b2bb4d2fac1a"; +let wordlist = null; +/** + * The [[link-bip39-cz]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangCz extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the Czech language Wordlist. + * + * Using the constructor should be unnecessary, instead use the + * [[wordlist]] singleton method. + * + * @_ignore: + */ + constructor() { super("cz", words, checksum); } + /** + * Returns a singleton instance of a ``LangCz``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangCz(); + } + return wordlist; + } +} +exports.LangCz = LangCz; +//# sourceMappingURL=lang-cz.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-cz.js.map b/dist/ethers.js/src.ts/wordlists/lang-cz.js.map new file mode 100644 index 0000000..1d0877b --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-cz.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-cz.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-cz.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,q9NAAq9N,CAAC;AACp+N,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-en.d.ts b/dist/ethers.js/src.ts/wordlists/lang-en.d.ts new file mode 100644 index 0000000..87a3234 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-en.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEn extends WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEn; +} +//# sourceMappingURL=lang-en.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-en.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-en.d.ts.map new file mode 100644 index 0000000..5348d03 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-en.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-en.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-en.js b/dist/ethers.js/src.ts/wordlists/lang-en.js new file mode 100644 index 0000000..27cac27 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-en.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangEn = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY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edXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurEAyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOgAyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NNGradeHoldOnP Set1BOng::Rd3Ar~ow9UUngU`:3BraRo9NeO"; +const checksum = "0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60"; +let wordlist = null; +/** + * The [[link-bip39-en]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangEn extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the English language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEn]] should suffice. + * + * @_ignore: + */ + constructor() { super("en", words, checksum); } + /** + * Returns a singleton instance of a ``LangEn``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangEn(); + } + return wordlist; + } +} +exports.LangEn = LangEn; +//# sourceMappingURL=lang-en.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-en.js.map b/dist/ethers.js/src.ts/wordlists/lang-en.js.map new file mode 100644 index 0000000..9988438 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-en.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-en.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-en.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,u3LAAu3L,CAAC;AACt4L,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-es.d.ts b/dist/ethers.js/src.ts/wordlists/lang-es.d.ts new file mode 100644 index 0000000..7e51683 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-es.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwlA } from "./wordlist-owla.js"; +/** + * The [[link-bip39-es]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangEs extends WordlistOwlA { + /** + * Creates a new instance of the Spanish language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langEs]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangEs``, creating it + * if this is the first time being called. + */ + static wordlist(): LangEs; +} +//# sourceMappingURL=lang-es.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-es.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-es.d.ts.map new file mode 100644 index 0000000..666f46b --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-es.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-es.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-es.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAQlD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,YAAY;IAEpC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-es.js b/dist/ethers.js/src.ts/wordlists/lang-es.js new file mode 100644 index 0000000..b48bd5e --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-es.js @@ -0,0 +1,36 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangEs = void 0; +const wordlist_owla_js_1 = require("./wordlist-owla.js"); +const words = "0arertoiotadonoaRteirroenaNonaLsolocoiliaralaorrenadaChoN$n0A>Dom,EjaI!#Oga&O'Or#RazoR*Ue=U<0Ab Adem@CeLe%OmoRa!RozUn0DazD$GeLaM,#S,)T^0AlAnceA+EEl]`E`EstruzI.I<2ErU{U'0Af[nArO)Uc Uf_Ul:BaB^|eH@IleJ Lanz/c.LdeMbuN>Nd-oRb(>RnizR+Scu]S#nSu[Tal]T!@T*Tu%UlZ 3BeBid/=S SoSt@3|oEnNgo2An>OqueUsa2ABi`BoCaCi`DaDegaIn//!oLsaMb-{dNi#N}saiRdeRr SqueTeTinVe{Zal2AvoAzoEchaEveIl=In>IsaOcaOmaOnceO)UjaUs>U#2CeoCleE'EyFan{F.HoIt_L#Rbuj(l(+Sc TacaZ.:Bal=BezaBi`B[CaoDav!D,aErFeI{ImanJaJ.LLam Lc$L&Li{dLleLm/^LvoMaMb$Mel=Mi'Mp}c!Nd?Nel-gu+Nic-#N-.ObaOsPazPi%nPo)Pt Puch((b.RcelRe%Rg(i'RneRpe%R+R%SaS>S!oSpaS#rT^ceT_U{lUsaZo3Bol]D!D+Ld/eb_LoAmpuAnc]ApaAr]I>Is)IvoOqueOzaUle%Up 0Cl.EgoE=EnEr#F[G +M->NeN%P_sR>Rue]SneTaU{d2Am^AnA+AseAveI,)ImaInica2B_Cc~|i'Ci`CoDigoDoF_G!He)JinJoL/ch/eg$Lg Lin/l LmoLum`Mba)M!Mi{Mo&Mpr-deNej}g-oc!Nsej}t PaPi(az.Rba%RchoR&nR.(r!S!SmosS%2AneoAt!E Ec!Ei&EmaIaIm,Ip%IsisOmoOnicaOque%U&Uz2Ad+Ar#At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uga0Ad@Cu+Ez'OT[0O'Ro1EjaU=1I&Ige'0En)0O':C#D_El]Gi`GoIsJ oLabr/>Le%Li&Lm/om/p NNalNi>Nt!-ue=PaPelP?]Que)R Rcel(edR*RoRpa&RqueR[foR)S SeoS~SoS%TaT$Tr@UsaU%VoYa<3A#nCa&C!a|oDalD*G IneL L{'Le/ig+LlejoLoLuc--s N.OnOrPi'Que'R(ch(d!Rez(f?Ri>Rl(mizEgun%Em$EnsaE|!oD^Eb=Er%Es#Lg/*Lm.LpoLrNd*N%P #Pet*PoN{PaP!oSaScaSt+T 5BiB^DoE{G*I&In/e%LoMboM^Ptu[TaTi`:Ba&B!B$BleC GazG[&L/&L!oL*Lm.L.Ls/#LudLv Mb-c~Ndi-e Ng_Ni{dN}#PoQueRdin()nSt_TanU`Xof.3Cc~CoC_#C%DGu*IsL=LvaMa`M?l-d-Re'Rg*S#T?:Ba>BiqueB]BuCoC#JoL L>L,#Ll/.Ma'Mb^Ng}quePaPe)P@P.Qu?l(deRe(if(je%RotR+R%TuajeU+ZaZ.3At+|oC]CnicaJa&J!Ji&L/efo'MaM^Mp=NazNd!N!NisNRmi'Rnur(+rSisSo+StigoT!aX#Z3B$Bu+nEmpoEn{Er[EPoR(.TanT!eTu=Za5Al]B?=C Ci'DoG/&M N}#P PeQueRaxR!oRm,%RneoRoRpe&R_RS!Xi>2AbajoAc#rA!Afi>AgoAjeAmoAnceA#AumaAz EbolEguaEin%EnEp EsIbuIgoIpaIs)IunfoOfeoOmpaOn>OpaO)OzoU>Ue'Ufa2B!@BoEr#MbaM^NelNic(bin(ismoR'T^:0Ic 9C!a0B[l0I{dIrIv!; + join(words: Array): string; + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist(): LangJa; +} +//# sourceMappingURL=lang-ja.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ja.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-ja.d.ts.map new file mode 100644 index 0000000..341c299 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ja.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAkIzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAGH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ja.js b/dist/ethers.js/src.ts/wordlists/lang-ja.js new file mode 100644 index 0000000..453d7d2 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ja.js @@ -0,0 +1,158 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangJa = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = [ + // 4-kana words + "AQRASRAGBAGUAIRAHBAghAURAdBAdcAnoAMEAFBAFCBKFBQRBSFBCXBCDBCHBGFBEQBpBBpQBIkBHNBeOBgFBVCBhBBhNBmOBmRBiHBiFBUFBZDBvFBsXBkFBlcBjYBwDBMBBTBBTRBWBBWXXaQXaRXQWXSRXCFXYBXpHXOQXHRXhRXuRXmXXbRXlXXwDXTRXrCXWQXWGaBWaKcaYgasFadQalmaMBacAKaRKKBKKXKKjKQRKDRKCYKCRKIDKeVKHcKlXKjHKrYNAHNBWNaR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BUqXIBkFDJIJEJPTIYJGWRIJeQPDIJeEfHIJFsJXOqGDSFHXEJqXgJCsJCgGQJqXgdQYJEgFMFNBgJFcqDVJwXUJVJFZJchIgJCCxOEJqXxOwXUJyDJBVRuscisciJBiJBieUtqXiJFDJkiFsJXQUGEZJcUJFsJXZtXIrXZDZJDrZJFNJDZJFstXvJFQqXvJFCJEsJXQJqkhkNGBbDJdTRbYJMEBlDwXUJMEFiJFcfXNJDRcNJWMTBLJXC", + // 8-kana words + "BraFUtHBFSJFdbNBLJXVJQoYJNEBSJBEJfHSJHwXUJCJdAZJMGjaFVJXEJPNJBlEJfFiJFpFbFEJqIJBVJCrIBdHiJhOPFChvJVJZJNJWxGFNIFLueIBQJqUHEJfUFstOZJDrlXEASJRlXVJXSFwVJNJWD", + // 9-kana words + "QJEJNNJDQJEJIBSFQJEJxegBQJEJfHEPSJBmXEJFSJCDEJqXLXNJFQqXIcQsFNJFIFEJqXUJgFsJXIJBUJEJfHNFvJxEqXNJnXUJFQqD", + // 10-kana words + "IJBEJqXZJ" +]; +// Maps each character into its kana value (the index) +const mapping = "~~AzB~X~a~KN~Q~D~S~C~G~E~Y~p~L~I~O~eH~g~V~hxyumi~~U~~Z~~v~~s~~dkoblPjfnqwMcRTr~W~~~F~~~~~Jt"; +let _wordlist = null; +function hex(word) { + return (0, index_js_2.hexlify)((0, index_js_2.toUtf8Bytes)(word)); +} +const KiYoKu = "0xe3818de38284e3818f"; +const KyoKu = "0xe3818de38283e3818f"; +function toString(data) { + return (0, index_js_2.toUtf8String)(new Uint8Array(data)); +} +function loadWords() { + if (_wordlist !== null) { + return _wordlist; + } + const wordlist = []; + // Transforms for normalizing (sort is a not quite UTF-8) + const transform = {}; + // Delete the diacritic marks + transform[toString([227, 130, 154])] = false; + transform[toString([227, 130, 153])] = false; + // Some simple transforms that sort out most of the order + transform[toString([227, 130, 133])] = toString([227, 130, 134]); + transform[toString([227, 129, 163])] = toString([227, 129, 164]); + transform[toString([227, 130, 131])] = toString([227, 130, 132]); + transform[toString([227, 130, 135])] = toString([227, 130, 136]); + // Normalize words using the transform + function normalize(word) { + let result = ""; + for (let i = 0; i < word.length; i++) { + let kana = word[i]; + const target = transform[kana]; + if (target === false) { + continue; + } + if (target) { + kana = target; + } + result += kana; + } + return result; + } + // Sort how the Japanese list is sorted + function sortJapanese(a, b) { + a = normalize(a); + b = normalize(b); + if (a < b) { + return -1; + } + if (a > b) { + return 1; + } + return 0; + } + // Load all the words + for (let length = 3; length <= 9; length++) { + const d = data[length - 3]; + for (let offset = 0; offset < d.length; offset += length) { + const word = []; + for (let i = 0; i < length; i++) { + const k = mapping.indexOf(d[offset + i]); + word.push(227); + word.push((k & 0x40) ? 130 : 129); + word.push((k & 0x3f) + 128); + } + wordlist.push(toString(word)); + } + } + wordlist.sort(sortJapanese); + // For some reason kyoku and kiyoku are flipped in node (!!). + // The order SHOULD be: + // - kyoku + // - kiyoku + // This should ignore "if", but that doesn't work here?? + /* c8 ignore start */ + if (hex(wordlist[442]) === KiYoKu && hex(wordlist[443]) === KyoKu) { + const tmp = wordlist[442]; + wordlist[442] = wordlist[443]; + wordlist[443] = tmp; + } + /* c8 ignore stop */ + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xcb36b09e6baa935787fd762ce65e80b0c6a8dabdfbc3a7f86ac0e2c4fd111600") { + throw new Error("BIP39 Wordlist for ja (Japanese) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ja]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangJa extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Japanese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langJa]] should suffice. + * + * @_ignore: + */ + constructor() { super("ja"); } + getWord(index) { + const words = loadWords(); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + split(phrase) { + //logger.assertNormalize(); + return phrase.split(/(?:\u3000| )+/g); + } + join(words) { + return words.join("\u3000"); + } + /** + * Returns a singleton instance of a ``LangJa``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangJa(); + } + return wordlist; + } +} +exports.LangJa = LangJa; +//# sourceMappingURL=lang-ja.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ja.js.map b/dist/ethers.js/src.ts/wordlists/lang-ja.js.map new file mode 100644 index 0000000..b3c6973 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ja.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ja.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-ja.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAE2B;AAE3B,+CAAyC;AAGzC,MAAM,IAAI,GAAG;IAET,eAAe;IACf,orEAAorE;IAEprE,eAAe;IACf,ssGAAssG;IAEtsG,eAAe;IACf,4uDAA4uD;IAE5uD,eAAe;IACf,olBAAolB;IAEplB,eAAe;IACf,4JAA4J;IAE5J,eAAe;IACf,0GAA0G;IAE1G,gBAAgB;IAChB,WAAW;CACd,CAAC;AAEF,sDAAsD;AACtD,MAAM,OAAO,GAAG,6FAA6F,CAAA;AAE7G,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,GAAG,CAAC,IAAY;IACrB,OAAO,IAAA,kBAAO,EAAC,IAAA,sBAAW,EAAC,IAAI,CAAC,CAAC,CAAC;AACtC,CAAC;AAED,MAAM,MAAM,GAAG,sBAAsB,CAAC;AACtC,MAAM,KAAK,GAAG,sBAAsB,CAAA;AAEpC,SAAS,QAAQ,CAAC,IAAmB;IACjC,OAAO,IAAA,uBAAY,EAAC,IAAI,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9C,CAA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AE,CAAC;QAC1B,IAAA,yBAAc,EAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,KAAK,CAAC,MAAc;QAChB,2BAA2B;QAC3B,OAAO,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC;IAC1C,CAAC;IAED,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAxCD,wBAwCC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts b/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts new file mode 100644 index 0000000..4329e05 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts @@ -0,0 +1,25 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangKo extends Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor(); + getWord(index: number): string; + getWordIndex(word: string): number; + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist(): LangKo; +} +//# sourceMappingURL=lang-ko.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts.map new file mode 100644 index 0000000..8483e6f --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ko.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ko.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA8DzC;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;OAOG;;IAKH,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ko.js b/dist/ethers.js/src.ts/wordlists/lang-ko.js new file mode 100644 index 0000000..189787d --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ko.js @@ -0,0 +1,93 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangKo = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = [ + "OYAa", + "ATAZoATBl3ATCTrATCl8ATDloATGg3ATHT8ATJT8ATJl3ATLlvATLn4ATMT8ATMX8ATMboATMgoAToLbAToMTATrHgATvHnAT3AnAT3JbAT3MTAT8DbAT8JTAT8LmAT8MYAT8MbAT#LnAUHT8AUHZvAUJXrAUJX8AULnrAXJnvAXLUoAXLgvAXMn6AXRg3AXrMbAX3JTAX3QbAYLn3AZLgvAZrSUAZvAcAZ8AaAZ8AbAZ8AnAZ8HnAZ8LgAZ8MYAZ8MgAZ8OnAaAboAaDTrAaFTrAaJTrAaJboAaLVoAaMXvAaOl8AaSeoAbAUoAbAg8AbAl4AbGnrA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MnSgOg6ATFg", + "HUDlGnrQXrJTrHgLnrAcJYMb8DULc8LTvFgGnCk3Mg8JbAnLX4QYvFYHnMXrRUoJnGnvFnRlvFTJlQnoSTrBXHXrLYSUJgLfoMT8Se8DTrHbDb", + "AbDl8SToJU8An3RbAb8ST8DUSTrGnrAgoLbFU6Db8LTrMg8AaHT8Jb8ObDl8SToJU8Pb3RlvFYoJl" +]; +const codes = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*"; +function getHangul(code) { + if (code >= 40) { + code = code + 168 - 40; + } + else if (code >= 19) { + code = code + 97 - 19; + } + return (0, index_js_2.toUtf8String)(new Uint8Array([225, (code >> 6) + 132, (code & 0x3f) + 128])); +} +let _wordlist = null; +function loadWords() { + if (_wordlist != null) { + return _wordlist; + } + const wordlist = []; + data.forEach((data, length) => { + length += 4; + for (let i = 0; i < data.length; i += length) { + let word = ""; + for (let j = 0; j < length; j++) { + word += getHangul(codes.indexOf(data[i + j])); + } + wordlist.push(word); + } + }); + wordlist.sort(); + // Verify the computed list matches the official list + /* istanbul ignore if */ + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== "0xf9eddeace9c5d3da9c93cf7d3cd38f6a13ed3affb933259ae865714e8a3ae71a") { + throw new Error("BIP39 Wordlist for ko (Korean) FAILED"); + } + /* c8 ignore stop */ + _wordlist = wordlist; + return wordlist; +} +let wordlist = null; +/** + * The [[link-bip39-ko]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangKo extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Korean language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langKo]] should suffice. + * + * @_ignore: + */ + constructor() { + super("ko"); + } + getWord(index) { + const words = loadWords(); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords().indexOf(word); + } + /** + * Returns a singleton instance of a ``LangKo``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangKo(); + } + return wordlist; + } +} +exports.LangKo = LangKo; +//# sourceMappingURL=lang-ko.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-ko.js.map b/dist/ethers.js/src.ts/wordlists/lang-ko.js.map new file mode 100644 index 0000000..af54668 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-ko.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-ko.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-ko.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAAiE;AAEjE,+CAAyC;AAGzC,MAAM,IAAI,GAAG;IACT,MAAM;IACN,y5JAAy5J;IACz5J,8lIAA8lI;IAC9lI,i8BAAi8B;IACj8B,koCAAkoC;IACloC,yaAAya;IACza,gHAAgH;IAChH,+EAA+E;CAClF,CAAA;AAED,MAAM,KAAK,GAAG,wEAAwE,CAAA;AAEtF,SAAS,SAAS,CAAC,IAAY;IAC3B,IAAI,IAAI,IAAI,EAAE,EAAE;QACZ,IAAI,GAAG,IAAI,GAAG,GAAG,GAAG,EAAE,CAAC;KAC1B;SAAM,IAAI,IAAI,IAAI,EAAE,EAAE;QACnB,IAAI,GAAG,IAAI,GAAG,EAAE,GAAG,EAAE,CAAC;KACzB;IAED,OAAO,IAAA,uBAAY,EAAC,IAAI,UAAU,CAAC,CAAE,GAAG,EAAE,CAAC,IAAI,IAAI,CAAC,CAAC,GAAG,GAAG,EAAE,CAAC,IAAI,GAAG,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACxF,CAAC;AAED,IAAI,SAAS,GAAyB,IAAI,CAAC;AAE3C,SAAS,SAAS;IACd,IAAI,SAAS,IAAI,IAAI,EAAE;QAAE,OAAO,SAAS,CAAC;KAAE;IAE5C,MAAM,QAAQ,GAAkB,EAAG,CAAC;I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AAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AAjCD,wBAiCC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts b/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts new file mode 100644 index 0000000..f218013 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts @@ -0,0 +1,23 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangPt extends WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor(); + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist(): LangPt; +} +//# sourceMappingURL=lang-pt.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts.map new file mode 100644 index 0000000..a7918ba --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-pt.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAOhD;;;;GAIG;AACH,qBAAa,MAAO,SAAQ,WAAW;IAEnC;;;;;;;OAOG;;IAGH;;;OAGG;IACH,MAAM,CAAC,QAAQ,IAAI,MAAM;CAI5B"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-pt.js b/dist/ethers.js/src.ts/wordlists/lang-pt.js new file mode 100644 index 0000000..4efe2fa --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-pt.js @@ -0,0 +1,35 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangPt = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const words = "0arad!ototealirertainrasoent hoandoaR#riareha!aroele'oronul0Aca%AixoAl A%rDuz'El]Er$IsmoO$ Rum S-&T(i&TigoVo[=0F&.Il#P' S?S* So&/Sun$Tr&0Ac#Adu+Al/A[f E End(Er_EuIng'Ir?IvoOl{oRac Revi=RizU&Um0Di$rM-.R>o+TismoT|@Tu 0Ali An%Ar@Ent&Es,I?Is Ul,1Ila1Ar E=Ei%Ulejo:B BosaC&]uCh `C@GagemI+c>~/Se#S)n%Ta)Te=rTidaTomTuc Unil]3B(IjoIr^IsebolLd!eLezaLgaLisc Ndi$Ng&aNz(RimbauRl*d>_Sou_XigaZ(_3CoCu=En&Foc&Furc G|naLhe%Mest[Mo$rOlog@OmboOsf(aPol Rr-$Scoi$Sne$SpoSsex$TolaZ _2Ind#OcoOque 2A$BagemC#CejoChec]Ico.L^LetimL]LoMb{oNdeNecoNi)Rb~h>d>e&R+c]V*oXe?2AncoAsaAvezaEuIgaIl/Inc OaOchu+Onze O$Uxo2C]DismoF LeRacoScaS$Z*a:Bimb Rn{oRpe%R['>)zRv&/SacoScaSeb[S%loS~oT a)Tiv UleUs?U%l V&oV(na3BolaDil]G}]Lebr L~ Nou+N,N%ioRc Rr#R%'oRvejaTimV^2Aco)Al{aAm#Ap^ArmeAticeAveEfeEg^E'oEqueIco%If[In`oOc&/Ov(UmboU.Uva0CatrizCl}eD!eD['aEn%Gcui$Rurg@T 2A[zaE_Ic OneUbe2A=Ag'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of}eZ}&3C C~ DaD-$Di#Do,Du$rGm-$G[=Gun=IvaLe$LvagemM<&M-%N?N/rNsu&Nt#P #Rei>*g>+RvoTemb_T|3GiloLhue)Lic}eMetr@Mpat@M~ N&Nc(oNg~ NopseN$ni>-eRiTu#5B(fis)Rp[s>[&Rt'Sp'oS%n$:B`aBle%Bu^C/G `aLh(LoLvezMdioRef>j>+xaTuagemUr*oXativoXis)3Atr&C(Ci=Cl#Dio,IaIm Lef}eLh#Mp(oN-%N,rN.Rm&RnoRr-oSeSou+St#ToXtu+Xugo3A+G`aJoloMbr MidezNgi=N%'oRagemT~ 5Al]C]L( LiceM^Mil/N`Ntu+Pe%R>ci=RneioRqueRr!>$S.UcaUp{aX*a2Ab&/Acej Adu$rAfeg Aje$AmaAnc ApoAs{oAt?Av E*oEm(Epid EvoIagemIboIcicloId-%Ilog@Ind!eIploItur Iunf&Oc Ombe)OvaUnfoUque2B~ CquesaT` T|i&:7V 3Bigo0HaId!eIf|me3Olog@SoTigaUbu0A=InaUfru':C*aDi G o,I=,LaL-%Lid!eLo[sN)gemQu{oRe)Rr(Sc~ Sil]S,u+Z Zio3A=D Ge.Ic~ L{oLhiceLu=Nce=rNdav&N( Nt[Rb&Rd!eRe?Rg}h>m`/RnizRs R%n%SpaSti=T|i&3Adu$AgemAj Atu+Br?D{aDr @ElaGaG-%Gi G| L ejoNcoNhe)NilOle)R!>tudeSi.S$Tr&V{oZ*/5A=rArG&L<%LeibolL)gemLumo,Nt!e5L$Vuz`a::D[zRope3QueRe.Rife3Ng ::Ng#Rp 3BuL?9Mb Olog@5Mbi="; +const checksum = "0x2219000926df7b50d8aa0a3d495826b988287df4657fbd100e6fe596c8f737ac"; +let wordlist = null; +/** + * The [[link-bip39-pt]] for [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangPt extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new instance of the Portuguese language Wordlist. + * + * This should be unnecessary most of the time as the exported + * [[langPt]] should suffice. + * + * @_ignore: + */ + constructor() { super("pt", words, checksum); } + /** + * Returns a singleton instance of a ``LangPt``, creating it + * if this is the first time being called. + */ + static wordlist() { + if (wordlist == null) { + wordlist = new LangPt(); + } + return wordlist; + } +} +exports.LangPt = LangPt; +//# sourceMappingURL=lang-pt.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-pt.js.map b/dist/ethers.js/src.ts/wordlists/lang-pt.js.map new file mode 100644 index 0000000..580be01 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-pt.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-pt.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-pt.ts"],"names":[],"mappings":";;;AAAA,uDAAgD;AAEhD,MAAM,KAAK,GAAG,s0OAAs0O,CAAC;AACr1O,MAAM,QAAQ,GAAG,oEAAoE,CAAC;AAEtF,IAAI,QAAQ,GAAkB,IAAI,CAAC;AAEnC;;;;GAIG;AACH,MAAa,MAAO,SAAQ,6BAAW;IAEnC;;;;;;;OAOG;IACH,gBAAgB,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC;IAE/C;;;OAGG;IACH,MAAM,CAAC,QAAQ;QACX,IAAI,QAAQ,IAAI,IAAI,EAAE;YAAE,QAAQ,GAAG,IAAI,MAAM,EAAE,CAAC;SAAE;QAClD,OAAO,QAAQ,CAAC;IACpB,CAAC;CACJ;AApBD,wBAoBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts b/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts new file mode 100644 index 0000000..5d0c14c --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +export declare class LangZh extends Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect: string); + getWord(index: number): string; + getWordIndex(word: string): number; + split(phrase: string): Array; + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect: string): LangZh; +} +//# sourceMappingURL=lang-zh.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts.map b/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts.map new file mode 100644 index 0000000..fe7d7fa --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-zh.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AA2DzC;;;;;GAKG;AACH,qBAAa,MAAO,SAAQ,QAAQ;IAEhC;;;;;;;;;OASG;gBACS,OAAO,EAAE,MAAM;IAE3B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAO9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIlC,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAKpC;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM;CAM3C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-zh.js b/dist/ethers.js/src.ts/wordlists/lang-zh.js new file mode 100644 index 0000000..44aded9 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-zh.js @@ -0,0 +1,96 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangZh = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const wordlist_js_1 = require("./wordlist.js"); +const data = "}aE#4A=Yv&co#4N#6G=cJ&SM#66|/Z#4t&kn~46#4K~4q%b9=IR#7l,mB#7W_X2*dl}Uo~7s}Uf&Iw#9c&cw~6O&H6&wx&IG%v5=IQ~8a&Pv#47$PR&50%Ko&QM&3l#5f,D9#4L|/H&tQ;v0~6n]nN> 2), + 128 + codes.indexOf(data[i * 3 + 1]), + 128 + codes.indexOf(data[i * 3 + 2]), + ]; + if (locale === "zh_tw") { + const common = s % 4; + for (let i = common; i < 3; i++) { + bytes[i] = codes.indexOf(deltaData[deltaOffset++]) + ((i == 0) ? 228 : 128); + } + } + wordlist.push((0, index_js_2.toUtf8String)(new Uint8Array(bytes))); + } + // Verify the computed list matches the official list + const checksum = (0, index_js_1.id)(wordlist.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== Checks[locale]) { + throw new Error(`BIP39 Wordlist for ${locale} (Chinese) FAILED`); + } + /* c8 ignore stop */ + _wordlist[locale] = wordlist; + return wordlist; +} +const wordlists = {}; +/** + * The [[link-bip39-zh_cn]] and [[link-bip39-zh_tw]] for + * [mnemonic phrases](link-bip-39). + * + * @_docloc: api/wordlists + */ +class LangZh extends wordlist_js_1.Wordlist { + /** + * Creates a new instance of the Chinese language Wordlist for + * the %%dialect%%, either ``"cn"`` or ``"tw"`` for simplified + * or traditional, respectively. + * + * This should be unnecessary most of the time as the exported + * [[langZhCn]] and [[langZhTw]] should suffice. + * + * @_ignore: + */ + constructor(dialect) { super("zh_" + dialect); } + getWord(index) { + const words = loadWords(this.locale); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return loadWords(this.locale).indexOf(word); + } + split(phrase) { + phrase = phrase.replace(/(?:\u3000| )+/g, ""); + return phrase.split(""); + } + /** + * Returns a singleton instance of a ``LangZh`` for %%dialect%%, + * creating it if this is the first time being called. + * + * Use the %%dialect%% ``"cn"`` or ``"tw"`` for simplified or + * traditional, respectively. + */ + static wordlist(dialect) { + if (wordlists[dialect] == null) { + wordlists[dialect] = new LangZh(dialect); + } + return wordlists[dialect]; + } +} +exports.LangZh = LangZh; +//# sourceMappingURL=lang-zh.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/lang-zh.js.map b/dist/ethers.js/src.ts/wordlists/lang-zh.js.map new file mode 100644 index 0000000..8b4b47a --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/lang-zh.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lang-zh.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/lang-zh.ts"],"names":[],"mappings":";;;AAAA,+CAAsC;AACtC,gDAAiE;AAEjE,+CAAyC;AAGzC,MAAM,IAAI,GAAG,kgMAAkgM,CAAC;AAChhM,MAAM,SAAS,GAAG,6lDAA6lD,CAAC;AAGhnD,MAAM,SAAS,GAAyC;IACpD,KAAK,EAAE,IAAI;IACX,KAAK,EAAE,IAAI;CACd,CAAA;AAED,MAAM,MAAM,GAA2B;IACnC,KAAK,EAAE,oEAAoE;IAC3E,KAAK,EAAE,oEAAoE;CAC9E,CAAA;AAED,MAAM,KAAK,GAAG,kEAAkE,CAAC;AACjF,MAAM,KAAK,GAAG,4BAA4B,CAAA;AAE1C,SAAS,SAAS,CAAC,MAAc;IAC7B,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,IAAI,EAAE;QAAE,OAAO,SAAS,CAAC,MAAM,CAAkB,CAAC;KAAE;IAE7E,MAAM,QAAQ,GAAkB,EAAE,CAAC;IAEnC,IAAI,WAAW,GAAG,CAAC,CAAC;IACpB,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,CAAC,EAAE,EAAE;QAC3B,MAAM,CAAC,GAAG,KAAK,C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;;;GAKG;AACH,MAAa,MAAO,SAAQ,sBAAQ;IAEhC;;;;;;;;;OASG;IACH,YAAY,OAAe,IAAI,KAAK,CAAC,KAAK,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;IAExD,OAAO,CAAC,KAAa;QACjB,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrC,IAAA,yBAAc,EAAC,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,KAAK,CAAC,MAAM,EAC7C,uBAAwB,KAAM,EAAE,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QACtD,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC;IAED,YAAY,CAAC,IAAY;QACrB,OAAO,SAAS,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,CAAC;IAED,KAAK,CAAC,MAAc;QAChB,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,EAAE,CAAC,CAAC;QAC9C,OAAO,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC5B,CAAC;IAED;;;;;;OAMG;IACH,MAAM,CAAC,QAAQ,CAAC,OAAe;QAC3B,IAAI,SAAS,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE;YAC5B,SAAS,CAAC,OAAO,CAAC,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;SAC5C;QACD,OAAO,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,CAAC;CACJ;AA3CD,wBA2CC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts b/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts new file mode 100644 index 0000000..c4d1efc --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts @@ -0,0 +1,32 @@ +import { Wordlist } from "./wordlist.js"; +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwl extends Wordlist { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, checksum: string); + /** + * The OWL-encoded data. + */ + get _data(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; + getWord(index: number): string; + getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist-owl.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts.map new file mode 100644 index 0000000..a7012f7 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owl.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owl.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist-owl.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC;;;;;;;;;;;GAWG;AACH,qBAAa,WAAY,SAAQ,QAAQ;;IAIrC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAO1D;;OAEG;IACH,IAAI,KAAK,IAAI,MAAM,CAAuB;IAE1C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;IAsB7B,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAM9B,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGrC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owl.js b/dist/ethers.js/src.ts/wordlists/wordlist-owl.js new file mode 100644 index 0000000..4b3e5be --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owl.js @@ -0,0 +1,83 @@ +"use strict"; +// Use the encode-latin.js script to create the necessary +// data files to be consumed by this class +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _WordlistOwl_instances, _WordlistOwl_data, _WordlistOwl_checksum, _WordlistOwl_words, _WordlistOwl_loadWords; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WordlistOwl = void 0; +const index_js_1 = require("../hash/index.js"); +const index_js_2 = require("../utils/index.js"); +const decode_owl_js_1 = require("./decode-owl.js"); +const wordlist_js_1 = require("./wordlist.js"); +/** + * An OWL format Wordlist is an encoding method that exploits + * the general locality of alphabetically sorted words to + * achieve a simple but effective means of compression. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on ASCII-7 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwl extends wordlist_js_1.Wordlist { + /** + * Creates a new Wordlist for %%locale%% using the OWL %%data%% + * and validated against the %%checksum%%. + */ + constructor(locale, data, checksum) { + super(locale); + _WordlistOwl_instances.add(this); + _WordlistOwl_data.set(this, void 0); + _WordlistOwl_checksum.set(this, void 0); + _WordlistOwl_words.set(this, void 0); + __classPrivateFieldSet(this, _WordlistOwl_data, data, "f"); + __classPrivateFieldSet(this, _WordlistOwl_checksum, checksum, "f"); + __classPrivateFieldSet(this, _WordlistOwl_words, null, "f"); + } + /** + * The OWL-encoded data. + */ + get _data() { return __classPrivateFieldGet(this, _WordlistOwl_data, "f"); } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return (0, decode_owl_js_1.decodeOwl)(__classPrivateFieldGet(this, _WordlistOwl_data, "f")); + } + getWord(index) { + const words = __classPrivateFieldGet(this, _WordlistOwl_instances, "m", _WordlistOwl_loadWords).call(this); + (0, index_js_2.assertArgument)(index >= 0 && index < words.length, `invalid word index: ${index}`, "index", index); + return words[index]; + } + getWordIndex(word) { + return __classPrivateFieldGet(this, _WordlistOwl_instances, "m", _WordlistOwl_loadWords).call(this).indexOf(word); + } +} +exports.WordlistOwl = WordlistOwl; +_WordlistOwl_data = new WeakMap(), _WordlistOwl_checksum = new WeakMap(), _WordlistOwl_words = new WeakMap(), _WordlistOwl_instances = new WeakSet(), _WordlistOwl_loadWords = function _WordlistOwl_loadWords() { + if (__classPrivateFieldGet(this, _WordlistOwl_words, "f") == null) { + const words = this._decodeWords(); + // Verify the computed list matches the official list + const checksum = (0, index_js_1.id)(words.join("\n") + "\n"); + /* c8 ignore start */ + if (checksum !== __classPrivateFieldGet(this, _WordlistOwl_checksum, "f")) { + throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`); + } + /* c8 ignore stop */ + __classPrivateFieldSet(this, _WordlistOwl_words, words, "f"); + } + return __classPrivateFieldGet(this, _WordlistOwl_words, "f"); +}; +//# sourceMappingURL=wordlist-owl.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owl.js.map b/dist/ethers.js/src.ts/wordlists/wordlist-owl.js.map new file mode 100644 index 0000000..2b5629c --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owl.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owl.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist-owl.ts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A,aAAE,EAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAC7C,qBAAqB;QACrB,IAAI,QAAQ,KAAK,uBAAA,IAAI,6BAAU,EAAE;YAC7B,MAAM,IAAI,KAAK,CAAC,sBAAuB,IAAI,CAAC,MAAO,SAAS,CAAC,CAAC;SACjE;QACD,oBAAoB;QAEpB,uBAAA,IAAI,sBAAU,KAAK,MAAA,CAAC;KACvB;IACD,OAAO,uBAAA,IAAI,0BAAO,CAAC;AACvB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts b/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts new file mode 100644 index 0000000..c87022d --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts @@ -0,0 +1,30 @@ +import { WordlistOwl } from "./wordlist-owl.js"; +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +export declare class WordlistOwlA extends WordlistOwl { + #private; + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale: string, data: string, accent: string, checksum: string); + /** + * The OWLA-encoded accent data. + */ + get _accent(): string; + /** + * Decode all the words for the wordlist. + */ + _decodeWords(): Array; +} +//# sourceMappingURL=wordlist-owla.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts.map new file mode 100644 index 0000000..00553ca --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owla.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAGhD;;;;;;;;;;;GAWG;AACH,qBAAa,YAAa,SAAQ,WAAW;;IAIzC;;;OAGG;gBACS,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM;IAK1E;;OAEG;IACH,IAAI,OAAO,IAAI,MAAM,CAAyB;IAE9C;;OAEG;IACH,YAAY,IAAI,KAAK,CAAC,MAAM,CAAC;CAGhC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owla.js b/dist/ethers.js/src.ts/wordlists/wordlist-owla.js new file mode 100644 index 0000000..293b049 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owla.js @@ -0,0 +1,53 @@ +"use strict"; +var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { + if (kind === "m") throw new TypeError("Private method is not writable"); + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); + return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; +}; +var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { + if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); + if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); + return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); +}; +var _WordlistOwlA_accent; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.WordlistOwlA = void 0; +const wordlist_owl_js_1 = require("./wordlist-owl.js"); +const decode_owla_js_1 = require("./decode-owla.js"); +/** + * An OWL-A format Wordlist extends the OWL format to add an + * overlay onto an OWL format Wordlist to support diacritic + * marks. + * + * This class is generally not useful to most developers as + * it is used mainly internally to keep Wordlists for languages + * based on latin-1 small. + * + * If necessary, there are tools within the ``generation/`` folder + * to create the necessary data. + */ +class WordlistOwlA extends wordlist_owl_js_1.WordlistOwl { + /** + * Creates a new Wordlist for %%locale%% using the OWLA %%data%% + * and %%accent%% data and validated against the %%checksum%%. + */ + constructor(locale, data, accent, checksum) { + super(locale, data, checksum); + _WordlistOwlA_accent.set(this, void 0); + __classPrivateFieldSet(this, _WordlistOwlA_accent, accent, "f"); + } + /** + * The OWLA-encoded accent data. + */ + get _accent() { return __classPrivateFieldGet(this, _WordlistOwlA_accent, "f"); } + /** + * Decode all the words for the wordlist. + */ + _decodeWords() { + return (0, decode_owla_js_1.decodeOwlA)(this._data, this._accent); + } +} +exports.WordlistOwlA = WordlistOwlA; +_WordlistOwlA_accent = new WeakMap(); +//# sourceMappingURL=wordlist-owla.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist-owla.js.map b/dist/ethers.js/src.ts/wordlists/wordlist-owla.js.map new file mode 100644 index 0000000..66f7f9f --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist-owla.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist-owla.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist-owla.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AACA,uDAAgD;AAChD,qDAA8C;AAE9C;;;;;;;;;;;GAWG;AACH,MAAa,YAAa,SAAQ,6BAAW;IAIzC;;;OAGG;IACH,YAAY,MAAc,EAAE,IAAY,EAAE,MAAc,EAAE,QAAgB;QACtE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,CAAC,CAAC;QARlC,uCAAgB;QASZ,uBAAA,IAAI,wBAAW,MAAM,MAAA,CAAC;IAC1B,CAAC;IAED;;OAEG;IACH,IAAI,OAAO,KAAa,OAAO,uBAAA,IAAI,4BAAQ,CAAC,CAAC,CAAC;IAE9C;;OAEG;IACH,YAAY;QACR,OAAO,IAAA,2BAAU,EAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IAChD,CAAC;CACJ;AAxBD,oCAwBC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist.d.ts b/dist/ethers.js/src.ts/wordlists/wordlist.d.ts new file mode 100644 index 0000000..cb843f3 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist.d.ts @@ -0,0 +1,47 @@ +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +export declare abstract class Wordlist { + locale: string; + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale: string); + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase: string): Array; + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words: Array): string; + /** + * Maps an 11-bit value into its coresponding word in the list. + * + * Sub-classes MUST override this. + */ + abstract getWord(index: number): string; + /** + * Maps a word to its corresponding 11-bit value. + * + * Sub-classes MUST override this. + */ + abstract getWordIndex(word: string): number; +} +//# sourceMappingURL=wordlist.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlist.d.ts.map new file mode 100644 index 0000000..d3b62aa --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,8BAAsB,QAAQ;IAC1B,MAAM,EAAG,MAAM,CAAC;IAEhB;;;;;;;;;OASG;gBACS,MAAM,EAAE,MAAM;IAI1B;;;;;;OAMG;IACH,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;IAIpC;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,MAAM;IAIlC;;;;OAIG;IACH,QAAQ,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM;IAEvC;;;;OAIG;IACH,QAAQ,CAAC,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAC9C"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist.js b/dist/ethers.js/src.ts/wordlists/wordlist.js new file mode 100644 index 0000000..a13fea9 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist.js @@ -0,0 +1,45 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.Wordlist = void 0; +const index_js_1 = require("../utils/index.js"); +/** + * A Wordlist represents a collection of language-specific + * words used to encode and devoce [[link-bip-39]] encoded data + * by mapping words to 11-bit values and vice versa. + */ +class Wordlist { + /** + * Creates a new Wordlist instance. + * + * Sub-classes MUST call this if they provide their own constructor, + * passing in the locale string of the language. + * + * Generally there is no need to create instances of a Wordlist, + * since each language-specific Wordlist creates an instance and + * there is no state kept internally, so they are safe to share. + */ + constructor(locale) { + (0, index_js_1.defineProperties)(this, { locale }); + } + /** + * Sub-classes may override this to provide a language-specific + * method for spliting %%phrase%% into individual words. + * + * By default, %%phrase%% is split using any sequences of + * white-space as defined by regular expressions (i.e. ``/\s+/``). + */ + split(phrase) { + return phrase.toLowerCase().split(/\s+/g); + } + /** + * Sub-classes may override this to provider a language-specific + * method for joining %%words%% into a phrase. + * + * By default, %%words%% are joined by a single space. + */ + join(words) { + return words.join(" "); + } +} +exports.Wordlist = Wordlist; +//# sourceMappingURL=wordlist.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlist.js.map b/dist/ethers.js/src.ts/wordlists/wordlist.js.map new file mode 100644 index 0000000..0874d35 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlist.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlist.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlist.ts"],"names":[],"mappings":";;;AAAA,gDAAqD;AAErD;;;;GAIG;AACH,MAAsB,QAAQ;IAG1B;;;;;;;;;OASG;IACH,YAAY,MAAc;QACtB,IAAA,2BAAgB,EAAW,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IACjD,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,MAAc;QAChB,OAAO,MAAM,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;IAC7C,CAAC;IAED;;;;;OAKG;IACH,IAAI,CAAC,KAAoB;QACrB,OAAO,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3B,CAAC;CAeJ;AAnDD,4BAmDC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts b/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts new file mode 100644 index 0000000..d0dbd19 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts @@ -0,0 +1,3 @@ +import type { Wordlist } from "./wordlist.js"; +export declare const wordlists: Record; +//# sourceMappingURL=wordlists-browser.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts.map new file mode 100644 index 0000000..25ac5d1 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-browser.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAE9C,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-browser.js b/dist/ethers.js/src.ts/wordlists/wordlists-browser.js new file mode 100644 index 0000000..569f5ca --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-browser.js @@ -0,0 +1,8 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = void 0; +const lang_en_js_1 = require("./lang-en.js"); +exports.wordlists = { + en: lang_en_js_1.LangEn.wordlist(), +}; +//# sourceMappingURL=wordlists-browser.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-browser.js.map b/dist/ethers.js/src.ts/wordlists/wordlists-browser.js.map new file mode 100644 index 0000000..aa2b423 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-browser.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists-browser.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AAIzB,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;CACtB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts b/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts new file mode 100644 index 0000000..7e15a23 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts @@ -0,0 +1,9 @@ +export { LangCz } from "./lang-cz.js"; +export { LangEs } from "./lang-es.js"; +export { LangFr } from "./lang-fr.js"; +export { LangJa } from "./lang-ja.js"; +export { LangKo } from "./lang-ko.js"; +export { LangIt } from "./lang-it.js"; +export { LangPt } from "./lang-pt.js"; +export { LangZh } from "./lang-zh.js"; +//# sourceMappingURL=wordlists-extra.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts.map new file mode 100644 index 0000000..e26b6de --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-extra.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-extra.js b/dist/ethers.js/src.ts/wordlists/wordlists-extra.js new file mode 100644 index 0000000..38dbc92 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-extra.js @@ -0,0 +1,20 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LangZh = exports.LangPt = exports.LangIt = exports.LangKo = exports.LangJa = exports.LangFr = exports.LangEs = exports.LangCz = void 0; +var lang_cz_js_1 = require("./lang-cz.js"); +Object.defineProperty(exports, "LangCz", { enumerable: true, get: function () { return lang_cz_js_1.LangCz; } }); +var lang_es_js_1 = require("./lang-es.js"); +Object.defineProperty(exports, "LangEs", { enumerable: true, get: function () { return lang_es_js_1.LangEs; } }); +var lang_fr_js_1 = require("./lang-fr.js"); +Object.defineProperty(exports, "LangFr", { enumerable: true, get: function () { return lang_fr_js_1.LangFr; } }); +var lang_ja_js_1 = require("./lang-ja.js"); +Object.defineProperty(exports, "LangJa", { enumerable: true, get: function () { return lang_ja_js_1.LangJa; } }); +var lang_ko_js_1 = require("./lang-ko.js"); +Object.defineProperty(exports, "LangKo", { enumerable: true, get: function () { return lang_ko_js_1.LangKo; } }); +var lang_it_js_1 = require("./lang-it.js"); +Object.defineProperty(exports, "LangIt", { enumerable: true, get: function () { return lang_it_js_1.LangIt; } }); +var lang_pt_js_1 = require("./lang-pt.js"); +Object.defineProperty(exports, "LangPt", { enumerable: true, get: function () { return lang_pt_js_1.LangPt; } }); +var lang_zh_js_1 = require("./lang-zh.js"); +Object.defineProperty(exports, "LangZh", { enumerable: true, get: function () { return lang_zh_js_1.LangZh; } }); +//# sourceMappingURL=wordlists-extra.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists-extra.js.map b/dist/ethers.js/src.ts/wordlists/wordlists-extra.js.map new file mode 100644 index 0000000..017389e --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists-extra.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists-extra.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists-extra.ts"],"names":[],"mappings":";;;AACA,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA;AACf,2CAAsC;AAA7B,oGAAA,MAAM,OAAA"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists.d.ts b/dist/ethers.js/src.ts/wordlists/wordlists.d.ts new file mode 100644 index 0000000..ab8b030 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists.d.ts @@ -0,0 +1,16 @@ +import type { Wordlist } from "./wordlist.js"; +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +export declare const wordlists: Record; +//# sourceMappingURL=wordlists.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists.d.ts.map b/dist/ethers.js/src.ts/wordlists/wordlists.d.ts.map new file mode 100644 index 0000000..ef193b9 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.d.ts","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAE9C;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,QAAQ,CAW9C,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists.js b/dist/ethers.js/src.ts/wordlists/wordlists.js new file mode 100644 index 0000000..97235d8 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists.js @@ -0,0 +1,38 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.wordlists = void 0; +const lang_cz_js_1 = require("./lang-cz.js"); +const lang_en_js_1 = require("./lang-en.js"); +const lang_es_js_1 = require("./lang-es.js"); +const lang_fr_js_1 = require("./lang-fr.js"); +const lang_ja_js_1 = require("./lang-ja.js"); +const lang_ko_js_1 = require("./lang-ko.js"); +const lang_it_js_1 = require("./lang-it.js"); +const lang_pt_js_1 = require("./lang-pt.js"); +const lang_zh_js_1 = require("./lang-zh.js"); +/** + * The available Wordlists by their + * [ISO 639-1 Language Code](link-wiki-iso639). + * + * (**i.e.** [cz](LangCz), [en](LangEn), [es](LangEs), [fr](LangFr), + * [ja](LangJa), [ko](LangKo), [it](LangIt), [pt](LangPt), + * [zh_cn](LangZh), [zh_tw](LangZh)) + * + * The dist files (in the ``/dist`` folder) have had all languages + * except English stripped out, which reduces the library size by + * about 80kb. If required, they are available by importing the + * included ``wordlists-extra.min.js`` file. + */ +exports.wordlists = { + cz: lang_cz_js_1.LangCz.wordlist(), + en: lang_en_js_1.LangEn.wordlist(), + es: lang_es_js_1.LangEs.wordlist(), + fr: lang_fr_js_1.LangFr.wordlist(), + it: lang_it_js_1.LangIt.wordlist(), + pt: lang_pt_js_1.LangPt.wordlist(), + ja: lang_ja_js_1.LangJa.wordlist(), + ko: lang_ko_js_1.LangKo.wordlist(), + zh_cn: lang_zh_js_1.LangZh.wordlist("cn"), + zh_tw: lang_zh_js_1.LangZh.wordlist("tw"), +}; +//# sourceMappingURL=wordlists.js.map \ No newline at end of file diff --git a/dist/ethers.js/src.ts/wordlists/wordlists.js.map b/dist/ethers.js/src.ts/wordlists/wordlists.js.map new file mode 100644 index 0000000..6c5ebd3 --- /dev/null +++ b/dist/ethers.js/src.ts/wordlists/wordlists.js.map @@ -0,0 +1 @@ +{"version":3,"file":"wordlists.js","sourceRoot":"","sources":["../../../../src/ethers.js/src.ts/wordlists/wordlists.ts"],"names":[],"mappings":";;;AACA,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AACtC,6CAAsC;AAItC;;;;;;;;;;;;GAYG;AACU,QAAA,SAAS,GAA6B;IACjD,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,EAAE,EAAE,mBAAM,CAAC,QAAQ,EAAE;IACrB,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;IAC5B,KAAK,EAAE,mBAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;CAC7B,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts new file mode 100644 index 0000000..8f0bb99 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts @@ -0,0 +1,12 @@ +import { ethers } from 'ethers'; +declare global { + interface Window { + ethereum: any; + } +} +export declare class AppComponent { + title: string; + network?: ethers.Network; + connect(): Promise; +} +//# sourceMappingURL=app.component.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts.map new file mode 100644 index 0000000..2a56bbb --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.d.ts","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.component.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,MAAM;QACd,QAAQ,EAAE,GAAG,CAAC;KACf;CACF;AAED,qBAKa,YAAY;IACvB,KAAK,SAAU;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC;IAEnB,OAAO;CA0Bd"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js new file mode 100644 index 0000000..00ef5a4 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js @@ -0,0 +1,101 @@ +"use strict"; +// See: https://github.com/ethers-io/ethers.js/issues/3910 +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppComponent = void 0; +const core_1 = require("@angular/core"); +const ethers_1 = require("ethers"); +exports.AppComponent = (() => { + let _classDecorators = [(0, core_1.Component)({ + selector: 'app-root', + templateUrl: './app.component.html', + styleUrls: ['./app.component.css'] + })]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var AppComponent = _classThis = class { + constructor() { + this.title = 'test'; + } + connect() { + return __awaiter(this, void 0, void 0, function* () { + if (window.ethereum == null) { + // If MetaMask is not installed, we use the default provider, + // which is backed by a variety of third-party services (such + // as INFURA). They do not have private keys installed so are + // only have read-only access + console.log('MetaMask not installed; using read-only defaults'); + } + else { + // Connect to the MetaMask EIP-1193 object. This is a standard + // protocol that allows Ethers access to make all read-only + // requests through MetaMask. + const provider = new ethers_1.ethers.BrowserProvider(window.ethereum); + const accounts = yield window.ethereum.request({ + method: 'eth_requestAccounts', + }); + console.log('accounts: ', accounts); + // It also provides an opportunity to request access to write + // operations, which will be performed by the private key + // that MetaMask manages for the user. + this.network = yield provider.getNetwork(); + } + }); + } + }; + __setFunctionName(_classThis, "AppComponent"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + AppComponent = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return AppComponent = _classThis; +})(); +//# sourceMappingURL=app.component.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js.map new file mode 100644 index 0000000..a1dbc35 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.js","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.component.ts"],"names":[],"mappings":";AAAA,0DAA0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAE1D,wCAA0C;AAC1C,mCAAgC;AAanB,QAAA,YAAY;4BALxB,IAAA,gBAAS,EAAC;YACT,QAAQ,EAAE,UAAU;YACpB,WAAW,EAAE,sBAAsB;YACnC,SAAS,EAAE,CAAC,qBAAqB,CAAC;SACnC,CAAC;;;;QACW,YAAY;;YACvB,UAAK,GAAG,MAAM,CAAC;QA6BjB,CAAC;QA1BO,OAAO;;gBAEX,IAAI,MAAM,CAAC,QAAQ,IAAI,IAAI,EAAE;oBAC3B,6DAA6D;oBAC7D,6DAA6D;oBAC7D,6DAA6D;oBAC7D,6BAA6B;oBAC7B,OAAO,CAAC,GAAG,CAAC,kDAAkD,CAAC,CAAC;iBACjE;qBAAM;oBACL,8DAA8D;oBAC9D,2DAA2D;oBAC3D,6BAA6B;oBAC7B,MAAM,QAAQ,GAAG,IAAI,eAAM,CAAC,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;oBAE7D,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC;wBAC7C,MAAM,EAAE,qBAAqB;qBAC9B,CAAC,CAAC;oBAEH,OAAO,CAAC,GAAG,CAAC,YAAY,EAAE,QAAQ,CAAC,CAAC;oBACpC,6DAA6D;oBAC7D,yDAAyD;oBACzD,sCAAsC;oBACtC,IAAI,CAAC,OAAO,GAAG,MAAM,QAAQ,CAAC,UAAU,EAAE,CAAC;iBAC5C;YACH,CAAC;SAAA;;;;QA5BH,wJA8BC;QA9BY,YAAY;QAAZ,uDAAY;;WAAZ,YAAY"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts new file mode 100644 index 0000000..f39063c --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=app.component.spec.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts.map new file mode 100644 index 0000000..87f8c07 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.spec.d.ts","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.component.spec.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js new file mode 100644 index 0000000..aa32a1d --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js @@ -0,0 +1,40 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const testing_1 = require("@angular/core/testing"); +const app_component_1 = require("./app.component"); +describe('AppComponent', () => { + beforeEach(() => __awaiter(void 0, void 0, void 0, function* () { + yield testing_1.TestBed.configureTestingModule({ + declarations: [ + app_component_1.AppComponent + ], + }).compileComponents(); + })); + it('should create the app', () => { + const fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent); + const app = fixture.componentInstance; + expect(app).toBeTruthy(); + }); + it(`should have as title 'test'`, () => { + const fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent); + const app = fixture.componentInstance; + expect(app.title).toEqual('test'); + }); + it('should render title', () => { + var _a; + const fixture = testing_1.TestBed.createComponent(app_component_1.AppComponent); + fixture.detectChanges(); + const compiled = fixture.nativeElement; + expect((_a = compiled.querySelector('.content span')) === null || _a === void 0 ? void 0 : _a.textContent).toContain('test app is running!'); + }); +}); +//# sourceMappingURL=app.component.spec.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js.map new file mode 100644 index 0000000..9ea6478 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.component.spec.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.component.spec.js","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.component.spec.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,mDAAgD;AAChD,mDAA+C;AAE/C,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,UAAU,CAAC,GAAS,EAAE;QACpB,MAAM,iBAAO,CAAC,sBAAsB,CAAC;YACnC,YAAY,EAAE;gBACZ,4BAAY;aACb;SACF,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACzB,CAAC,CAAA,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,OAAO,GAAG,iBAAO,CAAC,eAAe,CAAC,4BAAY,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,CAAC;IAC3B,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE;QACrC,MAAM,OAAO,GAAG,iBAAO,CAAC,eAAe,CAAC,4BAAY,CAAC,CAAC;QACtD,MAAM,GAAG,GAAG,OAAO,CAAC,iBAAiB,CAAC;QACtC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE;;QAC7B,MAAM,OAAO,GAAG,iBAAO,CAAC,eAAe,CAAC,4BAAY,CAAC,CAAC;QACtD,OAAO,CAAC,aAAa,EAAE,CAAC;QACxB,MAAM,QAAQ,GAAG,OAAO,CAAC,aAA4B,CAAC;QACtD,MAAM,CAAC,MAAA,QAAQ,CAAC,aAAa,CAAC,eAAe,CAAC,0CAAE,WAAW,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IACjG,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts new file mode 100644 index 0000000..9e8a304 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts @@ -0,0 +1,3 @@ +export declare class AppModule { +} +//# sourceMappingURL=app.module.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts.map new file mode 100644 index 0000000..63c679a --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"app.module.d.ts","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.module.ts"],"names":[],"mappings":"AAKA,qBAUa,SAAS;CAAI"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js new file mode 100644 index 0000000..9134c8c --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js @@ -0,0 +1,69 @@ +"use strict"; +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.push(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.push(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; +var __setFunctionName = (this && this.__setFunctionName) || function (f, name, prefix) { + if (typeof name === "symbol") name = name.description ? "[".concat(name.description, "]") : ""; + return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.AppModule = void 0; +const core_1 = require("@angular/core"); +const platform_browser_1 = require("@angular/platform-browser"); +const app_component_1 = require("./app.component"); +exports.AppModule = (() => { + let _classDecorators = [(0, core_1.NgModule)({ + declarations: [ + app_component_1.AppComponent + ], + imports: [ + platform_browser_1.BrowserModule + ], + providers: [], + bootstrap: [app_component_1.AppComponent] + })]; + let _classDescriptor; + let _classExtraInitializers = []; + let _classThis; + var AppModule = _classThis = class { + }; + __setFunctionName(_classThis, "AppModule"); + (() => { + __esDecorate(null, _classDescriptor = { value: _classThis }, _classDecorators, { kind: "class", name: _classThis.name }, null, _classExtraInitializers); + AppModule = _classThis = _classDescriptor.value; + __runInitializers(_classThis, _classExtraInitializers); + })(); + return AppModule = _classThis; +})(); +//# sourceMappingURL=app.module.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js.map b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js.map new file mode 100644 index 0000000..224585a --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/app/app.module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"app.module.js","sourceRoot":"","sources":["../../../../../../../src/ethers.js/testcases/test-env/angular/src/app/app.module.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,wCAAyC;AACzC,gEAA0D;AAE1D,mDAA+C;AAYlC,QAAA,SAAS;4BAVrB,IAAA,eAAQ,EAAC;YACR,YAAY,EAAE;gBACZ,4BAAY;aACb;YACD,OAAO,EAAE;gBACP,gCAAa;aACd;YACD,SAAS,EAAE,EAAE;YACb,SAAS,EAAE,CAAC,4BAAY,CAAC;SAC1B,CAAC;;;;QACW,SAAS;;;;QAAtB,wJAA0B;QAAb,SAAS;QAAT,uDAAS;;WAAT,SAAS"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/main.d.ts b/dist/ethers.js/testcases/test-env/angular/src/main.d.ts new file mode 100644 index 0000000..371115b --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/main.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=main.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/main.d.ts.map b/dist/ethers.js/testcases/test-env/angular/src/main.d.ts.map new file mode 100644 index 0000000..65d8434 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/main.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../../../../src/ethers.js/testcases/test-env/angular/src/main.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/main.js b/dist/ethers.js/testcases/test-env/angular/src/main.js new file mode 100644 index 0000000..14c0109 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/main.js @@ -0,0 +1,7 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const platform_browser_dynamic_1 = require("@angular/platform-browser-dynamic"); +const app_module_1 = require("./app/app.module"); +(0, platform_browser_dynamic_1.platformBrowserDynamic)().bootstrapModule(app_module_1.AppModule) + .catch(err => console.error(err)); +//# sourceMappingURL=main.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/angular/src/main.js.map b/dist/ethers.js/testcases/test-env/angular/src/main.js.map new file mode 100644 index 0000000..a45644c --- /dev/null +++ b/dist/ethers.js/testcases/test-env/angular/src/main.js.map @@ -0,0 +1 @@ +{"version":3,"file":"main.js","sourceRoot":"","sources":["../../../../../../src/ethers.js/testcases/test-env/angular/src/main.ts"],"names":[],"mappings":";;AAAA,gFAA2E;AAE3E,iDAA6C;AAG7C,IAAA,iDAAsB,GAAE,CAAC,eAAe,CAAC,sBAAS,CAAC;KAChD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts new file mode 100644 index 0000000..d6a9ad3 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts @@ -0,0 +1,2 @@ +declare const ethers: any; +//# sourceMappingURL=js-commonjs.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts.map b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts.map new file mode 100644 index 0000000..1c99ab1 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"js-commonjs.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/testcases/test-env/test-tsc/js-commonjs.ts"],"names":[],"mappings":"AAAA,QAAA,MAAQ,MAAM,KAAsB,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js new file mode 100644 index 0000000..722a3d1 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js @@ -0,0 +1,5 @@ +"use strict"; +const { ethers } = require("ethers"); +console.log("Version:", ethers.version); +console.log(ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567")); +//# sourceMappingURL=js-commonjs.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js.map b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js.map new file mode 100644 index 0000000..d2489f2 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-commonjs.js.map @@ -0,0 +1 @@ +{"version":3,"file":"js-commonjs.js","sourceRoot":"","sources":["../../../../../src/ethers.js/testcases/test-env/test-tsc/js-commonjs.ts"],"names":[],"mappings":";AAAA,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;AAErC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;AAExC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC,4CAA4C,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts b/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts new file mode 100644 index 0000000..c049252 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=js-module.d.ts.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts.map b/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts.map new file mode 100644 index 0000000..a234d32 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-module.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"js-module.d.ts","sourceRoot":"","sources":["../../../../../src/ethers.js/testcases/test-env/test-tsc/js-module.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-module.js b/dist/ethers.js/testcases/test-env/test-tsc/js-module.js new file mode 100644 index 0000000..29b6eba --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-module.js @@ -0,0 +1,6 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ethers_1 = require("ethers"); +console.log("Version:", ethers_1.ethers.version); +console.log(ethers_1.ethers.getAddress("0x0123456789abcdef0123456789abcdef01234567")); +//# sourceMappingURL=js-module.js.map \ No newline at end of file diff --git a/dist/ethers.js/testcases/test-env/test-tsc/js-module.js.map b/dist/ethers.js/testcases/test-env/test-tsc/js-module.js.map new file mode 100644 index 0000000..7d56ab9 --- /dev/null +++ b/dist/ethers.js/testcases/test-env/test-tsc/js-module.js.map @@ -0,0 +1 @@ +{"version":3,"file":"js-module.js","sourceRoot":"","sources":["../../../../../src/ethers.js/testcases/test-env/test-tsc/js-module.ts"],"names":[],"mappings":";;AAAA,mCAAgC;AAEhC,OAAO,CAAC,GAAG,CAAC,UAAU,EAAE,eAAM,CAAC,OAAO,CAAC,CAAC;AAExC,OAAO,CAAC,GAAG,CAAC,eAAM,CAAC,UAAU,CAAC,4CAA4C,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts new file mode 100644 index 0000000..34fa280 --- /dev/null +++ b/dist/index.d.ts @@ -0,0 +1,5 @@ +export { LacchainSigner } from './lacchain-signer'; +export { LacchainProvider } from './lacchain-provider'; +export { LacchainTransaction } from './lacchain-transaction'; +export { LacchainTransactionRequest } from './lacchain-transaction-request'; +//# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map new file mode 100644 index 0000000..f635165 --- /dev/null +++ b/dist/index.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EAAE,0BAA0B,EAAE,MAAM,gCAAgC,CAAC"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js new file mode 100644 index 0000000..c681db4 --- /dev/null +++ b/dist/index.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LacchainTransactionRequest = exports.LacchainTransaction = exports.LacchainProvider = exports.LacchainSigner = void 0; +var lacchain_signer_1 = require("./lacchain-signer"); +Object.defineProperty(exports, "LacchainSigner", { enumerable: true, get: function () { return lacchain_signer_1.LacchainSigner; } }); +var lacchain_provider_1 = require("./lacchain-provider"); +Object.defineProperty(exports, "LacchainProvider", { enumerable: true, get: function () { return lacchain_provider_1.LacchainProvider; } }); +var lacchain_transaction_1 = require("./lacchain-transaction"); +Object.defineProperty(exports, "LacchainTransaction", { enumerable: true, get: function () { return lacchain_transaction_1.LacchainTransaction; } }); +var lacchain_transaction_request_1 = require("./lacchain-transaction-request"); +Object.defineProperty(exports, "LacchainTransactionRequest", { enumerable: true, get: function () { return lacchain_transaction_request_1.LacchainTransactionRequest; } }); +//# sourceMappingURL=index.js.map \ No newline at end of file diff --git a/dist/index.js.map b/dist/index.js.map new file mode 100644 index 0000000..f2f9353 --- /dev/null +++ b/dist/index.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,yDAAuD;AAA9C,qHAAA,gBAAgB,OAAA;AACzB,+DAA6D;AAApD,2HAAA,mBAAmB,OAAA;AAC5B,+EAA4E;AAAnE,0IAAA,0BAA0B,OAAA"} \ No newline at end of file diff --git a/dist/lacchain-provider.d.ts b/dist/lacchain-provider.d.ts new file mode 100644 index 0000000..f27671a --- /dev/null +++ b/dist/lacchain-provider.d.ts @@ -0,0 +1,7 @@ +import { JsonRpcProvider, FetchRequest, Networkish, JsonRpcApiProviderOptions, PerformActionRequest, TransactionResponse } from 'ethers'; +export declare class LacchainProvider extends JsonRpcProvider { + constructor(url: string | FetchRequest, network?: Networkish, options?: JsonRpcApiProviderOptions); + _perform(req: PerformActionRequest): Promise; + broadcastTransaction(signedTx: string): Promise; +} +//# sourceMappingURL=lacchain-provider.d.ts.map \ No newline at end of file diff --git a/dist/lacchain-provider.d.ts.map b/dist/lacchain-provider.d.ts.map new file mode 100644 index 0000000..fcb33e1 --- /dev/null +++ b/dist/lacchain-provider.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-provider.d.ts","sourceRoot":"","sources":["../src/lacchain-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,UAAU,EACV,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EAGpB,MAAM,QAAQ,CAAC;AAKhB,qBAAa,gBAAiB,SAAQ,eAAe;gBAGjD,GAAG,EAAE,MAAM,GAAG,YAAY,EAC1B,OAAO,CAAC,EAAE,UAAU,EACpB,OAAO,CAAC,EAAE,yBAAyB;IAK/B,QAAQ,CAAC,GAAG,EAAE,oBAAoB;IASlC,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,mBAAmB,CAAC;CAqB3E"} \ No newline at end of file diff --git a/dist/lacchain-provider.js b/dist/lacchain-provider.js new file mode 100644 index 0000000..c36882f --- /dev/null +++ b/dist/lacchain-provider.js @@ -0,0 +1,51 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LacchainProvider = void 0; +const ethers_1 = require("ethers"); +const lacchain_transaction_1 = require("./lacchain-transaction"); +class LacchainProvider extends ethers_1.JsonRpcProvider { + constructor(url, network, options) { + super(url, network, Object.assign({ batchMaxSize: 1 }, options)); + } + _perform(req) { + const _super = Object.create(null, { + _perform: { get: () => super._perform } + }); + return __awaiter(this, void 0, void 0, function* () { + const result = yield _super._perform.call(this, req); + if (req.method === 'getTransactionReceipt' && result) { + delete result.root; + result.confirmations = 1; + } + return result; + }); + } + broadcastTransaction(signedTx) { + return __awaiter(this, void 0, void 0, function* () { + const { blockNumber, hash, network } = yield (0, ethers_1.resolveProperties)({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: 'broadcastTransaction', + signedTransaction: signedTx, + }), + network: this.getNetwork(), + }); + const tx = new lacchain_transaction_1.LacchainTransaction(ethers_1.Transaction.from(signedTx), hash); + if (tx.hash !== hash) { + throw new Error('@TODO: the returned hash did not match'); + } + return this._wrapTransactionResponse(tx, network).replaceableTransaction(blockNumber); + }); + } +} +exports.LacchainProvider = LacchainProvider; +//# sourceMappingURL=lacchain-provider.js.map \ No newline at end of file diff --git a/dist/lacchain-provider.js.map b/dist/lacchain-provider.js.map new file mode 100644 index 0000000..a2b3836 --- /dev/null +++ b/dist/lacchain-provider.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-provider.js","sourceRoot":"","sources":["../src/lacchain-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCASgB;AAEhB,iEAA6D;AAG7D,MAAa,gBAAiB,SAAQ,wBAAe;IAEnD,YACE,GAA0B,EAC1B,OAAoB,EACpB,OAAmC;QAEnC,KAAK,CAAC,GAAG,EAAE,OAAO,kBAAI,YAAY,EAAE,CAAC,IAAK,OAAO,EAAG,CAAC;IACvD,CAAC;IAEK,QAAQ,CAAC,GAAyB;;;;;YACtC,MAAM,MAAM,GAAG,MAAM,OAAM,QAAQ,YAAC,GAAG,CAAC,CAAC;YACzC,IAAI,GAAG,CAAC,MAAM,KAAK,uBAAuB,IAAI,MAAM,EAAE,CAAC;gBACrD,OAAO,MAAM,CAAC,IAAI,CAAC;gBACnB,MAAM,CAAC,aAAa,GAAG,CAAC,CAAC;YAC3B,CAAC;YACD,OAAO,MAAM,CAAC;QAChB,CAAC;KAAA;IAEK,oBAAoB,CAAC,QAAgB;;YACzC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,MAAM,IAAA,0BAAiB,EAAC;gBAC7D,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE;gBAClC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC;oBAClB,MAAM,EAAE,sBAAsB;oBAC9B,iBAAiB,EAAE,QAAQ;iBAC5B,CAAC;gBACF,OAAO,EAAE,IAAI,CAAC,UAAU,EAAE;aAC3B,CAAC,CAAC;YAEH,MAAM,EAAE,GAAG,IAAI,0CAAmB,CAAC,oBAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,IAAI,CAAC,CAAC;YAErE,IAAI,EAAE,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBACrB,MAAM,IAAI,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,CAAC;YAED,OAAO,IAAI,CAAC,wBAAwB,CAC7B,EAAE,EACP,OAAO,CACR,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC;QACxC,CAAC;KAAA;CACF;AAxCD,4CAwCC"} \ No newline at end of file diff --git a/dist/lacchain-signer.d.ts b/dist/lacchain-signer.d.ts new file mode 100644 index 0000000..b876a25 --- /dev/null +++ b/dist/lacchain-signer.d.ts @@ -0,0 +1,8 @@ +import { Provider, SigningKey, Wallet, TransactionRequest } from 'ethers'; +export declare class LacchainSigner extends Wallet { + private _aNodeAddress; + private _aExpirationTime; + constructor(privateKey: string | SigningKey, provider: Provider, _aNodeAddress: string, _aExpirationTime: number); + signTransaction(transactionRequest: TransactionRequest): Promise; +} +//# sourceMappingURL=lacchain-signer.d.ts.map \ No newline at end of file diff --git a/dist/lacchain-signer.d.ts.map b/dist/lacchain-signer.d.ts.map new file mode 100644 index 0000000..ad6ef3f --- /dev/null +++ b/dist/lacchain-signer.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-signer.d.ts","sourceRoot":"","sources":["../src/lacchain-signer.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,QAAQ,EACR,UAAU,EACV,MAAM,EAON,kBAAkB,EACnB,MAAM,QAAQ,CAAC;AAKhB,qBAAa,cAAe,SAAQ,MAAM;IAKtC,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,gBAAgB;gBAHxB,UAAU,EAAE,MAAM,GAAG,UAAU,EAC/B,QAAQ,EAAE,QAAQ,EACV,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM;IAK5B,eAAe,CAAC,kBAAkB,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC;CAmC/E"} \ No newline at end of file diff --git a/dist/lacchain-signer.js b/dist/lacchain-signer.js new file mode 100644 index 0000000..75d7ea9 --- /dev/null +++ b/dist/lacchain-signer.js @@ -0,0 +1,45 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LacchainSigner = void 0; +const ethers_1 = require("ethers"); +const lacchain_transaction_request_1 = require("./lacchain-transaction-request"); +class LacchainSigner extends ethers_1.Wallet { + constructor(privateKey, provider, _aNodeAddress, _aExpirationTime) { + super(privateKey, provider); + this._aNodeAddress = _aNodeAddress; + this._aExpirationTime = _aExpirationTime; + } + signTransaction(transactionRequest) { + return __awaiter(this, void 0, void 0, function* () { + // Replace any Addressable or ENS name with an address + const { to, from } = yield (0, ethers_1.resolveProperties)({ + to: transactionRequest.to ? (0, ethers_1.resolveAddress)(transactionRequest.to, this.provider) : undefined, + from: transactionRequest.from ? (0, ethers_1.resolveAddress)(transactionRequest.from, this.provider) : undefined, + }); + if (to != null) { + transactionRequest.to = to; + } + if (from != null) { + transactionRequest.from = from; + } + if (transactionRequest.from != null) { + (0, ethers_1.assertArgument)((0, ethers_1.getAddress)(transactionRequest.from) === this.address, 'transaction from address mismatch', 'tx.from', transactionRequest.from); + delete transactionRequest.from; + } + const btx = ethers_1.Transaction.from((new lacchain_transaction_request_1.LacchainTransactionRequest(transactionRequest, this._aNodeAddress, this._aExpirationTime))); + btx.signature = this.signingKey.sign(btx.unsignedHash); + return btx.serialized; + }); + } +} +exports.LacchainSigner = LacchainSigner; +//# sourceMappingURL=lacchain-signer.js.map \ No newline at end of file diff --git a/dist/lacchain-signer.js.map b/dist/lacchain-signer.js.map new file mode 100644 index 0000000..b18b4fc --- /dev/null +++ b/dist/lacchain-signer.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-signer.js","sourceRoot":"","sources":["../src/lacchain-signer.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,mCAWgB;AAEhB,iFAA4E;AAG5E,MAAa,cAAe,SAAQ,eAAM;IAExC,YACE,UAA+B,EAC/B,QAAkB,EACV,aAAqB,EACrB,gBAAwB;QAEhC,KAAK,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;QAHpB,kBAAa,GAAb,aAAa,CAAQ;QACrB,qBAAgB,GAAhB,gBAAgB,CAAQ;IAGlC,CAAC;IAEK,eAAe,CAAC,kBAAsC;;YAC1D,sDAAsD;YACtD,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,0BAAiB,EAAC;gBAC3C,EAAE,EAAE,kBAAkB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAA,uBAAc,EAAC,kBAAkB,CAAC,EAAE,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;gBAC5F,IAAI,EAAE,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,uBAAc,EAAC,kBAAkB,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;aACnG,CAAC,CAAC;YAEH,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC;gBACf,kBAAkB,CAAC,EAAE,GAAG,EAAE,CAAC;YAC7B,CAAC;YAED,IAAI,IAAI,IAAI,IAAI,EAAE,CAAC;gBACjB,kBAAkB,CAAC,IAAI,GAAG,IAAI,CAAC;YACjC,CAAC;YAED,IAAI,kBAAkB,CAAC,IAAI,IAAI,IAAI,EAAE,CAAC;gBACpC,IAAA,uBAAc,EACZ,IAAA,mBAAU,EAAS,kBAAkB,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,OAAO,EAC5D,mCAAmC,EACnC,SAAS,EACT,kBAAkB,CAAC,IAAI,CACxB,CAAC;gBACF,OAAO,kBAAkB,CAAC,IAAI,CAAC;YACjC,CAAC;YAED,MAAM,GAAG,GAAG,oBAAW,CAAC,IAAI,CACD,CACvB,IAAI,yDAA0B,CAAC,kBAAkB,EAAE,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAC9F,CACF,CAAC;YAEF,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;YAEvD,OAAO,GAAG,CAAC,UAAU,CAAC;QACxB,CAAC;KAAA;CACF;AA9CD,wCA8CC"} \ No newline at end of file diff --git a/dist/lacchain-transaction-request.d.ts b/dist/lacchain-transaction-request.d.ts new file mode 100644 index 0000000..ef030e8 --- /dev/null +++ b/dist/lacchain-transaction-request.d.ts @@ -0,0 +1,23 @@ +import { AccessListish, AddressLike, BigNumberish, BlockTag, TransactionRequest } from 'ethers'; +export declare class LacchainTransactionRequest implements TransactionRequest { + private _aOriginalTransactionRequest; + private _aNodeAddress; + private _aExpirationTime; + constructor(_aOriginalTransactionRequest: TransactionRequest, _aNodeAddress: string, _aExpirationTime: number); + get data(): any | string; + get chainId(): any | BigNumberish; + get type(): any | number; + get to(): any | AddressLike; + get from(): any | AddressLike; + get nonce(): any | number; + get gasLimit(): any | BigNumberish; + get gasPrice(): any | BigNumberish; + get maxPriorityFeePerGas(): any | BigNumberish; + get maxFeePerGas(): any | BigNumberish; + get value(): any | BigNumberish; + get accessList(): any | AccessListish; + get customData(): any; + get blockTag(): undefined | BlockTag; + get enableCcipRead(): undefined | boolean; +} +//# sourceMappingURL=lacchain-transaction-request.d.ts.map \ No newline at end of file diff --git a/dist/lacchain-transaction-request.d.ts.map b/dist/lacchain-transaction-request.d.ts.map new file mode 100644 index 0000000..9f57214 --- /dev/null +++ b/dist/lacchain-transaction-request.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction-request.d.ts","sourceRoot":"","sources":["../src/lacchain-transaction-request.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,aAAa,EAAE,WAAW,EAAE,YAAY,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MACtF,QAAQ,CAAC;AAId,qBAAa,0BAA2B,YAAW,kBAAkB;IAGjE,OAAO,CAAC,4BAA4B;IACpC,OAAO,CAAC,aAAa;IACrB,OAAO,CAAC,gBAAgB;gBAFhB,4BAA4B,EAAE,kBAAkB,EAChD,aAAa,EAAE,MAAM,EACrB,gBAAgB,EAAE,MAAM;IAGlC,IAAI,IAAI,IAAI,GAAG,GAAG,MAAM,CAKvB;IAED,IAAI,OAAO,IAAI,GAAG,GAAG,YAAY,CAAc;IAE/C,IAAI,IAAI,IAAI,GAAG,GAAG,MAAM,CAAmD;IAC3E,IAAI,EAAE,IAAI,GAAG,GAAG,WAAW,CAAiD;IAC5E,IAAI,IAAI,IAAI,GAAG,GAAG,WAAW,CAAmD;IAChF,IAAI,KAAK,IAAI,GAAG,GAAG,MAAM,CAAoD;IAC7E,IAAI,QAAQ,IAAI,GAAG,GAAG,YAAY,CAAuD;IACzF,IAAI,QAAQ,IAAI,GAAG,GAAG,YAAY,CAAuD;IACzF,IAAI,oBAAoB,IAAI,GAAG,GAAG,YAAY,CAAmE;IACjH,IAAI,YAAY,IAAI,GAAG,GAAG,YAAY,CAA2D;IACjG,IAAI,KAAK,IAAI,GAAG,GAAG,YAAY,CAAoD;IACnF,IAAI,UAAU,IAAI,GAAG,GAAG,aAAa,CAAyD;IAC9F,IAAI,UAAU,IAAI,GAAG,CAAyD;IAC9E,IAAI,QAAQ,IAAI,SAAS,GAAG,QAAQ,CAAuD;IAC3F,IAAI,cAAc,IAAI,SAAS,GAAG,OAAO,CAA6D;CACvG"} \ No newline at end of file diff --git a/dist/lacchain-transaction-request.js b/dist/lacchain-transaction-request.js new file mode 100644 index 0000000..10dbb19 --- /dev/null +++ b/dist/lacchain-transaction-request.js @@ -0,0 +1,31 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LacchainTransactionRequest = void 0; +const ethers_1 = require("ethers"); +class LacchainTransactionRequest { + constructor(_aOriginalTransactionRequest, _aNodeAddress, _aExpirationTime) { + this._aOriginalTransactionRequest = _aOriginalTransactionRequest; + this._aNodeAddress = _aNodeAddress; + this._aExpirationTime = _aExpirationTime; + } + get data() { + return this._aOriginalTransactionRequest.data + ethers_1.AbiCoder.defaultAbiCoder().encode(["address", "uint256"], [this._aNodeAddress, this._aExpirationTime]).substring(2); + ; + } + get chainId() { return 0; } + get type() { return this._aOriginalTransactionRequest.type; } + get to() { return this._aOriginalTransactionRequest.to; } + get from() { return this._aOriginalTransactionRequest.from; } + get nonce() { return this._aOriginalTransactionRequest.nonce; } + get gasLimit() { return this._aOriginalTransactionRequest.gasLimit; } + get gasPrice() { return this._aOriginalTransactionRequest.gasPrice; } + get maxPriorityFeePerGas() { return this._aOriginalTransactionRequest.maxPriorityFeePerGas; } + get maxFeePerGas() { return this._aOriginalTransactionRequest.maxFeePerGas; } + get value() { return this._aOriginalTransactionRequest.value; } + get accessList() { return this._aOriginalTransactionRequest.accessList; } + get customData() { return this._aOriginalTransactionRequest.customData; } + get blockTag() { return this._aOriginalTransactionRequest.blockTag; } + get enableCcipRead() { return this._aOriginalTransactionRequest.enableCcipRead; } +} +exports.LacchainTransactionRequest = LacchainTransactionRequest; +//# sourceMappingURL=lacchain-transaction-request.js.map \ No newline at end of file diff --git a/dist/lacchain-transaction-request.js.map b/dist/lacchain-transaction-request.js.map new file mode 100644 index 0000000..51c2941 --- /dev/null +++ b/dist/lacchain-transaction-request.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction-request.js","sourceRoot":"","sources":["../src/lacchain-transaction-request.ts"],"names":[],"mappings":";;;AAAA,mCACc;AAId,MAAa,0BAA0B;IAErC,YACU,4BAAgD,EAChD,aAAqB,EACrB,gBAAwB;QAFxB,iCAA4B,GAA5B,4BAA4B,CAAoB;QAChD,kBAAa,GAAb,aAAa,CAAQ;QACrB,qBAAgB,GAAhB,gBAAgB,CAAQ;IAC/B,CAAC;IAEJ,IAAI,IAAI;QACN,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAC/E,CAAC,SAAS,EAAE,SAAS,CAAC,EACtB,CAAC,IAAI,CAAC,aAAa,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAC5C,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAAA,CAAC;IAClB,CAAC;IAED,IAAI,OAAO,KAAyB,OAAO,CAAC,CAAC,CAAC,CAAC;IAE/C,IAAI,IAAI,KAAmB,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IAC3E,IAAI,EAAE,KAAwB,OAAO,IAAI,CAAC,4BAA4B,CAAC,EAAE,CAAC,CAAC,CAAC;IAC5E,IAAI,IAAI,KAAwB,OAAO,IAAI,CAAC,4BAA4B,CAAC,IAAI,CAAC,CAAC,CAAC;IAChF,IAAI,KAAK,KAAmB,OAAO,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC;IAC7E,IAAI,QAAQ,KAAyB,OAAO,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzF,IAAI,QAAQ,KAAyB,OAAO,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;IACzF,IAAI,oBAAoB,KAAyB,OAAO,IAAI,CAAC,4BAA4B,CAAC,oBAAoB,CAAC,CAAC,CAAC;IACjH,IAAI,YAAY,KAAyB,OAAO,IAAI,CAAC,4BAA4B,CAAC,YAAY,CAAC,CAAC,CAAC;IACjG,IAAI,KAAK,KAAyB,OAAO,IAAI,CAAC,4BAA4B,CAAC,KAAK,CAAC,CAAC,CAAC;IACnF,IAAI,UAAU,KAA0B,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9F,IAAI,UAAU,KAAU,OAAO,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,CAAC,CAAC;IAC9E,IAAI,QAAQ,KAA2B,OAAO,IAAI,CAAC,4BAA4B,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC3F,IAAI,cAAc,KAA0B,OAAO,IAAI,CAAC,4BAA4B,CAAC,cAAc,CAAC,CAAC,CAAC;CACvG;AA9BD,gEA8BC"} \ No newline at end of file diff --git a/dist/lacchain-transaction.d.ts b/dist/lacchain-transaction.d.ts new file mode 100644 index 0000000..f66c679 --- /dev/null +++ b/dist/lacchain-transaction.d.ts @@ -0,0 +1,26 @@ +import { AccessList, Signature, Transaction, TransactionLike } from 'ethers'; +export declare class LacchainTransaction implements TransactionLike { + private _aOriginalTx; + private _aHashTx; + constructor(_aOriginalTx: Transaction, _aHashTx: string); + get hash(): null | string; + get type(): null | number; + get typeName(): null | string; + get to(): null | string; + get nonce(): number; + get gasLimit(): bigint; + get gasPrice(): null | bigint; + get maxPriorityFeePerGas(): null | bigint; + get maxFeePerGas(): null | bigint; + get data(): string; + get value(): bigint; + get chainId(): bigint; + get signature(): null | Signature; + get accessList(): null | AccessList; + get unsignedHash(): string; + get from(): null | string; + get fromPublicKey(): null | string; + get serialized(): string; + get unsignedSerialized(): string; +} +//# sourceMappingURL=lacchain-transaction.d.ts.map \ No newline at end of file diff --git a/dist/lacchain-transaction.d.ts.map b/dist/lacchain-transaction.d.ts.map new file mode 100644 index 0000000..af9d0c5 --- /dev/null +++ b/dist/lacchain-transaction.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction.d.ts","sourceRoot":"","sources":["../src/lacchain-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAC;AAI7E,qBAAa,mBAAoB,YAAW,eAAe;IAE7C,OAAO,CAAC,YAAY;IAAe,OAAO,CAAC,QAAQ;gBAA3C,YAAY,EAAE,WAAW,EAAU,QAAQ,EAAE,MAAM;IAEvE,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,CAExB;IAED,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,CAAmC;IAC5D,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAAuC;IACpE,IAAI,EAAE,IAAI,IAAI,GAAG,MAAM,CAAiC;IACxD,IAAI,KAAK,IAAI,MAAM,CAAoC;IACvD,IAAI,QAAQ,IAAI,MAAM,CAAuC;IAC7D,IAAI,QAAQ,IAAI,IAAI,GAAG,MAAM,CAAuC;IACpE,IAAI,oBAAoB,IAAI,IAAI,GAAG,MAAM,CAAmD;IAC5F,IAAI,YAAY,IAAI,IAAI,GAAG,MAAM,CAA2C;IAC5E,IAAI,IAAI,IAAI,MAAM,CAAmC;IACrD,IAAI,KAAK,IAAI,MAAM,CAAoC;IACvD,IAAI,OAAO,IAAI,MAAM,CAAsC;IAC3D,IAAI,SAAS,IAAI,IAAI,GAAG,SAAS,CAAgD;IACjF,IAAI,UAAU,IAAI,IAAI,GAAG,UAAU,CAAwC;IAC3E,IAAI,YAAY,IAAI,MAAM,CAA2C;IACrE,IAAI,IAAI,IAAI,IAAI,GAAG,MAAM,CAAmC;IAC5D,IAAI,aAAa,IAAI,IAAI,GAAG,MAAM,CAA4C;IAC9E,IAAI,UAAU,IAAI,MAAM,CAAyC;IACjE,IAAI,kBAAkB,IAAI,MAAM,CAAiD;CAClF"} \ No newline at end of file diff --git a/dist/lacchain-transaction.js b/dist/lacchain-transaction.js new file mode 100644 index 0000000..c643685 --- /dev/null +++ b/dist/lacchain-transaction.js @@ -0,0 +1,32 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.LacchainTransaction = void 0; +class LacchainTransaction { + constructor(_aOriginalTx, _aHashTx) { + this._aOriginalTx = _aOriginalTx; + this._aHashTx = _aHashTx; + } + get hash() { + return this._aHashTx; + } + get type() { return this._aOriginalTx.type; } + get typeName() { return this._aOriginalTx.typeName; } + get to() { return this._aOriginalTx.to; } + get nonce() { return this._aOriginalTx.nonce; } + get gasLimit() { return this._aOriginalTx.gasLimit; } + get gasPrice() { return this._aOriginalTx.gasPrice; } + get maxPriorityFeePerGas() { return this._aOriginalTx.maxPriorityFeePerGas; } + get maxFeePerGas() { return this._aOriginalTx.maxFeePerGas; } + get data() { return this._aOriginalTx.data; } + get value() { return this._aOriginalTx.value; } + get chainId() { return this._aOriginalTx.chainId; } + get signature() { return this._aOriginalTx.signature || null; } + get accessList() { return this._aOriginalTx.accessList; } + get unsignedHash() { return this._aOriginalTx.unsignedHash; } + get from() { return this._aOriginalTx.from; } + get fromPublicKey() { return this._aOriginalTx.fromPublicKey; } + get serialized() { return this._aOriginalTx.serialized; } + get unsignedSerialized() { return this._aOriginalTx.unsignedSerialized; } +} +exports.LacchainTransaction = LacchainTransaction; +//# sourceMappingURL=lacchain-transaction.js.map \ No newline at end of file diff --git a/dist/lacchain-transaction.js.map b/dist/lacchain-transaction.js.map new file mode 100644 index 0000000..b37901b --- /dev/null +++ b/dist/lacchain-transaction.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction.js","sourceRoot":"","sources":["../src/lacchain-transaction.ts"],"names":[],"mappings":";;;AAIA,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,CAAA,CAAC,CAAC;IAC3E,IAAI,YAAY,KAAa,OAAO,IAAI,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC,CAAC;IACrE,IAAI,IAAI,KAAoB,OAAO,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC;IAC5D,IAAI,aAAa,KAAoB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC,CAAC;IAC9E,IAAI,UAAU,KAAa,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC,CAAC;IACjE,IAAI,kBAAkB,KAAa,OAAO,IAAI,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC,CAAC;CAClF;AA1BD,kDA0BC"} \ No newline at end of file diff --git a/dist/test/e2e/deploy-and-tx.test.d.ts b/dist/test/e2e/deploy-and-tx.test.d.ts new file mode 100644 index 0000000..9965d70 --- /dev/null +++ b/dist/test/e2e/deploy-and-tx.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=deploy-and-tx.test.d.ts.map \ No newline at end of file diff --git a/dist/test/e2e/deploy-and-tx.test.d.ts.map b/dist/test/e2e/deploy-and-tx.test.d.ts.map new file mode 100644 index 0000000..c9540f9 --- /dev/null +++ b/dist/test/e2e/deploy-and-tx.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"deploy-and-tx.test.d.ts","sourceRoot":"","sources":["../../../src/test/e2e/deploy-and-tx.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/e2e/deploy-and-tx.test.js b/dist/test/e2e/deploy-and-tx.test.js new file mode 100644 index 0000000..091b93a --- /dev/null +++ b/dist/test/e2e/deploy-and-tx.test.js @@ -0,0 +1,63 @@ +"use strict"; +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { + Object.defineProperty(o, "default", { enumerable: true, value: v }); +}) : function(o, v) { + o["default"] = v; +}); +var __importStar = (this && this.__importStar) || function (mod) { + if (mod && mod.__esModule) return mod; + var result = {}; + if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); + __setModuleDefault(result, mod); + return result; +}; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const process_1 = require("process"); +const ethers_1 = require("ethers"); +const dotenv = __importStar(require("dotenv")); +const test_contract_1 = require("./test-contract"); +const lacchain_provider_1 = require("../../lacchain-provider"); +const lacchain_signer_1 = require("../../lacchain-signer"); +const fixtures_1 = require("../fixtures"); +describe('e2e Provider & Signer re', () => { + dotenv.config(); + const { RPC_URL, NODE_ADDRESS, TRUSTED_FORWARDER } = process_1.env; + const signer = new lacchain_signer_1.LacchainSigner(fixtures_1.aPrivateKey, new lacchain_provider_1.LacchainProvider(RPC_URL), NODE_ADDRESS, fixtures_1.anExpirationTime); + console.log("set network"); + const _deployContract = () => __awaiter(void 0, void 0, void 0, function* () { + var _a; + const contractFactory = new ethers_1.ContractFactory(test_contract_1.aTestContract.abi, test_contract_1.aTestContract.bytecode, signer); + const contract = yield contractFactory.deploy(signer.address, TRUSTED_FORWARDER); + return yield ((_a = contract.deploymentTransaction()) === null || _a === void 0 ? void 0 : _a.wait()); + }); + test('Deploy & Transaction re', () => __awaiter(void 0, void 0, void 0, function* () { + const txReceipt = yield _deployContract(); + const contractAddress = (txReceipt === null || txReceipt === void 0 ? void 0 : txReceipt.contractAddress) || ''; + console.log(contractAddress); + expect(contractAddress).toBeTruthy(); + const contract = new ethers_1.Contract(contractAddress, test_contract_1.aTestContract.abi, signer); + yield (yield contract.add(fixtures_1.testAddresses[0], fixtures_1.testAddresses[1])).wait(); + expect(yield contract.exists(fixtures_1.testAddresses[0], fixtures_1.testAddresses[1])).toEqual(true); + }), 100000000); +}); +//# sourceMappingURL=deploy-and-tx.test.js.map \ No newline at end of file diff --git a/dist/test/e2e/deploy-and-tx.test.js.map b/dist/test/e2e/deploy-and-tx.test.js.map new file mode 100644 index 0000000..d801235 --- /dev/null +++ b/dist/test/e2e/deploy-and-tx.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"deploy-and-tx.test.js","sourceRoot":"","sources":["../../../src/test/e2e/deploy-and-tx.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAA8B;AAC9B,mCAAmD;AACnD,+CAAiC;AACjC,mDAAgD;AAChD,+DAA2D;AAC3D,2DAAuD;AACvD,0CAA2E;AAI3E,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IAExC,MAAM,CAAC,MAAM,EAAE,CAAC;IAEhB,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,GAAG,aAAG,CAAC;IAGzD,MAAM,MAAM,GAAmB,IAAI,gCAAc,CAC/C,sBAAW,EACX,IAAI,oCAAgB,CAAC,OAAQ,CAAC,EAC9B,YAAa,EACb,2BAAgB,CACjB,CAAC;IACJ,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACxB,MAAM,eAAe,GAAG,GAAS,EAAE;;QACjC,MAAM,eAAe,GAAG,IAAI,wBAAe,CACzC,6BAAa,CAAC,GAAG,EACjB,6BAAa,CAAC,QAAQ,EACtB,MAAM,CACP,CAAC;QAEF,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAkB,CAAC,CAAC;QAElF,OAAO,MAAM,CAAA,MAAA,QAAQ,CAAC,qBAAqB,EAAE,0CAAE,IAAI,EAAE,CAAA,CAAC;IACxD,CAAC,CAAA,CAAC;IAEF,IAAI,CAAC,yBAAyB,EAAE,GAAS,EAAE;QACzC,MAAM,SAAS,GAAG,MAAM,eAAe,EAAE,CAAC;QAC1C,MAAM,eAAe,GAAG,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,KAAI,EAAE,CAAC;QACzD,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC,CAAA;QAC5B,MAAM,CAAC,eAAe,CAAC,CAAC,UAAU,EAAE,CAAC;QAErC,MAAM,QAAQ,GAAG,IAAI,iBAAQ,CAAC,eAAe,EAAE,6BAAa,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QAE1E,MAAM,CAAC,MAAM,QAAQ,CAAC,GAAG,CAAC,wBAAa,CAAC,CAAC,CAAC,EAAE,wBAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAEtE,MAAM,CAAC,MAAM,QAAQ,CAAC,MAAM,CAAC,wBAAa,CAAC,CAAC,CAAC,EAAE,wBAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClF,CAAC,CAAA,EAAE,SAAS,CAAC,CAAC;AAChB,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/e2e/test-contract.d.ts b/dist/test/e2e/test-contract.d.ts new file mode 100644 index 0000000..d6a2c4b --- /dev/null +++ b/dist/test/e2e/test-contract.d.ts @@ -0,0 +1,60 @@ +export declare const aTestContract: { + _format: string; + contractName: string; + sourceName: string; + abi: ({ + inputs: { + internalType: string; + name: string; + type: string; + }[]; + stateMutability: string; + type: string; + name?: undefined; + anonymous?: undefined; + outputs?: undefined; + } | { + inputs: { + internalType: string; + name: string; + type: string; + }[]; + name: string; + type: string; + stateMutability?: undefined; + anonymous?: undefined; + outputs?: undefined; + } | { + anonymous: boolean; + inputs: { + indexed: boolean; + internalType: string; + name: string; + type: string; + }[]; + name: string; + type: string; + stateMutability?: undefined; + outputs?: undefined; + } | { + inputs: { + internalType: string; + name: string; + type: string; + }[]; + name: string; + outputs: { + internalType: string; + name: string; + type: string; + }[]; + stateMutability: string; + type: string; + anonymous?: undefined; + })[]; + bytecode: string; + deployedBytecode: string; + linkReferences: {}; + deployedLinkReferences: {}; +}; +//# sourceMappingURL=test-contract.d.ts.map \ No newline at end of file diff --git a/dist/test/e2e/test-contract.d.ts.map b/dist/test/e2e/test-contract.d.ts.map new file mode 100644 index 0000000..1e4412a --- /dev/null +++ b/dist/test/e2e/test-contract.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract.d.ts","sourceRoot":"","sources":["../../../src/test/e2e/test-contract.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqKzB,CAAA"} \ No newline at end of file diff --git a/dist/test/e2e/test-contract.js b/dist/test/e2e/test-contract.js new file mode 100644 index 0000000..fb6d061 --- /dev/null +++ b/dist/test/e2e/test-contract.js @@ -0,0 +1,170 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.aTestContract = void 0; +exports.aTestContract = { + "_format": "hh-sol-artifact-1", + "contractName": "Whitelist", + "sourceName": "contracts/Whitelist.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "address", + "name": "trustedForwarder_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AddressZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "add", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "remove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060405161078c38038061078c83398101604081905261002f916100fd565b80826001600160a01b03811661005f57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006881610091565b50600180546001600160a01b0319166001600160a01b0392909216919091179055506101309050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100f857600080fd5b919050565b6000806040838503121561011057600080fd5b610119836100e1565b9150610127602084016100e1565b90509250929050565b61064d8061013f6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", + "linkReferences": {}, + "deployedLinkReferences": {} +}; +//# sourceMappingURL=test-contract.js.map \ No newline at end of file diff --git a/dist/test/e2e/test-contract.js.map b/dist/test/e2e/test-contract.js.map new file mode 100644 index 0000000..d741ffd --- /dev/null +++ b/dist/test/e2e/test-contract.js.map @@ -0,0 +1 @@ +{"version":3,"file":"test-contract.js","sourceRoot":"","sources":["../../../src/test/e2e/test-contract.ts"],"names":[],"mappings":";;;AAAa,QAAA,aAAa,GAAG;IAC3B,SAAS,EAAE,mBAAmB;IAC9B,cAAc,EAAE,WAAW;IAC3B,YAAY,EAAE,yBAAyB;IACvC,KAAK,EAAE;QACL;YACE,QAAQ,EAAE;gBACR;oBACE,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,QAAQ;oBAChB,MAAM,EAAE,SAAS;iBAClB;gBACD;oBACE,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,mBAAmB;oBAC3B,MAAM,EAAE,SAAS;iBAClB;aACF;YACD,iBAAiB,EAAE,YAAY;YAC/B,MAAM,EAAE,aAAa;SACtB;QACD;YACE,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE,aAAa;YACrB,MAAM,EAAE,OAAO;SAChB;QACD;YACE,QAAQ,EAAE;gBACR;oBACE,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,OAAO;oBACf,MAAM,EAAE,SAAS;iBAClB;aACF;YACD,MAAM,EAAE,qBAAqB;YAC7B,MAAM,EAAE,OAAO;SAChB;QACD;YACE,QAAQ,EAAE;gBACR;oBACE,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,SAAS;oBACjB,MAAM,EAAE,SAAS;iBAClB;aACF;YACD,MAAM,EAAE,4BAA4B;YACpC,MAAM,EAAE,OAAO;SAChB;QACD;YACE,WAAW,EAAE,KAAK;YAClB,QAAQ,EAAE;gBACR;oBACE,SAAS,EAAE,IAAI;oBACf,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,eAAe;oBACvB,MAAM,EAAE,SAAS;iBAClB;gBACD;oBACE,SAAS,EAAE,IAAI;oBACf,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,UAAU;oBAClB,MAAM,EAAE,SAAS;iBAClB;aAC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ACb,iBAAiB,EAAE,YAAY;YAC/B,MAAM,EAAE,UAAU;SACnB;QACD;YACE,QAAQ,EAAE,EAAE;YACZ,MAAM,EAAE,mBAAmB;YAC3B,SAAS,EAAE,EAAE;YACb,iBAAiB,EAAE,YAAY;YAC/B,MAAM,EAAE,UAAU;SACnB;QACD;YACE,QAAQ,EAAE;gBACR;oBACE,cAAc,EAAE,SAAS;oBACzB,MAAM,EAAE,UAAU;oBAClB,MAAM,EAAE,SAAS;iBAClB;aACF;YACD,MAAM,EAAE,mBAAmB;YAC3B,SAAS,EAAE,EAAE;YACb,iBAAiB,EAAE,YAAY;YAC/B,MAAM,EAAE,UAAU;SACnB;KACF;IACD,UAAU,EAAE,4xHAA4xH;IACxyH,kBAAkB,EAAE,8pGAA8pG;IAClrG,gBAAgB,EAAE,EAAE;IACpB,wBAAwB,EAAE,EAAE;CAC7B,CAAA"} \ No newline at end of file diff --git a/dist/test/fixtures copy.d.ts b/dist/test/fixtures copy.d.ts new file mode 100644 index 0000000..9fd0d72 --- /dev/null +++ b/dist/test/fixtures copy.d.ts @@ -0,0 +1,8 @@ +import { TransactionRequest } from 'ethers'; +export declare const aPrivateKey = "9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c"; +export declare const anExpirationTime = 1836394529; +export declare const aNodeAddress = "0xc6e2459991BfE27cca6d86722F35da23A1E4Cb97"; +export declare const anOriginalTxRequest: TransactionRequest; +export declare const aSignedTxRequest = "0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7"; +export declare const testAddresses: string[]; +//# sourceMappingURL=fixtures%20copy.d.ts.map \ No newline at end of file diff --git a/dist/test/fixtures copy.d.ts.map b/dist/test/fixtures copy.d.ts.map new file mode 100644 index 0000000..124a2df --- /dev/null +++ b/dist/test/fixtures copy.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixtures copy.d.ts","sourceRoot":"","sources":["../../src/test/fixtures copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,YAAY,+CAA+C,CAAC;AACzE,eAAO,MAAM,mBAAmB,EAAE,kBAgBjC,CAAC;AACF,eAAO,MAAM,gBAAgB,mdACqb,CAAC;AACnd,eAAO,MAAM,aAAa,UAA+F,CAAC"} \ No newline at end of file diff --git a/dist/test/fixtures copy.js b/dist/test/fixtures copy.js new file mode 100644 index 0000000..f7efcd4 --- /dev/null +++ b/dist/test/fixtures copy.js @@ -0,0 +1,25 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.testAddresses = exports.aSignedTxRequest = exports.anOriginalTxRequest = exports.aNodeAddress = exports.anExpirationTime = exports.aPrivateKey = void 0; +exports.aPrivateKey = '9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c'; +exports.anExpirationTime = 1836394529; +exports.aNodeAddress = '0xc6e2459991BfE27cca6d86722F35da23A1E4Cb97'; +exports.anOriginalTxRequest = { + type: 0, + to: '0x4F3F9061c42B396746Bb9A232089703E4f9DBF76', + from: null, + nonce: 71, + gasLimit: '1234', + gasPrice: '0', + maxPriorityFeePerGas: null, + maxFeePerGas: null, + data: '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2', + value: 0, + chainId: 1234, + accessList: null, + customData: undefined, + blockTag: undefined, + enableCcipRead: undefined, +}; +exports.aSignedTxRequest = '0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7'; +exports.testAddresses = ['0xE81D7E5Cd979be0a7F6B6c98957A66fdF6240273', '0x410bd47227a5EA8AF81995Fa3d66B770aF6F85e2']; diff --git a/dist/test/fixtures.d.ts b/dist/test/fixtures.d.ts new file mode 100644 index 0000000..b7a8582 --- /dev/null +++ b/dist/test/fixtures.d.ts @@ -0,0 +1,8 @@ +import { TransactionRequest } from 'ethers'; +export declare const aPrivateKey = "9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c"; +export declare const anExpirationTime = 1836394529; +export declare const aNodeAddress = "0xc6e2459991BfE27cca6d86722F35da23A1E4Cb97"; +export declare const anOriginalTxRequest: TransactionRequest; +export declare const aSignedTxRequest = "0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7"; +export declare const testAddresses: string[]; +//# sourceMappingURL=fixtures.d.ts.map \ No newline at end of file diff --git a/dist/test/fixtures.d.ts.map b/dist/test/fixtures.d.ts.map new file mode 100644 index 0000000..d958cc9 --- /dev/null +++ b/dist/test/fixtures.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../src/test/fixtures.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,QAAQ,CAAC;AAG5C,eAAO,MAAM,WAAW,qEAC4C,CAAC;AACrE,eAAO,MAAM,gBAAgB,aAAa,CAAC;AAC3C,eAAO,MAAM,YAAY,+CAA+C,CAAC;AACzE,eAAO,MAAM,mBAAmB,EAAE,kBAgBjC,CAAC;AACF,eAAO,MAAM,gBAAgB,mdACqb,CAAC;AACnd,eAAO,MAAM,aAAa,UAA+F,CAAC"} \ No newline at end of file diff --git a/dist/test/fixtures.js b/dist/test/fixtures.js new file mode 100644 index 0000000..f7cc0d0 --- /dev/null +++ b/dist/test/fixtures.js @@ -0,0 +1,26 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.testAddresses = exports.aSignedTxRequest = exports.anOriginalTxRequest = exports.aNodeAddress = exports.anExpirationTime = exports.aPrivateKey = void 0; +exports.aPrivateKey = '9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c'; +exports.anExpirationTime = 1836394529; +exports.aNodeAddress = '0xc6e2459991BfE27cca6d86722F35da23A1E4Cb97'; +exports.anOriginalTxRequest = { + type: 0, + to: '0x4F3F9061c42B396746Bb9A232089703E4f9DBF76', + from: null, + nonce: 71, + gasLimit: '1234', + gasPrice: '0', + maxPriorityFeePerGas: null, + maxFeePerGas: null, + data: '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2', + value: 0, + chainId: 1234, + accessList: null, + customData: undefined, + blockTag: undefined, + enableCcipRead: undefined, +}; +exports.aSignedTxRequest = '0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7'; +exports.testAddresses = ['0xE81D7E5Cd979be0a7F6B6c98957A66fdF6240273', '0x410bd47227a5EA8AF81995Fa3d66B770aF6F85e2']; +//# sourceMappingURL=fixtures.js.map \ No newline at end of file diff --git a/dist/test/fixtures.js.map b/dist/test/fixtures.js.map new file mode 100644 index 0000000..9dd591a --- /dev/null +++ b/dist/test/fixtures.js.map @@ -0,0 +1 @@ +{"version":3,"file":"fixtures.js","sourceRoot":"","sources":["../../src/test/fixtures.ts"],"names":[],"mappings":";;;AAIa,QAAA,WAAW,GACtB,kEAAkE,CAAC;AACxD,QAAA,gBAAgB,GAAG,UAAU,CAAC;AAC9B,QAAA,YAAY,GAAG,4CAA4C,CAAC;AAC5D,QAAA,mBAAmB,GAAuB;IACrD,IAAI,EAAE,CAAC;IACP,EAAE,EAAE,4CAA4C;IAChD,IAAI,EAAE,IAAI;IACV,KAAK,EAAE,EAAE;IACT,QAAQ,EAAE,MAAM;IAChB,QAAQ,EAAE,GAAG;IACb,oBAAoB,EAAE,IAAI;IAC1B,YAAY,EAAE,IAAI;IAClB,IAAI,EAAE,4IAA4I;IAClJ,KAAK,EAAE,CAAC;IACR,OAAO,EAAE,IAAI;IACb,UAAU,EAAE,IAAI;IAChB,UAAU,EAAE,SAAS;IACrB,QAAQ,EAAE,SAAS;IACnB,cAAc,EAAE,SAAS;CAC1B,CAAC;AACW,QAAA,gBAAgB,GAC3B,gdAAgd,CAAC;AACtc,QAAA,aAAa,GAAG,CAAC,4CAA4C,EAAE,4CAA4C,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/index.test.d.ts b/dist/test/index.test.d.ts new file mode 100644 index 0000000..121d59b --- /dev/null +++ b/dist/test/index.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=index.test.d.ts.map \ No newline at end of file diff --git a/dist/test/index.test.d.ts.map b/dist/test/index.test.d.ts.map new file mode 100644 index 0000000..7f5e28b --- /dev/null +++ b/dist/test/index.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"index.test.d.ts","sourceRoot":"","sources":["../../src/test/index.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/index.test.js b/dist/test/index.test.js new file mode 100644 index 0000000..b648a04 --- /dev/null +++ b/dist/test/index.test.js @@ -0,0 +1,12 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const index_1 = require("../index"); +describe('index.ts', () => { + test('exports', () => { + expect(index_1.LacchainSigner).toBeTruthy(); + expect(index_1.LacchainProvider).toBeTruthy(); + expect(index_1.LacchainTransaction).toBeTruthy(); + expect(index_1.LacchainTransactionRequest).toBeTruthy(); + }); +}); +//# sourceMappingURL=index.test.js.map \ No newline at end of file diff --git a/dist/test/index.test.js.map b/dist/test/index.test.js.map new file mode 100644 index 0000000..ab78989 --- /dev/null +++ b/dist/test/index.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"index.test.js","sourceRoot":"","sources":["../../src/test/index.test.ts"],"names":[],"mappings":";;AAAA,oCAKkB;AAGlB,QAAQ,CAAC,UAAU,EAAE,GAAG,EAAE;IAExB,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,sBAAc,CAAC,CAAC,UAAU,EAAE,CAAC;QACpC,MAAM,CAAC,wBAAgB,CAAC,CAAC,UAAU,EAAE,CAAC;QACtC,MAAM,CAAC,2BAAmB,CAAC,CAAC,UAAU,EAAE,CAAC;QACzC,MAAM,CAAC,kCAA0B,CAAC,CAAC,UAAU,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/lacchain-provider.test.d.ts b/dist/test/lacchain-provider.test.d.ts new file mode 100644 index 0000000..5d4cdc6 --- /dev/null +++ b/dist/test/lacchain-provider.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=lacchain-provider.test.d.ts.map \ No newline at end of file diff --git a/dist/test/lacchain-provider.test.d.ts.map b/dist/test/lacchain-provider.test.d.ts.map new file mode 100644 index 0000000..68131cb --- /dev/null +++ b/dist/test/lacchain-provider.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-provider.test.d.ts","sourceRoot":"","sources":["../../src/test/lacchain-provider.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/lacchain-provider.test.js b/dist/test/lacchain-provider.test.js new file mode 100644 index 0000000..3a8aca5 --- /dev/null +++ b/dist/test/lacchain-provider.test.js @@ -0,0 +1,9 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lacchain_provider_1 = require("../lacchain-provider"); +describe('LacchainProvider', () => { + test('new', () => { + expect(new lacchain_provider_1.LacchainProvider('http://test.test')).toBeTruthy(); + }); +}); +//# sourceMappingURL=lacchain-provider.test.js.map \ No newline at end of file diff --git a/dist/test/lacchain-provider.test.js.map b/dist/test/lacchain-provider.test.js.map new file mode 100644 index 0000000..4bcbf5f --- /dev/null +++ b/dist/test/lacchain-provider.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-provider.test.js","sourceRoot":"","sources":["../../src/test/lacchain-provider.test.ts"],"names":[],"mappings":";;AAAA,4DAAwD;AAGxD,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAEhC,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;QACf,MAAM,CAAC,IAAI,oCAAgB,CAAC,kBAAkB,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC;IAChE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/lacchain-signer.test.d.ts b/dist/test/lacchain-signer.test.d.ts new file mode 100644 index 0000000..6448865 --- /dev/null +++ b/dist/test/lacchain-signer.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=lacchain-signer.test.d.ts.map \ No newline at end of file diff --git a/dist/test/lacchain-signer.test.d.ts.map b/dist/test/lacchain-signer.test.d.ts.map new file mode 100644 index 0000000..6d32ad9 --- /dev/null +++ b/dist/test/lacchain-signer.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-signer.test.d.ts","sourceRoot":"","sources":["../../src/test/lacchain-signer.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/lacchain-signer.test.js b/dist/test/lacchain-signer.test.js new file mode 100644 index 0000000..94f5ad4 --- /dev/null +++ b/dist/test/lacchain-signer.test.js @@ -0,0 +1,27 @@ +"use strict"; +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +Object.defineProperty(exports, "__esModule", { value: true }); +const lacchain_signer_1 = require("../lacchain-signer"); +const fixtures_1 = require("./fixtures"); +describe('LacchainSigner', () => { + let signer; + const aProvider = {}; + beforeEach(() => { + signer = new lacchain_signer_1.LacchainSigner(fixtures_1.aPrivateKey, aProvider, fixtures_1.aNodeAddress, fixtures_1.anExpirationTime); + }); + test('new', () => { + expect(signer).toBeTruthy(); + }); + test('signTransaction', () => __awaiter(void 0, void 0, void 0, function* () { + expect(yield signer.signTransaction(fixtures_1.anOriginalTxRequest)).toEqual(fixtures_1.aSignedTxRequest); + })); +}); +//# sourceMappingURL=lacchain-signer.test.js.map \ No newline at end of file diff --git a/dist/test/lacchain-signer.test.js.map b/dist/test/lacchain-signer.test.js.map new file mode 100644 index 0000000..abc51c2 --- /dev/null +++ b/dist/test/lacchain-signer.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-signer.test.js","sourceRoot":"","sources":["../../src/test/lacchain-signer.test.ts"],"names":[],"mappings":";;;;;;;;;;;AACA,wDAAoD;AACpD,yCAMoB;AAGpB,QAAQ,CAAC,gBAAgB,EAAE,GAAG,EAAE;IAE9B,IAAI,MAAsB,CAAC;IAE3B,MAAM,SAAS,GAAG,EAAc,CAAC;IAEjC,UAAU,CAAC,GAAG,EAAE;QACd,MAAM,GAAG,IAAI,gCAAc,CACzB,sBAAW,EACX,SAAS,EACT,uBAAY,EACZ,2BAAgB,CACjB,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;QACf,MAAM,CAAC,MAAM,CAAC,CAAC,UAAU,EAAE,CAAC;IAC9B,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,iBAAiB,EAAE,GAAS,EAAE;QACjC,MAAM,CAAC,MAAM,MAAM,CAAC,eAAe,CAAC,8BAAmB,CAAC,CAAC,CAAC,OAAO,CAC/D,2BAAgB,CACjB,CAAC;IACJ,CAAC,CAAA,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/lacchain-transaction-request.test.d.ts b/dist/test/lacchain-transaction-request.test.d.ts new file mode 100644 index 0000000..237dccb --- /dev/null +++ b/dist/test/lacchain-transaction-request.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=lacchain-transaction-request.test.d.ts.map \ No newline at end of file diff --git a/dist/test/lacchain-transaction-request.test.d.ts.map b/dist/test/lacchain-transaction-request.test.d.ts.map new file mode 100644 index 0000000..edfcfef --- /dev/null +++ b/dist/test/lacchain-transaction-request.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction-request.test.d.ts","sourceRoot":"","sources":["../../src/test/lacchain-transaction-request.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/lacchain-transaction-request.test.js b/dist/test/lacchain-transaction-request.test.js new file mode 100644 index 0000000..1d65dfa --- /dev/null +++ b/dist/test/lacchain-transaction-request.test.js @@ -0,0 +1,60 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const lacchain_transaction_request_1 = require("../lacchain-transaction-request"); +const fixtures_1 = require("./fixtures"); +describe('LacchainTransactionRequest', () => { + let lacchainTxRequest; + const lacchainDataExpected = '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d752821'; + beforeEach(() => { + lacchainTxRequest = new lacchain_transaction_request_1.LacchainTransactionRequest(fixtures_1.anOriginalTxRequest, fixtures_1.aNodeAddress, fixtures_1.anExpirationTime); + }); + test('new', () => { + expect(lacchainTxRequest).toBeTruthy(); + }); + test('type', () => { + expect(lacchainTxRequest.type).toEqual(fixtures_1.anOriginalTxRequest.type); + }); + test('to', () => { + expect(lacchainTxRequest.to).toEqual(fixtures_1.anOriginalTxRequest.to); + }); + test('from', () => { + expect(lacchainTxRequest.from).toEqual(fixtures_1.anOriginalTxRequest.from); + }); + test('nonce', () => { + expect(lacchainTxRequest.nonce).toEqual(fixtures_1.anOriginalTxRequest.nonce); + }); + test('gasLimit', () => { + expect(lacchainTxRequest.gasLimit).toEqual(fixtures_1.anOriginalTxRequest.gasLimit); + }); + test('gasPrice', () => { + expect(lacchainTxRequest.gasPrice).toEqual(fixtures_1.anOriginalTxRequest.gasPrice); + }); + test('maxPriorityFeePerGas', () => { + expect(lacchainTxRequest.maxPriorityFeePerGas).toEqual(fixtures_1.anOriginalTxRequest.maxPriorityFeePerGas); + }); + test('maxFeePerGas', () => { + expect(lacchainTxRequest.maxFeePerGas).toEqual(fixtures_1.anOriginalTxRequest.maxFeePerGas); + }); + test('data', () => { + expect(lacchainTxRequest.data).toEqual(lacchainDataExpected); + }); + test('value', () => { + expect(lacchainTxRequest.value).toEqual(fixtures_1.anOriginalTxRequest.value); + }); + test('chainId', () => { + expect(lacchainTxRequest.chainId).toEqual(0); + }); + test('accessList', () => { + expect(lacchainTxRequest.accessList).toEqual(fixtures_1.anOriginalTxRequest.accessList); + }); + test('customData', () => { + expect(lacchainTxRequest.customData).toEqual(fixtures_1.anOriginalTxRequest.customData); + }); + test('blockTag', () => { + expect(lacchainTxRequest.blockTag).toEqual(fixtures_1.anOriginalTxRequest.blockTag); + }); + test('enableCciRead', () => { + expect(lacchainTxRequest.enableCcipRead).toEqual(fixtures_1.anOriginalTxRequest.enableCcipRead); + }); +}); +//# sourceMappingURL=lacchain-transaction-request.test.js.map \ No newline at end of file diff --git a/dist/test/lacchain-transaction-request.test.js.map b/dist/test/lacchain-transaction-request.test.js.map new file mode 100644 index 0000000..137a964 --- /dev/null +++ b/dist/test/lacchain-transaction-request.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction-request.test.js","sourceRoot":"","sources":["../../src/test/lacchain-transaction-request.test.ts"],"names":[],"mappings":";;AAAA,kFAA6E;AAC7E,yCAAiF;AAGjF,QAAQ,CAAC,4BAA4B,EAAE,GAAG,EAAE;IAE1C,IAAI,iBAA6C,CAAC;IAElD,MAAM,oBAAoB,GAAG,4QAA4Q,CAAC;IAE1S,UAAU,CAAC,GAAG,EAAE;QACd,iBAAiB,GAAG,IAAI,yDAA0B,CAAC,8BAAmB,EAAE,uBAAY,EAAE,2BAAgB,CAAC,CAAC;IAC1G,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,KAAK,EAAE,GAAG,EAAE;QACf,MAAM,CAAC,iBAAiB,CAAC,CAAC,UAAU,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;QAChB,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,O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AM,EAAE,GAAG,EAAE;QAChB,MAAM,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAC/D,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,OAAO,EAAE,GAAG,EAAE;QACjB,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,OAAO,CAAC,8BAAmB,CAAC,KAAK,CAAC,CAAC;IACrE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QACnB,MAAM,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,8BAAmB,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,8BAAmB,CAAC,UAAU,CAAC,CAAC;IAC/E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,UAAU,EAAE,GAAG,EAAE;QACpB,MAAM,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,OAAO,CAAC,8BAAmB,CAAC,QAAQ,CAAC,CAAC;IAC3E,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,OAAO,CAC9C,8BAAmB,CAAC,cAAc,CACnC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/dist/test/lacchain-transaction.test.d.ts b/dist/test/lacchain-transaction.test.d.ts new file mode 100644 index 0000000..985faaf --- /dev/null +++ b/dist/test/lacchain-transaction.test.d.ts @@ -0,0 +1,2 @@ +export {}; +//# sourceMappingURL=lacchain-transaction.test.d.ts.map \ No newline at end of file diff --git a/dist/test/lacchain-transaction.test.d.ts.map b/dist/test/lacchain-transaction.test.d.ts.map new file mode 100644 index 0000000..a5cf439 --- /dev/null +++ b/dist/test/lacchain-transaction.test.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction.test.d.ts","sourceRoot":"","sources":["../../src/test/lacchain-transaction.test.ts"],"names":[],"mappings":""} \ No newline at end of file diff --git a/dist/test/lacchain-transaction.test.js b/dist/test/lacchain-transaction.test.js new file mode 100644 index 0000000..f615815 --- /dev/null +++ b/dist/test/lacchain-transaction.test.js @@ -0,0 +1,76 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +const ethers_1 = require("ethers"); +const lacchain_transaction_1 = require("../lacchain-transaction"); +describe('LacchainTransaction ', () => { + let transaction; + const aTestHash = 'a7c96262c21db9a06fd49e307d694fd95f624569f9b35bb3ffacd880440f9787'; + const anOriginalTx = ethers_1.Transaction.from('0xf8e4428082d558944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000fda1303fc59b74b0926740b627770ced2ee98672000000000000000000000000000000000000000000000000000000006d7528211ba05313a3599a01d85aecb9792ffdf22f3f3b22b90bdd171a4e9f042719e7358f9da066f66b78938797f47a6cb54e759bbc0b4133c7b616760e0242848ae4c797de82'); + beforeEach(() => { + transaction = new lacchain_transaction_1.LacchainTransaction(anOriginalTx, aTestHash); + }); + test('new', () => { + expect(transaction).toBeTruthy(); + }); + test('fixed hash value', () => { + expect(transaction.hash).toEqual(aTestHash); + }); + test('fixed hash', () => { + expect(transaction.hash === anOriginalTx.hash).toBeFalsy(); + }); + test('type', () => { + expect(transaction.type).toEqual(anOriginalTx.type); + }); + test('typeName', () => { + expect(transaction.typeName).toEqual(anOriginalTx.typeName); + }); + test('to', () => { + expect(transaction.to).toEqual(anOriginalTx.to); + }); + test('nonce', () => { + expect(transaction.nonce).toEqual(anOriginalTx.nonce); + }); + test('gasLimit', () => { + expect(transaction.gasLimit).toEqual(anOriginalTx.gasLimit); + }); + test('gasPrice', () => { + expect(transaction.gasPrice).toEqual(anOriginalTx.gasPrice); + }); + test('maxPriorityFeePerGas', () => { + expect(transaction.maxPriorityFeePerGas).toEqual(anOriginalTx.maxPriorityFeePerGas); + }); + test('maxFeePerGas', () => { + expect(transaction.maxFeePerGas).toEqual(anOriginalTx.maxFeePerGas); + }); + test('data', () => { + expect(transaction.data).toEqual(anOriginalTx.data); + }); + test('value', () => { + expect(transaction.value).toEqual(anOriginalTx.value); + }); + test('chainId', () => { + expect(transaction.chainId).toEqual(anOriginalTx.chainId); + }); + test('signature', () => { + expect(transaction.signature).toEqual(anOriginalTx.signature); + }); + test('accessList', () => { + expect(transaction.accessList).toEqual(anOriginalTx.accessList); + }); + test('unsignedHash', () => { + expect(transaction.unsignedHash).toEqual(anOriginalTx.unsignedHash); + }); + test('from', () => { + expect(transaction.from).toEqual(anOriginalTx.from); + }); + test('fromPublicKey', () => { + expect(transaction.fromPublicKey).toEqual(anOriginalTx.fromPublicKey); + }); + test('serialized', () => { + expect(transaction.serialized).toEqual(anOriginalTx.serialized); + }); + test('unsignedSerialized', () => { + expect(transaction.unsignedSerialized).toEqual(anOriginalTx.unsignedSerialized); + }); +}); +//# sourceMappingURL=lacchain-transaction.test.js.map \ No newline at end of file diff --git a/dist/test/lacchain-transaction.test.js.map b/dist/test/lacchain-transaction.test.js.map new file mode 100644 index 0000000..107d1e0 --- /dev/null +++ b/dist/test/lacchain-transaction.test.js.map @@ -0,0 +1 @@ +{"version":3,"file":"lacchain-transaction.test.js","sourceRoot":"","sources":["../../src/test/lacchain-transaction.test.ts"],"names":[],"mappings":";;AAAA,mCAAqC;AACrC,kEAA8D;AAG9D,QAAQ,CAAC,sBAAsB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AAE,GAAG,EAAE;QACrB,MAAM,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,SAAS,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,cAAc,EAAE,GAAG,EAAE;QACxB,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,MAAM,EAAE,GAAG,EAAE;QAChB,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,eAAe,EAAE,GAAG,EAAE;QACzB,MAAM,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,aAAa,CAAC,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,YAAY,EAAE,GAAG,EAAE;QACtB,MAAM,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,UAAU,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,IAAI,CAAC,oBAAoB,EAAE,GAAG,EAAE;QAC9B,MAAM,CAAC,WAAW,CAAC,kBAAkB,CAAC,CAAC,OAAO,CAAC,YAAY,CAAC,kBAAkB,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/jest.config.e2e.js b/jest.config.e2e.js new file mode 100644 index 0000000..dcc8f9b --- /dev/null +++ b/jest.config.e2e.js @@ -0,0 +1,11 @@ +module.exports = { + transform: { + '^.+\\.ts?$': 'ts-jest' + }, + testEnvironment: 'node', + testRegex: './src/tests/e2e/.*\\.(test|spec)?\\.(ts|ts)$', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + roots: [ + '/src' + ], +}; diff --git a/jest.config.js b/jest.config.js new file mode 100644 index 0000000..890deb3 --- /dev/null +++ b/jest.config.js @@ -0,0 +1,14 @@ +module.exports = { + transform: { + '^.+\\.ts?$': 'ts-jest' + }, + testEnvironment: 'node', + testRegex: './src/.*\\.(test|spec)?\\.(ts|ts)$', + moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'], + roots: [ + "/src" + ], + testPathIgnorePatterns: [ + '/src/tests/e2e/' + ], +}; diff --git a/package-lock.json b/package-lock.json index 0357053..512fcf8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,2689 +1,270 @@ { "name": "@lacchain/gas-model-provider", - "version": "1.0.1", - "lockfileVersion": 2, + "version": "1.2.0", + "lockfileVersion": 1, "requires": true, - "packages": { - "": { - "name": "@lacchain/gas-model-provider", - "version": "1.0.1", - "license": "ISC", - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "ethers": "^5.6.0" - }, - "devDependencies": { - "@types/chai": "^4.3.0", - "@types/mocha": "^9.1.0", - "@types/node": "^17.0.21", - "chai": "^4.3.6", - "chai-as-promised": "^7.1.1", - "codecov": "^3.8.3", - "mocha": "^9.2.1", - "prettier": "^2.5.1", - "ts-node": "^10.7.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "typescript": "^4.6.2" - } - }, - "node_modules/@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", - "dev": true, - "dependencies": { - "@babel/highlight": "^7.16.7" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", - "dev": true, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight": { - "version": "7.16.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", - "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", - "dev": true, - "dependencies": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", - "js-tokens": "^4.0.0" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/@babel/highlight/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "dependencies": { - "color-name": "1.1.3" - } - }, - "node_modules/@babel/highlight/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "node_modules/@babel/highlight/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/@babel/highlight/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true, - "engines": { - "node": ">=4" - } - }, - "node_modules/@babel/highlight/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", - "dev": true, - "engines": { - "node": ">= 12" - } - }, - "node_modules/@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-consumer": "0.8.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@ethersproject/abi": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.0.tgz", - "integrity": "sha512-AhVByTwdXCc2YQ20v300w6KVHle9g2OFc28ZAFCPnJyEpkv1xKXjZcSTgWOlv1i+0dqlgF8RCF2Rn2KC1t+1Vg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "node_modules/@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" - } - }, - "node_modules/@ethersproject/abstract-signer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.0.tgz", - "integrity": "sha512-WOqnG0NJKtI8n0wWZPReHtaLkDByPL67tn4nBaDAhmVq8sjHTPbCdz4DRhVu/cfTOvfy9w3iq5QZ7BX7zw56BQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0" - } - }, - "node_modules/@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" - } - }, - "node_modules/@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0" - } - }, - "node_modules/@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/properties": "^5.6.0" - } - }, - "node_modules/@ethersproject/bignumber": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.0.tgz", - "integrity": "sha512-VziMaXIUHQlHJmkv1dlcd6GY2PmT0khtAqaMctCIDogxkrarMzA9L94KN1NeXqqOfFD6r0sJT3vCTOFSmZ07DA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" - } - }, - "node_modules/@ethersproject/bytes": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.0.tgz", - "integrity": "sha512-3hJPlYemb9V4VLfJF5BfN0+55vltPZSHU3QKUyP9M3Y2TcajbiRrz65UG+xVHOzBereB1b9mn7r12o177xgN7w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.0" - } - }, - "node_modules/@ethersproject/contracts": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.0.tgz", - "integrity": "sha512-74Ge7iqTDom0NX+mux8KbRUeJgu1eHZ3iv6utv++sLJG80FVuU9HnHeKVPfjd9s3woFhaFoQGf3B3iH/FrQmgw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" - } - }, - "node_modules/@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "node_modules/@ethersproject/hdnode": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.0.tgz", - "integrity": "sha512-61g3Jp3nwDqJcL/p4nugSyLrpl/+ChXIOtCEM8UDmWeB3JCAt5FoLdOMXQc3WWkc0oM2C0aAn6GFqqMcS/mHTw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" - } - }, - "node_modules/@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" - } - }, - "node_modules/@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "js-sha3": "0.8.0" - } - }, - "node_modules/@ethersproject/logger": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", - "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ] - }, - "node_modules/@ethersproject/networks": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.0.tgz", - "integrity": "sha512-DaVzgyThzHgSDLuURhvkp4oviGoGe9iTZW4jMEORHDRCgSZ9K9THGFKqL+qGXqPAYLEgZTf5z2w56mRrPR1MjQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" - } - }, - "node_modules/@ethersproject/properties": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", - "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/providers": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.0.tgz", - "integrity": "sha512-6+5PKXTWAttJWFWF8+xCDTCa2/dtq9BNrdKQHGl0IyIOwj99vM6OeThmIRcsIAzIOb8m0XS6w+1KFZwrf3j9nw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", - "bech32": "1.1.4", - "ws": "7.4.6" - } - }, - "node_modules/@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/signing-key": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.0.tgz", - "integrity": "sha512-S+njkhowmLeUu/r7ir8n78OUKx63kBdMCPssePS89So1TH4hZqnWFsThEd/GiXYp9qMxVrydf7KdM9MTGPFukA==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", - "elliptic": "6.5.4", - "hash.js": "1.1.7" - } - }, - "node_modules/@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "node_modules/@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/transactions": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.0.tgz", - "integrity": "sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" - } - }, - "node_modules/@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "node_modules/@ethersproject/wallet": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.0.tgz", - "integrity": "sha512-qMlSdOSTyp0MBeE+r7SUhr1jjDlC1zAXB8VD84hCnpijPQiSNbxr6GdiLXxpUs8UKzkDiNYYC5DRI3MZr+n+tg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" - } - }, - "node_modules/@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "node_modules/@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "node_modules/@tootallnate/once": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, - "node_modules/@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", - "dev": true - }, - "node_modules/@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", - "dev": true - }, - "node_modules/@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", - "dev": true - }, - "node_modules/@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", - "dev": true - }, - "node_modules/@types/chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", - "dev": true - }, - "node_modules/@types/mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", - "dev": true - }, - "node_modules/@types/node": { - "version": "17.0.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", - "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==", - "dev": true - }, - "node_modules/@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", - "dev": true - }, - "node_modules/acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", - "dev": true, - "bin": { - "acorn": "bin/acorn" - }, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", - "dev": true, - "engines": { - "node": ">=0.4.0" - } - }, - "node_modules/aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" - }, - "node_modules/agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", - "dev": true, - "dependencies": { - "debug": "4" - }, - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", - "dev": true, - "dependencies": { - "normalize-path": "^3.0.0", - "picomatch": "^2.0.4" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/arg": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/arg/-/arg-4.1.3.tgz", - "integrity": "sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==", - "dev": true - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/argv": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", - "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", - "dev": true, - "engines": { - "node": ">=0.6.10" - } - }, - "node_modules/assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true - }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "node_modules/binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "dependencies": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "node_modules/braces": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.2.tgz", - "integrity": "sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==", - "dev": true, - "dependencies": { - "fill-range": "^7.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "node_modules/builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chai": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", - "dev": true, - "dependencies": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/chai-as-promised": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", - "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", - "dev": true, - "dependencies": { - "check-error": "^1.0.2" - }, - "peerDependencies": { - "chai": ">= 2.1.2 < 5" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ], - "dependencies": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - }, - "engines": { - "node": ">= 8.10.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, - "node_modules/cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^7.0.0" - } - }, - "node_modules/codecov": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.3.tgz", - "integrity": "sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==", - "deprecated": "https://about.codecov.io/blog/codecov-uploader-deprecation-plan/", - "dev": true, - "dependencies": { - "argv": "0.0.2", - "ignore-walk": "3.0.4", - "js-yaml": "3.14.1", - "teeny-request": "7.1.1", - "urlgrey": "1.0.0" - }, - "bin": { - "codecov": "bin/codecov" - }, - "engines": { - "node": ">=4.0" - } - }, - "node_modules/codecov/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } - }, - "node_modules/codecov/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, - "node_modules/concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "node_modules/create-require": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", - "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", - "dev": true - }, - "node_modules/debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", - "dev": true, - "dependencies": { - "ms": "2.1.2" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/debug/node_modules/ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "dependencies": { - "type-detect": "^4.0.0" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/escalade": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", - "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/esprima": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true, - "bin": { - "esparse": "bin/esparse.js", - "esvalidate": "bin/esvalidate.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ethers": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.0.tgz", - "integrity": "sha512-00FP71jt6bW3ndO5DhgH9mLIZhoCGnAKFLu8qig5KmV03ubEChKf2ilB3g6fX512tTYo+tSMDJ5WpCJWdBHkBQ==", - "funding": [ - { - "type": "individual", - "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" - }, - { - "type": "individual", - "url": "https://www.buymeacoffee.com/ricmoo" - } - ], - "dependencies": { - "@ethersproject/abi": "5.6.0", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.0", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.0", - "@ethersproject/bytes": "5.6.0", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.0", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.0", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", - "@ethersproject/logger": "5.6.0", - "@ethersproject/networks": "5.6.0", - "@ethersproject/pbkdf2": "5.6.0", - "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.0", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.0", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.0", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.0", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" - } - }, - "node_modules/fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=", - "dev": true, - "dependencies": { - "punycode": "^1.3.2" - } - }, - "node_modules/fill-range": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", - "integrity": "sha512-qOo9F+dMUmC2Lcb4BbVvnKJxTPjCm+RRpe4gDuGrzkL7mEVl/djYSu2OdQ2Pa302N4oqkSg9ir6jaLWJ2USVpQ==", - "dev": true, - "dependencies": { - "to-regex-range": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "bin": { - "flat": "cli.js" - } - }, - "node_modules/fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, - "node_modules/function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", - "dev": true - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", - "dev": true, - "dependencies": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - }, - "engines": { - "node": "*" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "dependencies": { - "is-glob": "^4.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true, - "engines": { - "node": ">=4.x" - } - }, - "node_modules/has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "dependencies": { - "function-bind": "^1.1.1" - }, - "engines": { - "node": ">= 0.4.0" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "bin": { - "he": "bin/he" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "dependencies": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", - "dev": true, - "dependencies": { - "agent-base": "6", - "debug": "4" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/ignore-walk": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", - "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", - "dev": true, - "dependencies": { - "minimatch": "^3.0.4" - } - }, - "node_modules/inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "dependencies": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "dependencies": { - "binary-extensions": "^2.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-core-module": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", - "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", - "dev": true, - "dependencies": { - "has": "^1.0.3" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "dependencies": { - "is-extglob": "^2.1.1" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-number": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", - "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "node_modules/js-tokens": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", - "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", - "dev": true - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/loupe": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz", - "integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==", - "dev": true, - "dependencies": { - "get-func-name": "^2.0.0" - } - }, - "node_modules/make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", - "dev": true - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "node_modules/minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "dependencies": { - "brace-expansion": "^1.1.7" - }, - "engines": { - "node": "*" - } - }, - "node_modules/minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", - "dev": true - }, - "node_modules/mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "dependencies": { - "minimist": "^1.2.5" - }, - "bin": { - "mkdirp": "bin/cmd.js" - } - }, - "node_modules/mocha": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.1.tgz", - "integrity": "sha512-T7uscqjJVS46Pq1XDXyo9Uvey9gd3huT/DD9cYBb4K2Xc/vbKRPUWK067bxDQRK0yIz6Jxk73IrnimvASzBNAQ==", - "dev": true, - "dependencies": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.3", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "3.0.4", - "ms": "2.1.3", - "nanoid": "3.2.0", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha" - }, - "engines": { - "node": ">= 12.0.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/mochajs" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true - }, - "node_modules/nanoid": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", - "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", - "dev": true, - "bin": { - "nanoid": "bin/nanoid.cjs" - }, - "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" - } - }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/normalize-path": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", - "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "dependencies": { - "wrappy": "1" - } - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/path-parse": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", - "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", - "dev": true - }, - "node_modules/pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", - "dev": true, - "engines": { - "node": "*" - } - }, - "node_modules/picomatch": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", - "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", - "dev": true, - "engines": { - "node": ">=8.6" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/prettier": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", - "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", - "dev": true, - "bin": { - "prettier": "bin-prettier.js" - }, - "engines": { - "node": ">=10.13.0" - } - }, - "node_modules/punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", - "dev": true, - "dependencies": { - "picomatch": "^2.2.1" - }, - "engines": { - "node": ">=8.10.0" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", - "dev": true, - "dependencies": { - "is-core-module": "^2.8.1", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" - }, - "node_modules/semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", - "dev": true, - "bin": { - "semver": "bin/semver" - } - }, - "node_modules/serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", - "dev": true, - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, - "node_modules/stream-events": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", - "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", - "dev": true, - "dependencies": { - "stubs": "^3.0.0" - } - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/stubs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", - "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=", - "dev": true - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/supports-preserve-symlinks-flag": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", - "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/teeny-request": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-7.1.1.tgz", - "integrity": "sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==", - "dev": true, - "dependencies": { - "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.1", - "stream-events": "^1.0.5", - "uuid": "^8.0.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/to-regex-range": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", - "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", - "dev": true, - "dependencies": { - "is-number": "^7.0.0" - }, - "engines": { - "node": ">=8.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "node_modules/ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", - "dev": true, - "dependencies": { - "@cspotcode/source-map-support": "0.7.0", - "@tsconfig/node10": "^1.0.7", - "@tsconfig/node12": "^1.0.7", - "@tsconfig/node14": "^1.0.0", - "@tsconfig/node16": "^1.0.2", - "acorn": "^8.4.1", - "acorn-walk": "^8.1.1", - "arg": "^4.1.0", - "create-require": "^1.1.0", - "diff": "^4.0.1", - "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", - "yn": "3.1.1" - }, - "bin": { - "ts-node": "dist/bin.js", - "ts-node-cwd": "dist/bin-cwd.js", - "ts-node-esm": "dist/bin-esm.js", - "ts-node-script": "dist/bin-script.js", - "ts-node-transpile-only": "dist/bin-transpile.js", - "ts-script": "dist/bin-script-deprecated.js" - }, - "peerDependencies": { - "@swc/core": ">=1.2.50", - "@swc/wasm": ">=1.2.50", - "@types/node": "*", - "typescript": ">=2.7" - }, - "peerDependenciesMeta": { - "@swc/core": { - "optional": true - }, - "@swc/wasm": { - "optional": true - } - } - }, - "node_modules/ts-node/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/tslint": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", - "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", - "deprecated": "TSLint has been deprecated in favor of ESLint. Please see https://github.com/palantir/tslint/issues/4534 for more information.", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.13.0", - "tsutils": "^2.29.0" - }, - "bin": { - "tslint": "bin/tslint" - }, - "engines": { - "node": ">=4.8.0" - }, - "peerDependencies": { - "typescript": ">=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >=3.0.0-dev || >= 3.1.0-dev || >= 3.2.0-dev || >= 4.0.0-dev" - } - }, - "node_modules/tslint-config-prettier": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", - "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", - "dev": true, - "bin": { - "tslint-config-prettier-check": "bin/check.js" - }, - "engines": { - "node": ">=4.0.0" - } - }, - "node_modules/tslint/node_modules/ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "dependencies": { - "color-convert": "^1.9.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/tslint/node_modules/argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "dependencies": { - "sprintf-js": "~1.0.2" - } + "dependencies": { + "@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" }, - "node_modules/tslint/node_modules/chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "@ampproject/remapping": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.1.tgz", + "integrity": "sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==", "dev": true, - "dependencies": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - }, - "engines": { - "node": ">=4" + "requires": { + "@jridgewell/gen-mapping": "^0.3.0", + "@jridgewell/trace-mapping": "^0.3.9" } }, - "node_modules/tslint/node_modules/color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "@babel/code-frame": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.5.tgz", + "integrity": "sha512-CgH3s1a96LipHCmSUmYFPwY7MNx8C3avkq7i4Wl3cfa662ldtUe4VM1TPXX70pfmrlWTb6jLqTYrZyT2ZTJBgA==", "dev": true, + "requires": { + "@babel/highlight": "^7.23.4", + "chalk": "^2.4.2" + }, "dependencies": { - "color-name": "1.1.3" + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } } }, - "node_modules/tslint/node_modules/color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "@babel/compat-data": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.23.5.tgz", + "integrity": "sha512-uU27kfDRlhfKl+w1U6vp16IuvSLtjAxdArVXPa9BvLkrr7CYIsxH5adpHObeAGY/41+syctUWOZ140a2Rvkgjw==", "dev": true }, - "node_modules/tslint/node_modules/diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true, - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/tslint/node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "@babel/core": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.23.6.tgz", + "integrity": "sha512-FxpRyGjrMJXh7X3wGLGhNDCRiwpWEF74sKjTLDJSG5Kyvow3QZaG0Adbqzi9ZrVjTWpsX+2cxWXD71NMg93kdw==", "dev": true, - "engines": { - "node": ">=0.8.0" + "requires": { + "@ampproject/remapping": "^2.2.0", + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-compilation-targets": "^7.23.6", + "@babel/helper-module-transforms": "^7.23.3", + "@babel/helpers": "^7.23.6", + "@babel/parser": "^7.23.6", + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.6", + "@babel/types": "^7.23.6", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "dependencies": { + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } } }, - "node_modules/tslint/node_modules/has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "@babel/generator": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.6.tgz", + "integrity": "sha512-qrSfCYxYQB5owCmGLbl8XRpX1ytXlpueOb0N0UmQwA073KZxejgQTzAmJezxvpwQD9uGtK2shHdi55QT+MbjIw==", "dev": true, - "engines": { - "node": ">=4" + "requires": { + "@babel/types": "^7.23.6", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" } }, - "node_modules/tslint/node_modules/js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", + "@babel/helper-compilation-targets": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.23.6.tgz", + "integrity": "sha512-9JB548GZoQVmzrFgp8o7KxdgkTGm6xs9DW0o/Pim72UDjzr5ObUQ6ZzYPqA+g9OTS2bBQoctLJrky0RDCAWRgQ==", "dev": true, - "dependencies": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" + "requires": { + "@babel/compat-data": "^7.23.5", + "@babel/helper-validator-option": "^7.23.5", + "browserslist": "^4.22.2", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/tslint/node_modules/supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, "dependencies": { - "has-flag": "^3.0.0" - }, - "engines": { - "node": ">=4" + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } } }, - "node_modules/tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "dependencies": { - "tslib": "^1.8.1" - }, - "peerDependencies": { - "typescript": ">=2.1.0 || >=2.1.0-dev || >=2.2.0-dev || >=2.3.0-dev || >=2.4.0-dev || >=2.5.0-dev || >=2.6.0-dev || >=2.7.0-dev || >=2.8.0-dev || >=2.9.0-dev || >= 3.0.0-dev || >= 3.1.0-dev" - } + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true }, - "node_modules/type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", + "@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", "dev": true, - "engines": { - "node": ">=4" + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" } }, - "node_modules/typescript": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", - "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", "dev": true, - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=4.2.0" + "requires": { + "@babel/types": "^7.22.5" } }, - "node_modules/urlgrey": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-1.0.0.tgz", - "integrity": "sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==", + "@babel/helper-module-imports": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.22.15.tgz", + "integrity": "sha512-0pYVBnDKZO2fnSPCrgM/6WMc7eS20Fbok+0r88fp+YtWVLZrp4CkafFGIp+W0VKw4a22sgebPT99y+FDNMdP4w==", "dev": true, - "dependencies": { - "fast-url-parser": "^1.1.3" + "requires": { + "@babel/types": "^7.22.15" } }, - "node_modules/uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "@babel/helper-module-transforms": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.23.3.tgz", + "integrity": "sha512-7bBs4ED9OmswdfDzpz4MpWgSrV7FXlc3zIagvLFjS5H+Mk7Snr21vQ6QwrsoCGMfNC4e4LQPdoULEt4ykz0SRQ==", "dev": true, - "bin": { - "uuid": "dist/bin/uuid" + "requires": { + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-module-imports": "^7.22.15", + "@babel/helper-simple-access": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/helper-validator-identifier": "^7.22.20" } }, - "node_modules/v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "@babel/helper-plugin-utils": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.22.5.tgz", + "integrity": "sha512-uLls06UVKgFG9QD4OeFYLEGteMIAa5kpTPcFL28yuCIIzsf6ZyKZMllKVOCZFhiZ5ptnwX4mtKdWCBE/uT4amg==", "dev": true }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "@babel/helper-simple-access": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.22.5.tgz", + "integrity": "sha512-n0H99E/K+Bika3++WNL17POvo4rKWZ7lZEp1Q+fStVbUi8nxPQEBOlTmCOxW/0JsS56SKKQ+ojAe2pHKJHN35w==", "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "requires": { + "@babel/types": "^7.22.5" } }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", "dev": true, - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" + "requires": { + "@babel/types": "^7.22.5" } }, - "node_modules/workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", + "@babel/helper-string-parser": { + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.23.4.tgz", + "integrity": "sha512-803gmbQdqwdf4olxrX4AJyFBV/RTr3rSmOj0rKwesmzlfhYNDEs+/iOcznzpNWlJlIlTJC2QfPFcHB6DlzdVLQ==", "dev": true }, - "node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", "dev": true }, - "node_modules/ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", - "dev": true, - "dependencies": { - "cliui": "^7.0.2", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.0", - "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", - "dev": true, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yn": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", - "integrity": "sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==", - "dev": true, - "engines": { - "node": ">=6" - } + "@babel/helper-validator-option": { + "version": "7.23.5", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.23.5.tgz", + "integrity": "sha512-85ttAOMLsr53VgXkTbkx8oA6YTfT4q7/HzXSLEYmjcSTJPMPQtvq1BD79Byep5xMUYbGRzEpDsjUf3dyp54IKw==", + "dev": true }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - } - }, - "dependencies": { - "@babel/code-frame": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.16.7.tgz", - "integrity": "sha512-iAXqUn8IIeBTNd72xsFlgaXHkMBMt6y4HJp1tIaK465CWLT/fG1aqB7ykr95gHHmlBdGbFeWWfyB4NJJ0nmeIg==", + "@babel/helpers": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.23.6.tgz", + "integrity": "sha512-wCfsbN4nBidDRhpDhvcKlzHWCTlgJYUUdSJfzXb2NuBssDSIjc3xcb+znA7l+zYsFljAcGM0aFkN40cR3lXiGA==", "dev": true, "requires": { - "@babel/highlight": "^7.16.7" + "@babel/template": "^7.22.15", + "@babel/traverse": "^7.23.6", + "@babel/types": "^7.23.6" } }, - "@babel/helper-validator-identifier": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.16.7.tgz", - "integrity": "sha512-hsEnFemeiW4D08A5gUAZxLBTXpZ39P+a+DGDsHw1yxqyQ/jzFEnxf5uTEGp+3bzAbNOxU1paTgYS4ECU/IgfDw==", - "dev": true - }, "@babel/highlight": { - "version": "7.16.10", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.16.10.tgz", - "integrity": "sha512-5FnTQLSLswEj6IkgVw5KusNUUFY9ZGqe/TRFnP/BKYHYgfh7tc+C7mwiy95/yNP7Dh9x580Vv8r7u7ZfTBFxdw==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "requires": { - "@babel/helper-validator-identifier": "^7.16.7", - "chalk": "^2.0.0", + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", "js-tokens": "^4.0.0" }, "dependencies": { @@ -2719,19 +300,19 @@ "color-name": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", "dev": true }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", "dev": true }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", "dev": true }, "supports-color": { @@ -2740,481 +321,685 @@ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", "dev": true, "requires": { - "has-flag": "^3.0.0" + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.6.tgz", + "integrity": "sha512-Z2uID7YJ7oNvAI20O9X0bblw7Qqs8Q2hFy0R9tAfnfLkp5MW0UH9eUvnDSnFwKZ0AvgS1ucqR4KzvVHgnke1VQ==", + "dev": true + }, + "@babel/plugin-syntax-async-generators": { + "version": "7.8.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-async-generators/-/plugin-syntax-async-generators-7.8.4.tgz", + "integrity": "sha512-tycmZxkGfZaxhMRbXlPXuVFpdWlXpir2W4AMhSJgRKzk/eDlIXOhb2LHWoLpDF7TEHylV5zNhykX6KAgHJmTNw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-bigint": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-bigint/-/plugin-syntax-bigint-7.8.3.tgz", + "integrity": "sha512-wnTnFlG+YxQm3vDxpGE57Pj0srRU4sHE/mDkt1qv2YJJSeUAec2ma4WLUnUPeKjyrfntVwe/N6dCXpU+zL3Npg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-class-properties": { + "version": "7.12.13", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-class-properties/-/plugin-syntax-class-properties-7.12.13.tgz", + "integrity": "sha512-fm4idjKla0YahUNgFNLCB0qySdsoPiZP3iQE3rky0mBUtMZ23yDJ9SJdg6dXTSDnulOVqiF3Hgr9nbXvXTQZYA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.12.13" + } + }, + "@babel/plugin-syntax-import-meta": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-meta/-/plugin-syntax-import-meta-7.10.4.tgz", + "integrity": "sha512-Yqfm+XDx0+Prh3VSeEQCPU81yC+JWZ2pDPFSS4ZdpfZhp4MkFMaDC1UqseovEKwSUpnIL7+vK+Clp7bfh0iD7g==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-json-strings": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-json-strings/-/plugin-syntax-json-strings-7.8.3.tgz", + "integrity": "sha512-lY6kdGpWHvjoe2vk4WrAapEuBR69EMxZl+RoGRhrFGNYVK8mOPAW8VfbT/ZgrFbXlDNiiaxQnAtgVCZ6jv30EA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-jsx": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.23.3.tgz", + "integrity": "sha512-EB2MELswq55OHUoRZLGg/zC7QWUKfNLpE57m/S2yr1uEneIgsTgrSzXP3NXEsMkVn76OlaVVnzN+ugObuYGwhg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/plugin-syntax-logical-assignment-operators": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", + "integrity": "sha512-d8waShlpFDinQ5MtvGU9xDAOzKH47+FFoney2baFIoMr952hKOLp1HR7VszoZvOsV/4+RRszNY7D17ba0te0ig==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-nullish-coalescing-operator": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-nullish-coalescing-operator/-/plugin-syntax-nullish-coalescing-operator-7.8.3.tgz", + "integrity": "sha512-aSff4zPII1u2QD7y+F8oDsz19ew4IGEJg9SVW+bqwpwtfFleiQDMdzA/R+UlWDzfnHFCxxleFT0PMIrR36XLNQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-numeric-separator": { + "version": "7.10.4", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-numeric-separator/-/plugin-syntax-numeric-separator-7.10.4.tgz", + "integrity": "sha512-9H6YdfkcK/uOnY/K7/aA2xpzaAgkQn37yzWUMRK7OaPOqOpGS1+n0H5hxT9AUw9EsSjPW8SVyMJwYRtWs3X3ug==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.10.4" + } + }, + "@babel/plugin-syntax-object-rest-spread": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-object-rest-spread/-/plugin-syntax-object-rest-spread-7.8.3.tgz", + "integrity": "sha512-XoqMijGZb9y3y2XskN+P1wUGiVwWZ5JmoDRwx5+3GmEplNyVM2s2Dg8ILFQm8rWM48orGy5YpI5Bl8U1y7ydlA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-catch-binding": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-catch-binding/-/plugin-syntax-optional-catch-binding-7.8.3.tgz", + "integrity": "sha512-6VPD0Pc1lpTqw0aKoeRTMiB+kWhAoT24PA+ksWSBrFtl5SIRVpZlwN3NNPQjehA2E/91FV3RjLWoVTglWcSV3Q==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-optional-chaining": { + "version": "7.8.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-optional-chaining/-/plugin-syntax-optional-chaining-7.8.3.tgz", + "integrity": "sha512-KoK9ErH1MBlCPxV0VANkXW2/dw4vlbGDrFgz8bmUsBGYkFRcbRwMh6cIJubdPrkxRwuGdtCk0v/wPTKbQgBjkg==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.8.0" + } + }, + "@babel/plugin-syntax-top-level-await": { + "version": "7.14.5", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-top-level-await/-/plugin-syntax-top-level-await-7.14.5.tgz", + "integrity": "sha512-hx++upLv5U1rgYfwe1xBQUhRmU41NEvpUvrp8jkrSCdvGSnM5/qdRMtylJ6PG5OFkBaHkbTAKTnd3/YyESRHFw==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.14.5" + } + }, + "@babel/plugin-syntax-typescript": { + "version": "7.23.3", + "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.23.3.tgz", + "integrity": "sha512-9EiNjVJOMwCO+43TqoTrgQ8jMwcAd0sWyXi9RPfIsLTj4R2MADDDQXELhffaUx/uJv2AYcxBgPwH6j4TIA4ytQ==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.22.5" + } + }, + "@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + } + }, + "@babel/traverse": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.6.tgz", + "integrity": "sha512-czastdK1e8YByZqezMPFiZ8ahwVMh/ESl9vPgvgdB9AmFMGP5jfpFax74AQgl5zj4XHzqeYAg2l8PuUeRS1MgQ==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.23.5", + "@babel/generator": "^7.23.6", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.6", + "@babel/types": "^7.23.6", + "debug": "^4.3.1", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.23.6", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.6.tgz", + "integrity": "sha512-+uarb83brBzPKN38NX1MkB6vb6+mwvR6amUulqAE7ccQw1pEl+bCia9TbdG1lsnFP7lZySvUn37CHyXQdfTwzg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.23.4", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + }, + "@bcoe/v8-coverage": { + "version": "0.2.3", + "resolved": "https://registry.npmjs.org/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz", + "integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==", + "dev": true + }, + "@cspotcode/source-map-support": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz", + "integrity": "sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "0.3.9" + }, + "dependencies": { + "@jridgewell/trace-mapping": { + "version": "0.3.9", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.9.tgz", + "integrity": "sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.0.3", + "@jridgewell/sourcemap-codec": "^1.4.10" } } } }, - "@cspotcode/source-map-consumer": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-consumer/-/source-map-consumer-0.8.0.tgz", - "integrity": "sha512-41qniHzTU8yAGbCp04ohlmSrZf8bkf/iJsl3V0dRGsQN/5GFfx+LbCSsCpp2gqrqjTVg/K6O8ycoV35JIwAzAg==", + "@istanbuljs/load-nyc-config": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz", + "integrity": "sha512-VjeHSlIzpv/NyD3N0YuHfXOPDIixcA1q2ZV98wsMqcYlPmv2n3Yb2lYP9XMElnaFVXg5A7YLTeLu6V84uQDjmQ==", + "dev": true, + "requires": { + "camelcase": "^5.3.1", + "find-up": "^4.1.0", + "get-package-type": "^0.1.0", + "js-yaml": "^3.13.1", + "resolve-from": "^5.0.0" + } + }, + "@istanbuljs/schema": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/@istanbuljs/schema/-/schema-0.1.3.tgz", + "integrity": "sha512-ZXRY4jNvVgSVQ8DL3LTcakaAtXwTVUxE81hslsyD2AtoXW/wVob10HkOJ1X/pAlcI7D+2YoZKg5do8G/w6RYgA==", "dev": true }, - "@cspotcode/source-map-support": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/@cspotcode/source-map-support/-/source-map-support-0.7.0.tgz", - "integrity": "sha512-X4xqRHqN8ACt2aHVe51OxeA2HjbcL4MqFqXkrmQszJ1NOUuUu5u6Vqx/0lZSVNku7velL5FC/s5uEAj1lsBMhA==", + "@jest/console": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/console/-/console-29.7.0.tgz", + "integrity": "sha512-5Ni4CU7XHQi32IJ398EEP4RrB8eV09sXP2ROqD4bksHrnTree52PsxvX8tpL8LvTZ3pFzXyPbNQReSN41CAhOg==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0" + } + }, + "@jest/core": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/core/-/core-29.7.0.tgz", + "integrity": "sha512-n7aeXWKMnGtDA48y8TLWJPJmLmmZ642Ceo78cYWEpiD7FzDgmNDV/GCVRorPABdXLJZ/9wzzgZAlHjXjxDHGsg==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/reporters": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-changed-files": "^29.7.0", + "jest-config": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-resolve-dependencies": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "jest-watcher": "^29.7.0", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-ansi": "^6.0.0" + } + }, + "@jest/environment": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/environment/-/environment-29.7.0.tgz", + "integrity": "sha512-aQIfHDq33ExsN4jP1NWGXhxgQ/wixs60gDiKO+XVMd8Mn0NWPWgc34ZQDTb2jKaUWQ7MuwoitXAsN2XVXNMpAw==", "dev": true, "requires": { - "@cspotcode/source-map-consumer": "0.8.0" + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0" + } + }, + "@jest/expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-8uMeAMycttpva3P1lBHB8VciS9V0XAr3GymPpipdyQXbBcuhkLQOSe8E/p92RyAdToS6ZD1tFkX+CkhoECE0dQ==", + "dev": true, + "requires": { + "expect": "^29.7.0", + "jest-snapshot": "^29.7.0" } }, - "@ethersproject/abi": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.6.0.tgz", - "integrity": "sha512-AhVByTwdXCc2YQ20v300w6KVHle9g2OFc28ZAFCPnJyEpkv1xKXjZcSTgWOlv1i+0dqlgF8RCF2Rn2KC1t+1Vg==", + "@jest/expect-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.7.0.tgz", + "integrity": "sha512-GlsNBWiFQFCVi9QVSx7f5AgMeLxe9YCCs5PuP2O2LdjDAA8Jh9eX7lA1Jq/xdXw3Wb3hyvlFNfZIfcRetSzYcA==", + "dev": true, "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" + "jest-get-type": "^29.6.3" } }, - "@ethersproject/abstract-provider": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.6.0.tgz", - "integrity": "sha512-oPMFlKLN+g+y7a79cLK3WiLcjWFnZQtXWgnLAbHZcN3s7L4v90UHpTOrLk+m3yr0gt+/h9STTM6zrr7PM8uoRw==", + "@jest/fake-timers": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-29.7.0.tgz", + "integrity": "sha512-q4DH1Ha4TTFPdxLsqDXK1d3+ioSL7yL5oCMJZgDYm6i+6CygW5E5xVr/D1HdsGxjt1ZWSfUAs9OxSB/BNelWrQ==", + "dev": true, "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0" + "@jest/types": "^29.6.3", + "@sinonjs/fake-timers": "^10.0.2", + "@types/node": "*", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" } }, - "@ethersproject/abstract-signer": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.6.0.tgz", - "integrity": "sha512-WOqnG0NJKtI8n0wWZPReHtaLkDByPL67tn4nBaDAhmVq8sjHTPbCdz4DRhVu/cfTOvfy9w3iq5QZ7BX7zw56BQ==", + "@jest/globals": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/globals/-/globals-29.7.0.tgz", + "integrity": "sha512-mpiz3dutLbkW2MNFubUGUEVLkTGiqW6yLVTA+JbP6fI6J5iL9Y0Nlg8k95pcF8ctKwCS7WVxteBs29hhfAotzQ==", + "dev": true, "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0" + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/types": "^29.6.3", + "jest-mock": "^29.7.0" } }, - "@ethersproject/address": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.6.0.tgz", - "integrity": "sha512-6nvhYXjbXsHPS+30sHZ+U4VMagFC/9zAk6Gd/h3S21YW4+yfb0WfRtaAIZ4kfM4rrVwqiy284LP0GtL5HXGLxQ==", + "@jest/reporters": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/reporters/-/reporters-29.7.0.tgz", + "integrity": "sha512-DApq0KJbJOEzAFYjHADNNxAE3KbhxQB1y5Kplb5Waqw6zVbuWatSnMjE5gs8FUgEPmNsnZA3NCWl9NG0ia04Pg==", + "dev": true, "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/rlp": "^5.6.0" + "@bcoe/v8-coverage": "^0.2.3", + "@jest/console": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "@types/node": "*", + "chalk": "^4.0.0", + "collect-v8-coverage": "^1.0.0", + "exit": "^0.1.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "istanbul-lib-coverage": "^3.0.0", + "istanbul-lib-instrument": "^6.0.0", + "istanbul-lib-report": "^3.0.0", + "istanbul-lib-source-maps": "^4.0.0", + "istanbul-reports": "^3.1.3", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "slash": "^3.0.0", + "string-length": "^4.0.1", + "strip-ansi": "^6.0.0", + "v8-to-istanbul": "^9.0.1" } }, - "@ethersproject/base64": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.6.0.tgz", - "integrity": "sha512-2Neq8wxJ9xHxCF9TUgmKeSh9BXJ6OAxWfeGWvbauPh8FuHEjamgHilllx8KkSd5ErxyHIX7Xv3Fkcud2kY9ezw==", + "@jest/schemas": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.3.tgz", + "integrity": "sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==", + "dev": true, "requires": { - "@ethersproject/bytes": "^5.6.0" - } - }, - "@ethersproject/basex": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.6.0.tgz", - "integrity": "sha512-qN4T+hQd/Md32MoJpc69rOwLYRUXwjTlhHDIeUkUmiN/JyWkkLLMoG0TqvSQKNqZOMgN5stbUYN6ILC+eD7MEQ==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/properties": "^5.6.0" - } - }, - "@ethersproject/bignumber": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.6.0.tgz", - "integrity": "sha512-VziMaXIUHQlHJmkv1dlcd6GY2PmT0khtAqaMctCIDogxkrarMzA9L94KN1NeXqqOfFD6r0sJT3vCTOFSmZ07DA==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "bn.js": "^4.11.9" - } - }, - "@ethersproject/bytes": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.6.0.tgz", - "integrity": "sha512-3hJPlYemb9V4VLfJF5BfN0+55vltPZSHU3QKUyP9M3Y2TcajbiRrz65UG+xVHOzBereB1b9mn7r12o177xgN7w==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } + "@sinclair/typebox": "^0.27.8" + } }, - "@ethersproject/constants": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.6.0.tgz", - "integrity": "sha512-SrdaJx2bK0WQl23nSpV/b1aq293Lh0sUaZT/yYKPDKn4tlAbkH96SPJwIhwSwTsoQQZxuh1jnqsKwyymoiBdWA==", + "@jest/source-map": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-29.6.3.tgz", + "integrity": "sha512-MHjT95QuipcPrpLM+8JMSzFx6eHp5Bm+4XeFDJlwsvVBjmKNiIAvasGK2fxz2WbGRlnvqehFbh07MMa7n3YJnw==", + "dev": true, "requires": { - "@ethersproject/bignumber": "^5.6.0" + "@jridgewell/trace-mapping": "^0.3.18", + "callsites": "^3.0.0", + "graceful-fs": "^4.2.9" } }, - "@ethersproject/contracts": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.6.0.tgz", - "integrity": "sha512-74Ge7iqTDom0NX+mux8KbRUeJgu1eHZ3iv6utv++sLJG80FVuU9HnHeKVPfjd9s3woFhaFoQGf3B3iH/FrQmgw==", - "requires": { - "@ethersproject/abi": "^5.6.0", - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/transactions": "^5.6.0" + "@jest/test-result": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-result/-/test-result-29.7.0.tgz", + "integrity": "sha512-Fdx+tv6x1zlkJPcWXmMDAG2HBnaR9XPSd5aDWQVsfrZmLVT3lU1cwyxLgRmXR9yrq4NBoEm9BMsfgFzTQAbJYA==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "collect-v8-coverage": "^1.0.0" } }, - "@ethersproject/hash": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.6.0.tgz", - "integrity": "sha512-fFd+k9gtczqlr0/BruWLAu7UAOas1uRRJvOR84uDf4lNZ+bTkGl366qvniUZHKtlqxBRU65MkOobkmvmpHU+jA==", + "@jest/test-sequencer": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/test-sequencer/-/test-sequencer-29.7.0.tgz", + "integrity": "sha512-GQwJ5WZVrKnOJuiYiAF52UNUJXgTZx1NHjFSEB0qEMmSZKAkdMoIzw/Cj6x6NF4AvV23AUqDpFzQkN/eYCYTxw==", + "dev": true, "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "@ethersproject/hdnode": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.6.0.tgz", - "integrity": "sha512-61g3Jp3nwDqJcL/p4nugSyLrpl/+ChXIOtCEM8UDmWeB3JCAt5FoLdOMXQc3WWkc0oM2C0aAn6GFqqMcS/mHTw==", - "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" + "@jest/test-result": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "slash": "^3.0.0" } - }, - "@ethersproject/json-wallets": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.6.0.tgz", - "integrity": "sha512-fmh86jViB9r0ibWXTQipxpAGMiuxoqUf78oqJDlCAJXgnJF024hOOX7qVgqsjtbeoxmcLwpPsXNU0WEe/16qPQ==", + }, + "@jest/transform": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/@jest/transform/-/transform-29.7.0.tgz", + "integrity": "sha512-ok/BTPFzFKVMwO5eOHRrvnBVHdRy9IrsrW1GpMaQ9MCnilNLXQKmAX8s1YXDFaai9xJpac2ySzV0YeRRECr2Vw==", + "dev": true, "requires": { - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/pbkdf2": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "aes-js": "3.0.0", - "scrypt-js": "3.0.1" + "@babel/core": "^7.11.6", + "@jest/types": "^29.6.3", + "@jridgewell/trace-mapping": "^0.3.18", + "babel-plugin-istanbul": "^6.1.1", + "chalk": "^4.0.0", + "convert-source-map": "^2.0.0", + "fast-json-stable-stringify": "^2.1.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "micromatch": "^4.0.4", + "pirates": "^4.0.4", + "slash": "^3.0.0", + "write-file-atomic": "^4.0.2" } - }, - "@ethersproject/keccak256": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.6.0.tgz", - "integrity": "sha512-tk56BJ96mdj/ksi7HWZVWGjCq0WVl/QvfhFQNeL8fxhBlGoP+L80uDCiQcpJPd+2XxkivS3lwRm3E0CXTfol0w==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "js-sha3": "0.8.0" - } - }, - "@ethersproject/logger": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.6.0.tgz", - "integrity": "sha512-BiBWllUROH9w+P21RzoxJKzqoqpkyM1pRnEKG69bulE9TSQD8SAIvTQqIMZmmCO8pUNkgLP1wndX1gKghSpBmg==" - }, - "@ethersproject/networks": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.6.0.tgz", - "integrity": "sha512-DaVzgyThzHgSDLuURhvkp4oviGoGe9iTZW4jMEORHDRCgSZ9K9THGFKqL+qGXqPAYLEgZTf5z2w56mRrPR1MjQ==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/pbkdf2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.6.0.tgz", - "integrity": "sha512-Wu1AxTgJo3T3H6MIu/eejLFok9TYoSdgwRr5oGY1LTLfmGesDoSx05pemsbrPT2gG4cQME+baTSCp5sEo2erZQ==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/sha2": "^5.6.0" - } - }, - "@ethersproject/properties": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.6.0.tgz", - "integrity": "sha512-szoOkHskajKePTJSZ46uHUWWkbv7TzP2ypdEK6jGMqJaEt2sb0jCgfBo0gH0m2HBpRixMuJ6TBRaQCF7a9DoCg==", - "requires": { - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/providers": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.6.0.tgz", - "integrity": "sha512-6+5PKXTWAttJWFWF8+xCDTCa2/dtq9BNrdKQHGl0IyIOwj99vM6OeThmIRcsIAzIOb8m0XS6w+1KFZwrf3j9nw==", - "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/basex": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/networks": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/web": "^5.6.0", - "bech32": "1.1.4", - "ws": "7.4.6" - } - }, - "@ethersproject/random": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.6.0.tgz", - "integrity": "sha512-si0PLcLjq+NG/XHSZz90asNf+YfKEqJGVdxoEkSukzbnBgC8rydbgbUgBbBGLeHN4kAJwUFEKsu3sCXT93YMsw==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/rlp": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.6.0.tgz", - "integrity": "sha512-dz9WR1xpcTL+9DtOT/aDO+YyxSSdO8YIS0jyZwHHSlAmnxA6cKU3TrTd4Xc/bHayctxTgGLYNuVVoiXE4tTq1g==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/sha2": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.6.0.tgz", - "integrity": "sha512-1tNWCPFLu1n3JM9t4/kytz35DkuF9MxqkGGEHNauEbaARdm2fafnOyw1s0tIQDPKF/7bkP1u3dbrmjpn5CelyA==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "hash.js": "1.1.7" - } - }, - "@ethersproject/signing-key": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.6.0.tgz", - "integrity": "sha512-S+njkhowmLeUu/r7ir8n78OUKx63kBdMCPssePS89So1TH4hZqnWFsThEd/GiXYp9qMxVrydf7KdM9MTGPFukA==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "bn.js": "^4.11.9", - "elliptic": "6.5.4", - "hash.js": "1.1.7" + }, + "@jest/types": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.3.tgz", + "integrity": "sha512-u3UPsIilWKOM3F9CXtrG8LEJmNxwoCQC/XVj4IKYXvvpx7QIi/Kg1LI5uDmDpKlac62NUtX7eLjRh+jVZcLOzw==", + "dev": true, + "requires": { + "@jest/schemas": "^29.6.3", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" } - }, - "@ethersproject/solidity": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.6.0.tgz", - "integrity": "sha512-YwF52vTNd50kjDzqKaoNNbC/r9kMDPq3YzDWmsjFTRBcIF1y4JCQJ8gB30wsTfHbaxgxelI5BfxQSxD/PbJOww==", - "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/sha2": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "@ethersproject/strings": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.6.0.tgz", - "integrity": "sha512-uv10vTtLTZqrJuqBZR862ZQjTIa724wGPWQqZrofaPI/kUsf53TBG0I0D+hQ1qyNtllbNzaW+PDPHHUI6/65Mg==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/transactions": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.6.0.tgz", - "integrity": "sha512-4HX+VOhNjXHZyGzER6E/LVI2i6lf9ejYeWD6l4g50AdmimyuStKc39kvKf1bXWQMg7QNVh+uC7dYwtaZ02IXeg==", - "requires": { - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/rlp": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0" - } - }, - "@ethersproject/units": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.6.0.tgz", - "integrity": "sha512-tig9x0Qmh8qbo1w8/6tmtyrm/QQRviBh389EQ+d8fP4wDsBrJBf08oZfoiz1/uenKK9M78yAP4PoR7SsVoTjsw==", - "requires": { - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/constants": "^5.6.0", - "@ethersproject/logger": "^5.6.0" - } - }, - "@ethersproject/wallet": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.6.0.tgz", - "integrity": "sha512-qMlSdOSTyp0MBeE+r7SUhr1jjDlC1zAXB8VD84hCnpijPQiSNbxr6GdiLXxpUs8UKzkDiNYYC5DRI3MZr+n+tg==", + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, "requires": { - "@ethersproject/abstract-provider": "^5.6.0", - "@ethersproject/abstract-signer": "^5.6.0", - "@ethersproject/address": "^5.6.0", - "@ethersproject/bignumber": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/hdnode": "^5.6.0", - "@ethersproject/json-wallets": "^5.6.0", - "@ethersproject/keccak256": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/random": "^5.6.0", - "@ethersproject/signing-key": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/wordlists": "^5.6.0" - } - }, - "@ethersproject/web": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.6.0.tgz", - "integrity": "sha512-G/XHj0hV1FxI2teHRfCGvfBUHFmU+YOSbCxlAMqJklxSa7QMiHFQfAxvwY2PFqgvdkxEKwRNr/eCjfAPEm2Ctg==", - "requires": { - "@ethersproject/base64": "^5.6.0", - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "@ethersproject/wordlists": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.6.0.tgz", - "integrity": "sha512-q0bxNBfIX3fUuAo9OmjlEYxP40IB8ABgb7HjEZCL5IKubzV3j30CWi2rqQbjTS2HfoyQbfINoKcTVWP4ejwR7Q==", - "requires": { - "@ethersproject/bytes": "^5.6.0", - "@ethersproject/hash": "^5.6.0", - "@ethersproject/logger": "^5.6.0", - "@ethersproject/properties": "^5.6.0", - "@ethersproject/strings": "^5.6.0" - } - }, - "@tootallnate/once": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", - "integrity": "sha512-RbzJvlNzmRq5c3O09UipeuXno4tA1FE6ikOjxZK0tuxVv3412l64l5t1W5pj4+rJq9vpkm/kwiR07aZXnsKPxw==", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.20", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.20.tgz", + "integrity": "sha512-R8LcPeWZol2zR8mmH3JeKQ6QRCFb7XgUhV9ZlGhHLGyg4wpPiPZNQOOWhFZhxKw8u//yTbNGI42Bx/3paXEQ+Q==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "requires": { + "@noble/hashes": "1.3.2" + } + }, + "@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" + }, + "@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", "dev": true }, + "@sinonjs/commons": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-3.0.0.tgz", + "integrity": "sha512-jXBtWAF4vmdNmZgD5FoKsVLv3rPgDnLgPbU84LIJ3otV44vJlDRokVng5v8NFJdCf/da9legHcKaRuZs4L7faA==", + "dev": true, + "requires": { + "type-detect": "4.0.8" + } + }, + "@sinonjs/fake-timers": { + "version": "10.3.0", + "resolved": "https://registry.npmjs.org/@sinonjs/fake-timers/-/fake-timers-10.3.0.tgz", + "integrity": "sha512-V4BG07kuYSUkTCSBHG8G8TNhM+F19jXFWnQtzj+we8DrkpSBCee9Z3Ms8yiGer/dlmhe35/Xdgyo3/0rQKg7YA==", + "dev": true, + "requires": { + "@sinonjs/commons": "^3.0.0" + } + }, "@tsconfig/node10": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.8.tgz", - "integrity": "sha512-6XFfSQmMgq0CFLY1MslA/CPUfhIL919M1rMsa5lP2P097N2Wd1sSX0tx1u4olM16fLNhtHZpRhedZJphNJqmZg==", + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", + "integrity": "sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==", "dev": true }, "@tsconfig/node12": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.9.tgz", - "integrity": "sha512-/yBMcem+fbvhSREH+s14YJi18sp7J9jpuhYByADT2rypfajMZZN4WQ6zBGgBKp53NKmqI36wFYDb3yaMPurITw==", + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/@tsconfig/node12/-/node12-1.0.11.tgz", + "integrity": "sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==", "dev": true }, "@tsconfig/node14": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.1.tgz", - "integrity": "sha512-509r2+yARFfHHE7T6Puu2jjkoycftovhXRqW328PDXTVGKihlb1P8Z9mMZH04ebyajfRY7dedfGynlrFHJUQCg==", + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/@tsconfig/node14/-/node14-1.0.3.tgz", + "integrity": "sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==", "dev": true }, "@tsconfig/node16": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.2.tgz", - "integrity": "sha512-eZxlbI8GZscaGS7kkc/trHTT5xgrjH3/1n2JDwusC9iahPKWMRvRjJSAN5mCXviuTGQ/lHnhvv8Q1YTpnfz9gA==", + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz", + "integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==", "dev": true }, - "@types/chai": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.3.0.tgz", - "integrity": "sha512-/ceqdqeRraGolFTcfoXNiqjyQhZzbINDngeoAq9GoHa8PPK1yNzTaxWjA6BFWp5Ua9JpXEMSS4s5i9tS0hOJtw==", - "dev": true + "@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "requires": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } }, - "@types/mocha": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-9.1.0.tgz", - "integrity": "sha512-QCWHkbMv4Y5U9oW10Uxbr45qMMSzl4OzijsozynUAgx3kEHUdXB00udx2dWDQ7f2TU2a2uuiFaRZjCe3unPpeg==", + "@types/babel__generator": { + "version": "7.6.7", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.6.7.tgz", + "integrity": "sha512-6Sfsq+EaaLrw4RmdFWE9Onp63TOUue71AWb4Gpa6JxzgTYtimbM086WnYTy2U67AofR++QKCo08ZP6pwx8YFHQ==", + "dev": true, + "requires": { + "@babel/types": "^7.0.0" + } + }, + "@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "requires": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "@types/babel__traverse": { + "version": "7.20.4", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.20.4.tgz", + "integrity": "sha512-mSM/iKUk5fDDrEV/e83qY+Cr3I1+Q3qqTuEn++HAWYjEa1+NxZr6CNrcJGf2ZTnq4HoFGC3zaTPZTobCzCFukA==", + "dev": true, + "requires": { + "@babel/types": "^7.20.7" + } + }, + "@types/graceful-fs": { + "version": "4.1.9", + "resolved": "https://registry.npmjs.org/@types/graceful-fs/-/graceful-fs-4.1.9.tgz", + "integrity": "sha512-olP3sd1qOEe5dXTSaFvQG+02VdRXcdytWLAZsAq1PecU8uqQAhkrnbli7DagjtXKW/Bl7YJbUsa8MPcuc8LHEQ==", + "dev": true, + "requires": { + "@types/node": "*" + } + }, + "@types/istanbul-lib-coverage": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", + "integrity": "sha512-2QF/t/auWm0lsy8XtKVPG19v3sSOQlJe/YHZgfjb/KBBHOGSV+J2q/S671rcq9uTBrLAXmZpqJiaQbMT+zNU1w==", "dev": true }, + "@types/istanbul-lib-report": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/@types/istanbul-lib-report/-/istanbul-lib-report-3.0.3.tgz", + "integrity": "sha512-NQn7AHQnk/RSLOxrBbGyJM/aVQ+pjj5HCgasFxc0K/KhoATfQ/47AyUl15I2yBUpihjmas+a+VJBOqecrFH+uA==", + "dev": true, + "requires": { + "@types/istanbul-lib-coverage": "*" + } + }, + "@types/istanbul-reports": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@types/istanbul-reports/-/istanbul-reports-3.0.4.tgz", + "integrity": "sha512-pk2B1NWalF9toCRu6gjBzR69syFjP4Od8WRAX+0mmf9lAjCRicLOWc+ZrxZHx/0XRjotgkF9t6iaMJ+aXcOdZQ==", + "dev": true, + "requires": { + "@types/istanbul-lib-report": "*" + } + }, + "@types/jest": { + "version": "29.5.11", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.11.tgz", + "integrity": "sha512-S2mHmYIVe13vrm6q4kN6fLYYAka15ALQki/vgDC3mIukEOx8WJlv0kQPM+d4w8Gp6u0uSdKND04IlTXBv0rwnQ==", + "dev": true, + "requires": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, "@types/node": { - "version": "17.0.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.21.tgz", - "integrity": "sha512-DBZCJbhII3r90XbQxI8Y9IjjiiOGlZ0Hr32omXIZvwwZ7p4DMMXGrKXVyPfuoBOri9XNtL0UK69jYIBIsRX3QQ==", + "version": "18.15.13", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz", + "integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==" + }, + "@types/stack-utils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/@types/stack-utils/-/stack-utils-2.0.3.tgz", + "integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==", "dev": true }, - "@ungap/promise-all-settled": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@ungap/promise-all-settled/-/promise-all-settled-1.1.2.tgz", - "integrity": "sha512-sL/cEvJWAnClXw0wHk85/2L0G6Sj8UB0Ctc1TEMbKSsmpRosqhwj9gWgFRZSrBr2f9tiXISwNhCPmlfqUqyb9Q==", + "@types/yargs": { + "version": "17.0.32", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.32.tgz", + "integrity": "sha512-xQ67Yc/laOG5uMfX/093MRlGGCIBzZMarVa+gfNKJxWAIgykYpVGkBdbqEzGDDfCrVUj6Hiff4mTZ5BA6TmAog==", + "dev": true, + "requires": { + "@types/yargs-parser": "*" + } + }, + "@types/yargs-parser": { + "version": "21.0.3", + "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-21.0.3.tgz", + "integrity": "sha512-I4q9QU9MQv4oEOz4tAHJtNz1cwuLxn2F3xcc2iV5WdqLPpUnj30aUuxt1mAxYTG+oe8CZMV/+6rU4S4gRDzqtQ==", "dev": true }, "acorn": { - "version": "8.7.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.7.0.tgz", - "integrity": "sha512-V/LGr1APy+PXIwKebEWrkZPwoeoF+w1jiOBUmuxuiUIaOHtob8Qc9BTrYo7VuI5fR8tqsy+buA2WFooR5olqvQ==", + "version": "8.11.2", + "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.11.2.tgz", + "integrity": "sha512-nc0Axzp/0FILLEVsm4fNwLCwMttvhEI263QtVPQcbpfZZ3ts0hLsZGOpE6czNlid7CJ9MlyH8reXkpsf3YUY4w==", "dev": true }, "acorn-walk": { - "version": "8.2.0", - "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.2.0.tgz", - "integrity": "sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==", + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/acorn-walk/-/acorn-walk-8.3.1.tgz", + "integrity": "sha512-TgUZgYvqZprrl7YldZNoa9OciCAyZR+Ejm9eXzKCmjsF5IKp/wgQ7Z/ZpjpGTIUPwrHQIcYeI8qDh4PsEwxMbw==", "dev": true }, "aes-js": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", - "integrity": "sha1-4h3xCtbCBTKVvLuNq0Cwnb6ofk0=" + "version": "4.0.0-beta.5", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", + "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" }, - "agent-base": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", - "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", "dev": true, "requires": { - "debug": "4" + "type-fest": "^0.21.3" } }, - "ansi-colors": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/ansi-colors/-/ansi-colors-4.1.1.tgz", - "integrity": "sha512-JoX0apGbHaUJBNl6yF+p6JAFYZ666/hhCGKN5t9QFjbJQKUU/g8MNbFDbvfrgKXvI1QpZplPOnwIo99lX/AAmA==", - "dev": true - }, "ansi-regex": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", @@ -3231,9 +1016,9 @@ } }, "anymatch": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.2.tgz", - "integrity": "sha512-P43ePfOAIupkguHUycrc4qJ9kz8ZiuOUijaETwX7THt0Y/GNK7v0aa8rY816xWjZ7rJdA5XdMcpVFTKMq+RvWg==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", "dev": true, "requires": { "normalize-path": "^3.0.0", @@ -3247,22 +1032,104 @@ "dev": true }, "argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, + "requires": { + "sprintf-js": "~1.0.2" + } }, - "argv": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/argv/-/argv-0.0.2.tgz", - "integrity": "sha1-7L0W+JSbFXGDcRsb2jNPN4QBhas=", - "dev": true + "babel-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-29.7.0.tgz", + "integrity": "sha512-BrvGY3xZSwEcCzKvKsCi2GgHqDqsYkOP4/by5xCgIwGXQxIEh+8ew3gmrE1y7XRR6LHZIj6yLYnUi/mm2KXKBg==", + "dev": true, + "requires": { + "@jest/transform": "^29.7.0", + "@types/babel__core": "^7.1.14", + "babel-plugin-istanbul": "^6.1.1", + "babel-preset-jest": "^29.6.3", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "slash": "^3.0.0" + } }, - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true + "babel-plugin-istanbul": { + "version": "6.1.1", + "resolved": "https://registry.npmjs.org/babel-plugin-istanbul/-/babel-plugin-istanbul-6.1.1.tgz", + "integrity": "sha512-Y1IQok9821cC9onCx5otgFfRm7Lm+I+wwxOx738M/WLPZ9Q42m4IG5W0FNX8WLL2gYMZo3JkuXIH2DOpWM+qwA==", + "dev": true, + "requires": { + "@babel/helper-plugin-utils": "^7.0.0", + "@istanbuljs/load-nyc-config": "^1.0.0", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-instrument": "^5.0.4", + "test-exclude": "^6.0.0" + }, + "dependencies": { + "istanbul-lib-instrument": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-5.2.1.tgz", + "integrity": "sha512-pzqtp31nLv/XFOzXGuvhCb8qhjmTVo5vjVk19XE4CRlSWz0KoeJ3bw9XsA7nOp9YBf4qHjwBxkDzKcME/J29Yg==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^6.3.0" + } + }, + "semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true + } + } + }, + "babel-plugin-jest-hoist": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-plugin-jest-hoist/-/babel-plugin-jest-hoist-29.6.3.tgz", + "integrity": "sha512-ESAc/RJvGTFEzRwOTT4+lNDk/GNHMkKbNzsvT0qKRfDyyYTskxB5rnU2njIDYVxXCBHHEI1c0YwHob3WaYujOg==", + "dev": true, + "requires": { + "@babel/template": "^7.3.3", + "@babel/types": "^7.3.3", + "@types/babel__core": "^7.1.14", + "@types/babel__traverse": "^7.0.6" + } + }, + "babel-preset-current-node-syntax": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/babel-preset-current-node-syntax/-/babel-preset-current-node-syntax-1.0.1.tgz", + "integrity": "sha512-M7LQ0bxarkxQoN+vz5aJPsLBn77n8QgTFmo8WK0/44auK2xlCXrYcUxHFxgU7qW5Yzw/CjmLRK2uJzaCd7LvqQ==", + "dev": true, + "requires": { + "@babel/plugin-syntax-async-generators": "^7.8.4", + "@babel/plugin-syntax-bigint": "^7.8.3", + "@babel/plugin-syntax-class-properties": "^7.8.3", + "@babel/plugin-syntax-import-meta": "^7.8.3", + "@babel/plugin-syntax-json-strings": "^7.8.3", + "@babel/plugin-syntax-logical-assignment-operators": "^7.8.3", + "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3", + "@babel/plugin-syntax-numeric-separator": "^7.8.3", + "@babel/plugin-syntax-object-rest-spread": "^7.8.3", + "@babel/plugin-syntax-optional-catch-binding": "^7.8.3", + "@babel/plugin-syntax-optional-chaining": "^7.8.3", + "@babel/plugin-syntax-top-level-await": "^7.8.3" + } + }, + "babel-preset-jest": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/babel-preset-jest/-/babel-preset-jest-29.6.3.tgz", + "integrity": "sha512-0B3bhxR6snWXJZtR/RliHTDPRgn1sNHOR0yVtq/IiQFyuOVjFS+wuio/R4gSNkyYmKmJB4wGZv2NZanmKmTnNA==", + "dev": true, + "requires": { + "babel-plugin-jest-hoist": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0" + } }, "balanced-match": { "version": "1.0.2", @@ -3270,22 +1137,6 @@ "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", "dev": true }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "binary-extensions": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz", - "integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==", - "dev": true - }, - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, "brace-expansion": { "version": "1.1.11", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", @@ -3305,53 +1156,60 @@ "fill-range": "^7.0.1" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true - }, - "builtin-modules": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", - "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", - "dev": true - }, - "camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true + "browserslist": { + "version": "4.22.2", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.22.2.tgz", + "integrity": "sha512-0UgcrvQmBDvZHFGdYUehrCNIazki7/lUP3kkoi/r3YB2amZbFM9J43ZRkJTXBUZK4gmx56+Sqk9+Vs9mwZx9+A==", + "dev": true, + "requires": { + "caniuse-lite": "^1.0.30001565", + "electron-to-chromium": "^1.4.601", + "node-releases": "^2.0.14", + "update-browserslist-db": "^1.0.13" + } }, - "chai": { - "version": "4.3.6", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.3.6.tgz", - "integrity": "sha512-bbcp3YfHCUzMOvKqsztczerVgBKSsEijCySNlHHbX3VG1nskvqjz5Rfso1gGwD6w6oOV3eI60pKuMOV5MV7p3Q==", + "bs-logger": { + "version": "0.2.6", + "resolved": "https://registry.npmjs.org/bs-logger/-/bs-logger-0.2.6.tgz", + "integrity": "sha512-pd8DCoxmbgc7hyPKOvxtqNcjYoOsABPQdcCUjGp3d42VR2CX1ORhk2A87oqqu5R1kk+76nsxZupkmyd+MVtCog==", "dev": true, "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "loupe": "^2.3.1", - "pathval": "^1.1.1", - "type-detect": "^4.0.5" + "fast-json-stable-stringify": "2.x" } }, - "chai-as-promised": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/chai-as-promised/-/chai-as-promised-7.1.1.tgz", - "integrity": "sha512-azL6xMoi+uxu6z4rhWQ1jbdUhOMhis2PvscD/xjLqNMkv3BPPp2JyyuTHOrf9BOosGpNQ11v6BKv/g57RXbiaA==", + "bser": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/bser/-/bser-2.1.1.tgz", + "integrity": "sha512-gQxTNE/GAfIIrmHLUE3oJyp5FO6HRBfhjnw4/wMmA63ZGDJnWBmgY/lyQBpnDUkGmAhbSe39tx2d/iTOAfglwQ==", "dev": true, "requires": { - "check-error": "^1.0.2" + "node-int64": "^0.4.0" } }, + "buffer-from": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz", + "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", + "dev": true + }, + "callsites": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", + "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", + "dev": true + }, + "camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true + }, + "caniuse-lite": { + "version": "1.0.30001570", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001570.tgz", + "integrity": "sha512-+3e0ASu4sw1SWaoCtvPeyXp+5PsjigkSt8OXZbF9StH5pQWbxEjLAZE3n8Aup5udop1uRiKA7a4utUk/uoSpUw==", + "dev": true + }, "chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -3360,85 +1218,48 @@ "requires": { "ansi-styles": "^4.1.0", "supports-color": "^7.1.0" - }, - "dependencies": { - "supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "requires": { - "has-flag": "^4.0.0" - } - } } }, - "check-error": { + "char-regex": { "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", + "resolved": "https://registry.npmjs.org/char-regex/-/char-regex-1.0.2.tgz", + "integrity": "sha512-kWWXztvZ5SBQV+eRgKFeh8q5sLuZY2+8WUIzlxWVTg+oGwY14qylx1KbKzHd8P6ZYkAg0xyIDU9JMHhyJMZ1jw==", "dev": true }, - "chokidar": { - "version": "3.5.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.5.3.tgz", - "integrity": "sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==", - "dev": true, - "requires": { - "anymatch": "~3.1.2", - "braces": "~3.0.2", - "fsevents": "~2.3.2", - "glob-parent": "~5.1.2", - "is-binary-path": "~2.1.0", - "is-glob": "~4.0.1", - "normalize-path": "~3.0.0", - "readdirp": "~3.6.0" - } + "ci-info": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.9.0.tgz", + "integrity": "sha512-NIxF55hv4nSqQswkAeiOi1r83xy8JldOFDTWiug55KBu9Jnblncd2U6ViHmYgHf01TPZS77NJBhBMKdWj9HQMQ==", + "dev": true + }, + "cjs-module-lexer": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/cjs-module-lexer/-/cjs-module-lexer-1.2.3.tgz", + "integrity": "sha512-0TNiGstbQmCFwt4akjjBg5pLRTSyj/PkWQ1ZoO2zntmg9yLqSRxwEa4iCfQLGjqhiqBfOJa7W/E8wfGrTDmlZQ==", + "dev": true }, "cliui": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz", - "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==", + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", "dev": true, "requires": { "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", + "strip-ansi": "^6.0.1", "wrap-ansi": "^7.0.0" } }, - "codecov": { - "version": "3.8.3", - "resolved": "https://registry.npmjs.org/codecov/-/codecov-3.8.3.tgz", - "integrity": "sha512-Y8Hw+V3HgR7V71xWH2vQ9lyS358CbGCldWlJFR0JirqoGtOoas3R3/OclRTvgUYFK29mmJICDPauVKmpqbwhOA==", - "dev": true, - "requires": { - "argv": "0.0.2", - "ignore-walk": "3.0.4", - "js-yaml": "3.14.1", - "teeny-request": "7.1.1", - "urlgrey": "1.0.0" - }, - "dependencies": { - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - } - } + "co": { + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/co/-/co-4.6.0.tgz", + "integrity": "sha512-QVb0dM5HvG+uaxitm8wONl7jltx8dqhfU33DcqtOZcLSVIKSDDLDi7+0LbAKiyI8hD9u42m2YxXSkMGWThaecQ==", + "dev": true + }, + "collect-v8-coverage": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/collect-v8-coverage/-/collect-v8-coverage-1.0.2.tgz", + "integrity": "sha512-lHl4d5/ONEbLlJvaJNtsF/Lz+WvB07u2ycqTYbdrq7UypDXailES4valYb2eWiJFxZlVmpGekfqoxQhzyFdT4Q==", + "dev": true }, "color-convert": { "version": "2.0.1", @@ -3455,75 +1276,106 @@ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", "dev": true }, - "commander": { - "version": "2.20.3", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", - "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", - "dev": true - }, "concat-map": { "version": "0.0.1", "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", + "dev": true + }, + "convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, + "create-jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/create-jest/-/create-jest-29.7.0.tgz", + "integrity": "sha512-Adz2bdH0Vq3F53KEMJOoftQFutWCukm6J24wbPWRO4k1kMY7gS7ds/uoJkNuV8wDCtWWnuwGcJwpWcih+zEW1Q==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "exit": "^0.1.2", + "graceful-fs": "^4.2.9", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "prompts": "^2.0.1" + } + }, "create-require": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz", "integrity": "sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==", "dev": true }, + "cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, "debug": { - "version": "4.3.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.3.tgz", - "integrity": "sha512-/zxw5+vh1Tfv+4Qn7a5nsbcJKPaSvCDhojn6FEl9vupwK2VCSDtEiEtqr8DFtzYFOdz63LBkxec7DYuc2jon6Q==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", + "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", "dev": true, "requires": { "ms": "2.1.2" - }, - "dependencies": { - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - } } }, - "decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", + "dedent": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.5.1.tgz", + "integrity": "sha512-+LxW+KLWxu3HW3M2w2ympwtqPrqYRzU8fqi6Fhd18fBALe15blJPI/I4+UHveMVG6lJqB4JNd4UG0S5cnVHwIg==", + "dev": true + }, + "deepmerge": { + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-4.3.1.tgz", + "integrity": "sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==", "dev": true }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } + "detect-newline": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-3.1.0.tgz", + "integrity": "sha512-TLz+x/vEXm/Y7P7wn1EJFNLxYpUD4TgMosxY6fAVJUnJMbupHBOncxyWUG9OpTaH9EBD7uFI5LfEgmMOc54DsA==", + "dev": true }, "diff": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-5.0.0.tgz", - "integrity": "sha512-/VTCrvm5Z0JGty/BWHljh+BAiw3IK+2j87NGMu8Nwc/f48WoDAC395uomO9ZD117ZOBaHmkX1oyLvkVM/aIT3w==", + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", + "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", "dev": true }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } + "diff-sequences": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.6.3.tgz", + "integrity": "sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==", + "dev": true + }, + "dotenv": { + "version": "16.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz", + "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==", + "dev": true + }, + "electron-to-chromium": { + "version": "1.4.612", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.612.tgz", + "integrity": "sha512-dM8BMtXtlH237ecSMnYdYuCkib2QHq0kpWfUnavjdYsyr/6OsAwg5ZGUfnQ9KD1Ga4QgB2sqXlB2NT8zy2GnVg==", + "dev": true + }, + "emittery": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.13.1.tgz", + "integrity": "sha512-DeWwawk6r5yR9jFgnDKYt4sLS0LmHJJi3ZOnb5/JdbYwj3nW+FxQnHIjhBKz8YLC7oRNPVM9NQ47I3CVx34eqQ==", + "dev": true }, "emoji-regex": { "version": "8.0.0", @@ -3531,6 +1383,15 @@ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", "dev": true }, + "error-ex": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", + "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", + "dev": true, + "requires": { + "is-arrayish": "^0.2.1" + } + }, "escalade": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz", @@ -3538,9 +1399,9 @@ "dev": true }, "escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", "dev": true }, "esprima": { @@ -3550,49 +1411,68 @@ "dev": true }, "ethers": { - "version": "5.6.0", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.6.0.tgz", - "integrity": "sha512-00FP71jt6bW3ndO5DhgH9mLIZhoCGnAKFLu8qig5KmV03ubEChKf2ilB3g6fX512tTYo+tSMDJ5WpCJWdBHkBQ==", - "requires": { - "@ethersproject/abi": "5.6.0", - "@ethersproject/abstract-provider": "5.6.0", - "@ethersproject/abstract-signer": "5.6.0", - "@ethersproject/address": "5.6.0", - "@ethersproject/base64": "5.6.0", - "@ethersproject/basex": "5.6.0", - "@ethersproject/bignumber": "5.6.0", - "@ethersproject/bytes": "5.6.0", - "@ethersproject/constants": "5.6.0", - "@ethersproject/contracts": "5.6.0", - "@ethersproject/hash": "5.6.0", - "@ethersproject/hdnode": "5.6.0", - "@ethersproject/json-wallets": "5.6.0", - "@ethersproject/keccak256": "5.6.0", - "@ethersproject/logger": "5.6.0", - "@ethersproject/networks": "5.6.0", - "@ethersproject/pbkdf2": "5.6.0", - "@ethersproject/properties": "5.6.0", - "@ethersproject/providers": "5.6.0", - "@ethersproject/random": "5.6.0", - "@ethersproject/rlp": "5.6.0", - "@ethersproject/sha2": "5.6.0", - "@ethersproject/signing-key": "5.6.0", - "@ethersproject/solidity": "5.6.0", - "@ethersproject/strings": "5.6.0", - "@ethersproject/transactions": "5.6.0", - "@ethersproject/units": "5.6.0", - "@ethersproject/wallet": "5.6.0", - "@ethersproject/web": "5.6.0", - "@ethersproject/wordlists": "5.6.0" - } - }, - "fast-url-parser": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/fast-url-parser/-/fast-url-parser-1.1.3.tgz", - "integrity": "sha1-9K8+qfNNiicc9YrSs3WfQx8LMY0=", - "dev": true, - "requires": { - "punycode": "^1.3.2" + "version": "6.9.0", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.9.0.tgz", + "integrity": "sha512-pmfNyQzc2mseLe91FnT2vmNaTt8dDzhxZ/xItAV7uGsF4dI4ek2ufMu3rAkgQETL/TIs0GS5A+U05g9QyWnv3Q==", + "requires": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@types/node": "18.15.13", + "aes-js": "4.0.0-beta.5", + "tslib": "2.4.0", + "ws": "8.5.0" + } + }, + "execa": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/execa/-/execa-5.1.1.tgz", + "integrity": "sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.3", + "get-stream": "^6.0.0", + "human-signals": "^2.1.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^4.0.1", + "onetime": "^5.1.2", + "signal-exit": "^3.0.3", + "strip-final-newline": "^2.0.0" + } + }, + "exit": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz", + "integrity": "sha512-Zk/eNKV2zbjpKzrsQ+n1G6poVbErQxJ0LBOJXaKZ1EViLzH+hrLu9cdXI4zw9dBQJslwBEpbQ2P1oS7nDxs6jQ==", + "dev": true + }, + "expect": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.7.0.tgz", + "integrity": "sha512-2Zks0hf1VLFYI1kbh0I5jP3KHHyCHpkfyHBzsSXRFgl/Bg9mWYfMW8oD+PdMPlEwy5HNsR9JutYy6pMeOh61nw==", + "dev": true, + "requires": { + "@jest/expect-utils": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "fast-json-stable-stringify": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true + }, + "fb-watchman": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/fb-watchman/-/fb-watchman-2.0.2.tgz", + "integrity": "sha512-p5161BqbuCaSnB8jIbzQHOlpgsPmK5rJVDfDKO91Axs5NC1uu3HRQm6wt9cd9/+GtQQIO53JdGXXoyDpTAsgYA==", + "dev": true, + "requires": { + "bser": "2.1.1" } }, "fill-range": { @@ -3605,38 +1485,38 @@ } }, "find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", "dev": true, "requires": { - "locate-path": "^6.0.0", + "locate-path": "^5.0.0", "path-exists": "^4.0.0" } }, - "flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true - }, "fs.realpath": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, "fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "dev": true, "optional": true }, "function-bind": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", - "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true + }, + "gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", "dev": true }, "get-caller-file": { @@ -3645,49 +1525,43 @@ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", "dev": true }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", + "get-package-type": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/get-package-type/-/get-package-type-0.1.0.tgz", + "integrity": "sha512-pjzuKtY64GYfWizNAJ0fr9VqttZkNiK2iS430LtIHzjBEr6bX8Am2zm4sW4Ro5wjWW5cAlRL1qAMTcXbjNAO2Q==", + "dev": true + }, + "get-stream": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-6.0.1.tgz", + "integrity": "sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==", "dev": true }, "glob": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.0.tgz", - "integrity": "sha512-lmLf6gtyrPq8tTjSmrO94wBeQbFR3HbLHbuyD69wuyQkImp2hWqMGB47OX65FBkPffO641IP9jWa1z4ivqG26Q==", + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", "dev": true, "requires": { "fs.realpath": "^1.0.0", "inflight": "^1.0.4", "inherits": "2", - "minimatch": "^3.0.4", + "minimatch": "^3.1.1", "once": "^1.3.0", "path-is-absolute": "^1.0.0" } }, - "glob-parent": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", - "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", - "dev": true, - "requires": { - "is-glob": "^4.0.1" - } - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", "dev": true }, - "has": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", - "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", - "dev": true, - "requires": { - "function-bind": "^1.1.1" - } + "graceful-fs": { + "version": "4.2.11", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.11.tgz", + "integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==", + "dev": true }, "has-flag": { "version": "4.0.0", @@ -3695,65 +1569,47 @@ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", "dev": true }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "hasown": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.0.tgz", + "integrity": "sha512-vUptKVTpIJhcczKBbgnS+RtcuYMB8+oNzPK2/Hp3hanz8JmpATdmmgLgSaadVREkDm+e2giHwY3ZRkyjSIDDFA==", + "dev": true, "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" + "function-bind": "^1.1.2" } }, - "he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", + "html-escaper": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/html-escaper/-/html-escaper-2.0.2.tgz", + "integrity": "sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==", "dev": true }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "http-proxy-agent": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-4.0.1.tgz", - "integrity": "sha512-k0zdNgqWTGA6aeIRVpvfVob4fL52dTfaehylg0Y4UvSySvOq/Y+BOyPrgpUrA7HylqvU8vIZGsRuXmspskV0Tg==", - "dev": true, - "requires": { - "@tootallnate/once": "1", - "agent-base": "6", - "debug": "4" - } + "human-signals": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", + "integrity": "sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==", + "dev": true }, - "https-proxy-agent": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.0.tgz", - "integrity": "sha512-EkYm5BcKUGiduxzSt3Eppko+PiNWNEpa4ySk9vTC6wDsQJW9rHSa+UhGNJoRYp7bz6Ht1eaRIa6QaJqO5rCFbA==", + "import-local": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/import-local/-/import-local-3.1.0.tgz", + "integrity": "sha512-ASB07uLtnDs1o6EHjKpX34BKYDSqnFerfTOJL2HvMqF70LnxpjkzDB8J44oT9pu4AMPkQwf8jl6szgvNd2tRIg==", "dev": true, "requires": { - "agent-base": "6", - "debug": "4" + "pkg-dir": "^4.2.0", + "resolve-cwd": "^3.0.0" } }, - "ignore-walk": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.4.tgz", - "integrity": "sha512-PY6Ii8o1jMRA1z4F2hRkH/xN59ox43DavKvD3oDpfurRlOJyAHpifIwpbdv1n4jt4ov0jSpw3kQ4GhJnpBL6WQ==", - "dev": true, - "requires": { - "minimatch": "^3.0.4" - } + "imurmurhash": { + "version": "0.1.4", + "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", + "integrity": "sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==", + "dev": true }, "inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", "dev": true, "requires": { "once": "^1.3.0", @@ -3763,46 +1619,35 @@ "inherits": { "version": "2.0.4", "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "dev": true }, - "is-binary-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", - "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", - "dev": true, - "requires": { - "binary-extensions": "^2.0.0" - } + "is-arrayish": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", + "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", + "dev": true }, "is-core-module": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.8.1.tgz", - "integrity": "sha512-SdNCUs284hr40hFTFP6l0IfZ/RSrMXF3qgoRHd3/79unUTvrFO/JoXwkGm+5J/Oe3E/b5GsnG330uUNgRpu1PA==", + "version": "2.13.1", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz", + "integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==", "dev": true, "requires": { - "has": "^1.0.3" + "hasown": "^2.0.0" } }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=", - "dev": true - }, "is-fullwidth-code-point": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", "dev": true }, - "is-glob": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", - "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } + "is-generator-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-generator-fn/-/is-generator-fn-2.1.0.tgz", + "integrity": "sha512-cTIB4yPYL/Grw0EaSzASzg6bBy9gqCofvWN8okThAYIxKJZC+udlRAmGbM0XLeniEJSs8uEgHPGuHSe1XsOLSQ==", + "dev": true }, "is-number": { "version": "7.0.0", @@ -3810,28 +1655,493 @@ "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", "dev": true }, - "is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true - }, - "is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", + "is-stream": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", + "integrity": "sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==", "dev": true }, "isexe": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "dev": true + }, + "istanbul-lib-coverage": { + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.2.tgz", + "integrity": "sha512-O8dpsF+r0WV/8MNRKfnmrtCWhuKjxrq2w+jpzBL5UZKTi2LeVWnWOmWRxFlesJONmc+wLAGvKQZEOanko0LFTg==", + "dev": true + }, + "istanbul-lib-instrument": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-instrument/-/istanbul-lib-instrument-6.0.1.tgz", + "integrity": "sha512-EAMEJBsYuyyztxMxW3g7ugGPkrZsV57v0Hmv3mm1uQsmB+QnZuepg731CRaIgeUVSdmsTngOkSnauNF8p7FIhA==", + "dev": true, + "requires": { + "@babel/core": "^7.12.3", + "@babel/parser": "^7.14.7", + "@istanbuljs/schema": "^0.1.2", + "istanbul-lib-coverage": "^3.2.0", + "semver": "^7.5.4" + } + }, + "istanbul-lib-report": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-report/-/istanbul-lib-report-3.0.1.tgz", + "integrity": "sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==", + "dev": true, + "requires": { + "istanbul-lib-coverage": "^3.0.0", + "make-dir": "^4.0.0", + "supports-color": "^7.1.0" + } + }, + "istanbul-lib-source-maps": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/istanbul-lib-source-maps/-/istanbul-lib-source-maps-4.0.1.tgz", + "integrity": "sha512-n3s8EwkdFIJCG3BPKBYvskgXGoy88ARzvegkitk60NxRdwltLOTaH7CUiMRXvwYorl0Q712iEjcWB+fK/MrWVw==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "istanbul-lib-coverage": "^3.0.0", + "source-map": "^0.6.1" + } + }, + "istanbul-reports": { + "version": "3.1.6", + "resolved": "https://registry.npmjs.org/istanbul-reports/-/istanbul-reports-3.1.6.tgz", + "integrity": "sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==", + "dev": true, + "requires": { + "html-escaper": "^2.0.0", + "istanbul-lib-report": "^3.0.0" + } + }, + "jest": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest/-/jest-29.7.0.tgz", + "integrity": "sha512-NIy3oAFp9shda19hy4HK0HRTWKtPJmGdnvywu01nOqNC2vZg+Z+fvJDxpMQA88eb2I9EcafcdjYgsDthnYTvGw==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/types": "^29.6.3", + "import-local": "^3.0.2", + "jest-cli": "^29.7.0" + } + }, + "jest-changed-files": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-changed-files/-/jest-changed-files-29.7.0.tgz", + "integrity": "sha512-fEArFiwf1BpQ+4bXSprcDc3/x4HSzL4al2tozwVpDFpsxALjLYdyiIK4e5Vz66GQJIbXJ82+35PtysofptNX2w==", + "dev": true, + "requires": { + "execa": "^5.0.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0" + } + }, + "jest-circus": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-circus/-/jest-circus-29.7.0.tgz", + "integrity": "sha512-3E1nCMgipcTkCocFwM90XXQab9bS+GMsjdpmPrlelaxwD93Ad8iVEjX/vvHPdLPnFf+L40u+5+iutRdA1N9myw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/expect": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "co": "^4.6.0", + "dedent": "^1.0.0", + "is-generator-fn": "^2.0.0", + "jest-each": "^29.7.0", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "p-limit": "^3.1.0", + "pretty-format": "^29.7.0", + "pure-rand": "^6.0.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-cli": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-cli/-/jest-cli-29.7.0.tgz", + "integrity": "sha512-OVVobw2IubN/GSYsxETi+gOe7Ka59EFMR/twOU3Jb2GnKKeMGJB5SGUUrEz3SFVmJASUdZUzy83sLNNQ2gZslg==", + "dev": true, + "requires": { + "@jest/core": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "create-jest": "^29.7.0", + "exit": "^0.1.2", + "import-local": "^3.0.2", + "jest-config": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "yargs": "^17.3.1" + } + }, + "jest-config": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-config/-/jest-config-29.7.0.tgz", + "integrity": "sha512-uXbpfeQ7R6TZBqI3/TxCU4q4ttk3u0PJeC+E0zbfSoSjq6bJ7buBPxzQPL0ifrkY4DNu4JUdk0ImlBUYi840eQ==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@jest/test-sequencer": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-jest": "^29.7.0", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "deepmerge": "^4.2.2", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-circus": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-runner": "^29.7.0", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "micromatch": "^4.0.4", + "parse-json": "^5.2.0", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "strip-json-comments": "^3.1.1" + } + }, + "jest-diff": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.7.0.tgz", + "integrity": "sha512-LMIgiIrhigmPrs03JHpxUh2yISK3vLFPkAodPeo0+BuF7wA2FoQbkEg1u8gBYBThncu7e1oEDUfIXVuTqLRUjw==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "diff-sequences": "^29.6.3", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-docblock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-docblock/-/jest-docblock-29.7.0.tgz", + "integrity": "sha512-q617Auw3A612guyaFgsbFeYpNP5t2aoUNLwBUbc/0kD1R4t9ixDbyFTHd1nok4epoVFpr7PmeWHrhvuV3XaJ4g==", + "dev": true, + "requires": { + "detect-newline": "^3.0.0" + } + }, + "jest-each": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-each/-/jest-each-29.7.0.tgz", + "integrity": "sha512-gns+Er14+ZrEoC5fhOfYCY1LOHHr0TI+rQUHZS8Ttw2l7gl+80eHc/gFf2Ktkw0+SIACDTeWvpFcv3B04VembQ==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "jest-util": "^29.7.0", + "pretty-format": "^29.7.0" + } + }, + "jest-environment-node": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-environment-node/-/jest-environment-node-29.7.0.tgz", + "integrity": "sha512-DOSwCRqXirTOyheM+4d5YZOrWcdu0LNZ87ewUoywbcb2XR4wKgqiG8vNeYwhjFMbEkfju7wx2GYH0P2gevGvFw==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-mock": "^29.7.0", + "jest-util": "^29.7.0" + } + }, + "jest-get-type": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.6.3.tgz", + "integrity": "sha512-zrteXnqYxfQh7l5FHyL38jL39di8H8rHoecLH3JNxH3BwOrBsNeabdap5e0I23lD4HHI8W5VFBZqG4Eaq5LNcw==", + "dev": true + }, + "jest-haste-map": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-haste-map/-/jest-haste-map-29.7.0.tgz", + "integrity": "sha512-fP8u2pyfqx0K1rGn1R9pyE0/KTn+G7PxktWidOBTqFPLYX0b9ksaMFkhK5vrS3DVun09pckLdlx90QthlW7AmA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/graceful-fs": "^4.1.3", + "@types/node": "*", + "anymatch": "^3.0.3", + "fb-watchman": "^2.0.0", + "fsevents": "^2.3.2", + "graceful-fs": "^4.2.9", + "jest-regex-util": "^29.6.3", + "jest-util": "^29.7.0", + "jest-worker": "^29.7.0", + "micromatch": "^4.0.4", + "walker": "^1.0.8" + } + }, + "jest-leak-detector": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-leak-detector/-/jest-leak-detector-29.7.0.tgz", + "integrity": "sha512-kYA8IJcSYtST2BY9I+SMC32nDpBT3J2NvWJx8+JCuCdl/CR1I4EKUJROiP8XtCcxqgTTBGJNdbB1A8XRKbTetw==", + "dev": true, + "requires": { + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-matcher-utils": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.7.0.tgz", + "integrity": "sha512-sBkD+Xi9DtcChsI3L3u0+N0opgPYnCRPtGcQYrgXmR+hmt/fYfWAL0xRXYU8eWOdfuLgBe0YCW3AFtnRLagq/g==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "pretty-format": "^29.7.0" + } + }, + "jest-message-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.7.0.tgz", + "integrity": "sha512-GBEV4GRADeP+qtB2+6u61stea8mGcOT4mCtrYISZwfu9/ISHFJ/5zOMXYbpBE9RsS5+Gb63DW4FgmnKJ79Kf6w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.3", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.7.0", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + } + }, + "jest-mock": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-mock/-/jest-mock-29.7.0.tgz", + "integrity": "sha512-ITOMZn+UkYS4ZFh83xYAOzWStloNzJFO2s8DWrE4lhtGD+AorgnbkiKERe4wQVBydIGPx059g6riW5Btp6Llnw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "jest-util": "^29.7.0" + } + }, + "jest-pnp-resolver": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/jest-pnp-resolver/-/jest-pnp-resolver-1.2.3.tgz", + "integrity": "sha512-+3NpwQEnRoIBtx4fyhblQDPgJI0H1IEIkX7ShLUjPGA7TtUTvI1oiKi3SR4oBR0hQhQR80l4WAe5RrXBwWMA8w==", + "dev": true + }, + "jest-regex-util": { + "version": "29.6.3", + "resolved": "https://registry.npmjs.org/jest-regex-util/-/jest-regex-util-29.6.3.tgz", + "integrity": "sha512-KJJBsRCyyLNWCNBOvZyRDnAIfUiRJ8v+hOBQYGn8gDyF3UegwiP4gwRR3/SDa42g1YbVycTidUF3rKjyLFDWbg==", "dev": true }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + "jest-resolve": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve/-/jest-resolve-29.7.0.tgz", + "integrity": "sha512-IOVhZSrg+UvVAshDSDtHyFCCBUl/Q3AAJv8iZ6ZjnZ74xzvwuzLXid9IIIPgTnY62SJjfuupMKZsZQRsCvxEgA==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-pnp-resolver": "^1.2.2", + "jest-util": "^29.7.0", + "jest-validate": "^29.7.0", + "resolve": "^1.20.0", + "resolve.exports": "^2.0.0", + "slash": "^3.0.0" + } + }, + "jest-resolve-dependencies": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-resolve-dependencies/-/jest-resolve-dependencies-29.7.0.tgz", + "integrity": "sha512-un0zD/6qxJ+S0et7WxeI3H5XSe9lTBBR7bOHCHXkKR6luG5mwDDlIzVQ0V5cZCuoTgEdcdwzTghYkTWfubi+nA==", + "dev": true, + "requires": { + "jest-regex-util": "^29.6.3", + "jest-snapshot": "^29.7.0" + } + }, + "jest-runner": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runner/-/jest-runner-29.7.0.tgz", + "integrity": "sha512-fsc4N6cPCAahybGBfTRcq5wFR6fpLznMg47sY5aDpsoejOcVYFb07AHuSnR0liMcPTgBsA3ZJL6kFOjPdoNipQ==", + "dev": true, + "requires": { + "@jest/console": "^29.7.0", + "@jest/environment": "^29.7.0", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "graceful-fs": "^4.2.9", + "jest-docblock": "^29.7.0", + "jest-environment-node": "^29.7.0", + "jest-haste-map": "^29.7.0", + "jest-leak-detector": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-resolve": "^29.7.0", + "jest-runtime": "^29.7.0", + "jest-util": "^29.7.0", + "jest-watcher": "^29.7.0", + "jest-worker": "^29.7.0", + "p-limit": "^3.1.0", + "source-map-support": "0.5.13" + } + }, + "jest-runtime": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-runtime/-/jest-runtime-29.7.0.tgz", + "integrity": "sha512-gUnLjgwdGqW7B4LvOIkbKs9WGbn+QLqRQQ9juC6HndeDiezIwhDP+mhMwHWCEcfQ5RUXa6OPnFF8BJh5xegwwQ==", + "dev": true, + "requires": { + "@jest/environment": "^29.7.0", + "@jest/fake-timers": "^29.7.0", + "@jest/globals": "^29.7.0", + "@jest/source-map": "^29.6.3", + "@jest/test-result": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "cjs-module-lexer": "^1.0.0", + "collect-v8-coverage": "^1.0.0", + "glob": "^7.1.3", + "graceful-fs": "^4.2.9", + "jest-haste-map": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-mock": "^29.7.0", + "jest-regex-util": "^29.6.3", + "jest-resolve": "^29.7.0", + "jest-snapshot": "^29.7.0", + "jest-util": "^29.7.0", + "slash": "^3.0.0", + "strip-bom": "^4.0.0" + } + }, + "jest-snapshot": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-snapshot/-/jest-snapshot-29.7.0.tgz", + "integrity": "sha512-Rm0BMWtxBcioHr1/OX5YCP8Uov4riHvKPknOGs804Zg9JGZgmIBkbtlxJC/7Z4msKYVbIJtfU+tKb8xlYNfdkw==", + "dev": true, + "requires": { + "@babel/core": "^7.11.6", + "@babel/generator": "^7.7.2", + "@babel/plugin-syntax-jsx": "^7.7.2", + "@babel/plugin-syntax-typescript": "^7.7.2", + "@babel/types": "^7.3.3", + "@jest/expect-utils": "^29.7.0", + "@jest/transform": "^29.7.0", + "@jest/types": "^29.6.3", + "babel-preset-current-node-syntax": "^1.0.0", + "chalk": "^4.0.0", + "expect": "^29.7.0", + "graceful-fs": "^4.2.9", + "jest-diff": "^29.7.0", + "jest-get-type": "^29.6.3", + "jest-matcher-utils": "^29.7.0", + "jest-message-util": "^29.7.0", + "jest-util": "^29.7.0", + "natural-compare": "^1.4.0", + "pretty-format": "^29.7.0", + "semver": "^7.5.3" + } + }, + "jest-util": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.7.0.tgz", + "integrity": "sha512-z6EbKajIpqGKU56y5KBUgy1dt1ihhQJgWzUlZHArA/+X2ad7Cb5iF+AK1EWVL/Bo7Rz9uurpqw6SiBCefUbCGA==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + } + }, + "jest-validate": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-validate/-/jest-validate-29.7.0.tgz", + "integrity": "sha512-ZB7wHqaRGVw/9hST/OuFUReG7M8vKeq0/J2egIGLdvjHCmYqGARhzXmtgi+gVeZ5uXFF219aOc3Ls2yLg27tkw==", + "dev": true, + "requires": { + "@jest/types": "^29.6.3", + "camelcase": "^6.2.0", + "chalk": "^4.0.0", + "jest-get-type": "^29.6.3", + "leven": "^3.1.0", + "pretty-format": "^29.7.0" + }, + "dependencies": { + "camelcase": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", + "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", + "dev": true + } + } + }, + "jest-watcher": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-watcher/-/jest-watcher-29.7.0.tgz", + "integrity": "sha512-49Fg7WXkU3Vl2h6LbLtMQ/HyB6rXSIX7SqvBLQmssRBGN9I0PNvPmAmCWSOY6SOvrjhI/F7/bGAv9RtnsPA03g==", + "dev": true, + "requires": { + "@jest/test-result": "^29.7.0", + "@jest/types": "^29.6.3", + "@types/node": "*", + "ansi-escapes": "^4.2.1", + "chalk": "^4.0.0", + "emittery": "^0.13.1", + "jest-util": "^29.7.0", + "string-length": "^4.0.1" + } + }, + "jest-worker": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-29.7.0.tgz", + "integrity": "sha512-eIz2msL/EzL9UFTFFx7jBTkeZfku0yUAyZZZmJ93H2TYEiroIx2PQjEXcwYtYl8zXCxb+PAmA2hLIt/6ZEkPHw==", + "dev": true, + "requires": { + "@types/node": "*", + "jest-util": "^29.7.0", + "merge-stream": "^2.0.0", + "supports-color": "^8.0.0" + }, + "dependencies": { + "supports-color": { + "version": "8.1.1", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", + "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } }, "js-tokens": { "version": "4.0.0", @@ -3840,134 +2150,153 @@ "dev": true }, "js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", + "version": "3.14.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", + "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", "dev": true, "requires": { - "argparse": "^2.0.1" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, + "json-parse-even-better-errors": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", + "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", + "dev": true + }, + "json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true + }, + "kleur": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", + "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", + "dev": true + }, + "leven": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", + "integrity": "sha512-qsda+H8jTaUaN/x5vzW2rzc+8Rw4TAQ/4KjB46IwK5VH+IlVeeeje/EoZRpiXvIqjFgK84QffqPztGI3VBLG1A==", + "dev": true + }, + "lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true + }, "locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", "dev": true, "requires": { - "p-locate": "^5.0.0" + "p-locate": "^4.1.0" } }, - "log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", + "lodash.memoize": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/lodash.memoize/-/lodash.memoize-4.1.2.tgz", + "integrity": "sha512-t7j+NzmgnQzTAYXcsHYLgimltOV1MXHtlOWf6GjL9Kj8GK5FInw5JotxvbOs+IvV1/Dzo04/fCGfLVs7aXb4Ag==", + "dev": true + }, + "lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "requires": { + "yallist": "^3.0.2" + } + }, + "make-dir": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", + "integrity": "sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==", + "dev": true, + "requires": { + "semver": "^7.5.3" + } + }, + "make-error": { + "version": "1.3.6", + "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", + "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "dev": true + }, + "makeerror": { + "version": "1.0.12", + "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", + "integrity": "sha512-JmqCvUhmt43madlpFzG4BQzG2Z3m6tvQDNKdClZnO3VbIudJYmxsT0FNJMeiB2+JTSlTQTSbU8QdesVmwJcmLg==", "dev": true, "requires": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" + "tmpl": "1.0.5" } }, - "loupe": { - "version": "2.3.4", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-2.3.4.tgz", - "integrity": "sha512-OvKfgCC2Ndby6aSTREl5aCCPTNIzlDfQZvZxNUrBrihDhL3xcrYegTblhmEiCrg2kKQz4XsFIaemE5BF4ybSaQ==", + "merge-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", + "integrity": "sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==", + "dev": true + }, + "micromatch": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.5.tgz", + "integrity": "sha512-DMy+ERcEW2q8Z2Po+WNXuw3c5YaUSFjAO5GsJqfEl7UjvtIuFKO6ZrKvcItdy98dwFI2N1tg3zNIdKaQT+aNdA==", "dev": true, "requires": { - "get-func-name": "^2.0.0" + "braces": "^3.0.2", + "picomatch": "^2.3.1" } }, - "make-error": { - "version": "1.3.6", - "resolved": "https://registry.npmjs.org/make-error/-/make-error-1.3.6.tgz", - "integrity": "sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==", + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", "dev": true }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", "dev": true, "requires": { "brace-expansion": "^1.1.7" } }, - "minimist": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.5.tgz", - "integrity": "sha512-FM9nNUYrRBAELZQT3xeZQ7fmMOBg6nWNmJKTcgsJeaLstP/UODVpGsr5OhXhhXg6f+qtJ8uiZ+PUxkDWcgIXLw==", + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "mkdirp": { - "version": "0.5.5", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.5.tgz", - "integrity": "sha512-NKmAlESf6jMGym1++R0Ra7wvhV+wFW63FaSOFPwRahvea0gMUcGUhVeAg/0BC0wiv9ih5NYPB1Wn1UEI1/L+xQ==", - "dev": true, - "requires": { - "minimist": "^1.2.5" - } - }, - "mocha": { - "version": "9.2.1", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-9.2.1.tgz", - "integrity": "sha512-T7uscqjJVS46Pq1XDXyo9Uvey9gd3huT/DD9cYBb4K2Xc/vbKRPUWK067bxDQRK0yIz6Jxk73IrnimvASzBNAQ==", - "dev": true, - "requires": { - "@ungap/promise-all-settled": "1.1.2", - "ansi-colors": "4.1.1", - "browser-stdout": "1.3.1", - "chokidar": "3.5.3", - "debug": "4.3.3", - "diff": "5.0.0", - "escape-string-regexp": "4.0.0", - "find-up": "5.0.0", - "glob": "7.2.0", - "growl": "1.10.5", - "he": "1.2.0", - "js-yaml": "4.1.0", - "log-symbols": "4.1.0", - "minimatch": "3.0.4", - "ms": "2.1.3", - "nanoid": "3.2.0", - "serialize-javascript": "6.0.0", - "strip-json-comments": "3.1.1", - "supports-color": "8.1.1", - "which": "2.0.2", - "workerpool": "6.2.0", - "yargs": "16.2.0", - "yargs-parser": "20.2.4", - "yargs-unparser": "2.0.0" - } - }, - "ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "natural-compare": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", + "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "nanoid": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.2.0.tgz", - "integrity": "sha512-fmsZYa9lpn69Ad5eDn7FMcnnSR+8R34W9qJEijxYhTbfOWzr22n1QxCMzXLK+ODyW2973V3Fux959iQoUxzUIA==", + "node-int64": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", + "integrity": "sha512-O5lz91xSOeoXP6DulyHfllpq+Eg00MWitZIbtPfoSEvqIHdl5gfcY6hYzDWnj0qD5tz52PI08u9qUvSVeUBeHw==", "dev": true }, - "node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "requires": { - "whatwg-url": "^5.0.0" - } + "node-releases": { + "version": "2.0.14", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.14.tgz", + "integrity": "sha512-y10wOWt8yZpqXmOgRo77WaHEmhYQYGNA6y421PKsKYWEK8aW+cqAphborZDhqfyKrbZEN92CN1X2KbafY2s7Yw==", + "dev": true }, "normalize-path": { "version": "3.0.0", @@ -3975,15 +2304,33 @@ "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", "dev": true }, + "npm-run-path": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-4.0.1.tgz", + "integrity": "sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, "once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", "dev": true, "requires": { "wrappy": "1" } }, + "onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, "p-limit": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", @@ -3994,12 +2341,41 @@ } }, "p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + }, + "dependencies": { + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + } + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "parse-json": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", + "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", "dev": true, "requires": { - "p-limit": "^3.0.2" + "@babel/code-frame": "^7.0.0", + "error-ex": "^1.3.1", + "json-parse-even-better-errors": "^2.3.0", + "lines-and-columns": "^1.1.6" } }, "path-exists": { @@ -4011,7 +2387,13 @@ "path-is-absolute": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", "dev": true }, "path-parse": { @@ -4020,10 +2402,10 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "pathval": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.1.tgz", - "integrity": "sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==", + "picocolors": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.0.0.tgz", + "integrity": "sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==", "dev": true }, "picomatch": { @@ -4032,92 +2414,204 @@ "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", "dev": true }, - "prettier": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.5.1.tgz", - "integrity": "sha512-vBZcPRUR5MZJwoyi3ZoyQlc1rXeEck8KgeC9AwwOn+exuxLxq5toTRDTSaVrXHxelDMHy9zlicw8u66yxoSUFg==", + "pirates": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.6.tgz", + "integrity": "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==", "dev": true }, - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "prettier": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.1.1.tgz", + "integrity": "sha512-22UbSzg8luF4UuZtzgiUOfcGM8s4tjBv6dJRT7j275NXsy2jb4aJa4NNveul5x4eqlF1wuhuR2RElK71RvmVaw==", "dev": true }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", + "pretty-format": { + "version": "29.7.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.7.0.tgz", + "integrity": "sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==", "dev": true, "requires": { - "safe-buffer": "^5.1.0" + "@jest/schemas": "^29.6.3", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true + } } }, - "readdirp": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", - "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "prompts": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", + "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", "dev": true, "requires": { - "picomatch": "^2.2.1" + "kleur": "^3.0.3", + "sisteransi": "^1.0.5" } }, + "pure-rand": { + "version": "6.0.4", + "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.0.4.tgz", + "integrity": "sha512-LA0Y9kxMYv47GIPJy6MI84fqTd2HmYZI83W/kM/SkKfDlajnZYfmXFTxkbY+xSBPkLJxltMa9hIkmdc29eguMA==", + "dev": true + }, + "react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, "require-directory": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", "dev": true }, "resolve": { - "version": "1.22.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.0.tgz", - "integrity": "sha512-Hhtrw0nLeSrFQ7phPp4OOcVjLPIeMnRlr5mcnVuMe7M/7eBn98A3hmFRLoFo3DLZkivSYwhRUJTyPyWAk56WLw==", + "version": "1.22.8", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.8.tgz", + "integrity": "sha512-oKWePCxqpd6FlLvGV1VU0x7bkPmmCNolxzjMf4NczoDnQcIWrAF+cPtZn5i6n+RfD2d9i0tzpKnG6Yk168yIyw==", "dev": true, "requires": { - "is-core-module": "^2.8.1", + "is-core-module": "^2.13.0", "path-parse": "^1.0.7", "supports-preserve-symlinks-flag": "^1.0.0" } }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "resolve-cwd": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-3.0.0.tgz", + "integrity": "sha512-OrZaX2Mb+rJCpH/6CpSqt9xFVpN++x01XnN2ie9g6P5/3xelLAkXWVADpdz1IHD/KFfEXyE6V0U01OQ3UO2rEg==", + "dev": true, + "requires": { + "resolve-from": "^5.0.0" + } + }, + "resolve-from": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", + "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", "dev": true }, - "scrypt-js": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", - "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + "resolve.exports": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/resolve.exports/-/resolve.exports-2.0.2.tgz", + "integrity": "sha512-X2UW6Nw3n/aMgDVy+0rSqgHlv39WZAlZrXCdnbyEiKm17DSqHX4MmQMaST3FbeWR5FTuRcUwYAziZajji0Y7mg==", + "dev": true }, "semver": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", - "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz", + "integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==", + "dev": true, + "requires": { + "lru-cache": "^6.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "dev": true, + "requires": { + "yallist": "^4.0.0" + } + }, + "yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "dev": true + } + } + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", "dev": true }, - "serialize-javascript": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", - "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", + "signal-exit": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", + "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", + "dev": true + }, + "sisteransi": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", + "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true + }, + "source-map-support": { + "version": "0.5.13", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.13.tgz", + "integrity": "sha512-SHSKFHadjVA5oR4PPqhtAVdcBWwRYVd6g6cAXnIbRiIwc2EhPrTuKUBdSLvlEKyIP3GCf89fltvcZiP9MMFA1w==", "dev": true, "requires": { - "randombytes": "^2.1.0" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" } }, "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "integrity": "sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==", "dev": true }, - "stream-events": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", - "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "stack-utils": { + "version": "2.0.6", + "resolved": "https://registry.npmjs.org/stack-utils/-/stack-utils-2.0.6.tgz", + "integrity": "sha512-XlkWvfIm6RmsWtNJx+uqtKLS8eqFbxUg0ZzLXqY0caEy9l7hruX8IpiDnjsLavoBgqCCR71TqWO8MaXYheJ3RQ==", "dev": true, "requires": { - "stubs": "^3.0.0" + "escape-string-regexp": "^2.0.0" + } + }, + "string-length": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/string-length/-/string-length-4.0.2.tgz", + "integrity": "sha512-+l6rNN5fYHNhZZy41RXsYptCjA2Igmq4EG7kZAYFQI1E1VTXarr6ZPXBg6eq7Y6eK4FEhY6AJlyuFIb/v/S0VQ==", + "dev": true, + "requires": { + "char-regex": "^1.0.2", + "strip-ansi": "^6.0.0" } }, "string-width": { @@ -4140,22 +2634,28 @@ "ansi-regex": "^5.0.1" } }, + "strip-bom": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", + "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", + "dev": true + }, + "strip-final-newline": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/strip-final-newline/-/strip-final-newline-2.0.0.tgz", + "integrity": "sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==", + "dev": true + }, "strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", "dev": true }, - "stubs": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", - "integrity": "sha1-6NK6H6nJBXAwPAMLaQD31fiavls=", - "dev": true - }, "supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", "dev": true, "requires": { "has-flag": "^4.0.0" @@ -4167,19 +2667,29 @@ "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", "dev": true }, - "teeny-request": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-7.1.1.tgz", - "integrity": "sha512-iwY6rkW5DDGq8hE2YgNQlKbptYpY5Nn2xecjQiNjOXWbKzPGUfmeUBCSQbbr306d7Z7U2N0TPl+/SwYRfua1Dg==", + "test-exclude": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/test-exclude/-/test-exclude-6.0.0.tgz", + "integrity": "sha512-cAGWPIyOHU6zlmg88jwm7VRyXnMN7iV68OGAbYDk/Mh/xC/pzVPlQtY6ngoIH/5/tciuhGfvESU8GrHrcxD56w==", "dev": true, "requires": { - "http-proxy-agent": "^4.0.0", - "https-proxy-agent": "^5.0.0", - "node-fetch": "^2.6.1", - "stream-events": "^1.0.5", - "uuid": "^8.0.0" + "@istanbuljs/schema": "^0.1.2", + "glob": "^7.1.4", + "minimatch": "^3.0.4" } }, + "tmpl": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz", + "integrity": "sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==", + "dev": true + }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -4189,19 +2699,29 @@ "is-number": "^7.0.0" } }, - "tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true + "ts-jest": { + "version": "29.1.1", + "resolved": "https://registry.npmjs.org/ts-jest/-/ts-jest-29.1.1.tgz", + "integrity": "sha512-D6xjnnbP17cC85nliwGiL+tpoKN0StpgE0TeOjXQTU6MVCfsB4v7aW05CgQ/1OywGb0x/oy9hHFnN+sczTiRaA==", + "dev": true, + "requires": { + "bs-logger": "0.x", + "fast-json-stable-stringify": "2.x", + "jest-util": "^29.0.0", + "json5": "^2.2.3", + "lodash.memoize": "4.x", + "make-error": "1.x", + "semver": "^7.5.3", + "yargs-parser": "^21.0.1" + } }, "ts-node": { - "version": "10.7.0", - "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.7.0.tgz", - "integrity": "sha512-TbIGS4xgJoX2i3do417KSaep1uRAW/Lu+WAL2doDHC0D6ummjirVOXU5/7aiZotbQ5p1Zp9tP7U6cYhA0O7M8A==", + "version": "10.9.2", + "resolved": "https://registry.npmjs.org/ts-node/-/ts-node-10.9.2.tgz", + "integrity": "sha512-f0FFpIdcHgn8zcPSbf1dRevwt047YMnaiJM3u2w2RewrB+fob/zePZcrOyQoLMMO7aBIddLcQIEK5dYjkLnGrQ==", "dev": true, "requires": { - "@cspotcode/source-map-support": "0.7.0", + "@cspotcode/source-map-support": "^0.8.0", "@tsconfig/node10": "^1.0.7", "@tsconfig/node12": "^1.0.7", "@tsconfig/node14": "^1.0.0", @@ -4212,142 +2732,14 @@ "create-require": "^1.1.0", "diff": "^4.0.1", "make-error": "^1.1.1", - "v8-compile-cache-lib": "^3.0.0", + "v8-compile-cache-lib": "^3.0.1", "yn": "3.1.1" - }, - "dependencies": { - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - } } }, "tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "tslint": { - "version": "6.1.3", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-6.1.3.tgz", - "integrity": "sha512-IbR4nkT96EQOvKE2PW/djGz8iGNeJ4rF2mBfiYaR/nvUWYKJhLwimoJKgjIFEIDibBtOevj7BqCRL4oHeWWUCg==", - "dev": true, - "requires": { - "@babel/code-frame": "^7.0.0", - "builtin-modules": "^1.1.1", - "chalk": "^2.3.0", - "commander": "^2.12.1", - "diff": "^4.0.1", - "glob": "^7.1.1", - "js-yaml": "^3.13.1", - "minimatch": "^3.0.4", - "mkdirp": "^0.5.3", - "resolve": "^1.3.2", - "semver": "^5.3.0", - "tslib": "^1.13.0", - "tsutils": "^2.29.0" - }, - "dependencies": { - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } - }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, - "chalk": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", - "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, - "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" - } - }, - "color-convert": { - "version": "1.9.3", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", - "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, - "requires": { - "color-name": "1.1.3" - } - }, - "color-name": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", - "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=", - "dev": true - }, - "diff": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.2.tgz", - "integrity": "sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==", - "dev": true - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "js-yaml": { - "version": "3.14.1", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.14.1.tgz", - "integrity": "sha512-okMH7OXXJ7YrN9Ok3/SXrnu4iX9yOk+25nqX4imS2npuvTYDmo/QEZoqwZkYaIDk3jVvBOTOIEgEhaLOynBS9g==", - "dev": true, - "requires": { - "argparse": "^1.0.7", - "esprima": "^4.0.0" - } - }, - "supports-color": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", - "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, - "requires": { - "has-flag": "^3.0.0" - } - } - } - }, - "tslint-config-prettier": { - "version": "1.18.0", - "resolved": "https://registry.npmjs.org/tslint-config-prettier/-/tslint-config-prettier-1.18.0.tgz", - "integrity": "sha512-xPw9PgNPLG3iKRxmK7DWr+Ea/SzrvfHtjFt5LBl61gk2UBG/DB9kCXRjv+xyIU1rUtnayLeMUVJBcMX8Z17nDg==", - "dev": true - }, - "tsutils": { - "version": "2.29.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", - "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", - "dev": true, - "requires": { - "tslib": "^1.8.1" - } + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.4.0.tgz", + "integrity": "sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==" }, "type-detect": { "version": "4.0.8", @@ -4355,47 +2747,52 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true + }, "typescript": { - "version": "4.6.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.6.2.tgz", - "integrity": "sha512-HM/hFigTBHZhLXshn9sN37H085+hQGeJHJ/X7LpBWLID/fbc2acUMfU+lGD98X81sKP+pFa9f0DZmCwB9GnbAg==", + "version": "5.3.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", + "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", "dev": true }, - "urlgrey": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/urlgrey/-/urlgrey-1.0.0.tgz", - "integrity": "sha512-hJfIzMPJmI9IlLkby8QrsCykQ+SXDeO2W5Q9QTW3QpqZVTx4a/K7p8/5q+/isD8vsbVaFgql/gvAoQCRQ2Cb5w==", + "update-browserslist-db": { + "version": "1.0.13", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.0.13.tgz", + "integrity": "sha512-xebP81SNcPuNpPP3uzeW1NYXxI3rxyJzF3pD6sH4jE7o/IX+WtSpwnVU+qIsDPyk0d3hmFQ7mjqc6AtV604hbg==", "dev": true, "requires": { - "fast-url-parser": "^1.1.3" + "escalade": "^3.1.1", + "picocolors": "^1.0.0" } }, - "uuid": { - "version": "8.3.2", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", - "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", - "dev": true - }, "v8-compile-cache-lib": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.0.tgz", - "integrity": "sha512-mpSYqfsFvASnSn5qMiwrr4VKfumbPyONLCOPmsR3A6pTY/r0+tSaVbgPWSAIuzbk3lCTa+FForeTiO+wBQGkjA==", - "dev": true - }, - "webidl-conversions": { "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "resolved": "https://registry.npmjs.org/v8-compile-cache-lib/-/v8-compile-cache-lib-3.0.1.tgz", + "integrity": "sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==", "dev": true }, - "whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "v8-to-istanbul": { + "version": "9.2.0", + "resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz", + "integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==", + "dev": true, + "requires": { + "@jridgewell/trace-mapping": "^0.3.12", + "@types/istanbul-lib-coverage": "^2.0.1", + "convert-source-map": "^2.0.0" + } + }, + "walker": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/walker/-/walker-1.0.8.tgz", + "integrity": "sha512-ts/8E8l5b7kY0vlWLewOkDXMmPdLcVV4GmOQLyxuSswIJsweeFZtAsMF7k1Nszz+TYBQrlYRmzOnr398y1JemQ==", "dev": true, "requires": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" + "makeerror": "1.0.12" } }, "which": { @@ -4407,12 +2804,6 @@ "isexe": "^2.0.0" } }, - "workerpool": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-6.2.0.tgz", - "integrity": "sha512-Rsk5qQHJ9eowMH28Jwhe8HEbmdYDX4lwoMWshiCXugjtHqMD9ZbiqSDLxcsfdqsETPzVUtX5s1Z5kStiIM6l4A==", - "dev": true - }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -4427,14 +2818,23 @@ "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", "dev": true }, + "write-file-atomic": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/write-file-atomic/-/write-file-atomic-4.0.2.tgz", + "integrity": "sha512-7KxauUdBmSdWnmpaGFg+ppNjKF8uNLry8LyzjauQDOVONfFLNKrKvQOxZ/VuTIcS/gge/YNahf5RIIQWTSarlg==", + "dev": true, + "requires": { + "imurmurhash": "^0.1.4", + "signal-exit": "^3.0.7" + } + }, "ws": { - "version": "7.4.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", - "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", - "requires": {} + "version": "8.5.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", + "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==" }, "y18n": { "version": "5.0.8", @@ -4442,39 +2842,33 @@ "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", "dev": true }, + "yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true + }, "yargs": { - "version": "16.2.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz", - "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==", + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", "dev": true, "requires": { - "cliui": "^7.0.2", + "cliui": "^8.0.1", "escalade": "^3.1.1", "get-caller-file": "^2.0.5", "require-directory": "^2.1.1", - "string-width": "^4.2.0", + "string-width": "^4.2.3", "y18n": "^5.0.5", - "yargs-parser": "^20.2.2" + "yargs-parser": "^21.1.1" } }, "yargs-parser": { - "version": "20.2.4", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz", - "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA==", + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", "dev": true }, - "yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "requires": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - } - }, "yn": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/yn/-/yn-3.1.1.tgz", diff --git a/package.json b/package.json index 1836a7d..c226451 100644 --- a/package.json +++ b/package.json @@ -1,19 +1,20 @@ { "name": "@lacchain/gas-model-provider", - "version": "1.1.0", + "version": "1.2.0", "description": "Ethers.js LAC-NET Gas Model provider", - "main": "lib/index.js", - "types": "lib/index.d.ts", + "main": "dist/index.js", + "types": "dist/index.d.ts", "scripts": { - "test": "mocha --require ts-node/register --timeout 50000 --ui bdd tests/**", + "test": "jest", "build": "tsc", "format": "prettier --write \"src/**/*.ts\" \"src/**/*.js\"", - "lint": "tslint -p tsconfig.json", "prepare": "npm run build", "prepublishOnly": "npm test && npm run lint", "preversion": "npm run lint", "version": "npm run format && git add -A src", - "postversion": "git push && git push --tags" + "postversion": "git push && git push --tags", + "test:e2e": "jest --config jest.config.e2e.js", + "test:watch": "jest --watch" }, "repository": { "type": "git", @@ -30,26 +31,19 @@ "url": "https://github.com/lacchain/gas-model-provider/issues" }, "homepage": "https://github.com/lacchain/gas-model-provider#readme", - "dependencies": { - "ethers": "^5.6.0", - "@ethersproject/transactions": "^5.6.0", - "@ethersproject/bytes": "^5.6.0" - }, "devDependencies": { - "@types/chai": "^4.3.0", - "@types/mocha": "^9.1.0", - "@types/node": "^17.0.21", - "chai": "^4.3.6", - "chai-as-promised": "^7.1.1", - "codecov": "^3.8.3", - "mocha": "^9.2.1", - "prettier": "^2.5.1", - "ts-node": "^10.7.0", - "tslint": "^6.1.3", - "tslint-config-prettier": "^1.18.0", - "typescript": "^4.6.2" + "@types/jest": "^29.5.10", + "dotenv": "^16.3.1", + "jest": "^29.7.0", + "prettier": "^3.1.0", + "ts-jest": "^29.1.1", + "ts-node": "^10.9.2", + "typescript": "^5.3.3" }, "files": [ - "lib/**/*" - ] + "dist/**/*" + ], + "dependencies": { + "ethers": "^6.9.0" + } } diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..33ccc1a4ca40af75ba020073520647bd0c651d3d GIT binary patch literal 6148 zcmeHKOG-mQ5UkcLBH3h_<(xq921AG^$OT+PA|eqIb^TVJ%cG_GLomF!5!^^Mbk|Hz z*F0V=UcUxl%lFM4Fb6QDJL1#B*!LiOI;@5dt0!AcC>BrW{VmF2JyB5# zNP%+&u5&y0{(n#ZVg5fSX(t7wz`s(!Cad*o$yci0I(j+pwT=Ej_nI%d8`nW$h;~ej icFc{p<3$u@UGp{1d*P56bmoIj)X#wHB9j7tt-uj{0u?|2 literal 0 HcmV?d00001 diff --git a/src/index.ts b/src/index.ts index d37b43d..dd4e4fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,4 @@ -import { GasModelSigner } from "./signer"; -import { GasModelProvider } from "./provider"; - -export { GasModelSigner } from "./signer"; -export { GasModelProvider } from "./provider"; - -export default { GasModelSigner, GasModelProvider }; \ No newline at end of file +export { LacchainSigner } from './lacchain-signer'; +export { LacchainProvider } from './lacchain-provider'; +export { LacchainTransaction } from './lacchain-transaction'; +export { LacchainTransactionRequest } from './lacchain-transaction-request'; diff --git a/src/lacchain-provider.ts b/src/lacchain-provider.ts new file mode 100644 index 0000000..cac42ff --- /dev/null +++ b/src/lacchain-provider.ts @@ -0,0 +1,55 @@ +import { + JsonRpcProvider, + FetchRequest, + Networkish, + JsonRpcApiProviderOptions, + PerformActionRequest, + TransactionResponse, + resolveProperties, + Transaction, +} from 'ethers'; + +import { LacchainTransaction } from './lacchain-transaction'; + + +export class LacchainProvider extends JsonRpcProvider { + + constructor( + url: string | FetchRequest, + network?: Networkish, + options?: JsonRpcApiProviderOptions, + ) { + super(url, network, { batchMaxSize: 1, ...options }); + } + + async _perform(req: PerformActionRequest) { + const result = await super._perform(req); + if (req.method === 'getTransactionReceipt' && result) { + delete result.root; + result.confirmations = 1; + } + return result; + } + + async broadcastTransaction(signedTx: string): Promise { + const { blockNumber, hash, network } = await resolveProperties({ + blockNumber: this.getBlockNumber(), + hash: this._perform({ + method: 'broadcastTransaction', + signedTransaction: signedTx, + }), + network: this.getNetwork(), + }); + + const tx = new LacchainTransaction(Transaction.from(signedTx), hash); + + if (tx.hash !== hash) { + throw new Error('@TODO: the returned hash did not match'); + } + + return this._wrapTransactionResponse( + tx, + network, + ).replaceableTransaction(blockNumber); + } +} diff --git a/src/lacchain-signer.ts b/src/lacchain-signer.ts new file mode 100644 index 0000000..8b93c80 --- /dev/null +++ b/src/lacchain-signer.ts @@ -0,0 +1,63 @@ +import { + Provider, + SigningKey, + Wallet, + resolveProperties, + resolveAddress, + assertArgument, + getAddress, + Transaction, + TransactionLike, + TransactionRequest +} from 'ethers'; + +import { LacchainTransactionRequest } from './lacchain-transaction-request'; + + +export class LacchainSigner extends Wallet { + + constructor( + privateKey: string | SigningKey, + provider: Provider, + private _aNodeAddress: string, + private _aExpirationTime: number, + ) { + super(privateKey, provider); + } + + async signTransaction(transactionRequest: TransactionRequest): Promise { + // Replace any Addressable or ENS name with an address + const { to, from } = await resolveProperties({ + to: transactionRequest.to ? resolveAddress(transactionRequest.to, this.provider) : undefined, + from: transactionRequest.from ? resolveAddress(transactionRequest.from, this.provider) : undefined, + }); + + if (to != null) { + transactionRequest.to = to; + } + + if (from != null) { + transactionRequest.from = from; + } + + if (transactionRequest.from != null) { + assertArgument( + getAddress(transactionRequest.from) === this.address, + 'transaction from address mismatch', + 'tx.from', + transactionRequest.from, + ); + delete transactionRequest.from; + } + + const btx = Transaction.from( + >( + new LacchainTransactionRequest(transactionRequest, this._aNodeAddress, this._aExpirationTime) + ), + ); + + btx.signature = this.signingKey.sign(btx.unsignedHash); + + return btx.serialized; + } +} diff --git a/src/lacchain-transaction-request.ts b/src/lacchain-transaction-request.ts new file mode 100644 index 0000000..4cb67b3 --- /dev/null +++ b/src/lacchain-transaction-request.ts @@ -0,0 +1,36 @@ +import { AbiCoder, AccessListish, AddressLike, BigNumberish, BlockTag, TransactionRequest } +from 'ethers'; + + + +export class LacchainTransactionRequest implements TransactionRequest { + + constructor( + private _aOriginalTransactionRequest: TransactionRequest, + private _aNodeAddress: string, + private _aExpirationTime: number + ) {} + + get data(): any | string { + return this._aOriginalTransactionRequest.data + AbiCoder.defaultAbiCoder().encode( + ["address", "uint256"], + [this._aNodeAddress, this._aExpirationTime] + ).substring(2);; + } + + get chainId(): any | BigNumberish { return 0; } + + get type(): any | number { return this._aOriginalTransactionRequest.type; } + get to(): any | AddressLike { return this._aOriginalTransactionRequest.to; } + get from(): any | AddressLike { return this._aOriginalTransactionRequest.from; } + get nonce(): any | number { return this._aOriginalTransactionRequest.nonce; } + get gasLimit(): any | BigNumberish { return this._aOriginalTransactionRequest.gasLimit; } + get gasPrice(): any | BigNumberish { return this._aOriginalTransactionRequest.gasPrice; } + get maxPriorityFeePerGas(): any | BigNumberish { return this._aOriginalTransactionRequest.maxPriorityFeePerGas; } + get maxFeePerGas(): any | BigNumberish { return this._aOriginalTransactionRequest.maxFeePerGas; } + get value(): any | BigNumberish { return this._aOriginalTransactionRequest.value; } + get accessList(): any | AccessListish { return this._aOriginalTransactionRequest.accessList; } + get customData(): any { return this._aOriginalTransactionRequest.customData; } + get blockTag(): undefined | BlockTag { return this._aOriginalTransactionRequest.blockTag; } + get enableCcipRead(): undefined | boolean { return this._aOriginalTransactionRequest.enableCcipRead; } +} diff --git a/src/lacchain-transaction.ts b/src/lacchain-transaction.ts new file mode 100644 index 0000000..7dc7b76 --- /dev/null +++ b/src/lacchain-transaction.ts @@ -0,0 +1,31 @@ +import { AccessList, Signature, Transaction, TransactionLike } from 'ethers'; + + + +export class LacchainTransaction implements TransactionLike { + + constructor(private _aOriginalTx: Transaction, private _aHashTx: string) {} + + get hash(): null | string { + return this._aHashTx; + } + + get type(): null | number { return this._aOriginalTx.type; } + get typeName(): null | string { return this._aOriginalTx.typeName; } + get to(): null | string { return this._aOriginalTx.to; } + get nonce(): number { return this._aOriginalTx.nonce; } + get gasLimit(): bigint { return this._aOriginalTx.gasLimit; } + get gasPrice(): null | bigint { return this._aOriginalTx.gasPrice; } + get maxPriorityFeePerGas(): null | bigint { return this._aOriginalTx.maxPriorityFeePerGas; } + get maxFeePerGas(): null | bigint { return this._aOriginalTx.maxFeePerGas; } + get data(): string { return this._aOriginalTx.data; } + get value(): bigint { return this._aOriginalTx.value; } + get chainId(): bigint { return this._aOriginalTx.chainId; } + get signature(): null | Signature { return this._aOriginalTx.signature || null; } + get accessList(): null | AccessList { return this._aOriginalTx.accessList } + get unsignedHash(): string { return this._aOriginalTx.unsignedHash; } + get from(): null | string { return this._aOriginalTx.from; } + get fromPublicKey(): null | string { return this._aOriginalTx.fromPublicKey; } + get serialized(): string { return this._aOriginalTx.serialized; } + get unsignedSerialized(): string { return this._aOriginalTx.unsignedSerialized; } +} diff --git a/src/provider.ts b/src/provider.ts deleted file mode 100644 index a092052..0000000 --- a/src/provider.ts +++ /dev/null @@ -1,33 +0,0 @@ -import {providers} from "ethers"; -import {hexlify} from "@ethersproject/bytes" - -export class GasModelProvider extends providers.JsonRpcProvider { - - async perform(method: string, params: any) { - const result = await super.perform(method, params); - if (method === 'getTransactionReceipt' && result) { - delete result.root; - result.confirmations = 1 - } - return result; - } - - async sendTransaction(transaction: string | Promise) { - await this.getNetwork(); - const hexTx = await Promise.resolve(transaction).then((t: string) => hexlify(t)); - const tx = this.formatter.transaction(transaction); - if (tx.confirmations == null) { - tx.confirmations = 0; - } - const blockNumber = await this._getInternalBlockNumber(100 + 2 * this.pollingInterval); - try { - const hash = await this.perform("sendTransaction", {signedTransaction: hexTx}); - tx.hash = hash; - return this._wrapTransaction(tx, hash, blockNumber); - } catch (error) { - (error as any).transaction = tx; - (error as any).transactionHash = tx.hash; - throw error; - } - } -} \ No newline at end of file diff --git a/src/signer.ts b/src/signer.ts deleted file mode 100644 index 6d91b2c..0000000 --- a/src/signer.ts +++ /dev/null @@ -1,32 +0,0 @@ -import {ethers, Wallet, Transaction} from "ethers"; -import {serialize} from "@ethersproject/transactions"; -import {BytesLike} from "@ethersproject/bytes"; -import {ExternallyOwnedAccount} from "@ethersproject/abstract-signer"; -import {SigningKey} from "@ethersproject/signing-key"; -import {Provider, TransactionRequest} from "@ethersproject/abstract-provider"; - -export class GasModelSigner extends Wallet { - private readonly nodeAddress: string; - private readonly expiration: number; - - constructor(privateKey: BytesLike | ExternallyOwnedAccount | SigningKey, provider: Provider, nodeAddress: string, expiration: number) { - super(privateKey, provider); - this.nodeAddress = nodeAddress; - this.expiration = expiration; - } - - signTransaction(transaction: TransactionRequest) { - return ethers.utils.resolveProperties(transaction as Transaction).then((tx: Transaction) => { - if (tx.from !== null) { - delete tx.from; - } - const value = ethers.utils.defaultAbiCoder - .encode(["address", "uint256"], [this.nodeAddress, this.expiration]); - - tx.data = tx.data + value.substring(2); - tx.chainId = 0; - const signature = this._signingKey().signDigest(ethers.utils.keccak256(serialize(tx))); - return serialize(tx, signature); - }); - } -} \ No newline at end of file diff --git a/src/test/e2e/deploy-and-tx.test.ts b/src/test/e2e/deploy-and-tx.test.ts new file mode 100644 index 0000000..42a07cd --- /dev/null +++ b/src/test/e2e/deploy-and-tx.test.ts @@ -0,0 +1,49 @@ +import { env } from 'process'; +import { ContractFactory, Contract } from 'ethers'; +import * as dotenv from 'dotenv'; +import { aTestContract } from './test-contract'; +import { LacchainProvider } from '../../lacchain-provider'; +import { LacchainSigner } from '../../lacchain-signer'; +import { aPrivateKey, anExpirationTime, testAddresses } from '../fixtures'; + + + +describe('e2e Provider & Signer re', () => { + + dotenv.config(); + + const { RPC_URL, NODE_ADDRESS, TRUSTED_FORWARDER } = env; + + + const signer: LacchainSigner = new LacchainSigner( + aPrivateKey, + new LacchainProvider(RPC_URL!), + NODE_ADDRESS!, + anExpirationTime + ); +console.log("set network") + const _deployContract = async () => { + const contractFactory = new ContractFactory( + aTestContract.abi, + aTestContract.bytecode, + signer + ); + + const contract = await contractFactory.deploy(signer.address, TRUSTED_FORWARDER!); + + return await contract.deploymentTransaction()?.wait(); + }; + + test('Deploy & Transaction re', async () => { + const txReceipt = await _deployContract(); + const contractAddress = txReceipt?.contractAddress || ''; + console.log(contractAddress) + expect(contractAddress).toBeTruthy(); + + const contract = new Contract(contractAddress, aTestContract.abi, signer); + + await (await contract.add(testAddresses[0], testAddresses[1])).wait(); + + expect(await contract.exists(testAddresses[0], testAddresses[1])).toEqual(true); + }, 100000000); +}); diff --git a/src/test/e2e/test-contract.ts b/src/test/e2e/test-contract.ts new file mode 100644 index 0000000..cf825cd --- /dev/null +++ b/src/test/e2e/test-contract.ts @@ -0,0 +1,166 @@ +export const aTestContract = { + "_format": "hh-sol-artifact-1", + "contractName": "Whitelist", + "sourceName": "contracts/Whitelist.sol", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "owner_", + "type": "address" + }, + { + "internalType": "address", + "name": "trustedForwarder_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AddressZero", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + } + ], + "name": "OwnableInvalidOwner", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "OwnableUnauthorizedAccount", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "add", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "exists", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "anUser", + "type": "address" + }, + { + "internalType": "address", + "name": "aToken", + "type": "address" + } + ], + "name": "remove", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060405161078c38038061078c83398101604081905261002f916100fd565b80826001600160a01b03811661005f57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b61006881610091565b50600180546001600160a01b0319166001600160a01b0392909216919091179055506101309050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146100f857600080fd5b919050565b6000806040838503121561011057600080fd5b610119836100e1565b9150610127602084016100e1565b90509250929050565b61064d8061013f6000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100725760003560e01c80637f7c1491116100505780637f7c1491146100e65780638da5cb5b146100f9578063f2fde38b1461011457600080fd5b806352c28fab14610077578063715018a61461008c5780637663f82214610094575b600080fd5b61008a61008536600461056e565b610127565b005b61008a6101b6565b6100d16100a236600461056e565b6001600160a01b0380821660009081526002602090815260408083209386168352929052205460ff1692915050565b60405190151581526020015b60405180910390f35b61008a6100f436600461056e565b6101ca565b6000546040516001600160a01b0390911681526020016100dd565b61008a6101223660046105a7565b610256565b61012f6102b2565b816001600160a01b03811661015757604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661017f57604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19166001179055565b6101be6102b2565b6101c86000610329565b565b6101d26102b2565b816001600160a01b0381166101fa57604051639fabe1c160e01b815260040160405180910390fd5b816001600160a01b03811661022257604051639fabe1c160e01b815260040160405180910390fd5b50506001600160a01b039081166000908152600260209081526040808320949093168252929092529020805460ff19169055565b61025e6102b2565b6001600160a01b0381166102a6576040517f1e4fbdf7000000000000000000000000000000000000000000000000000000008152600060048201526024015b60405180910390fd5b6102af81610329565b50565b6102ba610391565b6001600160a01b03166102d56000546001600160a01b031690565b6001600160a01b0316146101c8576102eb610391565b6040517f118cdaa70000000000000000000000000000000000000000000000000000000081526001600160a01b03909116600482015260240161029d565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600061039b6103a0565b905090565b60015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7bdf2ec70000000000000000000000000000000000000000000000000000000017905290516000926060926001600160a01b039091169161041791906105cb565b600060405180830381855afa9150503d8060008114610452576040519150601f19603f3d011682016040523d82523d6000602084013e610457565b606091505b5080519092506104719150820160209081019083016105fa565b6001600160a01b031633036105525760015460408051600481526024810182526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f7a6ce2e10000000000000000000000000000000000000000000000000000000017905290516060926001600160a01b0316916104f1916105cb565b600060405180830381855afa9150503d806000811461052c576040519150601f19603f3d011682016040523d82523d6000602084013e610531565b606091505b50805190925061054b9150820160209081019083016105fa565b9250505090565b3391505090565b6001600160a01b03811681146102af57600080fd5b6000806040838503121561058157600080fd5b823561058c81610559565b9150602083013561059c81610559565b809150509250929050565b6000602082840312156105b957600080fd5b81356105c481610559565b9392505050565b6000825160005b818110156105ec57602081860181015185830152016105d2565b506000920191825250919050565b60006020828403121561060c57600080fd5b81516105c48161055956fea2646970667358221220877b455148ea5c2247a6126ff72c91e58f8132d3b9b84edaa8cdc621e2daa35464736f6c63430008140033", + "linkReferences": {}, + "deployedLinkReferences": {} +} \ No newline at end of file diff --git a/src/test/fixtures.ts b/src/test/fixtures.ts new file mode 100644 index 0000000..59a7a09 --- /dev/null +++ b/src/test/fixtures.ts @@ -0,0 +1,28 @@ + +import { TransactionRequest } from 'ethers'; + + +export const aPrivateKey = + '9ea92b45be8c30b18da6857cf60cfec534c0d612af34b291fd022ac4573e617c'; +export const anExpirationTime = 1836394529; +export const aNodeAddress = '0xc6e2459991BfE27cca6d86722F35da23A1E4Cb97'; +export const anOriginalTxRequest: TransactionRequest = { + type: 0, + to: '0x4F3F9061c42B396746Bb9A232089703E4f9DBF76', + from: null, + nonce: 71, + gasLimit: '1234', + gasPrice: '0', + maxPriorityFeePerGas: null, + maxFeePerGas: null, + data: '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2', + value: 0, + chainId: 1234, + accessList: null, + customData: undefined, + blockTag: undefined, + enableCcipRead: undefined, +}; +export const aSignedTxRequest = + '0xf8e447808204d2944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d7528211ba0c82f7051ffec883df1a1ce7fbe735cbd61900b8957362709b3614bd3c3309418a03f6b1897320a809a93c17ccc26130a0918a995cfb14fcd7c4108b35778003ab7'; +export const testAddresses = ['0xE81D7E5Cd979be0a7F6B6c98957A66fdF6240273', '0x410bd47227a5EA8AF81995Fa3d66B770aF6F85e2']; diff --git a/src/test/index.test.ts b/src/test/index.test.ts new file mode 100644 index 0000000..a529392 --- /dev/null +++ b/src/test/index.test.ts @@ -0,0 +1,17 @@ +import { + LacchainSigner, + LacchainProvider, + LacchainTransaction, + LacchainTransactionRequest, +} from '../index'; + + +describe('index.ts', () => { + + test('exports', () => { + expect(LacchainSigner).toBeTruthy(); + expect(LacchainProvider).toBeTruthy(); + expect(LacchainTransaction).toBeTruthy(); + expect(LacchainTransactionRequest).toBeTruthy(); + }); +}); diff --git a/src/test/lacchain-provider.test.ts b/src/test/lacchain-provider.test.ts new file mode 100644 index 0000000..23b7443 --- /dev/null +++ b/src/test/lacchain-provider.test.ts @@ -0,0 +1,9 @@ +import { LacchainProvider } from '../lacchain-provider'; + + +describe('LacchainProvider', () => { + + test('new', () => { + expect(new LacchainProvider('http://test.test')).toBeTruthy(); + }); +}); diff --git a/src/test/lacchain-signer.test.ts b/src/test/lacchain-signer.test.ts new file mode 100644 index 0000000..533f1ff --- /dev/null +++ b/src/test/lacchain-signer.test.ts @@ -0,0 +1,36 @@ +import { Provider } from 'ethers'; +import { LacchainSigner } from '../lacchain-signer'; +import { + aPrivateKey, + aNodeAddress, + anExpirationTime, + anOriginalTxRequest, + aSignedTxRequest, +} from './fixtures'; + + +describe('LacchainSigner', () => { + + let signer: LacchainSigner; + + const aProvider = {} as Provider; + + beforeEach(() => { + signer = new LacchainSigner( + aPrivateKey, + aProvider, + aNodeAddress, + anExpirationTime, + ); + }); + + test('new', () => { + expect(signer).toBeTruthy(); + }); + + test('signTransaction', async () => { + expect(await signer.signTransaction(anOriginalTxRequest)).toEqual( + aSignedTxRequest, + ); + }); +}); diff --git a/src/test/lacchain-transaction-request.test.ts b/src/test/lacchain-transaction-request.test.ts new file mode 100644 index 0000000..1542c7c --- /dev/null +++ b/src/test/lacchain-transaction-request.test.ts @@ -0,0 +1,84 @@ +import { LacchainTransactionRequest } from '../lacchain-transaction-request'; +import { anOriginalTxRequest, aNodeAddress, anExpirationTime } from './fixtures'; + + +describe('LacchainTransactionRequest', () => { + + let lacchainTxRequest: LacchainTransactionRequest; + + const lacchainDataExpected = '0x52c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000c6e2459991bfe27cca6d86722f35da23a1e4cb97000000000000000000000000000000000000000000000000000000006d752821'; + + beforeEach(() => { + lacchainTxRequest = new LacchainTransactionRequest(anOriginalTxRequest, aNodeAddress, anExpirationTime); + }); + + test('new', () => { + expect(lacchainTxRequest).toBeTruthy(); + }); + + test('type', () => { + expect(lacchainTxRequest.type).toEqual(anOriginalTxRequest.type); + }); + + test('to', () => { + expect(lacchainTxRequest.to).toEqual(anOriginalTxRequest.to); + }); + + test('from', () => { + expect(lacchainTxRequest.from).toEqual(anOriginalTxRequest.from); + }); + + test('nonce', () => { + expect(lacchainTxRequest.nonce).toEqual(anOriginalTxRequest.nonce); + }); + + test('gasLimit', () => { + expect(lacchainTxRequest.gasLimit).toEqual(anOriginalTxRequest.gasLimit); + }); + + test('gasPrice', () => { + expect(lacchainTxRequest.gasPrice).toEqual(anOriginalTxRequest.gasPrice); + }); + + test('maxPriorityFeePerGas', () => { + expect(lacchainTxRequest.maxPriorityFeePerGas).toEqual( + anOriginalTxRequest.maxPriorityFeePerGas, + ); + }); + + test('maxFeePerGas', () => { + expect(lacchainTxRequest.maxFeePerGas).toEqual( + anOriginalTxRequest.maxFeePerGas, + ); + }); + + test('data', () => { + expect(lacchainTxRequest.data).toEqual(lacchainDataExpected); + }); + + test('value', () => { + expect(lacchainTxRequest.value).toEqual(anOriginalTxRequest.value); + }); + + test('chainId', () => { + expect(lacchainTxRequest.chainId).toEqual(0); + }); + + test('accessList', () => { + expect(lacchainTxRequest.accessList).toEqual(anOriginalTxRequest.accessList); + }); + + test('customData', () => { + expect(lacchainTxRequest.customData).toEqual(anOriginalTxRequest.customData); + }); + + test('blockTag', () => { + expect(lacchainTxRequest.blockTag).toEqual(anOriginalTxRequest.blockTag); + }); + + test('enableCciRead', () => { + expect(lacchainTxRequest.enableCcipRead).toEqual( + anOriginalTxRequest.enableCcipRead, + ); + }); +}); diff --git a/src/test/lacchain-transaction.test.ts b/src/test/lacchain-transaction.test.ts new file mode 100644 index 0000000..94391df --- /dev/null +++ b/src/test/lacchain-transaction.test.ts @@ -0,0 +1,102 @@ +import { Transaction } from 'ethers'; +import { LacchainTransaction } from '../lacchain-transaction'; + + +describe('LacchainTransaction ', () => { + + let transaction: LacchainTransaction; + + const aTestHash = + 'a7c96262c21db9a06fd49e307d694fd95f624569f9b35bb3ffacd880440f9787'; + const anOriginalTx = Transaction.from( + '0xf8e4428082d558944f3f9061c42b396746bb9a232089703e4f9dbf7680b88452c28fab000000000000000000000000e81d7e5cd979be0a7f6b6c98957a66fdf6240273000000000000000000000000410bd47227a5ea8af81995fa3d66b770af6f85e2000000000000000000000000fda1303fc59b74b0926740b627770ced2ee98672000000000000000000000000000000000000000000000000000000006d7528211ba05313a3599a01d85aecb9792ffdf22f3f3b22b90bdd171a4e9f042719e7358f9da066f66b78938797f47a6cb54e759bbc0b4133c7b616760e0242848ae4c797de82', + ); + + beforeEach(() => { + transaction = new LacchainTransaction(anOriginalTx, aTestHash); + }); + + test('new', () => { + expect(transaction).toBeTruthy(); + }); + + test('fixed hash value', () => { + expect(transaction.hash).toEqual(aTestHash); + }); + + test('fixed hash', () => { + expect(transaction.hash === anOriginalTx.hash).toBeFalsy(); + }); + + test('type', () => { + expect(transaction.type).toEqual(anOriginalTx.type); + }); + + test('typeName', () => { + expect(transaction.typeName).toEqual(anOriginalTx.typeName); + }); + + test('to', () => { + expect(transaction.to).toEqual(anOriginalTx.to); + }); + + test('nonce', () => { + expect(transaction.nonce).toEqual(anOriginalTx.nonce); + }); + + test('gasLimit', () => { + expect(transaction.gasLimit).toEqual(anOriginalTx.gasLimit); + }); + + test('gasPrice', () => { + expect(transaction.gasPrice).toEqual(anOriginalTx.gasPrice); + }); + + test('maxPriorityFeePerGas', () => { + expect(transaction.maxPriorityFeePerGas).toEqual(anOriginalTx.maxPriorityFeePerGas); + }); + + test('maxFeePerGas', () => { + expect(transaction.maxFeePerGas).toEqual(anOriginalTx.maxFeePerGas); + }); + + test('data', () => { + expect(transaction.data).toEqual(anOriginalTx.data); + }); + + test('value', () => { + expect(transaction.value).toEqual(anOriginalTx.value); + }); + + test('chainId', () => { + expect(transaction.chainId).toEqual(anOriginalTx.chainId); + }); + + test('signature', () => { + expect(transaction.signature).toEqual(anOriginalTx.signature); + }); + + test('accessList', () => { + expect(transaction.accessList).toEqual(anOriginalTx.accessList); + }); + + test('unsignedHash', () => { + expect(transaction.unsignedHash).toEqual(anOriginalTx.unsignedHash); + }); + + test('from', () => { + expect(transaction.from).toEqual(anOriginalTx.from); + }); + + test('fromPublicKey', () => { + expect(transaction.fromPublicKey).toEqual(anOriginalTx.fromPublicKey); + }); + + test('serialized', () => { + expect(transaction.serialized).toEqual(anOriginalTx.serialized); + }); + + test('unsignedSerialized', () => { + expect(transaction.unsignedSerialized).toEqual(anOriginalTx.unsignedSerialized); + }); +}); diff --git a/tests/fixtures.ts b/tests/fixtures.ts deleted file mode 100644 index ae8f115..0000000 --- a/tests/fixtures.ts +++ /dev/null @@ -1,329 +0,0 @@ -export const RegisterHashContract = { - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "HashSeted", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "hash", - "type": "bytes32" - } - ], - "name": "store", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - } - ], - "name": "retreiveHash", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getOwner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x6080604052733b62e51e37d090453600395ff1f9bdf4d73984046000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555034801561006457600080fd5b506100736100b860201b60201c565b600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610244565b600060606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f7a6ce2e1000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b602083106101aa5780518252602082019150602081019050602083039250610187565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461020c576040519150601f19603f3d011682016040523d82523d6000602084013e610211565b606091505b5090508091505080806020019051602081101561022d57600080fd5b810190808051906020019092919050505091505090565b61040a806102536000396000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80632dee44ed14610046578063654cf88c1461009e578063893d20e8146100cc575b600080fd5b6100886004803603602081101561005c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610116565b6040518082815260200191505060405180910390f35b6100ca600480360360208110156100b457600080fd5b810190808035906020019092919050505061015f565b005b6100d461021e565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b6000610169610248565b905081600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fc3c7878f06e70b05d5ce7a617bf1d0e5a68a7b80a2edffb2ad7a236d71b5ea328183604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060606000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166040516024016040516020818303038152906040527f7a6ce2e1000000000000000000000000000000000000000000000000000000007bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19166020820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff83818316178352505050506040518082805190602001908083835b6020831061033a5780518252602082019150602081019050602083039250610317565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d806000811461039c576040519150601f19603f3d011682016040523d82523d6000602084013e6103a1565b606091505b509050809150508080602001905160208110156103bd57600080fd5b81019080805190602001909291905050509150509056fea2646970667358221220725a0ed6d95a50404e9f2035b5635e489bcfde378a523914b59014cd703c04c464736f6c63430006020033" -} - -export const PKD = { - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "entity", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "did", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "expires", - "type": "uint256" - } - ], - "name": "PublicKeyAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "entity", - "type": "address" - } - ], - "name": "PublicKeyRevoked", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "entity", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "did", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "expires", - "type": "uint256" - } - ], - "name": "PublicKeyUpdated", - "type": "event" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "publicKeys", - "outputs": [ - { - "internalType": "string", - "name": "did", - "type": "string" - }, - { - "internalType": "string", - "name": "name", - "type": "string" - }, - { - "internalType": "uint256", - "name": "expires", - "type": "uint256" - }, - { - "internalType": "uint8", - "name": "status", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_entity", - "type": "address" - }, - { - "internalType": "string", - "name": "_did", - "type": "string" - }, - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "uint256", - "name": "_expires", - "type": "uint256" - } - ], - "name": "register", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_entity", - "type": "address" - }, - { - "internalType": "string", - "name": "_did", - "type": "string" - }, - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "uint256", - "name": "_expires", - "type": "uint256" - } - ], - "name": "update", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_entity", - "type": "address" - } - ], - "name": "revoke", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "entity", - "type": "address" - } - ], - "name": "isActive", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - } - ], - "bytecode": "0x608060405234801561001057600080fd5b5061002d61002261003260201b60201c565b61003a60201b60201c565b6100fe565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6112528061010d6000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146100eb5780639f8a13d714610109578063a3d6f9a914610139578063f2fde38b1461016c57610088565b806315b8ac241461008d578063715018a6146100a957806374a8f103146100b35780638792ffef146100cf575b600080fd5b6100a760048036038101906100a29190610c11565b610188565b005b6100b1610350565b005b6100cd60048036038101906100c89190610be8565b6103d8565b005b6100e960048036038101906100e49190610c11565b610553565b005b6100f361071b565b6040516101009190610ecb565b60405180910390f35b610123600480360381019061011e9190610be8565b610744565b6040516101309190610ee6565b60405180910390f35b610153600480360381019061014e9190610be8565b6107a2565b6040516101639493929190610f46565b60405180910390f35b61018660048036038101906101819190610be8565b6108ef565b005b6101906109e7565b73ffffffffffffffffffffffffffffffffffffffff166101ae61071b565b73ffffffffffffffffffffffffffffffffffffffff1614610204576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016101fb90610ff9565b60405180910390fd5b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060018160030160009054906101000a900460ff1660ff161461029e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161029590610fd9565b60405180910390fd5b838160000190805190602001906102b6929190610ab3565b50828160010190805190602001906102cf929190610ab3565b5081816002018190555060018160030160006101000a81548160ff021916908360ff1602179055508473ffffffffffffffffffffffffffffffffffffffff167f723d887aa96d32e81a8ce9bee308b1121cdac043f534abd1d2cf0e2615402b6b85858560405161034193929190610f01565b60405180910390a25050505050565b6103586109e7565b73ffffffffffffffffffffffffffffffffffffffff1661037661071b565b73ffffffffffffffffffffffffffffffffffffffff16146103cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103c390610ff9565b60405180910390fd5b6103d660006109ef565b565b6103e06109e7565b73ffffffffffffffffffffffffffffffffffffffff166103fe61071b565b73ffffffffffffffffffffffffffffffffffffffff1614610454576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161044b90610ff9565b60405180910390fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060018160030160009054906101000a900460ff1660ff16146104ee576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016104e590610fb9565b60405180910390fd5b60028160030160006101000a81548160ff021916908360ff1602179055508173ffffffffffffffffffffffffffffffffffffffff167f3e9b3945c326d5b02acb76accdb779cb4e642522f75894270be2881eda642d8760405160405180910390a25050565b61055b6109e7565b73ffffffffffffffffffffffffffffffffffffffff1661057961071b565b73ffffffffffffffffffffffffffffffffffffffff16146105cf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016105c690610ff9565b60405180910390fd5b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020905060008160030160009054906101000a900460ff1660ff1614610669576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161066090611019565b60405180910390fd5b83816000019080519060200190610681929190610ab3565b508281600101908051906020019061069a929190610ab3565b5081816002018190555060018160030160006101000a81548160ff021916908360ff1602179055508473ffffffffffffffffffffffffffffffffffffffff167f579bad6bab18e7c22b055334de0b50297fad1ef23adc530b96f1c206de4ac98a85858560405161070c93929190610f01565b60405180910390a25050505050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b600060018060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060030160009054906101000a900460ff1660ff16149050919050565b60016020528060005260406000206000915090508060000180546107c59061114d565b80601f01602080910402602001604051908101604052809291908181526020018280546107f19061114d565b801561083e5780601f106108135761010080835404028352916020019161083e565b820191906000526020600020905b81548152906001019060200180831161082157829003601f168201915b5050505050908060010180546108539061114d565b80601f016020809104026020016040519081016040528092919081815260200182805461087f9061114d565b80156108cc5780601f106108a1576101008083540402835291602001916108cc565b820191906000526020600020905b8154815290600101906020018083116108af57829003601f168201915b5050505050908060020154908060030160009054906101000a900460ff16905084565b6108f76109e7565b73ffffffffffffffffffffffffffffffffffffffff1661091561071b565b73ffffffffffffffffffffffffffffffffffffffff161461096b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161096290610ff9565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156109db576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109d290610f99565b60405180910390fd5b6109e4816109ef565b50565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b828054610abf9061114d565b90600052602060002090601f016020900481019282610ae15760008555610b28565b82601f10610afa57805160ff1916838001178555610b28565b82800160010185558215610b28579182015b82811115610b27578251825591602001919060010190610b0c565b5b509050610b359190610b39565b5090565b5b80821115610b52576000816000905550600101610b3a565b5090565b6000610b69610b648461106a565b611039565b905082815260208101848484011115610b8157600080fd5b610b8c84828561110b565b509392505050565b600081359050610ba3816111ee565b92915050565b600082601f830112610bba57600080fd5b8135610bca848260208601610b56565b91505092915050565b600081359050610be281611205565b92915050565b600060208284031215610bfa57600080fd5b6000610c0884828501610b94565b91505092915050565b60008060008060808587031215610c2757600080fd5b6000610c3587828801610b94565b945050602085013567ffffffffffffffff811115610c5257600080fd5b610c5e87828801610ba9565b935050604085013567ffffffffffffffff811115610c7b57600080fd5b610c8787828801610ba9565b9250506060610c9887828801610bd3565b91505092959194509250565b610cad816110b6565b82525050565b610cbc816110c8565b82525050565b6000610ccd8261109a565b610cd781856110a5565b9350610ce781856020860161111a565b610cf0816111dd565b840191505092915050565b6000610d086026836110a5565b91507f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008301527f64647265737300000000000000000000000000000000000000000000000000006020830152604082019050919050565b6000610d6e6020836110a5565b91507f546865207075626c6963206b6579206973206e6f7420726567697374657265646000830152602082019050919050565b6000610dae6034836110a5565b91507f546865207075626c6963206b6579206973206e6f74207265676973746572656460008301527f206f7220686173206265656e207265766f6b65640000000000000000000000006020830152604082019050919050565b6000610e146020836110a5565b91507f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726000830152602082019050919050565b6000610e546024836110a5565b91507f546865207075626c6963206b657920697320616c72656164792072656769737460008301527f65726564000000000000000000000000000000000000000000000000000000006020830152604082019050919050565b610eb6816110f4565b82525050565b610ec5816110fe565b82525050565b6000602082019050610ee06000830184610ca4565b92915050565b6000602082019050610efb6000830184610cb3565b92915050565b60006060820190508181036000830152610f1b8186610cc2565b90508181036020830152610f2f8185610cc2565b9050610f3e6040830184610ead565b949350505050565b60006080820190508181036000830152610f608187610cc2565b90508181036020830152610f748186610cc2565b9050610f836040830185610ead565b610f906060830184610ebc565b95945050505050565b60006020820190508181036000830152610fb281610cfb565b9050919050565b60006020820190508181036000830152610fd281610d61565b9050919050565b60006020820190508181036000830152610ff281610da1565b9050919050565b6000602082019050818103600083015261101281610e07565b9050919050565b6000602082019050818103600083015261103281610e47565b9050919050565b6000604051905081810181811067ffffffffffffffff821117156110605761105f6111ae565b5b8060405250919050565b600067ffffffffffffffff821115611085576110846111ae565b5b601f19601f8301169050602081019050919050565b600081519050919050565b600082825260208201905092915050565b60006110c1826110d4565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b82818337600083830152505050565b60005b8381101561113857808201518184015260208101905061111d565b83811115611147576000848401525b50505050565b6000600282049050600182168061116557607f821691505b602082108114156111795761117861117f565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b6111f7816110b6565b811461120257600080fd5b50565b61120e816110f4565b811461121957600080fd5b5056fea2646970667358221220cc7256fe22dc2c67650f9c08711bf462fe7879356028956e0c1a201510d77dbf64736f6c63430008000033" -} \ No newline at end of file diff --git a/tests/index.ts b/tests/index.ts deleted file mode 100644 index 905f116..0000000 --- a/tests/index.ts +++ /dev/null @@ -1,36 +0,0 @@ -import 'mocha'; -import {ethers} from "ethers"; -import * as chai from "chai"; -import lacchain from "../src"; -import {PKD} from "./fixtures"; - -const expect = chai.expect; -chai.should(); - -describe('Tests', () => { - - let contractAddress = "0xf6F2B3665E5A596780A4Ee9247A1cA409bd9Edc2"; - const provider = new lacchain.GasModelProvider('http://34.73.228.200') - const privateKey = '0E273FFD9CF5214F7D6ADE5D1ABFD6D101B648AF12BC2DE6AC4AFCB4DB805CD3' - const nodeAddress = '0x971bb94d235a4ba42d53ab6fb0a86b12c73ba460'; - const expiration = 1736394529; - const signer = new lacchain.GasModelSigner(privateKey, provider, nodeAddress, expiration); - - it('should deploy contract', async () => { - const factory = new ethers.ContractFactory(PKD.abi, PKD.bytecode, signer) - const contract = await factory.deploy({gasLimit: 1588811, gasPrice: 0}) - const receipt = await contract.deployTransaction.wait(); - console.log(`Deployment successful! Contract Address: ${receipt.contractAddress}`); - expect(receipt.contractAddress).to.not.null; - contractAddress = receipt.contractAddress; - return false; - }); - - it('should send a transaction', async () => { - const contract = new ethers.Contract(contractAddress, PKD.abi, signer); - const stored = await contract.publicKeys('0x173CF75f0905338597fcd38F5cE13E6840b230e9'); - expect(stored).to.not.null; - return false; - }); - } -); \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 8f9e8cc..a40387d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,11 +1,17 @@ { "compilerOptions": { - "target": "es2015", + "target": "es2016", "module": "commonjs", + "rootDir": "./src", "declaration": true, - "outDir": "./lib", - "strict": true + "declarationMap": true, + "outDir": "./dist", + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "strict": true, + "skipLibCheck": true, + "sourceMap": true }, "include": ["src"], - "exclude": ["node_modules", "**/__tests__/*"] + "exclude": ["node_modules", "./dist", "./src/tests"] } \ No newline at end of file diff --git a/tslint.json b/tslint.json deleted file mode 100644 index 16b0abc..0000000 --- a/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": ["tslint:recommended", "tslint-config-prettier"] -} \ No newline at end of file From 39c5fe3ebc2334c1e63bf57ca0445a076902f99e Mon Sep 17 00:00:00 2001 From: Eduardo Marchena Date: Thu, 21 Dec 2023 12:45:33 -0500 Subject: [PATCH 2/2] update readme --- README.md | 61 ++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 42 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 1651a37..6cd3f46 100644 --- a/README.md +++ b/README.md @@ -11,10 +11,15 @@ Installation ### Usage ``` javascript -import provider from "@lacchain/gas-model-provider"; - -const provider = new provider.GasModelProvider( RPC_URL ); -const signer = new provider.GasModelSigner( PRIVATE_KEY, provider, NODE_ADDRESS, EXPIRATION ); +import { LacchainProvider, LacchainSigner } from '@lacchain/gas-model-provider'; + +const provider = new LacchainProvider(RPC_URL); +const signer: LacchainSigner = new LacchainSigner( + PRIVATE_KEY, + provider, + NODE_ADDRESS, + EXPIRATION +); ``` Where: @@ -28,13 +33,25 @@ Where: #### Deploy smart contract ``` javascript -import ethers from "ethers"; - -const factory = new ethers.ContractFactory( CONTRACT_ABI, CONTRACT_BYTECODE, signer ) -const contract = await factory.deploy( { gasLimit: 100000, gasPrice: 0 } ) -const receipt = await contract.deployTransaction.wait(); -console.log( `Contract Address: ${receipt.contractAddress}` ); -contractAddress = receipt.contractAddress; +import { ContractFactory } from 'ethers'; +import { LacchainProvider, LacchainSigner } from '@lacchain/gas-model-provider'; + +const signer: LacchainSigner = new LacchainSigner( + PRIVATE_KEY, + new LacchainProvider(RPC_URL!), + NODE_ADDRESS!, + EXPIRATION +); + +const contractFactory = new ContractFactory( + CONTRACT_ABI, + CONTRACT_BYTECODE, + signer +); + +const contract = await contractFactory.deploy(); +const txReceipt = await contract.deploymentTransaction()?.wait(); +console.log( `Contract Address: ${txReceipt?.contractAddress}` ); ``` Where: @@ -46,16 +63,22 @@ Where: #### Invoke and call contract ``` javascript -const hash = "0x7465737400000000000000000000000000000000000000000000000000000000"; -const contract = new ethers.Contract(CONTRACT_ADDRESS, CONTRACT_ABI, signer); -const tx = await contract.store(hash); -const receipt = await tx.wait(); -console.log('Receipt', receipt); -const stored = await contract.retreiveHash(SENDER_ADDRESS); -console.log(stored); +import { Contract } from 'ethers'; +import { LacchainProvider, LacchainSigner } from '@lacchain/gas-model-provider'; + +const signer: LacchainSigner = new LacchainSigner( + PRIVATE_KEY, + new LacchainProvider(RPC_URL!), + NODE_ADDRESS!, + EXPIRATION +); + +const contract = new Contract(CONTRACT_ADDRESS, CONTRACT_ABI, signer); + +await (await contract.someContractFunction()).wait(); ``` Where: - CONTRACT_ADDRESS: is the contract address - CONTRACT_ABI: is the contract ABI -- SENDER_ADDRESS: is the sender address +