@sentio/sdk 2.57.12-rc.j → 2.57.13-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/template.d.ts +1 -5
- package/lib/core/template.d.ts.map +1 -1
- package/lib/core/template.js +1 -4
- package/lib/core/template.js.map +1 -1
- package/lib/store/store.d.ts +2 -2
- package/lib/store/store.d.ts.map +1 -1
- package/lib/store/store.js.map +1 -1
- package/package.json +3 -3
- package/src/core/template.ts +1 -6
- package/src/store/store.ts +2 -3
- package/lib/chunk-2F2KNF4Z.js +0 -71905
- package/lib/chunk-2F2KNF4Z.js.map +0 -1
- package/lib/chunk-43HP4DQZ.js +0 -47
- package/lib/chunk-43HP4DQZ.js.map +0 -1
- package/lib/chunk-4HPFNKDX.js +0 -6763
- package/lib/chunk-4HPFNKDX.js.map +0 -1
- package/lib/chunk-4OCWUYSJ.js +0 -898
- package/lib/chunk-4OCWUYSJ.js.map +0 -1
- package/lib/chunk-6UVWNOIX.js +0 -4207
- package/lib/chunk-6UVWNOIX.js.map +0 -1
- package/lib/chunk-73SHERGU.js +0 -23970
- package/lib/chunk-73SHERGU.js.map +0 -1
- package/lib/chunk-742S42NO.js +0 -1323
- package/lib/chunk-742S42NO.js.map +0 -1
- package/lib/chunk-7ECRTQD7.js +0 -26757
- package/lib/chunk-7ECRTQD7.js.map +0 -1
- package/lib/chunk-7IDGS56O.js +0 -5058
- package/lib/chunk-7IDGS56O.js.map +0 -1
- package/lib/chunk-7S6WQ4RL.js +0 -1069
- package/lib/chunk-7S6WQ4RL.js.map +0 -1
- package/lib/chunk-AZFMPZRN.js +0 -3613
- package/lib/chunk-AZFMPZRN.js.map +0 -1
- package/lib/chunk-BZCXYTDE.js +0 -1333
- package/lib/chunk-BZCXYTDE.js.map +0 -1
- package/lib/chunk-E2DS6WZF.js +0 -1690
- package/lib/chunk-E2DS6WZF.js.map +0 -1
- package/lib/chunk-GE6BRIGS.js +0 -1721
- package/lib/chunk-GE6BRIGS.js.map +0 -1
- package/lib/chunk-J3I3VNTV.js +0 -767
- package/lib/chunk-J3I3VNTV.js.map +0 -1
- package/lib/chunk-J3QOJ2RV.js +0 -661
- package/lib/chunk-J3QOJ2RV.js.map +0 -1
- package/lib/chunk-J5UEW4B7.js +0 -1351
- package/lib/chunk-J5UEW4B7.js.map +0 -1
- package/lib/chunk-LPSNAS2G.js +0 -460
- package/lib/chunk-LPSNAS2G.js.map +0 -1
- package/lib/chunk-LR232ZJV.js +0 -2593
- package/lib/chunk-LR232ZJV.js.map +0 -1
- package/lib/chunk-N36N7RXJ.js +0 -653
- package/lib/chunk-N36N7RXJ.js.map +0 -1
- package/lib/chunk-OJG2VJ5T.js +0 -7063
- package/lib/chunk-OJG2VJ5T.js.map +0 -1
- package/lib/chunk-ONBEMKI5.js +0 -323
- package/lib/chunk-ONBEMKI5.js.map +0 -1
- package/lib/chunk-PVX2LIM5.js +0 -205
- package/lib/chunk-PVX2LIM5.js.map +0 -1
- package/lib/chunk-R7PMHHKJ.js +0 -52
- package/lib/chunk-R7PMHHKJ.js.map +0 -1
- package/lib/chunk-RMT2JEWA.js +0 -7740
- package/lib/chunk-RMT2JEWA.js.map +0 -1
- package/lib/chunk-S6MJ3KIL.js +0 -27798
- package/lib/chunk-S6MJ3KIL.js.map +0 -1
- package/lib/chunk-UEFVZL4I.js +0 -199
- package/lib/chunk-UEFVZL4I.js.map +0 -1
- package/lib/chunk-UIBPOKNT.js +0 -945
- package/lib/chunk-UIBPOKNT.js.map +0 -1
- package/lib/chunk-ZR7UHHH2.js +0 -5
- package/lib/chunk-ZR7UHHH2.js.map +0 -1
- package/lib/multipart-parser-SQIYSR67.js +0 -368
- package/lib/multipart-parser-SQIYSR67.js.map +0 -1
- package/src/aptos/builtin/0x1.d.ts +0 -6451
- package/src/aptos/builtin/0x1.d.ts.map +0 -1
- package/src/aptos/builtin/0x1.js +0 -7138
- package/src/aptos/builtin/0x1.js.map +0 -1
- package/src/aptos/builtin/0x3.d.ts +0 -1122
- package/src/aptos/builtin/0x3.d.ts.map +0 -1
- package/src/aptos/builtin/0x3.js +0 -937
- package/src/aptos/builtin/0x3.js.map +0 -1
- package/src/aptos/builtin/0x4.d.ts +0 -551
- package/src/aptos/builtin/0x4.d.ts.map +0 -1
- package/src/aptos/builtin/0x4.js +0 -529
- package/src/aptos/builtin/0x4.js.map +0 -1
- package/src/aptos/builtin/index.d.ts +0 -4
- package/src/aptos/builtin/index.d.ts.map +0 -1
- package/src/aptos/builtin/index.js +0 -7
- package/src/aptos/builtin/index.js.map +0 -1
- package/src/eth/builtin/eacaggregatorproxy.d.ts +0 -5
- package/src/eth/builtin/eacaggregatorproxy.d.ts.map +0 -1
- package/src/eth/builtin/eacaggregatorproxy.js +0 -8
- package/src/eth/builtin/eacaggregatorproxy.js.map +0 -1
- package/src/eth/builtin/erc1155.d.ts +0 -5
- package/src/eth/builtin/erc1155.d.ts.map +0 -1
- package/src/eth/builtin/erc1155.js +0 -8
- package/src/eth/builtin/erc1155.js.map +0 -1
- package/src/eth/builtin/erc20.d.ts +0 -5
- package/src/eth/builtin/erc20.d.ts.map +0 -1
- package/src/eth/builtin/erc20.js +0 -8
- package/src/eth/builtin/erc20.js.map +0 -1
- package/src/eth/builtin/erc20bytes.d.ts +0 -5
- package/src/eth/builtin/erc20bytes.d.ts.map +0 -1
- package/src/eth/builtin/erc20bytes.js +0 -8
- package/src/eth/builtin/erc20bytes.js.map +0 -1
- package/src/eth/builtin/erc721.d.ts +0 -5
- package/src/eth/builtin/erc721.d.ts.map +0 -1
- package/src/eth/builtin/erc721.js +0 -8
- package/src/eth/builtin/erc721.js.map +0 -1
- package/src/eth/builtin/index.d.ts +0 -13
- package/src/eth/builtin/index.d.ts.map +0 -1
- package/src/eth/builtin/index.js +0 -16
- package/src/eth/builtin/index.js.map +0 -1
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts +0 -50
- package/src/eth/builtin/internal/EACAggregatorProxy.d.ts.map +0 -1
- package/src/eth/builtin/internal/EACAggregatorProxy.js +0 -2
- package/src/eth/builtin/internal/EACAggregatorProxy.js.map +0 -1
- package/src/eth/builtin/internal/ERC1155.d.ts +0 -57
- package/src/eth/builtin/internal/ERC1155.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC1155.js +0 -2
- package/src/eth/builtin/internal/ERC1155.js.map +0 -1
- package/src/eth/builtin/internal/ERC20.d.ts +0 -41
- package/src/eth/builtin/internal/ERC20.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC20.js +0 -2
- package/src/eth/builtin/internal/ERC20.js.map +0 -1
- package/src/eth/builtin/internal/ERC20Bytes.d.ts +0 -32
- package/src/eth/builtin/internal/ERC20Bytes.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC20Bytes.js +0 -2
- package/src/eth/builtin/internal/ERC20Bytes.js.map +0 -1
- package/src/eth/builtin/internal/ERC721.d.ts +0 -43
- package/src/eth/builtin/internal/ERC721.d.ts.map +0 -1
- package/src/eth/builtin/internal/ERC721.js +0 -2
- package/src/eth/builtin/internal/ERC721.js.map +0 -1
- package/src/eth/builtin/internal/WETH9.d.ts +0 -47
- package/src/eth/builtin/internal/WETH9.d.ts.map +0 -1
- package/src/eth/builtin/internal/WETH9.js +0 -2
- package/src/eth/builtin/internal/WETH9.js.map +0 -1
- package/src/eth/builtin/internal/common.d.ts +0 -3
- package/src/eth/builtin/internal/common.d.ts.map +0 -1
- package/src/eth/builtin/internal/common.js +0 -8
- package/src/eth/builtin/internal/common.js.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts +0 -373
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js +0 -1355
- package/src/eth/builtin/internal/eacaggregatorproxy-processor.js.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js +0 -55
- package/src/eth/builtin/internal/eacaggregatorproxy-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc1155-processor.d.ts +0 -173
- package/src/eth/builtin/internal/erc1155-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc1155-processor.js +0 -596
- package/src/eth/builtin/internal/erc1155-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/erc1155-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc1155-test-utils.js +0 -55
- package/src/eth/builtin/internal/erc1155-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc20-processor.d.ts +0 -244
- package/src/eth/builtin/internal/erc20-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20-processor.js +0 -1109
- package/src/eth/builtin/internal/erc20-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc20-test-utils.d.ts +0 -6
- package/src/eth/builtin/internal/erc20-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20-test-utils.js +0 -44
- package/src/eth/builtin/internal/erc20-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts +0 -144
- package/src/eth/builtin/internal/erc20bytes-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-processor.js +0 -594
- package/src/eth/builtin/internal/erc20bytes-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts +0 -5
- package/src/eth/builtin/internal/erc20bytes-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc20bytes-test-utils.js +0 -33
- package/src/eth/builtin/internal/erc20bytes-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/erc721-processor.d.ts +0 -215
- package/src/eth/builtin/internal/erc721-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc721-processor.js +0 -895
- package/src/eth/builtin/internal/erc721-processor.js.map +0 -1
- package/src/eth/builtin/internal/erc721-test-utils.d.ts +0 -6
- package/src/eth/builtin/internal/erc721-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/erc721-test-utils.js +0 -44
- package/src/eth/builtin/internal/erc721-test-utils.js.map +0 -1
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts +0 -400
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js +0 -524
- package/src/eth/builtin/internal/factories/EACAggregatorProxy__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts +0 -251
- package/src/eth/builtin/internal/factories/ERC1155__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC1155__factory.js +0 -329
- package/src/eth/builtin/internal/factories/ERC1155__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts +0 -185
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js +0 -251
- package/src/eth/builtin/internal/factories/ERC20Bytes__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts +0 -303
- package/src/eth/builtin/internal/factories/ERC20__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC20__factory.js +0 -401
- package/src/eth/builtin/internal/factories/ERC20__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts +0 -273
- package/src/eth/builtin/internal/factories/ERC721__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/ERC721__factory.js +0 -361
- package/src/eth/builtin/internal/factories/ERC721__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts +0 -220
- package/src/eth/builtin/internal/factories/WETH9__factory.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/WETH9__factory.js +0 -294
- package/src/eth/builtin/internal/factories/WETH9__factory.js.map +0 -1
- package/src/eth/builtin/internal/factories/index.d.ts +0 -7
- package/src/eth/builtin/internal/factories/index.d.ts.map +0 -1
- package/src/eth/builtin/internal/factories/index.js +0 -10
- package/src/eth/builtin/internal/factories/index.js.map +0 -1
- package/src/eth/builtin/internal/index.d.ts +0 -14
- package/src/eth/builtin/internal/index.d.ts.map +0 -1
- package/src/eth/builtin/internal/index.js +0 -8
- package/src/eth/builtin/internal/index.js.map +0 -1
- package/src/eth/builtin/internal/weth9-processor.d.ts +0 -172
- package/src/eth/builtin/internal/weth9-processor.d.ts.map +0 -1
- package/src/eth/builtin/internal/weth9-processor.js +0 -729
- package/src/eth/builtin/internal/weth9-processor.js.map +0 -1
- package/src/eth/builtin/internal/weth9-test-utils.d.ts +0 -7
- package/src/eth/builtin/internal/weth9-test-utils.d.ts.map +0 -1
- package/src/eth/builtin/internal/weth9-test-utils.js +0 -55
- package/src/eth/builtin/internal/weth9-test-utils.js.map +0 -1
- package/src/eth/builtin/weth9.d.ts +0 -5
- package/src/eth/builtin/weth9.d.ts.map +0 -1
- package/src/eth/builtin/weth9.js +0 -8
- package/src/eth/builtin/weth9.js.map +0 -1
- package/src/solana/builtin/index.d.ts +0 -2
- package/src/solana/builtin/index.d.ts.map +0 -1
- package/src/solana/builtin/index.js +0 -2
- package/src/solana/builtin/index.js.map +0 -1
- package/src/solana/builtin/spl-token-processor.d.ts +0 -40
- package/src/solana/builtin/spl-token-processor.d.ts.map +0 -1
- package/src/solana/builtin/spl-token-processor.js +0 -254
- package/src/solana/builtin/spl-token-processor.js.map +0 -1
- package/src/solana/builtin/types.d.ts +0 -428
- package/src/solana/builtin/types.d.ts.map +0 -1
- package/src/solana/builtin/types.js +0 -201
- package/src/solana/builtin/types.js.map +0 -1
- package/src/sui/builtin/0x1.d.ts +0 -114
- package/src/sui/builtin/0x1.d.ts.map +0 -1
- package/src/sui/builtin/0x1.js +0 -159
- package/src/sui/builtin/0x1.js.map +0 -1
- package/src/sui/builtin/0x2.d.ts +0 -1250
- package/src/sui/builtin/0x2.d.ts.map +0 -1
- package/src/sui/builtin/0x2.js +0 -1511
- package/src/sui/builtin/0x2.js.map +0 -1
- package/src/sui/builtin/0x3.d.ts +0 -774
- package/src/sui/builtin/0x3.d.ts.map +0 -1
- package/src/sui/builtin/0x3.js +0 -720
- package/src/sui/builtin/0x3.js.map +0 -1
- package/src/sui/builtin/index.d.ts +0 -4
- package/src/sui/builtin/index.d.ts.map +0 -1
- package/src/sui/builtin/index.js +0 -7
- package/src/sui/builtin/index.js.map +0 -1
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/_version.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/properties.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/errors.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/data.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/maths.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/events.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/utf8.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/utils/rlp-encode.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/abstract-coder.ts","../../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/src/_assert.ts","../../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/src/_u64.ts","../../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/src/utils.ts","../../../node_modules/.pnpm/@noble+hashes@1.3.2/node_modules/@noble/hashes/src/sha3.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/crypto/keccak.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/constants/hashes.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/crypto/signature.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/address/address.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/address/contract-address.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/address/checks.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/typed.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/address.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/anonymous.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/array.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/boolean.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/bytes.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/fixed-bytes.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/null.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/number.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/string.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/coders/tuple.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/hash/id.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/transaction/accesslist.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/fragments.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/abi-coder.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/bytes32.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/abi/interface.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/providers/provider.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/contract/wrappers.ts","../../../node_modules/.pnpm/@sentio+ethers@6.13.1-patch.5_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@sentio/ethers/src.ts/contract/contract.ts","../src/eth/abi-decoder/decode-worker.ts"],"sourcesContent":["/* 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 = \"6.13.1\";\n","/**\n * Property helper functions.\n *\n * @_subsection api/utils:Properties [about-properties]\n */\n\nfunction checkType(value: any, type: string, name: string): void {\n const types = type.split(\"|\").map(t => t.trim());\n for (let i = 0; i < types.length; i++) {\n switch (type) {\n case \"any\":\n return;\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n if (typeof(value) === type) { return; }\n }\n }\n\n const error: any = new Error(`invalid value for type ${ type }`);\n error.code = \"INVALID_ARGUMENT\";\n error.argument = `value.${ name }`;\n error.value = value;\n\n throw error;\n}\n\n/**\n * Resolves to a new object that is a copy of %%value%%, but with all\n * values resolved.\n */\nexport async function resolveProperties<T>(value: { [ P in keyof T ]: T[P] | Promise<T[P]>}): Promise<T> {\n const keys = Object.keys(value);\n const results = await Promise.all(keys.map((k) => Promise.resolve(value[<keyof T>k])));\n return results.reduce((accum: any, v, index) => {\n accum[keys[index]] = v;\n return accum;\n }, <{ [ P in keyof T]: T[P] }>{ });\n}\n\n/**\n * Assigns the %%values%% to %%target%% as read-only values.\n *\n * It %%types%% is specified, the values are checked.\n */\nexport function defineProperties<T>(\n target: T,\n values: { [ K in keyof T ]?: T[K] },\n types?: { [ K in keyof T ]?: string }): void {\n\n for (let key in values) {\n let value = values[key];\n\n const type = (types ? types[key]: null);\n if (type) { checkType(value, type, key); }\n\n Object.defineProperty(target, key, { enumerable: true, value, writable: false });\n }\n}\n","/**\n * All errors in ethers include properties to ensure they are both\n * human-readable (i.e. ``.message``) and machine-readable (i.e. ``.code``).\n *\n * The [[isError]] function can be used to check the error ``code`` and\n * provide a type guard for the properties present on that error interface.\n *\n * @_section: api/utils/errors:Errors [about-errors]\n */\n\nimport { version } from \"../_version.js\";\n\nimport { defineProperties } from \"./properties.js\";\n\nimport type {\n TransactionRequest, TransactionReceipt, TransactionResponse\n} from \"../providers/index.js\";\n\nimport type { FetchRequest, FetchResponse } from \"./fetch.js\";\n\n/**\n * An error may contain additional properties, but those must not\n * conflict with any implicit properties.\n */\nexport type ErrorInfo<T> = Omit<T, \"code\" | \"name\" | \"message\" | \"shortMessage\"> & { shortMessage?: string };\n\n\nfunction stringify(value: any): any {\n if (value == null) { return \"null\"; }\n\n if (Array.isArray(value)) {\n return \"[ \" + (value.map(stringify)).join(\", \") + \" ]\";\n }\n\n if (value instanceof Uint8Array) {\n const HEX = \"0123456789abcdef\";\n let result = \"0x\";\n for (let i = 0; i < value.length; i++) {\n result += HEX[value[i] >> 4];\n result += HEX[value[i] & 0xf];\n }\n return result;\n }\n\n if (typeof(value) === \"object\" && typeof(value.toJSON) === \"function\") {\n return stringify(value.toJSON());\n }\n\n switch (typeof(value)) {\n case \"boolean\": case \"symbol\":\n return value.toString();\n case \"bigint\":\n return BigInt(value).toString();\n case \"number\":\n return (value).toString();\n case \"string\":\n return JSON.stringify(value);\n case \"object\": {\n const keys = Object.keys(value);\n keys.sort();\n return \"{ \" + keys.map((k) => `${ stringify(k) }: ${ stringify(value[k]) }`).join(\", \") + \" }\";\n }\n }\n\n return `[ COULD NOT SERIALIZE ]`;\n}\n\n/**\n * All errors emitted by ethers have an **ErrorCode** to help\n * identify and coalesce errors to simplify programmatic analysis.\n *\n * Each **ErrorCode** is the %%code%% proerty of a coresponding\n * [[EthersError]].\n *\n * **Generic Errors**\n *\n * **``\"UNKNOWN_ERROR\"``** - see [[UnknownError]]\n *\n * **``\"NOT_IMPLEMENTED\"``** - see [[NotImplementedError]]\n *\n * **``\"UNSUPPORTED_OPERATION\"``** - see [[UnsupportedOperationError]]\n *\n * **``\"NETWORK_ERROR\"``** - see [[NetworkError]]\n *\n * **``\"SERVER_ERROR\"``** - see [[ServerError]]\n *\n * **``\"TIMEOUT\"``** - see [[TimeoutError]]\n *\n * **``\"BAD_DATA\"``** - see [[BadDataError]]\n *\n * **``\"CANCELLED\"``** - see [[CancelledError]]\n *\n * **Operational Errors**\n *\n * **``\"BUFFER_OVERRUN\"``** - see [[BufferOverrunError]]\n *\n * **``\"NUMERIC_FAULT\"``** - see [[NumericFaultError]]\n *\n * **Argument Errors**\n *\n * **``\"INVALID_ARGUMENT\"``** - see [[InvalidArgumentError]]\n *\n * **``\"MISSING_ARGUMENT\"``** - see [[MissingArgumentError]]\n *\n * **``\"UNEXPECTED_ARGUMENT\"``** - see [[UnexpectedArgumentError]]\n *\n * **``\"VALUE_MISMATCH\"``** - //unused//\n *\n * **Blockchain Errors**\n *\n * **``\"CALL_EXCEPTION\"``** - see [[CallExceptionError]]\n *\n * **``\"INSUFFICIENT_FUNDS\"``** - see [[InsufficientFundsError]]\n *\n * **``\"NONCE_EXPIRED\"``** - see [[NonceExpiredError]]\n *\n * **``\"REPLACEMENT_UNDERPRICED\"``** - see [[ReplacementUnderpricedError]]\n *\n * **``\"TRANSACTION_REPLACED\"``** - see [[TransactionReplacedError]]\n *\n * **``\"UNCONFIGURED_NAME\"``** - see [[UnconfiguredNameError]]\n *\n * **``\"OFFCHAIN_FAULT\"``** - see [[OffchainFaultError]]\n *\n * **User Interaction Errors**\n *\n * **``\"ACTION_REJECTED\"``** - see [[ActionRejectedError]]\n */\nexport type ErrorCode =\n\n // Generic Errors\n \"UNKNOWN_ERROR\" | \"NOT_IMPLEMENTED\" | \"UNSUPPORTED_OPERATION\" |\n \"NETWORK_ERROR\" | \"SERVER_ERROR\" | \"TIMEOUT\" | \"BAD_DATA\" |\n \"CANCELLED\" |\n\n // Operational Errors\n \"BUFFER_OVERRUN\" | \"NUMERIC_FAULT\" |\n\n // Argument Errors\n \"INVALID_ARGUMENT\" | \"MISSING_ARGUMENT\" | \"UNEXPECTED_ARGUMENT\" |\n \"VALUE_MISMATCH\" |\n\n // Blockchain Errors\n \"CALL_EXCEPTION\" | \"INSUFFICIENT_FUNDS\" | \"NONCE_EXPIRED\" |\n \"REPLACEMENT_UNDERPRICED\" | \"TRANSACTION_REPLACED\" |\n \"UNCONFIGURED_NAME\" | \"OFFCHAIN_FAULT\" |\n\n // User Interaction\n \"ACTION_REJECTED\"\n;\n\n/**\n * All errors in Ethers include properties to assist in\n * machine-readable errors.\n */\nexport interface EthersError<T extends ErrorCode = ErrorCode> extends Error {\n /**\n * The string error code.\n */\n code: ErrorCode;\n\n /**\n * A short message describing the error, with minimal additional\n * details.\n */\n shortMessage: string;\n\n /**\n * Additional info regarding the error that may be useful.\n *\n * This is generally helpful mostly for human-based debugging.\n */\n info?: Record<string, any>;\n\n /**\n * Any related error.\n */\n error?: Error;\n}\n\n// Generic Errors\n\n/**\n * This Error is a catch-all for when there is no way for Ethers to\n * know what the underlying problem is.\n */\nexport interface UnknownError extends EthersError<\"UNKNOWN_ERROR\"> {\n [ key: string ]: any;\n}\n\n/**\n * This Error is mostly used as a stub for functionality that is\n * intended for the future, but is currently not implemented.\n */\nexport interface NotImplementedError extends EthersError<\"NOT_IMPLEMENTED\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n}\n\n/**\n * This Error indicates that the attempted operation is not supported.\n *\n * This could range from a specific JSON-RPC end-point not supporting\n * a feature to a specific configuration of an object prohibiting the\n * operation.\n *\n * For example, a [[Wallet]] with no connected [[Provider]] is unable\n * to send a transaction.\n */\nexport interface UnsupportedOperationError extends EthersError<\"UNSUPPORTED_OPERATION\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n}\n\n/**\n * This Error indicates a problem connecting to a network.\n */\nexport interface NetworkError extends EthersError<\"NETWORK_ERROR\"> {\n /**\n * The network event.\n */\n event: string;\n}\n\n/**\n * This Error indicates there was a problem fetching a resource from\n * a server.\n */\nexport interface ServerError extends EthersError<\"SERVER_ERROR\"> {\n /**\n * The requested resource.\n */\n request: FetchRequest | string;\n\n /**\n * The response received from the server, if available.\n */\n response?: FetchResponse;\n}\n\n/**\n * This Error indicates that the timeout duration has expired and\n * that the operation has been implicitly cancelled.\n *\n * The side-effect of the operation may still occur, as this\n * generally means a request has been sent and there has simply\n * been no response to indicate whether it was processed or not.\n */\nexport interface TimeoutError extends EthersError<\"TIMEOUT\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n\n /**\n * The reason.\n */\n reason: string;\n\n /**\n * The resource request, if available.\n */\n request?: FetchRequest;\n}\n\n/**\n * This Error indicates that a provided set of data cannot\n * be correctly interpreted.\n */\nexport interface BadDataError extends EthersError<\"BAD_DATA\"> {\n /**\n * The data.\n */\n value: any;\n}\n\n/**\n * This Error indicates that the operation was cancelled by a\n * programmatic call, for example to ``cancel()``.\n */\nexport interface CancelledError extends EthersError<\"CANCELLED\"> {\n}\n\n\n// Operational Errors\n\n/**\n * This Error indicates an attempt was made to read outside the bounds\n * of protected data.\n *\n * Most operations in Ethers are protected by bounds checks, to mitigate\n * exploits when parsing data.\n */\nexport interface BufferOverrunError extends EthersError<\"BUFFER_OVERRUN\"> {\n /**\n * The buffer that was overrun.\n */\n buffer: Uint8Array;\n\n /**\n * The length of the buffer.\n */\n length: number;\n\n /**\n * The offset that was requested.\n */\n offset: number;\n}\n\n/**\n * This Error indicates an operation which would result in incorrect\n * arithmetic output has occurred.\n *\n * For example, trying to divide by zero or using a ``uint8`` to store\n * a negative value.\n */\nexport interface NumericFaultError extends EthersError<\"NUMERIC_FAULT\"> {\n /**\n * The attempted operation.\n */\n operation: string;\n\n /**\n * The fault reported.\n */\n fault: string;\n\n /**\n * The value the operation was attempted against.\n */\n value: any;\n}\n\n\n// Argument Errors\n\n/**\n * This Error indicates an incorrect type or value was passed to\n * a function or method.\n */\nexport interface InvalidArgumentError extends EthersError<\"INVALID_ARGUMENT\"> {\n /**\n * The name of the argument.\n */\n argument: string;\n\n /**\n * The value that was provided.\n */\n value: any;\n\n info?: Record<string, any>\n}\n\n/**\n * This Error indicates there were too few arguments were provided.\n */\nexport interface MissingArgumentError extends EthersError<\"MISSING_ARGUMENT\"> {\n /**\n * The number of arguments received.\n */\n count: number;\n\n /**\n * The number of arguments expected.\n */\n expectedCount: number;\n}\n\n/**\n * This Error indicates too many arguments were provided.\n */\nexport interface UnexpectedArgumentError extends EthersError<\"UNEXPECTED_ARGUMENT\"> {\n /**\n * The number of arguments received.\n */\n count: number;\n\n /**\n * The number of arguments expected.\n */\n expectedCount: number;\n}\n\n\n// Blockchain Errors\n\n/**\n * The action that resulted in the call exception.\n */\nexport type CallExceptionAction = \"call\" | \"estimateGas\" | \"getTransactionResult\" | \"sendTransaction\" | \"unknown\";\n\n/**\n * The related transaction that caused the error.\n */\nexport type CallExceptionTransaction = {\n to: null | string;\n from?: string;\n data: string;\n};\n\n/**\n * This **Error** indicates a transaction reverted.\n */\nexport interface CallExceptionError extends EthersError<\"CALL_EXCEPTION\"> {\n\n /**\n * The action being performed when the revert was encountered.\n */\n action: CallExceptionAction;\n\n /**\n * The revert data returned.\n */\n data: null | string;\n\n /**\n * A human-readable representation of data, if possible.\n */\n reason: null | string;\n\n /**\n * The transaction that triggered the exception.\n */\n transaction: CallExceptionTransaction,\n\n /**\n * The contract invocation details, if available.\n */\n invocation: null | {\n method: string;\n signature: string;\n args: Array<any>;\n }\n\n /**\n * The built-in or custom revert error, if available\n */\n revert: null | {\n signature: string;\n name: string;\n args: Array<any>;\n }\n\n /**\n * If the error occurred in a transaction that was mined\n * (with a status of ``0``), this is the receipt.\n */\n receipt?: TransactionReceipt; // @TODO: in v7, make this `null | TransactionReceipt`\n}\n\n\n/**\n * The sending account has insufficient funds to cover the\n * entire transaction cost.\n */\nexport interface InsufficientFundsError extends EthersError<\"INSUFFICIENT_FUNDS\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * The sending account has already used this nonce in a\n * transaction that has been included.\n */\nexport interface NonceExpiredError extends EthersError<\"NONCE_EXPIRED\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * A CCIP-read exception, which cannot be recovered from or\n * be further processed.\n */\nexport interface OffchainFaultError extends EthersError<\"OFFCHAIN_FAULT\"> {\n /**\n * The transaction.\n */\n transaction?: TransactionRequest;\n\n /**\n * The reason the CCIP-read failed.\n */\n reason: string;\n}\n\n/**\n * An attempt was made to replace a transaction, but with an\n * insufficient additional fee to afford evicting the old\n * transaction from the memory pool.\n */\nexport interface ReplacementUnderpricedError extends EthersError<\"REPLACEMENT_UNDERPRICED\"> {\n /**\n * The transaction.\n */\n transaction: TransactionRequest;\n}\n\n/**\n * A pending transaction was replaced by another.\n */\nexport interface TransactionReplacedError extends EthersError<\"TRANSACTION_REPLACED\"> {\n /**\n * If the transaction was cancelled, such that the original\n * effects of the transaction cannot be assured.\n */\n cancelled: boolean;\n\n /**\n * The reason the transaction was replaced.\n */\n reason: \"repriced\" | \"cancelled\" | \"replaced\";\n\n /**\n * The hash of the replaced transaction.\n */\n hash: string;\n\n /**\n * The transaction that replaced the transaction.\n */\n replacement: TransactionResponse;\n\n /**\n * The receipt of the transaction that replace the transaction.\n */\n receipt: TransactionReceipt;\n}\n\n/**\n * This Error indicates an ENS name was used, but the name has not\n * been configured.\n *\n * This could indicate an ENS name is unowned or that the current\n * address being pointed to is the [[ZeroAddress]].\n */\nexport interface UnconfiguredNameError extends EthersError<\"UNCONFIGURED_NAME\"> {\n /**\n * The ENS name that was requested\n */\n value: string;\n}\n\n/**\n * This Error indicates a request was rejected by the user.\n *\n * In most clients (such as MetaMask), when an operation requires user\n * authorization (such as ``signer.sendTransaction``), the client\n * presents a dialog box to the user. If the user denies the request\n * this error is thrown.\n */\nexport interface ActionRejectedError extends EthersError<\"ACTION_REJECTED\"> {\n /**\n * The requested action.\n */\n action: \"requestAccess\" | \"sendTransaction\" | \"signMessage\" | \"signTransaction\" | \"signTypedData\" | \"unknown\",\n\n /**\n * The reason the action was rejected.\n *\n * If there is already a pending request, some clients may indicate\n * there is already a ``\"pending\"`` action. This prevents an app\n * from spamming the user.\n */\n reason: \"expired\" | \"rejected\" | \"pending\"\n}\n\n// Coding; converts an ErrorCode its Typed Error\n\n/**\n * A conditional type that transforms the [[ErrorCode]] T into\n * its EthersError type.\n *\n * @flatworm-skip-docs\n */\nexport type CodedEthersError<T> =\n T extends \"UNKNOWN_ERROR\" ? UnknownError:\n T extends \"NOT_IMPLEMENTED\" ? NotImplementedError:\n T extends \"UNSUPPORTED_OPERATION\" ? UnsupportedOperationError:\n T extends \"NETWORK_ERROR\" ? NetworkError:\n T extends \"SERVER_ERROR\" ? ServerError:\n T extends \"TIMEOUT\" ? TimeoutError:\n T extends \"BAD_DATA\" ? BadDataError:\n T extends \"CANCELLED\" ? CancelledError:\n\n T extends \"BUFFER_OVERRUN\" ? BufferOverrunError:\n T extends \"NUMERIC_FAULT\" ? NumericFaultError:\n\n T extends \"INVALID_ARGUMENT\" ? InvalidArgumentError:\n T extends \"MISSING_ARGUMENT\" ? MissingArgumentError:\n T extends \"UNEXPECTED_ARGUMENT\" ? UnexpectedArgumentError:\n\n T extends \"CALL_EXCEPTION\" ? CallExceptionError:\n T extends \"INSUFFICIENT_FUNDS\" ? InsufficientFundsError:\n T extends \"NONCE_EXPIRED\" ? NonceExpiredError:\n T extends \"OFFCHAIN_FAULT\" ? OffchainFaultError:\n T extends \"REPLACEMENT_UNDERPRICED\" ? ReplacementUnderpricedError:\n T extends \"TRANSACTION_REPLACED\" ? TransactionReplacedError:\n T extends \"UNCONFIGURED_NAME\" ? UnconfiguredNameError:\n\n T extends \"ACTION_REJECTED\" ? ActionRejectedError:\n\n never;\n\n\n\n/**\n * Returns true if the %%error%% matches an error thrown by ethers\n * that matches the error %%code%%.\n *\n * In TypeScript environments, this can be used to check that %%error%%\n * matches an EthersError type, which means the expected properties will\n * be set.\n *\n * @See [ErrorCodes](api:ErrorCode)\n * @example\n * try {\n * // code....\n * } catch (e) {\n * if (isError(e, \"CALL_EXCEPTION\")) {\n * // The Type Guard has validated this object\n * console.log(e.data);\n * }\n * }\n */\nexport function isError<K extends ErrorCode, T extends CodedEthersError<K>>(error: any, code: K): error is T {\n return (error && (<EthersError>error).code === code);\n}\n\n/**\n * Returns true if %%error%% is a [[CallExceptionError].\n */\nexport function isCallException(error: any): error is CallExceptionError {\n return isError(error, \"CALL_EXCEPTION\");\n}\n\n/**\n * Returns a new Error configured to the format ethers emits errors, with\n * the %%message%%, [[api:ErrorCode]] %%code%% and additional properties\n * for the corresponding EthersError.\n *\n * Each error in ethers includes the version of ethers, a\n * machine-readable [[ErrorCode]], and depending on %%code%%, additional\n * required properties. The error message will also include the %%message%%,\n * ethers version, %%code%% and all additional properties, serialized.\n */\nexport function makeError<K extends ErrorCode, T extends CodedEthersError<K>>(message: string, code: K, info?: ErrorInfo<T>): T {\n let shortMessage = message;\n\n {\n const details: Array<string> = [];\n if (info) {\n if (\"message\" in info || \"code\" in info || \"name\" in info) {\n throw new Error(`value will overwrite populated values: ${ stringify(info) }`);\n }\n for (const key in info) {\n if (key === \"shortMessage\") { continue; }\n const value = <any>(info[<keyof ErrorInfo<T>>key]);\n// try {\n details.push(key + \"=\" + stringify(value));\n// } catch (error: any) {\n// console.log(\"MMM\", error.message);\n// details.push(key + \"=[could not serialize object]\");\n// }\n }\n }\n details.push(`code=${ code }`);\n details.push(`version=${ version }`);\n\n if (details.length) {\n message += \" (\" + details.join(\", \") + \")\";\n }\n }\n\n let error;\n switch (code) {\n case \"INVALID_ARGUMENT\":\n error = new TypeError(message);\n break;\n case \"NUMERIC_FAULT\":\n case \"BUFFER_OVERRUN\":\n error = new RangeError(message);\n break;\n default:\n error = new Error(message);\n }\n\n defineProperties<EthersError>(<EthersError>error, { code });\n\n if (info) { Object.assign(error, info); }\n\n if ((<any>error).shortMessage == null) {\n defineProperties<EthersError>(<EthersError>error, { shortMessage });\n }\n\n return <T>error;\n}\n\n/**\n * Throws an EthersError with %%message%%, %%code%% and additional error\n * %%info%% when %%check%% is falsish..\n *\n * @see [[api:makeError]]\n */\nexport function assert<K extends ErrorCode, T extends CodedEthersError<K>>(check: unknown, message: string, code: K, info?: ErrorInfo<T>): asserts check {\n if (!check) { throw makeError(message, code, info); }\n}\n\n\n/**\n * A simple helper to simply ensuring provided arguments match expected\n * constraints, throwing if not.\n *\n * In TypeScript environments, the %%check%% has been asserted true, so\n * any further code does not need additional compile-time checks.\n */\nexport function assertArgument(check: unknown, message: string, name: string, value: unknown): asserts check {\n assert(check, message, \"INVALID_ARGUMENT\", { argument: name, value: value });\n}\n\nexport function assertArgumentCount(count: number, expectedCount: number, message?: string): void {\n if (message == null) { message = \"\"; }\n if (message) { message = \": \" + message; }\n\n assert(count >= expectedCount, \"missing arguemnt\" + message, \"MISSING_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n\n assert(count <= expectedCount, \"too many arguments\" + message, \"UNEXPECTED_ARGUMENT\", {\n count: count,\n expectedCount: expectedCount\n });\n}\n\nconst _normalizeForms = [\"NFD\", \"NFC\", \"NFKD\", \"NFKC\"].reduce((accum, form) => {\n try {\n // General test for normalize\n /* c8 ignore start */\n if (\"test\".normalize(form) !== \"test\") { throw new Error(\"bad\"); };\n /* c8 ignore stop */\n\n if (form === \"NFD\") {\n const check = String.fromCharCode(0xe9).normalize(\"NFD\");\n const expected = String.fromCharCode(0x65, 0x0301)\n /* c8 ignore start */\n if (check !== expected) { throw new Error(\"broken\") }\n /* c8 ignore stop */\n }\n\n accum.push(form);\n } catch(error) { }\n\n return accum;\n}, <Array<string>>[]);\n\n/**\n * Throws if the normalization %%form%% is not supported.\n */\nexport function assertNormalize(form: string): void {\n assert(_normalizeForms.indexOf(form) >= 0, \"platform missing String.prototype.normalize\", \"UNSUPPORTED_OPERATION\", {\n operation: \"String.prototype.normalize\", info: { form }\n });\n}\n\n/**\n * Many classes use file-scoped values to guard the constructor,\n * making it effectively private. This facilitates that pattern\n * by ensuring the %%givenGaurd%% matches the file-scoped %%guard%%,\n * throwing if not, indicating the %%className%% if provided.\n */\nexport function assertPrivate(givenGuard: any, guard: any, className?: string): void {\n if (className == null) { className = \"\"; }\n if (givenGuard !== guard) {\n let method = className, operation = \"new\";\n if (className) {\n method += \".\";\n operation += \" \" + className;\n }\n assert(false, `private constructor; use ${ method }from* methods`, \"UNSUPPORTED_OPERATION\", {\n operation\n });\n }\n}\n","/**\n * Some data helpers.\n *\n *\n * @_subsection api/utils:Data Helpers [about-data]\n */\nimport { assert, assertArgument } from \"./errors.js\";\n\n/**\n * A [[HexString]] whose length is even, which ensures it is a valid\n * representation of binary data.\n */\nexport type DataHexString = string;\n\n/**\n * A string which is prefixed with ``0x`` and followed by any number\n * of case-agnostic hexadecimal characters.\n *\n * It must match the regular expression ``/0x[0-9A-Fa-f]*\\/``.\n */\nexport type HexString = string;\n\n/**\n * An object that can be used to represent binary data.\n */\nexport type BytesLike = DataHexString | Uint8Array;\n\nfunction _getBytes(value: BytesLike, name?: string, copy?: boolean): Uint8Array {\n if (value instanceof Uint8Array) {\n if (copy) { return new Uint8Array(value); }\n return value;\n }\n\n if (typeof(value) === \"string\" && value.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)) {\n const result = new Uint8Array((value.length - 2) / 2);\n let offset = 2;\n for (let i = 0; i < result.length; i++) {\n result[i] = parseInt(value.substring(offset, offset + 2), 16);\n offset += 2;\n }\n return result;\n }\n\n assertArgument(false, \"invalid BytesLike value\", name || \"value\", value);\n}\n\n/**\n * Get a typed Uint8Array for %%value%%. If already a Uint8Array\n * the original %%value%% is returned; if a copy is required use\n * [[getBytesCopy]].\n *\n * @see: getBytesCopy\n */\nexport function getBytes(value: BytesLike, name?: string): Uint8Array {\n return _getBytes(value, name, false);\n}\n\n/**\n * Get a typed Uint8Array for %%value%%, creating a copy if necessary\n * to prevent any modifications of the returned value from being\n * reflected elsewhere.\n *\n * @see: getBytes\n */\nexport function getBytesCopy(value: BytesLike, name?: string): Uint8Array {\n return _getBytes(value, name, true);\n}\n\n\n/**\n * Returns true if %%value%% is a valid [[HexString]].\n *\n * If %%length%% is ``true`` or a //number//, it also checks that\n * %%value%% is a valid [[DataHexString]] of %%length%% (if a //number//)\n * bytes of data (e.g. ``0x1234`` is 2 bytes).\n */\nexport function isHexString(value: any, length?: number | boolean): value is `0x${ string }` {\n if (typeof(value) !== \"string\" || !value.match(/^0x[0-9A-Fa-f]*$/)) {\n return false\n }\n\n if (typeof(length) === \"number\" && value.length !== 2 + 2 * length) { return false; }\n if (length === true && (value.length % 2) !== 0) { return false; }\n\n return true;\n}\n\n/**\n * Returns true if %%value%% is a valid representation of arbitrary\n * data (i.e. a valid [[DataHexString]] or a Uint8Array).\n */\nexport function isBytesLike(value: any): value is BytesLike {\n return (isHexString(value, true) || (value instanceof Uint8Array));\n}\n\nconst HexCharacters: string = \"0123456789abcdef\";\n\n/**\n * Returns a [[DataHexString]] representation of %%data%%.\n */\nexport function hexlify(data: BytesLike): string {\n const bytes = getBytes(data);\n\n let result = \"0x\";\n for (let i = 0; i < bytes.length; i++) {\n const v = bytes[i];\n result += HexCharacters[(v & 0xf0) >> 4] + HexCharacters[v & 0x0f];\n }\n return result;\n}\n\n/**\n * Returns a [[DataHexString]] by concatenating all values\n * within %%data%%.\n */\nexport function concat(datas: ReadonlyArray<BytesLike>): string {\n return \"0x\" + datas.map((d) => hexlify(d).substring(2)).join(\"\");\n}\n\n/**\n * Returns the length of %%data%%, in bytes.\n */\nexport function dataLength(data: BytesLike): number {\n if (isHexString(data, true)) { return (data.length - 2) / 2; }\n return getBytes(data).length;\n}\n\n/**\n * Returns a [[DataHexString]] by slicing %%data%% from the %%start%%\n * offset to the %%end%% offset.\n *\n * By default %%start%% is 0 and %%end%% is the length of %%data%%.\n */\nexport function dataSlice(data: BytesLike, start?: number, end?: number): string {\n const bytes = getBytes(data);\n if (end != null && end > bytes.length) {\n assert(false, \"cannot slice beyond data bounds\", \"BUFFER_OVERRUN\", {\n buffer: bytes, length: bytes.length, offset: end\n });\n }\n return hexlify(bytes.slice((start == null) ? 0: start, (end == null) ? bytes.length: end));\n}\n\n/**\n * Return the [[DataHexString]] result by stripping all **leading**\n ** zero bytes from %%data%%.\n */\nexport function stripZerosLeft(data: BytesLike): string {\n let bytes = hexlify(data).substring(2);\n while (bytes.startsWith(\"00\")) { bytes = bytes.substring(2); }\n return \"0x\" + bytes;\n}\n\nfunction zeroPad(data: BytesLike, length: number, left: boolean): string {\n const bytes = getBytes(data);\n assert(length >= bytes.length, \"padding exceeds data length\", \"BUFFER_OVERRUN\", {\n buffer: new Uint8Array(bytes),\n length: length,\n offset: length + 1\n });\n\n const result = new Uint8Array(length);\n result.fill(0);\n if (left) {\n result.set(bytes, length - bytes.length);\n } else {\n result.set(bytes, 0);\n }\n\n return hexlify(result);\n}\n\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **left**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **values** are in Solidity\n * (e.g. ``uint128``).\n */\nexport function zeroPadValue(data: BytesLike, length: number): string {\n return zeroPad(data, length, true);\n}\n\n/**\n * Return the [[DataHexString]] of %%data%% padded on the **right**\n * to %%length%% bytes.\n *\n * If %%data%% already exceeds %%length%%, a [[BufferOverrunError]] is\n * thrown.\n *\n * This pads data the same as **bytes** are in Solidity\n * (e.g. ``bytes16``).\n */\nexport function zeroPadBytes(data: BytesLike, length: number): string {\n return zeroPad(data, length, false);\n}\n","/**\n * Some mathematic operations.\n *\n * @_subsection: api/utils:Math Helpers [about-maths]\n */\nimport { hexlify, isBytesLike } from \"./data.js\";\nimport { assert, assertArgument } from \"./errors.js\";\n\nimport type { BytesLike } from \"./data.js\";\n\n/**\n * Any type that can be used where a numeric value is needed.\n */\nexport type Numeric = number | bigint;\n\n/**\n * Any type that can be used where a big number is needed.\n */\nexport type BigNumberish = string | Numeric;\n\n\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\n\n//const BN_Max256 = (BN_1 << BigInt(256)) - BN_1;\n\n\n// IEEE 754 support 53-bits of mantissa\nconst maxValue = 0x1fffffffffffff;\n\n/**\n * Convert %%value%% from a twos-compliment representation of %%width%%\n * bits to its value.\n *\n * If the highest bit is ``1``, the result will be negative.\n */\nexport function fromTwos(_value: BigNumberish, _width: Numeric): bigint {\n const value = getUint(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n\n assert((value >> width) === BN_0, \"overflow\", \"NUMERIC_FAULT\", {\n operation: \"fromTwos\", fault: \"overflow\", value: _value\n });\n\n // Top bit set; treat as a negative value\n if (value >> (width - BN_1)) {\n const mask = (BN_1 << width) - BN_1;\n return -(((~value) & mask) + BN_1);\n }\n\n return value;\n}\n\n/**\n * Convert %%value%% to a twos-compliment representation of\n * %%width%% bits.\n *\n * The result will always be positive.\n */\nexport function toTwos(_value: BigNumberish, _width: Numeric): bigint {\n let value = getBigInt(_value, \"value\");\n const width = BigInt(getNumber(_width, \"width\"));\n\n const limit = (BN_1 << (width - BN_1));\n\n if (value < BN_0) {\n value = -value;\n assert(value <= limit, \"too low\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n const mask = (BN_1 << width) - BN_1;\n return ((~value) & mask) + BN_1;\n } else {\n assert(value < limit, \"too high\", \"NUMERIC_FAULT\", {\n operation: \"toTwos\", fault: \"overflow\", value: _value\n });\n }\n\n return value;\n}\n\n/**\n * Mask %%value%% with a bitmask of %%bits%% ones.\n */\nexport function mask(_value: BigNumberish, _bits: Numeric): bigint {\n const value = getUint(_value, \"value\");\n const bits = BigInt(getNumber(_bits, \"bits\"));\n return value & ((BN_1 << bits) - BN_1);\n}\n\n/**\n * Gets a BigInt from %%value%%. If it is an invalid value for\n * a BigInt, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getBigInt(value: BigNumberish, name?: string): bigint {\n switch (typeof(value)) {\n case \"bigint\": return value;\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return BigInt(value);\n case \"string\":\n try {\n if (value === \"\") { throw new Error(\"empty string\"); }\n if (value[0] === \"-\" && value[1] !== \"-\") {\n return -BigInt(value.substring(1));\n }\n return BigInt(value);\n } catch(e: any) {\n assertArgument(false, `invalid BigNumberish string: ${ e.message }`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid BigNumberish value\", name || \"value\", value);\n}\n\n/**\n * Returns %%value%% as a bigint, validating it is valid as a bigint\n * value and that it is positive.\n */\nexport function getUint(value: BigNumberish, name?: string): bigint {\n const result = getBigInt(value, name);\n assert(result >= BN_0, \"unsigned value cannot be negative\", \"NUMERIC_FAULT\", {\n fault: \"overflow\", operation: \"getUint\", value\n });\n return result;\n}\n\nconst Nibbles = \"0123456789abcdef\";\n\n/*\n * Converts %%value%% to a BigInt. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data.\n */\nexport function toBigInt(value: BigNumberish | Uint8Array): bigint {\n if (value instanceof Uint8Array) {\n let result = \"0x0\";\n for (const v of value) {\n result += Nibbles[v >> 4];\n result += Nibbles[v & 0x0f];\n }\n return BigInt(result);\n }\n\n return getBigInt(value);\n}\n\n/**\n * Gets a //number// from %%value%%. If it is an invalid value for\n * a //number//, then an ArgumentError will be thrown for %%name%%.\n */\nexport function getNumber(value: BigNumberish, name?: string): number {\n switch (typeof(value)) {\n case \"bigint\":\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return Number(value);\n case \"number\":\n assertArgument(Number.isInteger(value), \"underflow\", name || \"value\", value);\n assertArgument(value >= -maxValue && value <= maxValue, \"overflow\", name || \"value\", value);\n return value;\n case \"string\":\n try {\n if (value === \"\") { throw new Error(\"empty string\"); }\n return getNumber(BigInt(value), name);\n } catch(e: any) {\n assertArgument(false, `invalid numeric string: ${ e.message }`, name || \"value\", value);\n }\n }\n assertArgument(false, \"invalid numeric value\", name || \"value\", value);\n}\n\n\n/**\n * Converts %%value%% to a number. If %%value%% is a Uint8Array, it\n * is treated as Big Endian data. Throws if the value is not safe.\n */\nexport function toNumber(value: BigNumberish | Uint8Array): number {\n return getNumber(toBigInt(value));\n}\n\n/**\n * Converts %%value%% to a Big Endian hexstring, optionally padded to\n * %%width%% bytes.\n */\nexport function toBeHex(_value: BigNumberish, _width?: Numeric): string {\n const value = getUint(_value, \"value\");\n\n let result = value.toString(16);\n\n if (_width == null) {\n // Ensure the value is of even length\n if (result.length % 2) { result = \"0\" + result; }\n } else {\n const width = getNumber(_width, \"width\");\n assert(width * 2 >= result.length, `value exceeds width (${ width } bytes)`, \"NUMERIC_FAULT\", {\n operation: \"toBeHex\",\n fault: \"overflow\",\n value: _value\n });\n\n // Pad the value to the required width\n while (result.length < (width * 2)) { result = \"0\" + result; }\n\n }\n\n return \"0x\" + result;\n}\n\n/**\n * Converts %%value%% to a Big Endian Uint8Array.\n */\nexport function toBeArray(_value: BigNumberish): Uint8Array {\n const value = getUint(_value, \"value\");\n\n if (value === BN_0) { return new Uint8Array([ ]); }\n\n let hex = value.toString(16);\n if (hex.length % 2) { hex = \"0\" + hex; }\n\n const result = new Uint8Array(hex.length / 2);\n for (let i = 0; i < result.length; i++) {\n const offset = i * 2;\n result[i] = parseInt(hex.substring(offset, offset + 2), 16);\n }\n\n return result;\n}\n\n/**\n * Returns a [[HexString]] for %%value%% safe to use as a //Quantity//.\n *\n * A //Quantity// does not have and leading 0 values unless the value is\n * the literal value `0x0`. This is most commonly used for JSSON-RPC\n * numeric values.\n */\nexport function toQuantity(value: BytesLike | BigNumberish): string {\n let result = hexlify(isBytesLike(value) ? value: toBeArray(value)).substring(2);\n while (result.startsWith(\"0\")) { result = result.substring(1); }\n if (result === \"\") { result = \"0\"; }\n return \"0x\" + result;\n}\n","/**\n * Events allow for applications to use the observer pattern, which\n * allows subscribing and publishing events, outside the normal\n * execution paths.\n *\n * @_section api/utils/events:Events [about-events]\n */\nimport { defineProperties } from \"./properties.js\";\n\n/**\n * A callback function called when a an event is triggered.\n */\nexport type Listener = (...args: Array<any>) => void;\n\n/**\n * An **EventEmitterable** behaves similar to an EventEmitter\n * except provides async access to its methods.\n *\n * An EventEmitter implements the observer pattern.\n */\nexport interface EventEmitterable<T> {\n /**\n * Registers a %%listener%% that is called whenever the\n * %%event%% occurs until unregistered.\n */\n on(event: T, listener: Listener): Promise<this>;\n\n /**\n * Registers a %%listener%% that is called the next time\n * %%event%% occurs.\n */\n once(event: T, listener: Listener): Promise<this>;\n\n /**\n * Triggers each listener for %%event%% with the %%args%%.\n */\n emit(event: T, ...args: Array<any>): Promise<boolean>;\n\n /**\n * Resolves to the number of listeners for %%event%%.\n */\n listenerCount(event?: T): Promise<number>;\n\n /**\n * Resolves to the listeners for %%event%%.\n */\n listeners(event?: T): Promise<Array<Listener>>;\n\n /**\n * Unregister the %%listener%% for %%event%%. If %%listener%%\n * is unspecified, all listeners are unregistered.\n */\n off(event: T, listener?: Listener): Promise<this>;\n\n /**\n * Unregister all listeners for %%event%%.\n */\n removeAllListeners(event?: T): Promise<this>;\n\n /**\n * Alias for [[on]].\n */\n addListener(event: T, listener: Listener): Promise<this>;\n\n /**\n * Alias for [[off]].\n */\n removeListener(event: T, listener: Listener): Promise<this>;\n}\n\n/**\n * When an [[EventEmitterable]] triggers a [[Listener]], the\n * callback always ahas one additional argument passed, which is\n * an **EventPayload**.\n */\nexport class EventPayload<T> {\n /**\n * The event filter.\n */\n readonly filter!: T;\n\n /**\n * The **EventEmitterable**.\n */\n readonly emitter!: EventEmitterable<T>;\n\n readonly #listener: null | Listener;\n\n /**\n * Create a new **EventPayload** for %%emitter%% with\n * the %%listener%% and for %%filter%%.\n */\n constructor(emitter: EventEmitterable<T>, listener: null | Listener, filter: T) {\n this.#listener = listener;\n defineProperties<EventPayload<any>>(this, { emitter, filter });\n }\n\n /**\n * Unregister the triggered listener for future events.\n */\n async removeListener(): Promise<void> {\n if (this.#listener == null) { return; }\n await this.emitter.off(this.filter, this.#listener);\n }\n}\n","/**\n * Using strings in Ethereum (or any security-basd system) requires\n * additional care. These utilities attempt to mitigate some of the\n * safety issues as well as provide the ability to recover and analyse\n * strings.\n *\n * @_subsection api/utils:Strings and UTF-8 [about-strings]\n */\nimport { getBytes } from \"./data.js\";\nimport { assertArgument, assertNormalize } from \"./errors.js\";\n\nimport type { BytesLike } from \"./index.js\";\n\n\n///////////////////////////////\n\n/**\n * The stanard normalization forms.\n */\nexport type UnicodeNormalizationForm = \"NFC\" | \"NFD\" | \"NFKC\" | \"NFKD\";\n\n/**\n * When using the UTF-8 error API the following errors can be intercepted\n * and processed as the %%reason%% passed to the [[Utf8ErrorFunc]].\n *\n * **``\"UNEXPECTED_CONTINUE\"``** - a continuation byte was present where there\n * was nothing to continue.\n *\n * **``\"BAD_PREFIX\"``** - an invalid (non-continuation) byte to start a\n * UTF-8 codepoint was found.\n *\n * **``\"OVERRUN\"``** - the string is too short to process the expected\n * codepoint length.\n *\n * **``\"MISSING_CONTINUE\"``** - a missing continuation byte was expected but\n * not found. The %%offset%% indicates the index the continuation byte\n * was expected at.\n *\n * **``\"OUT_OF_RANGE\"``** - the computed code point is outside the range\n * for UTF-8. The %%badCodepoint%% indicates the computed codepoint, which was\n * outside the valid UTF-8 range.\n *\n * **``\"UTF16_SURROGATE\"``** - the UTF-8 strings contained a UTF-16 surrogate\n * pair. The %%badCodepoint%% is the computed codepoint, which was inside the\n * UTF-16 surrogate range.\n *\n * **``\"OVERLONG\"``** - the string is an overlong representation. The\n * %%badCodepoint%% indicates the computed codepoint, which has already\n * been bounds checked.\n *\n *\n * @returns string\n */\nexport type Utf8ErrorReason = \"UNEXPECTED_CONTINUE\" | \"BAD_PREFIX\" | \"OVERRUN\" |\n \"MISSING_CONTINUE\" | \"OUT_OF_RANGE\" | \"UTF16_SURROGATE\" | \"OVERLONG\";\n\n\n/**\n * A callback that can be used with [[toUtf8String]] to analysis or\n * recovery from invalid UTF-8 data.\n *\n * Parsing UTF-8 data is done through a simple Finite-State Machine (FSM)\n * which calls the ``Utf8ErrorFunc`` if a fault is detected.\n *\n * The %%reason%% indicates where in the FSM execution the fault\n * occurred and the %%offset%% indicates where the input failed.\n *\n * The %%bytes%% represents the raw UTF-8 data that was provided and\n * %%output%% is the current array of UTF-8 code-points, which may\n * be updated by the ``Utf8ErrorFunc``.\n *\n * The value of the %%badCodepoint%% depends on the %%reason%%. See\n * [[Utf8ErrorReason]] for details.\n *\n * The function should return the number of bytes that should be skipped\n * when control resumes to the FSM.\n */\nexport type Utf8ErrorFunc = (reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array<number>, badCodepoint?: number) => number;\n\n\nfunction errorFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array<number>, badCodepoint?: number): number {\n assertArgument(false, `invalid codepoint at offset ${ offset }; ${ reason }`, \"bytes\", bytes);\n}\n\nfunction ignoreFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array<number>, badCodepoint?: number): number {\n\n // If there is an invalid prefix (including stray continuation), skip any additional continuation bytes\n if (reason === \"BAD_PREFIX\" || reason === \"UNEXPECTED_CONTINUE\") {\n let i = 0;\n for (let o = offset + 1; o < bytes.length; o++) {\n if (bytes[o] >> 6 !== 0x02) { break; }\n i++;\n }\n return i;\n }\n\n // This byte runs us past the end of the string, so just jump to the end\n // (but the first byte was read already read and therefore skipped)\n if (reason === \"OVERRUN\") {\n return bytes.length - offset - 1;\n }\n\n // Nothing to skip\n return 0;\n}\n\nfunction replaceFunc(reason: Utf8ErrorReason, offset: number, bytes: Uint8Array, output: Array<number>, badCodepoint?: number): number {\n\n // Overlong representations are otherwise \"valid\" code points; just non-deistingtished\n if (reason === \"OVERLONG\") {\n assertArgument(typeof(badCodepoint) === \"number\", \"invalid bad code point for replacement\", \"badCodepoint\", badCodepoint);\n output.push(badCodepoint);\n return 0;\n }\n\n // Put the replacement character into the output\n output.push(0xfffd);\n\n // Otherwise, process as if ignoring errors\n return ignoreFunc(reason, offset, bytes, output, badCodepoint);\n}\n\n/**\n * A handful of popular, built-in UTF-8 error handling strategies.\n *\n * **``\"error\"``** - throws on ANY illegal UTF-8 sequence or\n * non-canonical (overlong) codepoints (this is the default)\n *\n * **``\"ignore\"``** - silently drops any illegal UTF-8 sequence\n * and accepts non-canonical (overlong) codepoints\n *\n * **``\"replace\"``** - replace any illegal UTF-8 sequence with the\n * UTF-8 replacement character (i.e. ``\"\\\\ufffd\"``) and accepts\n * non-canonical (overlong) codepoints\n *\n * @returns: Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>\n */\nexport const Utf8ErrorFuncs: Readonly<Record<\"error\" | \"ignore\" | \"replace\", Utf8ErrorFunc>> = Object.freeze({\n error: errorFunc,\n ignore: ignoreFunc,\n replace: replaceFunc\n});\n\n// http://stackoverflow.com/questions/13356493/decode-utf-8-with-javascript#13691499\nfunction getUtf8CodePoints(_bytes: BytesLike, onError?: Utf8ErrorFunc): Array<number> {\n if (onError == null) { onError = Utf8ErrorFuncs.error; }\n\n const bytes = getBytes(_bytes, \"bytes\");\n\n const result: Array<number> = [];\n let i = 0;\n\n // Invalid bytes are ignored\n while(i < bytes.length) {\n\n const c = bytes[i++];\n\n // 0xxx xxxx\n if (c >> 7 === 0) {\n result.push(c);\n continue;\n }\n\n // Multibyte; how many bytes left for this character?\n let extraLength: null | number = null;\n let overlongMask: null | number = null;\n\n // 110x xxxx 10xx xxxx\n if ((c & 0xe0) === 0xc0) {\n extraLength = 1;\n overlongMask = 0x7f;\n\n // 1110 xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf0) === 0xe0) {\n extraLength = 2;\n overlongMask = 0x7ff;\n\n // 1111 0xxx 10xx xxxx 10xx xxxx 10xx xxxx\n } else if ((c & 0xf8) === 0xf0) {\n extraLength = 3;\n overlongMask = 0xffff;\n\n } else {\n if ((c & 0xc0) === 0x80) {\n i += onError(\"UNEXPECTED_CONTINUE\", i - 1, bytes, result);\n } else {\n i += onError(\"BAD_PREFIX\", i - 1, bytes, result);\n }\n continue;\n }\n\n // Do we have enough bytes in our data?\n if (i - 1 + extraLength >= bytes.length) {\n i += onError(\"OVERRUN\", i - 1, bytes, result);\n continue;\n }\n\n // Remove the length prefix from the char\n let res: null | number = c & ((1 << (8 - extraLength - 1)) - 1);\n\n for (let j = 0; j < extraLength; j++) {\n let nextChar = bytes[i];\n\n // Invalid continuation byte\n if ((nextChar & 0xc0) != 0x80) {\n i += onError(\"MISSING_CONTINUE\", i, bytes, result);\n res = null;\n break;\n };\n\n res = (res << 6) | (nextChar & 0x3f);\n i++;\n }\n\n // See above loop for invalid continuation byte\n if (res === null) { continue; }\n\n // Maximum code point\n if (res > 0x10ffff) {\n i += onError(\"OUT_OF_RANGE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Reserved for UTF-16 surrogate halves\n if (res >= 0xd800 && res <= 0xdfff) {\n i += onError(\"UTF16_SURROGATE\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n // Check for overlong sequences (more bytes than needed)\n if (res <= overlongMask) {\n i += onError(\"OVERLONG\", i - 1 - extraLength, bytes, result, res);\n continue;\n }\n\n result.push(res);\n }\n\n return result;\n}\n\n// http://stackoverflow.com/questions/18729405/how-to-convert-utf8-string-to-byte-array\n\n/**\n * Returns the UTF-8 byte representation of %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8Bytes(str: string, form?: UnicodeNormalizationForm): Uint8Array {\n assertArgument(typeof(str) === \"string\", \"invalid string value\", \"str\", str);\n\n if (form != null) {\n assertNormalize(form);\n str = str.normalize(form);\n }\n\n let result: Array<number> = [];\n for (let i = 0; i < str.length; i++) {\n const c = str.charCodeAt(i);\n\n if (c < 0x80) {\n result.push(c);\n\n } else if (c < 0x800) {\n result.push((c >> 6) | 0xc0);\n result.push((c & 0x3f) | 0x80);\n\n } else if ((c & 0xfc00) == 0xd800) {\n i++;\n const c2 = str.charCodeAt(i);\n\n assertArgument(i < str.length && ((c2 & 0xfc00) === 0xdc00),\n \"invalid surrogate pair\", \"str\", str);\n\n // Surrogate Pair\n const pair = 0x10000 + ((c & 0x03ff) << 10) + (c2 & 0x03ff);\n result.push((pair >> 18) | 0xf0);\n result.push(((pair >> 12) & 0x3f) | 0x80);\n result.push(((pair >> 6) & 0x3f) | 0x80);\n result.push((pair & 0x3f) | 0x80);\n\n } else {\n result.push((c >> 12) | 0xe0);\n result.push(((c >> 6) & 0x3f) | 0x80);\n result.push((c & 0x3f) | 0x80);\n }\n }\n\n return new Uint8Array(result);\n};\n\n//export \nfunction _toUtf8String(codePoints: Array<number>): string {\n return codePoints.map((codePoint) => {\n if (codePoint <= 0xffff) {\n return String.fromCharCode(codePoint);\n }\n codePoint -= 0x10000;\n return String.fromCharCode(\n (((codePoint >> 10) & 0x3ff) + 0xd800),\n ((codePoint & 0x3ff) + 0xdc00)\n );\n }).join(\"\");\n}\n\n/**\n * Returns the string represented by the UTF-8 data %%bytes%%.\n *\n * When %%onError%% function is specified, it is called on UTF-8\n * errors allowing recovery using the [[Utf8ErrorFunc]] API.\n * (default: [error](Utf8ErrorFuncs))\n */\nexport function toUtf8String(bytes: BytesLike, onError?: Utf8ErrorFunc): string {\n return _toUtf8String(getUtf8CodePoints(bytes, onError));\n}\n\n/**\n * Returns the UTF-8 code-points for %%str%%.\n *\n * If %%form%% is specified, the string is normalized.\n */\nexport function toUtf8CodePoints(str: string, form?: UnicodeNormalizationForm): Array<number> {\n return getUtf8CodePoints(toUtf8Bytes(str, form));\n}\n\n","//See: https://github.com/ethereum/wiki/wiki/RLP\n\nimport { getBytes } from \"./data.js\";\n\nimport type { RlpStructuredDataish } from \"./rlp.js\";\n\n\nfunction arrayifyInteger(value: number): Array<number> {\n const result: Array<number> = [];\n while (value) {\n result.unshift(value & 0xff);\n value >>= 8;\n }\n return result;\n}\n\nfunction _encode(object: Array<any> | string | Uint8Array): Array<number> {\n if (Array.isArray(object)) {\n let payload: Array<number> = [];\n object.forEach(function(child) {\n payload = payload.concat(_encode(child));\n });\n\n if (payload.length <= 55) {\n payload.unshift(0xc0 + payload.length)\n return payload;\n }\n\n const length = arrayifyInteger(payload.length);\n length.unshift(0xf7 + length.length);\n\n return length.concat(payload);\n\n }\n\n const data: Array<number> = Array.prototype.slice.call(getBytes(object, \"object\"));\n\n if (data.length === 1 && data[0] <= 0x7f) {\n return data;\n\n } else if (data.length <= 55) {\n data.unshift(0x80 + data.length);\n return data;\n }\n\n const length = arrayifyInteger(data.length);\n length.unshift(0xb7 + length.length);\n\n return length.concat(data);\n}\n\nconst nibbles = \"0123456789abcdef\";\n\n/**\n * Encodes %%object%% as an RLP-encoded [[DataHexString]].\n */\nexport function encodeRlp(object: RlpStructuredDataish): string {\n let result = \"0x\";\n for (const v of _encode(object)) {\n result += nibbles[v >> 4];\n result += nibbles[v & 0xf];\n }\n return result;\n}\n","\nimport {\n defineProperties, concat, getBytesCopy, getNumber, hexlify,\n toBeArray, toBigInt, toNumber,\n assert, assertArgument\n /*, isError*/\n} from \"../../utils/index.js\";\n\nimport type { BigNumberish, BytesLike } from \"../../utils/index.js\";\n\n/**\n * @_ignore:\n */\nexport const WordSize: number = 32;\nconst Padding = new Uint8Array(WordSize);\n\n// Properties used to immediate pass through to the underlying object\n// - `then` is used to detect if an object is a Promise for await\nconst passProperties = [ \"then\" ];\n\nconst _guard = { };\n\nconst resultNames: WeakMap<Result, ReadonlyArray<null | string>> = new WeakMap();\n\nfunction getNames(result: Result): ReadonlyArray<null | string> {\n return resultNames.get(result)!;\n}\nfunction setNames(result: Result, names: ReadonlyArray<null | string>): void {\n resultNames.set(result, names);\n}\n\nfunction throwError(name: string, error: Error): never {\n const wrapped = new Error(`deferred error during ABI decoding triggered accessing ${ name }`);\n (<any>wrapped).error = error;\n throw wrapped;\n}\n\nfunction toObject(names: ReadonlyArray<null | string>, items: Result, deep?: boolean): Record<string, any> | Array<any> {\n if (names.indexOf(null) >= 0) {\n return items.map((item, index) => {\n if (item instanceof Result) {\n return toObject(getNames(item), item, deep);\n }\n return item;\n });\n }\n\n return (<Array<string>>names).reduce((accum, name, index) => {\n let item = items.getValue(name);\n if (!(name in accum)) {\n if (deep && item instanceof Result) {\n item = toObject(getNames(item), item, deep);\n }\n accum[name] = item;\n }\n return accum;\n }, <Record<string, any>>{ });\n}\n\n\n/**\n * A [[Result]] is a sub-class of Array, which allows accessing any\n * of its values either positionally by its index or, if keys are\n * provided by its name.\n *\n * @_docloc: api/abi\n */\nexport class Result extends Array<any> {\n // No longer used; but cannot be removed as it will remove the\n // #private field from the .d.ts which may break backwards\n // compatibility\n readonly #names: ReadonlyArray<null | string>;\n\n [ K: string | number ]: any\n\n /**\n * @private\n */\n constructor(...args: Array<any>) {\n // To properly sub-class Array so the other built-in\n // functions work, the constructor has to behave fairly\n // well. So, in the event we are created via fromItems()\n // we build the read-only Result object we want, but on\n // any other input, we use the default constructor\n\n // constructor(guard: any, items: Array<any>, keys?: Array<null | string>);\n const guard = args[0];\n let items: Array<any> = args[1];\n let names: Array<null | string> = (args[2] || [ ]).slice();\n\n let wrap = true;\n if (guard !== _guard) {\n items = args;\n names = [ ];\n wrap = false;\n }\n\n // Can't just pass in ...items since an array of length 1\n // is a special case in the super.\n super(items.length);\n items.forEach((item, index) => { this[index] = item; });\n\n // Find all unique keys\n const nameCounts = names.reduce((accum, name) => {\n if (typeof(name) === \"string\") {\n accum.set(name, (accum.get(name) || 0) + 1);\n }\n return accum;\n }, <Map<string, number>>(new Map()));\n\n // Remove any key thats not unique\n setNames(this, Object.freeze(items.map((item, index) => {\n const name = names[index];\n if (name != null && nameCounts.get(name) === 1) {\n return name;\n }\n return null;\n })));\n\n // Dummy operations to prevent TypeScript from complaining\n this.#names = [ ];\n if (this.#names == null) { void(this.#names); }\n\n if (!wrap) { return; }\n\n // A wrapped Result is immutable\n Object.freeze(this);\n\n // Proxy indices and names so we can trap deferred errors\n const proxy = new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof(prop) === \"string\") {\n\n // Index accessor\n if (prop.match(/^[0-9]+$/)) {\n const index = getNumber(prop, \"%index\");\n if (index < 0 || index >= this.length) {\n throw new RangeError(\"out of result range\");\n }\n\n const item = target[index];\n if (item instanceof Error) {\n throwError(`index ${ index }`, item);\n }\n return item;\n }\n\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n const value = target[prop];\n if (value instanceof Function) {\n // Make sure functions work with private variables\n // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy#no_private_property_forwarding\n return function(this: any, ...args: Array<any>) {\n return value.apply((this === receiver) ? target: this, args);\n };\n\n } else if (!(prop in target)) {\n // Possible name accessor\n return target.getValue.apply((this === receiver) ? target: this, [ prop ]);\n }\n }\n\n return Reflect.get(target, prop, receiver);\n }\n });\n setNames(proxy, getNames(this));\n return proxy;\n }\n\n /**\n * Returns the Result as a normal Array. If %%deep%%, any children\n * which are Result objects are also converted to a normal Array.\n *\n * This will throw if there are any outstanding deferred\n * errors.\n */\n toArray(deep?: boolean): Array<any> {\n const result: Array<any> = [ ];\n this.forEach((item, index) => {\n if (item instanceof Error) { throwError(`index ${ index }`, item); }\n if (deep && item instanceof Result) {\n item = item.toArray(deep);\n }\n result.push(item);\n });\n return result;\n }\n\n /**\n * Returns the Result as an Object with each name-value pair. If\n * %%deep%%, any children which are Result objects are also\n * converted to an Object.\n *\n * This will throw if any value is unnamed, or if there are\n * any outstanding deferred errors.\n */\n toObject(deep?: boolean): Record<string, any> {\n const names = getNames(this);\n return names.reduce((accum, name, index) => {\n\n assert(name != null, `value at index ${ index } unnamed`, \"UNSUPPORTED_OPERATION\", {\n operation: \"toObject()\"\n });\n\n return toObject(names, this, deep);\n }, <Record<string, any>>{});\n }\n\n /**\n * @_ignore\n */\n slice(start?: number | undefined, end?: number | undefined): Result {\n if (start == null) { start = 0; }\n if (start < 0) {\n start += this.length;\n if (start < 0) { start = 0; }\n }\n\n if (end == null) { end = this.length; }\n if (end < 0) {\n end += this.length;\n if (end < 0) { end = 0; }\n }\n if (end > this.length) { end = this.length; }\n\n const _names = getNames(this);\n\n const result: Array<any> = [ ], names: Array<null | string> = [ ];\n for (let i = start; i < end; i++) {\n result.push(this[i]);\n names.push(_names[i]);\n }\n\n return new Result(_guard, result, names);\n }\n\n /**\n * @_ignore\n */\n filter(callback: (el: any, index: number, array: Result) => boolean, thisArg?: any): Result {\n const _names = getNames(this);\n\n const result: Array<any> = [ ], names: Array<null | string> = [ ];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${ i }`, item);\n }\n\n if (callback.call(thisArg, item, i, this)) {\n result.push(item);\n names.push(_names[i]);\n }\n }\n\n return new Result(_guard, result, names);\n }\n\n /**\n * @_ignore\n */\n map<T extends any = any>(callback: (el: any, index: number, array: Result) => T, thisArg?: any): Array<T> {\n const result: Array<T> = [ ];\n for (let i = 0; i < this.length; i++) {\n const item = this[i];\n if (item instanceof Error) {\n throwError(`index ${ i }`, item);\n }\n\n result.push(callback.call(thisArg, item, i, this));\n }\n\n return result;\n }\n\n\n /**\n * Returns the value for %%name%%.\n *\n * Since it is possible to have a key whose name conflicts with\n * a method on a [[Result]] or its superclass Array, or any\n * JavaScript keyword, this ensures all named values are still\n * accessible by name.\n */\n getValue(name: string): any {\n const index = getNames(this).indexOf(name);\n if (index === -1) { return undefined; }\n\n const value = this[index];\n\n if (value instanceof Error) {\n throwError(`property ${ JSON.stringify(name) }`, (<any>value).error);\n }\n\n return value;\n }\n\n /**\n * Creates a new [[Result]] for %%items%% with each entry\n * also accessible by its corresponding name in %%keys%%.\n */\n static fromItems(items: Array<any>, keys?: Array<null | string>): Result {\n return new Result(_guard, items, keys);\n }\n}\n\n/**\n * Returns all errors found in a [[Result]].\n *\n * Since certain errors encountered when creating a [[Result]] do\n * not impact the ability to continue parsing data, they are\n * deferred until they are actually accessed. Hence a faulty string\n * in an Event that is never used does not impact the program flow.\n *\n * However, sometimes it may be useful to access, identify or\n * validate correctness of a [[Result]].\n *\n * @_docloc api/abi\n */\nexport function checkResultErrors(result: Result): Array<{ path: Array<string | number>, error: Error }> {\n // Find the first error (if any)\n const errors: Array<{ path: Array<string | number>, error: Error }> = [ ];\n\n const checkErrors = function(path: Array<string | number>, object: any): void {\n if (!Array.isArray(object)) { return; }\n for (let key in object) {\n const childPath = path.slice();\n childPath.push(key);\n\n try {\n checkErrors(childPath, object[key]);\n } catch (error: any) {\n errors.push({ path: childPath, error: error });\n }\n }\n }\n checkErrors([ ], result);\n\n return errors;\n\n}\n\nfunction getValue(value: BigNumberish): Uint8Array {\n let bytes = toBeArray(value);\n\n assert (bytes.length <= WordSize, \"value out-of-bounds\",\n \"BUFFER_OVERRUN\", { buffer: bytes, length: WordSize, offset: bytes.length });\n\n if (bytes.length !== WordSize) {\n bytes = getBytesCopy(concat([ Padding.slice(bytes.length % WordSize), bytes ]));\n }\n\n return bytes;\n}\n\n/**\n * @_ignore\n */\nexport abstract class Coder {\n\n // The coder name:\n // - address, uint256, tuple, array, etc.\n readonly name!: string;\n\n // The fully expanded type, including composite types:\n // - address, uint256, tuple(address,bytes), uint256[3][4][], etc.\n readonly type!: string;\n\n // The localName bound in the signature, in this example it is \"baz\":\n // - tuple(address foo, uint bar) baz\n readonly localName!: string;\n\n // Whether this type is dynamic:\n // - Dynamic: bytes, string, address[], tuple(boolean[]), etc.\n // - Not Dynamic: address, uint256, boolean[3], tuple(address, uint8)\n readonly dynamic!: boolean;\n\n constructor(name: string, type: string, localName: string, dynamic: boolean) {\n defineProperties<Coder>(this, { name, type, localName, dynamic }, {\n name: \"string\", type: \"string\", localName: \"string\", dynamic: \"boolean\"\n });\n }\n\n _throwError(message: string, value: any): never {\n assertArgument(false, message, this.localName, value);\n }\n\n abstract encode(writer: Writer, value: any): number;\n abstract decode(reader: Reader): any;\n\n abstract defaultValue(): any;\n}\n\n/**\n * @_ignore\n */\nexport class Writer {\n // An array of WordSize lengthed objects to concatenation\n #data: Array<Uint8Array>;\n #dataLength: number;\n\n constructor() {\n this.#data = [ ];\n this.#dataLength = 0;\n }\n\n get data(): string {\n return concat(this.#data);\n }\n get length(): number { return this.#dataLength; }\n\n #writeData(data: Uint8Array): number {\n this.#data.push(data);\n this.#dataLength += data.length;\n return data.length;\n }\n\n appendWriter(writer: Writer): number {\n return this.#writeData(getBytesCopy(writer.data));\n }\n\n // Arrayish item; pad on the right to *nearest* WordSize\n writeBytes(value: BytesLike): number {\n let bytes = getBytesCopy(value);\n const paddingOffset = bytes.length % WordSize;\n if (paddingOffset) {\n bytes = getBytesCopy(concat([ bytes, Padding.slice(paddingOffset) ]))\n }\n return this.#writeData(bytes);\n }\n\n // Numeric item; pad on the left *to* WordSize\n writeValue(value: BigNumberish): number {\n return this.#writeData(getValue(value));\n }\n\n // Inserts a numeric place-holder, returning a callback that can\n // be used to asjust the value later\n writeUpdatableValue(): (value: BigNumberish) => void {\n const offset = this.#data.length;\n this.#data.push(Padding);\n this.#dataLength += WordSize;\n return (value: BigNumberish) => {\n this.#data[offset] = getValue(value);\n };\n }\n}\n\n/**\n * @_ignore\n */\nexport class Reader {\n // Allows incomplete unpadded data to be read; otherwise an error\n // is raised if attempting to overrun the buffer. This is required\n // to deal with an old Solidity bug, in which event data for\n // external (not public thoguh) was tightly packed.\n readonly allowLoose!: boolean;\n\n readonly #data: Uint8Array;\n #offset: number;\n\n #bytesRead: number;\n #parent: null | Reader;\n #maxInflation: number;\n\n constructor(data: BytesLike, allowLoose?: boolean, maxInflation?: number) {\n defineProperties<Reader>(this, { allowLoose: !!allowLoose });\n\n this.#data = getBytesCopy(data);\n this.#bytesRead = 0;\n this.#parent = null;\n this.#maxInflation = (maxInflation != null) ? maxInflation: 1024;\n\n this.#offset = 0;\n }\n\n get data(): string { return hexlify(this.#data); }\n get dataLength(): number { return this.#data.length; }\n get consumed(): number { return this.#offset; }\n get bytes(): Uint8Array { return new Uint8Array(this.#data); }\n\n #incrementBytesRead(count: number): void {\n if (this.#parent) { return this.#parent.#incrementBytesRead(count); }\n\n this.#bytesRead += count;\n\n // Check for excessive inflation (see: #4537)\n assert(this.#maxInflation < 1 || this.#bytesRead <= this.#maxInflation * this.dataLength, `compressed ABI data exceeds inflation ratio of ${ this.#maxInflation } ( see: https:/\\/github.com/ethers-io/ethers.js/issues/4537 )`, \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data), offset: this.#offset,\n length: count, info: {\n bytesRead: this.#bytesRead,\n dataLength: this.dataLength\n }\n });\n }\n\n #peekBytes(offset: number, length: number, loose?: boolean): Uint8Array {\n let alignedLength = Math.ceil(length / WordSize) * WordSize;\n if (this.#offset + alignedLength > this.#data.length) {\n if (this.allowLoose && loose && this.#offset + length <= this.#data.length) {\n alignedLength = length;\n } else {\n assert(false, \"data out-of-bounds\", \"BUFFER_OVERRUN\", {\n buffer: getBytesCopy(this.#data),\n length: this.#data.length,\n offset: this.#offset + alignedLength\n });\n }\n }\n return this.#data.slice(this.#offset, this.#offset + alignedLength)\n }\n\n // Create a sub-reader with the same underlying data, but offset\n subReader(offset: number): Reader {\n const reader = new Reader(this.#data.slice(this.#offset + offset), this.allowLoose, this.#maxInflation);\n reader.#parent = this;\n return reader;\n }\n\n // Read bytes\n readBytes(length: number, loose?: boolean): Uint8Array {\n let bytes = this.#peekBytes(0, length, !!loose);\n this.#incrementBytesRead(length);\n this.#offset += bytes.length;\n // @TODO: Make sure the length..end bytes are all 0?\n return bytes.slice(0, length);\n }\n\n // Read a numeric values\n readValue(): bigint {\n return toBigInt(this.readBytes(WordSize));\n }\n\n readIndex(): number {\n return toNumber(this.readBytes(WordSize));\n }\n}\n","function number(n: number) {\n if (!Number.isSafeInteger(n) || n < 0) throw new Error(`Wrong positive integer: ${n}`);\n}\n\nfunction bool(b: boolean) {\n if (typeof b !== 'boolean') throw new Error(`Expected boolean, not ${b}`);\n}\n\nfunction bytes(b: Uint8Array | undefined, ...lengths: number[]) {\n if (!(b instanceof Uint8Array)) throw new Error('Expected Uint8Array');\n if (lengths.length > 0 && !lengths.includes(b.length))\n throw new Error(`Expected Uint8Array of length ${lengths}, not of length=${b.length}`);\n}\n\ntype Hash = {\n (data: Uint8Array): Uint8Array;\n blockLen: number;\n outputLen: number;\n create: any;\n};\nfunction hash(hash: Hash) {\n if (typeof hash !== 'function' || typeof hash.create !== 'function')\n throw new Error('Hash should be wrapped by utils.wrapConstructor');\n number(hash.outputLen);\n number(hash.blockLen);\n}\n\nfunction exists(instance: any, checkFinished = true) {\n if (instance.destroyed) throw new Error('Hash instance has been destroyed');\n if (checkFinished && instance.finished) throw new Error('Hash#digest() has already been called');\n}\nfunction output(out: any, instance: any) {\n bytes(out);\n const min = instance.outputLen;\n if (out.length < min) {\n throw new Error(`digestInto() expects output buffer of length at least ${min}`);\n }\n}\n\nexport { number, bool, bytes, hash, exists, output };\n\nconst assert = { number, bool, bytes, hash, exists, output };\nexport default assert;\n","const U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);\nconst _32n = /* @__PURE__ */ BigInt(32);\n\n// We are not using BigUint64Array, because they are extremely slow as per 2022\nfunction fromBig(n: bigint, le = false) {\n if (le) return { h: Number(n & U32_MASK64), l: Number((n >> _32n) & U32_MASK64) };\n return { h: Number((n >> _32n) & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };\n}\n\nfunction split(lst: bigint[], le = false) {\n let Ah = new Uint32Array(lst.length);\n let Al = new Uint32Array(lst.length);\n for (let i = 0; i < lst.length; i++) {\n const { h, l } = fromBig(lst[i], le);\n [Ah[i], Al[i]] = [h, l];\n }\n return [Ah, Al];\n}\n\nconst toBig = (h: number, l: number) => (BigInt(h >>> 0) << _32n) | BigInt(l >>> 0);\n// for Shift in [0, 32)\nconst shrSH = (h: number, _l: number, s: number) => h >>> s;\nconst shrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in [1, 32)\nconst rotrSH = (h: number, l: number, s: number) => (h >>> s) | (l << (32 - s));\nconst rotrSL = (h: number, l: number, s: number) => (h << (32 - s)) | (l >>> s);\n// Right rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotrBH = (h: number, l: number, s: number) => (h << (64 - s)) | (l >>> (s - 32));\nconst rotrBL = (h: number, l: number, s: number) => (h >>> (s - 32)) | (l << (64 - s));\n// Right rotate for shift===32 (just swaps l&h)\nconst rotr32H = (_h: number, l: number) => l;\nconst rotr32L = (h: number, _l: number) => h;\n// Left rotate for Shift in [1, 32)\nconst rotlSH = (h: number, l: number, s: number) => (h << s) | (l >>> (32 - s));\nconst rotlSL = (h: number, l: number, s: number) => (l << s) | (h >>> (32 - s));\n// Left rotate for Shift in (32, 64), NOTE: 32 is special case.\nconst rotlBH = (h: number, l: number, s: number) => (l << (s - 32)) | (h >>> (64 - s));\nconst rotlBL = (h: number, l: number, s: number) => (h << (s - 32)) | (l >>> (64 - s));\n\n// JS uses 32-bit signed integers for bitwise operations which means we cannot\n// simple take carry out of low bit sum by shift, we need to use division.\nfunction add(Ah: number, Al: number, Bh: number, Bl: number) {\n const l = (Al >>> 0) + (Bl >>> 0);\n return { h: (Ah + Bh + ((l / 2 ** 32) | 0)) | 0, l: l | 0 };\n}\n// Addition with more than 2 elements\nconst add3L = (Al: number, Bl: number, Cl: number) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);\nconst add3H = (low: number, Ah: number, Bh: number, Ch: number) =>\n (Ah + Bh + Ch + ((low / 2 ** 32) | 0)) | 0;\nconst add4L = (Al: number, Bl: number, Cl: number, Dl: number) =>\n (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);\nconst add4H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number) =>\n (Ah + Bh + Ch + Dh + ((low / 2 ** 32) | 0)) | 0;\nconst add5L = (Al: number, Bl: number, Cl: number, Dl: number, El: number) =>\n (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);\nconst add5H = (low: number, Ah: number, Bh: number, Ch: number, Dh: number, Eh: number) =>\n (Ah + Bh + Ch + Dh + Eh + ((low / 2 ** 32) | 0)) | 0;\n\n// prettier-ignore\nexport {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\n// prettier-ignore\nconst u64 = {\n fromBig, split, toBig,\n shrSH, shrSL,\n rotrSH, rotrSL, rotrBH, rotrBL,\n rotr32H, rotr32L,\n rotlSH, rotlSL, rotlBH, rotlBL,\n add, add3L, add3H, add4L, add4H, add5H, add5L,\n};\nexport default u64;\n","/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */\n\n// We use WebCrypto aka globalThis.crypto, which exists in browsers and node.js 16+.\n// node.js versions earlier than v19 don't declare it in global scope.\n// For node.js, package.json#exports field mapping rewrites import\n// from `crypto` to `cryptoNode`, which imports native module.\n// Makes the utils un-importable in browsers without a bundler.\n// Once node.js 18 is deprecated, we can just drop the import.\nimport { crypto } from '@noble/hashes/crypto';\n\n// prettier-ignore\nexport type TypedArray = Int8Array | Uint8ClampedArray | Uint8Array |\n Uint16Array | Int16Array | Uint32Array | Int32Array;\n\nconst u8a = (a: any): a is Uint8Array => a instanceof Uint8Array;\n// Cast array to different type\nexport const u8 = (arr: TypedArray) => new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);\nexport const u32 = (arr: TypedArray) =>\n new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));\n\n// Cast array to view\nexport const createView = (arr: TypedArray) =>\n new DataView(arr.buffer, arr.byteOffset, arr.byteLength);\n\n// The rotate right (circular right shift) operation for uint32\nexport const rotr = (word: number, shift: number) => (word << (32 - shift)) | (word >>> shift);\n\n// big-endian hardware is rare. Just in case someone still decides to run hashes:\n// early-throw an error because we don't support BE yet.\nexport const isLE = new Uint8Array(new Uint32Array([0x11223344]).buffer)[0] === 0x44;\nif (!isLE) throw new Error('Non little-endian hardware is not supported');\n\nconst hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) =>\n i.toString(16).padStart(2, '0')\n);\n/**\n * @example bytesToHex(Uint8Array.from([0xca, 0xfe, 0x01, 0x23])) // 'cafe0123'\n */\nexport function bytesToHex(bytes: Uint8Array): string {\n if (!u8a(bytes)) throw new Error('Uint8Array expected');\n // pre-caching improves the speed 6x\n let hex = '';\n for (let i = 0; i < bytes.length; i++) {\n hex += hexes[bytes[i]];\n }\n return hex;\n}\n\n/**\n * @example hexToBytes('cafe0123') // Uint8Array.from([0xca, 0xfe, 0x01, 0x23])\n */\nexport function hexToBytes(hex: string): Uint8Array {\n if (typeof hex !== 'string') throw new Error('hex string expected, got ' + typeof hex);\n const len = hex.length;\n if (len % 2) throw new Error('padded hex string expected, got unpadded hex of length ' + len);\n const array = new Uint8Array(len / 2);\n for (let i = 0; i < array.length; i++) {\n const j = i * 2;\n const hexByte = hex.slice(j, j + 2);\n const byte = Number.parseInt(hexByte, 16);\n if (Number.isNaN(byte) || byte < 0) throw new Error('Invalid byte sequence');\n array[i] = byte;\n }\n return array;\n}\n\n// There is no setImmediate in browser and setTimeout is slow.\n// call of async fn will return Promise, which will be fullfiled only on\n// next scheduler queue processing step and this is exactly what we need.\nexport const nextTick = async () => {};\n\n// Returns control to thread each 'tick' ms to avoid blocking\nexport async function asyncLoop(iters: number, tick: number, cb: (i: number) => void) {\n let ts = Date.now();\n for (let i = 0; i < iters; i++) {\n cb(i);\n // Date.now() is not monotonic, so in case if clock goes backwards we return return control too\n const diff = Date.now() - ts;\n if (diff >= 0 && diff < tick) continue;\n await nextTick();\n ts += diff;\n }\n}\n\n// Global symbols in both browsers and Node.js since v11\n// See https://github.com/microsoft/TypeScript/issues/31535\ndeclare const TextEncoder: any;\n\n/**\n * @example utf8ToBytes('abc') // new Uint8Array([97, 98, 99])\n */\nexport function utf8ToBytes(str: string): Uint8Array {\n if (typeof str !== 'string') throw new Error(`utf8ToBytes expected string, got ${typeof str}`);\n return new Uint8Array(new TextEncoder().encode(str)); // https://bugzil.la/1681809\n}\n\nexport type Input = Uint8Array | string;\n/**\n * Normalizes (non-hex) string or Uint8Array to Uint8Array.\n * Warning: when Uint8Array is passed, it would NOT get copied.\n * Keep in mind for future mutable operations.\n */\nexport function toBytes(data: Input): Uint8Array {\n if (typeof data === 'string') data = utf8ToBytes(data);\n if (!u8a(data)) throw new Error(`expected Uint8Array, got ${typeof data}`);\n return data;\n}\n\n/**\n * Copies several Uint8Arrays into one.\n */\nexport function concatBytes(...arrays: Uint8Array[]): Uint8Array {\n const r = new Uint8Array(arrays.reduce((sum, a) => sum + a.length, 0));\n let pad = 0; // walk through each item, ensure they have proper type\n arrays.forEach((a) => {\n if (!u8a(a)) throw new Error('Uint8Array expected');\n r.set(a, pad);\n pad += a.length;\n });\n return r;\n}\n\n// For runtime check if class implements interface\nexport abstract class Hash<T extends Hash<T>> {\n abstract blockLen: number; // Bytes per block\n abstract outputLen: number; // Bytes in output\n abstract update(buf: Input): this;\n // Writes digest into buf\n abstract digestInto(buf: Uint8Array): void;\n abstract digest(): Uint8Array;\n /**\n * Resets internal state. Makes Hash instance unusable.\n * Reset is impossible for keyed hashes if key is consumed into state. If digest is not consumed\n * by user, they will need to manually call `destroy()` when zeroing is necessary.\n */\n abstract destroy(): void;\n /**\n * Clones hash instance. Unsafe: doesn't check whether `to` is valid. Can be used as `clone()`\n * when no options are passed.\n * Reasons to use `_cloneInto` instead of clone: 1) performance 2) reuse instance => all internal\n * buffers are overwritten => causes buffer overwrite which is used for digest in some cases.\n * There are no guarantees for clean-up because it's impossible in JS.\n */\n abstract _cloneInto(to?: T): T;\n // Safe version that clones internal state\n clone(): T {\n return this._cloneInto();\n }\n}\n\n/**\n * XOF: streaming API to read digest in chunks.\n * Same as 'squeeze' in keccak/k12 and 'seek' in blake3, but more generic name.\n * When hash used in XOF mode it is up to user to call '.destroy' afterwards, since we cannot\n * destroy state, next call can require more bytes.\n */\nexport type HashXOF<T extends Hash<T>> = Hash<T> & {\n xof(bytes: number): Uint8Array; // Read 'bytes' bytes from digest stream\n xofInto(buf: Uint8Array): Uint8Array; // read buf.length bytes from digest stream into buf\n};\n\nconst toStr = {}.toString;\ntype EmptyObj = {};\nexport function checkOpts<T1 extends EmptyObj, T2 extends EmptyObj>(\n defaults: T1,\n opts?: T2\n): T1 & T2 {\n if (opts !== undefined && toStr.call(opts) !== '[object Object]')\n throw new Error('Options should be object or undefined');\n const merged = Object.assign(defaults, opts);\n return merged as T1 & T2;\n}\n\nexport type CHash = ReturnType<typeof wrapConstructor>;\n\nexport function wrapConstructor<T extends Hash<T>>(hashCons: () => Hash<T>) {\n const hashC = (msg: Input): Uint8Array => hashCons().update(toBytes(msg)).digest();\n const tmp = hashCons();\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = () => hashCons();\n return hashC;\n}\n\nexport function wrapConstructorWithOpts<H extends Hash<H>, T extends Object>(\n hashCons: (opts?: T) => Hash<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\nexport function wrapXOFConstructorWithOpts<H extends HashXOF<H>, T extends Object>(\n hashCons: (opts?: T) => HashXOF<H>\n) {\n const hashC = (msg: Input, opts?: T): Uint8Array => hashCons(opts).update(toBytes(msg)).digest();\n const tmp = hashCons({} as T);\n hashC.outputLen = tmp.outputLen;\n hashC.blockLen = tmp.blockLen;\n hashC.create = (opts: T) => hashCons(opts);\n return hashC;\n}\n\n/**\n * Secure PRNG. Uses `crypto.getRandomValues`, which defers to OS.\n */\nexport function randomBytes(bytesLength = 32): Uint8Array {\n if (crypto && typeof crypto.getRandomValues === 'function') {\n return crypto.getRandomValues(new Uint8Array(bytesLength));\n }\n throw new Error('crypto.getRandomValues must be defined');\n}\n","import { bytes, exists, number, output } from './_assert.js';\nimport { rotlBH, rotlBL, rotlSH, rotlSL, split } from './_u64.js';\nimport {\n Hash,\n u32,\n Input,\n toBytes,\n wrapConstructor,\n wrapXOFConstructorWithOpts,\n HashXOF,\n} from './utils.js';\n\n// SHA3 (keccak) is based on a new design: basically, the internal state is bigger than output size.\n// It's called a sponge function.\n\n// Various per round constants calculations\nconst [SHA3_PI, SHA3_ROTL, _SHA3_IOTA]: [number[], number[], bigint[]] = [[], [], []];\nconst _0n = /* @__PURE__ */ BigInt(0);\nconst _1n = /* @__PURE__ */ BigInt(1);\nconst _2n = /* @__PURE__ */ BigInt(2);\nconst _7n = /* @__PURE__ */ BigInt(7);\nconst _256n = /* @__PURE__ */ BigInt(256);\nconst _0x71n = /* @__PURE__ */ BigInt(0x71);\nfor (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {\n // Pi\n [x, y] = [y, (2 * x + 3 * y) % 5];\n SHA3_PI.push(2 * (5 * y + x));\n // Rotational\n SHA3_ROTL.push((((round + 1) * (round + 2)) / 2) % 64);\n // Iota\n let t = _0n;\n for (let j = 0; j < 7; j++) {\n R = ((R << _1n) ^ ((R >> _7n) * _0x71n)) % _256n;\n if (R & _2n) t ^= _1n << ((_1n << /* @__PURE__ */ BigInt(j)) - _1n);\n }\n _SHA3_IOTA.push(t);\n}\nconst [SHA3_IOTA_H, SHA3_IOTA_L] = /* @__PURE__ */ split(_SHA3_IOTA, true);\n\n// Left rotation (without 0, 32, 64)\nconst rotlH = (h: number, l: number, s: number) => (s > 32 ? rotlBH(h, l, s) : rotlSH(h, l, s));\nconst rotlL = (h: number, l: number, s: number) => (s > 32 ? rotlBL(h, l, s) : rotlSL(h, l, s));\n\n// Same as keccakf1600, but allows to skip some rounds\nexport function keccakP(s: Uint32Array, rounds: number = 24) {\n const B = new Uint32Array(5 * 2);\n // NOTE: all indices are x2 since we store state as u32 instead of u64 (bigints to slow in js)\n for (let round = 24 - rounds; round < 24; round++) {\n // Theta θ\n for (let x = 0; x < 10; x++) B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];\n for (let x = 0; x < 10; x += 2) {\n const idx1 = (x + 8) % 10;\n const idx0 = (x + 2) % 10;\n const B0 = B[idx0];\n const B1 = B[idx0 + 1];\n const Th = rotlH(B0, B1, 1) ^ B[idx1];\n const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];\n for (let y = 0; y < 50; y += 10) {\n s[x + y] ^= Th;\n s[x + y + 1] ^= Tl;\n }\n }\n // Rho (ρ) and Pi (π)\n let curH = s[2];\n let curL = s[3];\n for (let t = 0; t < 24; t++) {\n const shift = SHA3_ROTL[t];\n const Th = rotlH(curH, curL, shift);\n const Tl = rotlL(curH, curL, shift);\n const PI = SHA3_PI[t];\n curH = s[PI];\n curL = s[PI + 1];\n s[PI] = Th;\n s[PI + 1] = Tl;\n }\n // Chi (χ)\n for (let y = 0; y < 50; y += 10) {\n for (let x = 0; x < 10; x++) B[x] = s[y + x];\n for (let x = 0; x < 10; x++) s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];\n }\n // Iota (ι)\n s[0] ^= SHA3_IOTA_H[round];\n s[1] ^= SHA3_IOTA_L[round];\n }\n B.fill(0);\n}\n\nexport class Keccak extends Hash<Keccak> implements HashXOF<Keccak> {\n protected state: Uint8Array;\n protected pos = 0;\n protected posOut = 0;\n protected finished = false;\n protected state32: Uint32Array;\n protected destroyed = false;\n // NOTE: we accept arguments in bytes instead of bits here.\n constructor(\n public blockLen: number,\n public suffix: number,\n public outputLen: number,\n protected enableXOF = false,\n protected rounds: number = 24\n ) {\n super();\n // Can be passed from user as dkLen\n number(outputLen);\n // 1600 = 5x5 matrix of 64bit. 1600 bits === 200 bytes\n if (0 >= this.blockLen || this.blockLen >= 200)\n throw new Error('Sha3 supports only keccak-f1600 function');\n this.state = new Uint8Array(200);\n this.state32 = u32(this.state);\n }\n protected keccak() {\n keccakP(this.state32, this.rounds);\n this.posOut = 0;\n this.pos = 0;\n }\n update(data: Input) {\n exists(this);\n const { blockLen, state } = this;\n data = toBytes(data);\n const len = data.length;\n for (let pos = 0; pos < len; ) {\n const take = Math.min(blockLen - this.pos, len - pos);\n for (let i = 0; i < take; i++) state[this.pos++] ^= data[pos++];\n if (this.pos === blockLen) this.keccak();\n }\n return this;\n }\n protected finish() {\n if (this.finished) return;\n this.finished = true;\n const { state, suffix, pos, blockLen } = this;\n // Do the padding\n state[pos] ^= suffix;\n if ((suffix & 0x80) !== 0 && pos === blockLen - 1) this.keccak();\n state[blockLen - 1] ^= 0x80;\n this.keccak();\n }\n protected writeInto(out: Uint8Array): Uint8Array {\n exists(this, false);\n bytes(out);\n this.finish();\n const bufferOut = this.state;\n const { blockLen } = this;\n for (let pos = 0, len = out.length; pos < len; ) {\n if (this.posOut >= blockLen) this.keccak();\n const take = Math.min(blockLen - this.posOut, len - pos);\n out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);\n this.posOut += take;\n pos += take;\n }\n return out;\n }\n xofInto(out: Uint8Array): Uint8Array {\n // Sha3/Keccak usage with XOF is probably mistake, only SHAKE instances can do XOF\n if (!this.enableXOF) throw new Error('XOF is not possible for this instance');\n return this.writeInto(out);\n }\n xof(bytes: number): Uint8Array {\n number(bytes);\n return this.xofInto(new Uint8Array(bytes));\n }\n digestInto(out: Uint8Array) {\n output(out, this);\n if (this.finished) throw new Error('digest() was already called');\n this.writeInto(out);\n this.destroy();\n return out;\n }\n digest() {\n return this.digestInto(new Uint8Array(this.outputLen));\n }\n destroy() {\n this.destroyed = true;\n this.state.fill(0);\n }\n _cloneInto(to?: Keccak): Keccak {\n const { blockLen, suffix, outputLen, rounds, enableXOF } = this;\n to ||= new Keccak(blockLen, suffix, outputLen, enableXOF, rounds);\n to.state32.set(this.state32);\n to.pos = this.pos;\n to.posOut = this.posOut;\n to.finished = this.finished;\n to.rounds = rounds;\n // Suffix can change in cSHAKE\n to.suffix = suffix;\n to.outputLen = outputLen;\n to.enableXOF = enableXOF;\n to.destroyed = this.destroyed;\n return to;\n }\n}\n\nconst gen = (suffix: number, blockLen: number, outputLen: number) =>\n wrapConstructor(() => new Keccak(blockLen, suffix, outputLen));\n\nexport const sha3_224 = /* @__PURE__ */ gen(0x06, 144, 224 / 8);\n/**\n * SHA3-256 hash function\n * @param message - that would be hashed\n */\nexport const sha3_256 = /* @__PURE__ */ gen(0x06, 136, 256 / 8);\nexport const sha3_384 = /* @__PURE__ */ gen(0x06, 104, 384 / 8);\nexport const sha3_512 = /* @__PURE__ */ gen(0x06, 72, 512 / 8);\nexport const keccak_224 = /* @__PURE__ */ gen(0x01, 144, 224 / 8);\n/**\n * keccak-256 hash function. Different from SHA3-256.\n * @param message - that would be hashed\n */\nexport const keccak_256 = /* @__PURE__ */ gen(0x01, 136, 256 / 8);\nexport const keccak_384 = /* @__PURE__ */ gen(0x01, 104, 384 / 8);\nexport const keccak_512 = /* @__PURE__ */ gen(0x01, 72, 512 / 8);\n\nexport type ShakeOpts = { dkLen?: number };\n\nconst genShake = (suffix: number, blockLen: number, outputLen: number) =>\n wrapXOFConstructorWithOpts<HashXOF<Keccak>, ShakeOpts>(\n (opts: ShakeOpts = {}) =>\n new Keccak(blockLen, suffix, opts.dkLen === undefined ? outputLen : opts.dkLen, true)\n );\n\nexport const shake128 = /* @__PURE__ */ genShake(0x1f, 168, 128 / 8);\nexport const shake256 = /* @__PURE__ */ genShake(0x1f, 136, 256 / 8);\n","/**\n * Cryptographic hashing functions\n *\n * @_subsection: api/crypto:Hash Functions [about-crypto-hashing]\n */\n\nimport { keccak_256 } from \"@noble/hashes/sha3\";\n\nimport { getBytes, hexlify } from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n\nlet locked = false;\n\nconst _keccak256 = function(data: Uint8Array): Uint8Array {\n return keccak_256(data);\n}\n\nlet __keccak256: (data: Uint8Array) => BytesLike = _keccak256;\n\n/**\n * Compute the cryptographic KECCAK256 hash of %%data%%.\n *\n * The %%data%% **must** be a data representation, to compute the\n * hash of UTF-8 data use the [[id]] function.\n *\n * @returns DataHexstring\n * @example:\n * keccak256(\"0x\")\n * //_result:\n *\n * keccak256(\"0x1337\")\n * //_result:\n *\n * keccak256(new Uint8Array([ 0x13, 0x37 ]))\n * //_result:\n *\n * // Strings are assumed to be DataHexString, otherwise it will\n * // throw. To hash UTF-8 data, see the note above.\n * keccak256(\"Hello World\")\n * //_error:\n */\nexport function keccak256(_data: BytesLike): string {\n const data = getBytes(_data, \"data\");\n return hexlify(__keccak256(data));\n}\nkeccak256._ = _keccak256;\nkeccak256.lock = function(): void { locked = true; }\nkeccak256.register = function(func: (data: Uint8Array) => BytesLike) {\n if (locked) { throw new TypeError(\"keccak256 is locked\"); }\n __keccak256 = func;\n}\nObject.freeze(keccak256);\n","/**\n * A constant for the zero hash.\n *\n * (**i.e.** ``\"0x0000000000000000000000000000000000000000000000000000000000000000\"``)\n */\nexport const ZeroHash: string = \"0x0000000000000000000000000000000000000000000000000000000000000000\";\n\n","\nimport { ZeroHash } from \"../constants/index.js\";\nimport {\n concat, dataLength, getBigInt, getBytes, getNumber, hexlify,\n toBeArray, isHexString, zeroPadValue,\n assertArgument, assertPrivate\n} from \"../utils/index.js\";\n\nimport type {\n BigNumberish, BytesLike, Numeric\n} from \"../utils/index.js\";\n\n\n// Constants\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_2 = BigInt(2);\nconst BN_27 = BigInt(27);\nconst BN_28 = BigInt(28);\nconst BN_35 = BigInt(35);\n\n\nconst _guard = { };\n\n// @TODO: Allow Uint8Array\n\n/**\n * A SignatureLike\n *\n * @_docloc: api/crypto:Signing\n */\nexport type SignatureLike = Signature | string | {\n r: string;\n s: string;\n v: BigNumberish;\n yParity?: 0 | 1;\n yParityAndS?: string;\n} | {\n r: string;\n yParityAndS: string;\n yParity?: 0 | 1;\n s?: string;\n v?: number;\n} | {\n r: string;\n s: string;\n yParity: 0 | 1;\n v?: BigNumberish;\n yParityAndS?: string;\n};\n\nfunction toUint256(value: BigNumberish): string {\n return zeroPadValue(toBeArray(value), 32);\n}\n\n/**\n * A Signature @TODO\n *\n *\n * @_docloc: api/crypto:Signing\n */\nexport class Signature {\n #r: string;\n #s: string;\n #v: 27 | 28;\n #networkV: null | bigint;\n\n /**\n * The ``r`` value for a signautre.\n *\n * This represents the ``x`` coordinate of a \"reference\" or\n * challenge point, from which the ``y`` can be computed.\n */\n get r(): string { return this.#r; }\n set r(value: BytesLike) {\n assertArgument(dataLength(value) === 32, \"invalid r\", \"value\", value);\n this.#r = hexlify(value);\n }\n\n /**\n * The ``s`` value for a signature.\n */\n get s(): string { return this.#s; }\n set s(_value: BytesLike) {\n assertArgument(dataLength(_value) === 32, \"invalid s\", \"value\", _value);\n const value = hexlify(_value);\n assertArgument(parseInt(value.substring(0, 3)) < 8, \"non-canonical s\", \"value\", value);\n this.#s = value;\n }\n\n /**\n * The ``v`` value for a signature.\n *\n * Since a given ``x`` value for ``r`` has two possible values for\n * its correspondin ``y``, the ``v`` indicates which of the two ``y``\n * values to use.\n *\n * It is normalized to the values ``27`` or ``28`` for legacy\n * purposes.\n */\n get v(): 27 | 28 { return this.#v; }\n set v(value: BigNumberish) {\n const v = getNumber(value, \"value\");\n assertArgument(v === 27 || v === 28, \"invalid v\", \"v\", value);\n this.#v = v;\n }\n\n /**\n * The EIP-155 ``v`` for legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get networkV(): null | bigint { return this.#networkV; }\n\n /**\n * The chain ID for EIP-155 legacy transactions. For non-legacy\n * transactions, this value is ``null``.\n */\n get legacyChainId(): null | bigint {\n const v = this.networkV;\n if (v == null) { return null; }\n return Signature.getChainId(v);\n }\n\n /**\n * The ``yParity`` for the signature.\n *\n * See ``v`` for more details on how this value is used.\n */\n get yParity(): 0 | 1 {\n return (this.v === 27) ? 0: 1;\n }\n\n /**\n * The [[link-eip-2098]] compact representation of the ``yParity``\n * and ``s`` compacted into a single ``bytes32``.\n */\n get yParityAndS(): string {\n // The EIP-2098 compact representation\n const yParityAndS = getBytes(this.s);\n if (this.yParity) { yParityAndS[0] |= 0x80; }\n return hexlify(yParityAndS);\n }\n\n /**\n * The [[link-eip-2098]] compact representation.\n */\n get compactSerialized(): string {\n return concat([ this.r, this.yParityAndS ]);\n }\n\n /**\n * The serialized representation.\n */\n get serialized(): string {\n return concat([ this.r, this.s, (this.yParity ? \"0x1c\": \"0x1b\") ]);\n }\n\n /**\n * @private\n */\n constructor(guard: any, r: string, s: string, v: 27 | 28) {\n assertPrivate(guard, _guard, \"Signature\");\n this.#r = r;\n this.#s = s;\n this.#v = v;\n this.#networkV = null;\n }\n\n [Symbol.for('nodejs.util.inspect.custom')](): string {\n return `Signature { r: \"${ this.r }\", s: \"${ this.s }\", yParity: ${ this.yParity }, networkV: ${ this.networkV } }`;\n }\n\n /**\n * Returns a new identical [[Signature]].\n */\n clone(): Signature {\n const clone = new Signature(_guard, this.r, this.s, this.v);\n if (this.networkV) { clone.#networkV = this.networkV; }\n return clone;\n }\n\n /**\n * Returns a representation that is compatible with ``JSON.stringify``.\n */\n toJSON(): any {\n const networkV = this.networkV;\n return {\n _type: \"signature\",\n networkV: ((networkV != null) ? networkV.toString(): null),\n r: this.r, s: this.s, v: this.v,\n };\n }\n\n /**\n * Compute the chain ID from the ``v`` in a legacy EIP-155 transactions.\n *\n * @example:\n * Signature.getChainId(45)\n * //_result:\n *\n * Signature.getChainId(46)\n * //_result:\n */\n static getChainId(v: BigNumberish): bigint {\n const bv = getBigInt(v, \"v\");\n\n // The v is not an EIP-155 v, so it is the unspecified chain ID\n if ((bv == BN_27) || (bv == BN_28)) { return BN_0; }\n\n // Bad value for an EIP-155 v\n assertArgument(bv >= BN_35, \"invalid EIP-155 v\", \"v\", v);\n\n return (bv - BN_35) / BN_2;\n }\n\n /**\n * Compute the ``v`` for a chain ID for a legacy EIP-155 transactions.\n *\n * Legacy transactions which use [[link-eip-155]] hijack the ``v``\n * property to include the chain ID.\n *\n * @example:\n * Signature.getChainIdV(5, 27)\n * //_result:\n *\n * Signature.getChainIdV(5, 28)\n * //_result:\n *\n */\n static getChainIdV(chainId: BigNumberish, v: 27 | 28): bigint {\n return (getBigInt(chainId) * BN_2) + BigInt(35 + v - 27);\n }\n\n /**\n * Compute the normalized legacy transaction ``v`` from a ``yParirty``,\n * a legacy transaction ``v`` or a legacy [[link-eip-155]] transaction.\n *\n * @example:\n * // The values 0 and 1 imply v is actually yParity\n * Signature.getNormalizedV(0)\n * //_result:\n *\n * // Legacy non-EIP-1559 transaction (i.e. 27 or 28)\n * Signature.getNormalizedV(27)\n * //_result:\n *\n * // Legacy EIP-155 transaction (i.e. >= 35)\n * Signature.getNormalizedV(46)\n * //_result:\n *\n * // Invalid values throw\n * Signature.getNormalizedV(5)\n * //_error:\n */\n static getNormalizedV(v: BigNumberish): 27 | 28 {\n const bv = getBigInt(v);\n\n if (bv === BN_0 || bv === BN_27) { return 27; }\n if (bv === BN_1 || bv === BN_28) { return 28; }\n\n assertArgument(bv >= BN_35, \"invalid v\", \"v\", v);\n\n // Otherwise, EIP-155 v means odd is 27 and even is 28\n return (bv & BN_1) ? 27: 28;\n }\n\n /**\n * Creates a new [[Signature]].\n *\n * If no %%sig%% is provided, a new [[Signature]] is created\n * with default values.\n *\n * If %%sig%% is a string, it is parsed.\n */\n static from(sig?: SignatureLike): Signature {\n function assertError(check: unknown, message: string): asserts check {\n assertArgument(check, message, \"signature\", sig);\n };\n\n if (sig == null) {\n return new Signature(_guard, ZeroHash, ZeroHash, 27);\n }\n\n if (typeof(sig) === \"string\") {\n const bytes = getBytes(sig, \"signature\");\n if (bytes.length === 64) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n const v = (s[0] & 0x80) ? 28: 27;\n s[0] &= 0x7f;\n return new Signature(_guard, r, hexlify(s), v);\n }\n\n if (bytes.length === 65) {\n const r = hexlify(bytes.slice(0, 32));\n const s = bytes.slice(32, 64);\n assertError((s[0] & 0x80) === 0, \"non-canonical s\");\n const v = Signature.getNormalizedV(bytes[64]);\n return new Signature(_guard, r, hexlify(s), v);\n }\n\n assertError(false, \"invalid raw signature length\");\n }\n\n if (sig instanceof Signature) { return sig.clone(); }\n\n // Get r\n const _r = sig.r;\n assertError(_r != null, \"missing r\");\n const r = toUint256(_r);\n\n // Get s; by any means necessary (we check consistency below)\n const s = (function(s?: string, yParityAndS?: string) {\n if (s != null) { return toUint256(s); }\n\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n const bytes = getBytes(yParityAndS);\n bytes[0] &= 0x7f;\n return hexlify(bytes);\n }\n\n assertError(false, \"missing s\");\n })(sig.s, sig.yParityAndS);\n assertError((getBytes(s)[0] & 0x80) == 0, \"non-canonical s\");\n\n // Get v; by any means necessary (we check consistency below)\n const { networkV, v } = (function(_v?: BigNumberish, yParityAndS?: string, yParity?: Numeric): { networkV?: bigint, v: 27 | 28 } {\n if (_v != null) {\n const v = getBigInt(_v);\n return {\n networkV: ((v >= BN_35) ? v: undefined),\n v: Signature.getNormalizedV(v)\n };\n }\n\n if (yParityAndS != null) {\n assertError(isHexString(yParityAndS, 32), \"invalid yParityAndS\");\n return { v: ((getBytes(yParityAndS)[0] & 0x80) ? 28: 27) };\n }\n\n if (yParity != null) {\n switch (getNumber(yParity, \"sig.yParity\")) {\n case 0: return { v: 27 };\n case 1: return { v: 28 };\n }\n assertError(false, \"invalid yParity\");\n }\n\n assertError(false, \"missing v\");\n })(sig.v, sig.yParityAndS, sig.yParity);\n\n const result = new Signature(_guard, r, s, v);\n if (networkV) { result.#networkV = networkV; }\n\n // If multiple of v, yParity, yParityAndS we given, check they match\n assertError(sig.yParity == null || getNumber(sig.yParity, \"sig.yParity\") === result.yParity, \"yParity mismatch\");\n assertError(sig.yParityAndS == null || sig.yParityAndS === result.yParityAndS, \"yParityAndS mismatch\");\n\n return result;\n }\n}\n\n","import { keccak256 } from \"../crypto/index.js\";\nimport { getBytes, assertArgument } from \"../utils/index.js\";\n\n\nconst BN_0 = BigInt(0);\nconst BN_36 = BigInt(36);\n\nfunction getChecksumAddress(address: string): string {\n// if (!isHexString(address, 20)) {\n// logger.throwArgumentError(\"invalid address\", \"address\", address);\n// }\n\n address = address.toLowerCase();\n\n const chars = address.substring(2).split(\"\");\n\n const expanded = new Uint8Array(40);\n for (let i = 0; i < 40; i++) {\n expanded[i] = chars[i].charCodeAt(0);\n }\n\n const hashed = getBytes(keccak256(expanded));\n\n for (let i = 0; i < 40; i += 2) {\n if ((hashed[i >> 1] >> 4) >= 8) {\n chars[i] = chars[i].toUpperCase();\n }\n if ((hashed[i >> 1] & 0x0f) >= 8) {\n chars[i + 1] = chars[i + 1].toUpperCase();\n }\n }\n\n return \"0x\" + chars.join(\"\");\n}\n\n// See: https://en.wikipedia.org/wiki/International_Bank_Account_Number\n\n// Create lookup table\nconst ibanLookup: { [character: string]: string } = { };\nfor (let i = 0; i < 10; i++) { ibanLookup[String(i)] = String(i); }\nfor (let i = 0; i < 26; i++) { ibanLookup[String.fromCharCode(65 + i)] = String(10 + i); }\n\n// How many decimal digits can we process? (for 64-bit float, this is 15)\n// i.e. Math.floor(Math.log10(Number.MAX_SAFE_INTEGER));\nconst safeDigits = 15;\n\nfunction ibanChecksum(address: string): string {\n address = address.toUpperCase();\n address = address.substring(4) + address.substring(0, 2) + \"00\";\n\n let expanded = address.split(\"\").map((c) => { return ibanLookup[c]; }).join(\"\");\n\n // Javascript can handle integers safely up to 15 (decimal) digits\n while (expanded.length >= safeDigits){\n let block = expanded.substring(0, safeDigits);\n expanded = parseInt(block, 10) % 97 + expanded.substring(block.length);\n }\n\n let checksum = String(98 - (parseInt(expanded, 10) % 97));\n while (checksum.length < 2) { checksum = \"0\" + checksum; }\n\n return checksum;\n};\n\nconst Base36 = (function() {;\n const result: Record<string, bigint> = { };\n for (let i = 0; i < 36; i++) {\n const key = \"0123456789abcdefghijklmnopqrstuvwxyz\"[i];\n result[key] = BigInt(i);\n }\n return result;\n})();\n\nfunction fromBase36(value: string): bigint {\n value = value.toLowerCase();\n\n let result = BN_0;\n for (let i = 0; i < value.length; i++) {\n result = result * BN_36 + Base36[value[i]];\n }\n return result;\n}\n\n/**\n * Returns a normalized and checksumed address for %%address%%.\n * This accepts non-checksum addresses, checksum addresses and\n * [[getIcapAddress]] formats.\n *\n * The checksum in Ethereum uses the capitalization (upper-case\n * vs lower-case) of the characters within an address to encode\n * its checksum, which offers, on average, a checksum of 15-bits.\n *\n * If %%address%% contains both upper-case and lower-case, it is\n * assumed to already be a checksum address and its checksum is\n * validated, and if the address fails its expected checksum an\n * error is thrown.\n *\n * If you wish the checksum of %%address%% to be ignore, it should\n * be converted to lower-case (i.e. ``.toLowercase()``) before\n * being passed in. This should be a very rare situation though,\n * that you wish to bypass the safegaurds in place to protect\n * against an address that has been incorrectly copied from another\n * source.\n *\n * @example:\n * // Adds the checksum (via upper-casing specific letters)\n * getAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\")\n * //_result:\n *\n * // Converts ICAP address and adds checksum\n * getAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if an address contains mixed case,\n * // but the checksum fails\n * getAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_error:\n */\nexport function getAddress(address: string): string {\n\n assertArgument(typeof(address) === \"string\", \"invalid address\", \"address\", address);\n\n if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {\n\n // Missing the 0x prefix\n if (!address.startsWith(\"0x\")) { address = \"0x\" + address; }\n\n const result = getChecksumAddress(address);\n\n // It is a checksummed address with a bad checksum\n assertArgument(!address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) || result === address,\n \"bad address checksum\", \"address\", address);\n\n return result;\n }\n\n // Maybe ICAP? (we only support direct mode)\n if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {\n // It is an ICAP address with a bad checksum\n assertArgument(address.substring(2, 4) === ibanChecksum(address), \"bad icap checksum\", \"address\", address);\n\n let result = fromBase36(address.substring(4)).toString(16);\n while (result.length < 40) { result = \"0\" + result; }\n return getChecksumAddress(\"0x\" + result);\n }\n\n assertArgument(false, \"invalid address\", \"address\", address);\n}\n\n/**\n * The [ICAP Address format](link-icap) format is an early checksum\n * format which attempts to be compatible with the banking\n * industry [IBAN format](link-wiki-iban) for bank accounts.\n *\n * It is no longer common or a recommended format.\n *\n * @example:\n * getIcapAddress(\"0x8ba1f109551bd432803012645ac136ddd64dba72\");\n * //_result:\n *\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\");\n * //_result:\n *\n * // Throws an error if the ICAP checksum is wrong\n * getIcapAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK37\");\n * //_error:\n */\nexport function getIcapAddress(address: string): string {\n //let base36 = _base16To36(getAddress(address).substring(2)).toUpperCase();\n let base36 = BigInt(getAddress(address)).toString(36).toUpperCase();\n while (base36.length < 30) { base36 = \"0\" + base36; }\n return \"XE\" + ibanChecksum(\"XE00\" + base36) + base36;\n}\n","import { keccak256 } from \"../crypto/index.js\";\nimport {\n concat, dataSlice, getBigInt, getBytes, encodeRlp, assertArgument\n} from \"../utils/index.js\";\n\nimport { getAddress } from \"./address.js\";\n\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\n\n\n// http://ethereum.stackexchange.com/questions/760/how-is-the-address-of-an-ethereum-contract-computed\n\n/**\n * Returns the address that would result from a ``CREATE`` for %%tx%%.\n *\n * This can be used to compute the address a contract will be\n * deployed to by an EOA when sending a deployment transaction (i.e.\n * when the ``to`` address is ``null``).\n *\n * This can also be used to compute the address a contract will be\n * deployed to by a contract, by using the contract's address as the\n * ``to`` and the contract's nonce.\n *\n * @example\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\";\n * nonce = 5;\n *\n * getCreateAddress({ from, nonce });\n * //_result:\n */\nexport function getCreateAddress(tx: { from: string, nonce: BigNumberish }): string {\n const from = getAddress(tx.from);\n const nonce = getBigInt(tx.nonce, \"tx.nonce\");\n\n let nonceHex = nonce.toString(16);\n if (nonceHex === \"0\") {\n nonceHex = \"0x\";\n } else if (nonceHex.length % 2) {\n nonceHex = \"0x0\" + nonceHex;\n } else {\n nonceHex = \"0x\" + nonceHex;\n }\n\n return getAddress(dataSlice(keccak256(encodeRlp([ from, nonceHex ])), 12));\n}\n\n/**\n * Returns the address that would result from a ``CREATE2`` operation\n * with the given %%from%%, %%salt%% and %%initCodeHash%%.\n *\n * To compute the %%initCodeHash%% from a contract's init code, use\n * the [[keccak256]] function.\n *\n * For a quick overview and example of ``CREATE2``, see [[link-ricmoo-wisps]].\n *\n * @example\n * // The address of the contract\n * from = \"0x8ba1f109551bD432803012645Ac136ddd64DBA72\"\n *\n * // The salt\n * salt = id(\"HelloWorld\")\n *\n * // The hash of the initCode\n * initCode = \"0x6394198df16000526103ff60206004601c335afa6040516060f3\";\n * initCodeHash = keccak256(initCode)\n *\n * getCreate2Address(from, salt, initCodeHash)\n * //_result:\n */\nexport function getCreate2Address(_from: string, _salt: BytesLike, _initCodeHash: BytesLike): string {\n const from = getAddress(_from);\n const salt = getBytes(_salt, \"salt\");\n const initCodeHash = getBytes(_initCodeHash, \"initCodeHash\");\n\n assertArgument(salt.length === 32, \"salt must be 32 bytes\", \"salt\", _salt);\n\n assertArgument(initCodeHash.length === 32, \"initCodeHash must be 32 bytes\", \"initCodeHash\", _initCodeHash);\n\n return getAddress(dataSlice(keccak256(concat([ \"0xff\", from, salt, initCodeHash ])), 12))\n}\n","import { assert, assertArgument } from \"../utils/index.js\";\n\nimport { getAddress } from \"./address.js\";\n\nimport type { Addressable, AddressLike, NameResolver } from \"./index.js\";\n\n\n/**\n * Returns true if %%value%% is an object which implements the\n * [[Addressable]] interface.\n *\n * @example:\n * // Wallets and AbstractSigner sub-classes\n * isAddressable(Wallet.createRandom())\n * //_result:\n *\n * // Contracts\n * contract = new Contract(\"dai.tokens.ethers.eth\", [ ], provider)\n * isAddressable(contract)\n * //_result:\n */\nexport function isAddressable(value: any): value is Addressable {\n return (value && typeof(value.getAddress) === \"function\");\n}\n\n/**\n * Returns true if %%value%% is a valid address.\n *\n * @example:\n * // Valid address\n * isAddress(\"0x8ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Valid ICAP address\n * isAddress(\"XE65GB6LDNXYOFTX0NSV3FUWKOWIXAMJK36\")\n * //_result:\n *\n * // Invalid checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBa72\")\n * //_result:\n *\n * // Invalid ICAP checksum\n * isAddress(\"0x8Ba1f109551bD432803012645Ac136ddd64DBA72\")\n * //_result:\n *\n * // Not an address (an ENS name requires a provided and an\n * // asynchronous API to access)\n * isAddress(\"ricmoo.eth\")\n * //_result:\n */\nexport function isAddress(value: any): value is string {\n try {\n getAddress(value);\n return true;\n } catch (error) { }\n return false;\n}\n\nasync function checkAddress(target: any, promise: Promise<null | string>): Promise<string> {\n const result = await promise;\n if (result == null || result === \"0x0000000000000000000000000000000000000000\") {\n assert(typeof(target) !== \"string\", \"unconfigured name\", \"UNCONFIGURED_NAME\", { value: target });\n assertArgument(false, \"invalid AddressLike value; did not resolve to a value address\", \"target\", target);\n }\n return getAddress(result);\n}\n\n/**\n * Resolves to an address for the %%target%%, which may be any\n * supported address type, an [[Addressable]] or a Promise which\n * resolves to an address.\n *\n * If an ENS name is provided, but that name has not been correctly\n * configured a [[UnconfiguredNameError]] is thrown.\n *\n * @example:\n * addr = \"0x6B175474E89094C44Da98b954EedeAC495271d0F\"\n *\n * // Addresses are return synchronously\n * resolveAddress(addr, provider)\n * //_result:\n *\n * // Address promises are resolved asynchronously\n * resolveAddress(Promise.resolve(addr))\n * //_result:\n *\n * // ENS names are resolved asynchronously\n * resolveAddress(\"dai.tokens.ethers.eth\", provider)\n * //_result:\n *\n * // Addressable objects are resolved asynchronously\n * contract = new Contract(addr, [ ])\n * resolveAddress(contract, provider)\n * //_result:\n *\n * // Unconfigured ENS names reject\n * resolveAddress(\"nothing-here.ricmoo.eth\", provider)\n * //_error:\n *\n * // ENS names require a NameResolver object passed in\n * // (notice the provider was omitted)\n * resolveAddress(\"nothing-here.ricmoo.eth\")\n * //_error:\n */\nexport function resolveAddress(target: AddressLike, resolver?: null | NameResolver): string | Promise<string> {\n\n if (typeof(target) === \"string\") {\n if (target.match(/^0x[0-9a-f]{40}$/i)) { return getAddress(target); }\n\n assert(resolver != null, \"ENS resolution requires a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"resolveName\" });\n\n return checkAddress(target, resolver.resolveName(target));\n\n } else if (isAddressable(target)) {\n return checkAddress(target, target.getAddress());\n\n } else if (target && typeof(target.then) === \"function\") {\n return checkAddress(target, target);\n }\n\n assertArgument(false, \"unsupported addressable value\", \"target\", target);\n}\n","/**\n * A Typed object allows a value to have its type explicitly\n * specified.\n *\n * For example, in Solidity, the value ``45`` could represent a\n * ``uint8`` or a ``uint256``. The value ``0x1234`` could represent\n * a ``bytes2`` or ``bytes``.\n *\n * Since JavaScript has no meaningful way to explicitly inform any\n * APIs which what the type is, this allows transparent interoperation\n * with Soldity.\n *\n * @_subsection: api/abi:Typed Values\n */\n\nimport { assertPrivate, defineProperties } from \"../utils/index.js\";\n\nimport type { Addressable } from \"../address/index.js\";\nimport type { BigNumberish, BytesLike } from \"../utils/index.js\";\n\nimport type { Result } from \"./coders/abstract-coder.js\";\n\nconst _gaurd = { };\n\nfunction n(value: BigNumberish, width: number): Typed {\n let signed = false;\n if (width < 0) {\n signed = true;\n width *= -1;\n }\n\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `${ signed ? \"\": \"u\" }int${ width }`, value, { signed, width });\n}\n\nfunction b(value: BytesLike, size?: number): Typed {\n // @TODO: Check range is valid for value\n return new Typed(_gaurd, `bytes${ (size) ? size: \"\" }`, value, { size });\n}\n\n// @TODO: Remove this in v7, it was replaced by TypedBigInt\n/**\n * @_ignore:\n */\nexport interface TypedNumber extends Typed {\n value: number;\n defaultValue(): number;\n minValue(): number;\n maxValue(): number;\n}\n\n/**\n * A **Typed** that represents a numeric value.\n */\nexport interface TypedBigInt extends Typed {\n /**\n * The value.\n */\n value: bigint;\n\n /**\n * The default value for all numeric types is ``0``.\n */\n defaultValue(): bigint;\n\n /**\n * The minimum value for this type, accounting for bit-width and signed-ness.\n */\n minValue(): bigint;\n\n /**\n * The minimum value for this type, accounting for bit-width.\n */\n maxValue(): bigint;\n}\n\n/**\n * A **Typed** that represents a binary sequence of data as bytes.\n */\nexport interface TypedData extends Typed {\n /**\n * The value.\n */\n value: string;\n\n /**\n * The default value for this type.\n */\n defaultValue(): string;\n}\n\n/**\n * A **Typed** that represents a UTF-8 sequence of bytes.\n */\nexport interface TypedString extends Typed {\n /**\n * The value.\n */\n value: string;\n\n /**\n * The default value for the string type is the empty string (i.e. ``\"\"``).\n */\n defaultValue(): string;\n}\n\nconst _typedSymbol = Symbol.for(\"_ethers_typed\");\n\n/**\n * The **Typed** class to wrap values providing explicit type information.\n */\nexport class Typed {\n\n /**\n * The type, as a Solidity-compatible type.\n */\n readonly type!: string;\n\n /**\n * The actual value.\n */\n readonly value!: any;\n\n readonly #options: any;\n\n /**\n * @_ignore:\n */\n readonly _typedSymbol!: Symbol;\n\n /**\n * @_ignore:\n */\n constructor(gaurd: any, type: string, value: any, options?: any) {\n if (options == null) { options = null; }\n assertPrivate(_gaurd, gaurd, \"Typed\");\n defineProperties<Typed>(this, { _typedSymbol, type, value });\n this.#options = options;\n\n // Check the value is valid\n this.format();\n }\n\n /**\n * Format the type as a Human-Readable type.\n */\n format(): string {\n if (this.type === \"array\") {\n throw new Error(\"\");\n } else if (this.type === \"dynamicArray\") {\n throw new Error(\"\");\n } else if (this.type === \"tuple\") {\n return `tuple(${ this.value.map((v: Typed) => v.format()).join(\",\") })`\n }\n\n return this.type;\n }\n\n /**\n * The default value returned by this type.\n */\n defaultValue(): string | number | bigint | Result {\n return 0;\n }\n\n /**\n * The minimum value for numeric types.\n */\n minValue(): string | number | bigint {\n return 0;\n }\n\n /**\n * The maximum value for numeric types.\n */\n maxValue(): string | number | bigint {\n return 0;\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedBigInt]].\n */\n isBigInt(): this is TypedBigInt {\n return !!(this.type.match(/^u?int[0-9]+$/));\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedData]].\n */\n isData(): this is TypedData {\n return this.type.startsWith(\"bytes\");\n }\n\n /**\n * Returns ``true`` and provides a type guard is this is a [[TypedString]].\n */\n isString(): this is TypedString {\n return (this.type === \"string\");\n }\n\n /**\n * Returns the tuple name, if this is a tuple. Throws otherwise.\n */\n get tupleName(): null | string {\n if (this.type !== \"tuple\") { throw TypeError(\"not a tuple\"); }\n return this.#options;\n }\n\n // Returns the length of this type as an array\n // - `null` indicates the length is unforced, it could be dynamic\n // - `-1` indicates the length is dynamic\n // - any other value indicates it is a static array and is its length\n\n /**\n * Returns the length of the array type or ``-1`` if it is dynamic.\n *\n * Throws if the type is not an array.\n */\n get arrayLength(): null | number {\n if (this.type !== \"array\") { throw TypeError(\"not an array\"); }\n if (this.#options === true) { return -1; }\n if (this.#options === false) { return (<Array<any>>(this.value)).length; }\n return null;\n }\n\n /**\n * Returns a new **Typed** of %%type%% with the %%value%%.\n */\n static from(type: string, value: any): Typed {\n return new Typed(_gaurd, type, value);\n }\n\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static uint8(v: BigNumberish): Typed { return n(v, 8); }\n\n /**\n * Return a new ``uint16`` type for %%v%%.\n */\n static uint16(v: BigNumberish): Typed { return n(v, 16); }\n\n /**\n * Return a new ``uint24`` type for %%v%%.\n */\n static uint24(v: BigNumberish): Typed { return n(v, 24); }\n\n /**\n * Return a new ``uint32`` type for %%v%%.\n */\n static uint32(v: BigNumberish): Typed { return n(v, 32); }\n\n /**\n * Return a new ``uint40`` type for %%v%%.\n */\n static uint40(v: BigNumberish): Typed { return n(v, 40); }\n\n /**\n * Return a new ``uint48`` type for %%v%%.\n */\n static uint48(v: BigNumberish): Typed { return n(v, 48); }\n\n /**\n * Return a new ``uint56`` type for %%v%%.\n */\n static uint56(v: BigNumberish): Typed { return n(v, 56); }\n\n /**\n * Return a new ``uint64`` type for %%v%%.\n */\n static uint64(v: BigNumberish): Typed { return n(v, 64); }\n\n /**\n * Return a new ``uint72`` type for %%v%%.\n */\n static uint72(v: BigNumberish): Typed { return n(v, 72); }\n\n /**\n * Return a new ``uint80`` type for %%v%%.\n */\n static uint80(v: BigNumberish): Typed { return n(v, 80); }\n\n /**\n * Return a new ``uint88`` type for %%v%%.\n */\n static uint88(v: BigNumberish): Typed { return n(v, 88); }\n\n /**\n * Return a new ``uint96`` type for %%v%%.\n */\n static uint96(v: BigNumberish): Typed { return n(v, 96); }\n\n /**\n * Return a new ``uint104`` type for %%v%%.\n */\n static uint104(v: BigNumberish): Typed { return n(v, 104); }\n\n /**\n * Return a new ``uint112`` type for %%v%%.\n */\n static uint112(v: BigNumberish): Typed { return n(v, 112); }\n\n /**\n * Return a new ``uint120`` type for %%v%%.\n */\n static uint120(v: BigNumberish): Typed { return n(v, 120); }\n\n /**\n * Return a new ``uint128`` type for %%v%%.\n */\n static uint128(v: BigNumberish): Typed { return n(v, 128); }\n\n /**\n * Return a new ``uint136`` type for %%v%%.\n */\n static uint136(v: BigNumberish): Typed { return n(v, 136); }\n\n /**\n * Return a new ``uint144`` type for %%v%%.\n */\n static uint144(v: BigNumberish): Typed { return n(v, 144); }\n\n /**\n * Return a new ``uint152`` type for %%v%%.\n */\n static uint152(v: BigNumberish): Typed { return n(v, 152); }\n\n /**\n * Return a new ``uint160`` type for %%v%%.\n */\n static uint160(v: BigNumberish): Typed { return n(v, 160); }\n\n /**\n * Return a new ``uint168`` type for %%v%%.\n */\n static uint168(v: BigNumberish): Typed { return n(v, 168); }\n\n /**\n * Return a new ``uint176`` type for %%v%%.\n */\n static uint176(v: BigNumberish): Typed { return n(v, 176); }\n\n /**\n * Return a new ``uint184`` type for %%v%%.\n */\n static uint184(v: BigNumberish): Typed { return n(v, 184); }\n\n /**\n * Return a new ``uint192`` type for %%v%%.\n */\n static uint192(v: BigNumberish): Typed { return n(v, 192); }\n\n /**\n * Return a new ``uint200`` type for %%v%%.\n */\n static uint200(v: BigNumberish): Typed { return n(v, 200); }\n\n /**\n * Return a new ``uint208`` type for %%v%%.\n */\n static uint208(v: BigNumberish): Typed { return n(v, 208); }\n\n /**\n * Return a new ``uint216`` type for %%v%%.\n */\n static uint216(v: BigNumberish): Typed { return n(v, 216); }\n\n /**\n * Return a new ``uint224`` type for %%v%%.\n */\n static uint224(v: BigNumberish): Typed { return n(v, 224); }\n\n /**\n * Return a new ``uint232`` type for %%v%%.\n */\n static uint232(v: BigNumberish): Typed { return n(v, 232); }\n\n /**\n * Return a new ``uint240`` type for %%v%%.\n */\n static uint240(v: BigNumberish): Typed { return n(v, 240); }\n\n /**\n * Return a new ``uint248`` type for %%v%%.\n */\n static uint248(v: BigNumberish): Typed { return n(v, 248); }\n\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint256(v: BigNumberish): Typed { return n(v, 256); }\n\n /**\n * Return a new ``uint256`` type for %%v%%.\n */\n static uint(v: BigNumberish): Typed { return n(v, 256); }\n\n /**\n * Return a new ``int8`` type for %%v%%.\n */\n static int8(v: BigNumberish): Typed { return n(v, -8); }\n\n /**\n * Return a new ``int16`` type for %%v%%.\n */\n static int16(v: BigNumberish): Typed { return n(v, -16); }\n\n /**\n * Return a new ``int24`` type for %%v%%.\n */\n static int24(v: BigNumberish): Typed { return n(v, -24); }\n\n /**\n * Return a new ``int32`` type for %%v%%.\n */\n static int32(v: BigNumberish): Typed { return n(v, -32); }\n\n /**\n * Return a new ``int40`` type for %%v%%.\n */\n static int40(v: BigNumberish): Typed { return n(v, -40); }\n\n /**\n * Return a new ``int48`` type for %%v%%.\n */\n static int48(v: BigNumberish): Typed { return n(v, -48); }\n\n /**\n * Return a new ``int56`` type for %%v%%.\n */\n static int56(v: BigNumberish): Typed { return n(v, -56); }\n\n /**\n * Return a new ``int64`` type for %%v%%.\n */\n static int64(v: BigNumberish): Typed { return n(v, -64); }\n\n /**\n * Return a new ``int72`` type for %%v%%.\n */\n static int72(v: BigNumberish): Typed { return n(v, -72); }\n\n /**\n * Return a new ``int80`` type for %%v%%.\n */\n static int80(v: BigNumberish): Typed { return n(v, -80); }\n\n /**\n * Return a new ``int88`` type for %%v%%.\n */\n static int88(v: BigNumberish): Typed { return n(v, -88); }\n\n /**\n * Return a new ``int96`` type for %%v%%.\n */\n static int96(v: BigNumberish): Typed { return n(v, -96); }\n\n /**\n * Return a new ``int104`` type for %%v%%.\n */\n static int104(v: BigNumberish): Typed { return n(v, -104); }\n\n /**\n * Return a new ``int112`` type for %%v%%.\n */\n static int112(v: BigNumberish): Typed { return n(v, -112); }\n\n /**\n * Return a new ``int120`` type for %%v%%.\n */\n static int120(v: BigNumberish): Typed { return n(v, -120); }\n\n /**\n * Return a new ``int128`` type for %%v%%.\n */\n static int128(v: BigNumberish): Typed { return n(v, -128); }\n\n /**\n * Return a new ``int136`` type for %%v%%.\n */\n static int136(v: BigNumberish): Typed { return n(v, -136); }\n\n /**\n * Return a new ``int144`` type for %%v%%.\n */\n static int144(v: BigNumberish): Typed { return n(v, -144); }\n\n /**\n * Return a new ``int52`` type for %%v%%.\n */\n static int152(v: BigNumberish): Typed { return n(v, -152); }\n\n /**\n * Return a new ``int160`` type for %%v%%.\n */\n static int160(v: BigNumberish): Typed { return n(v, -160); }\n\n /**\n * Return a new ``int168`` type for %%v%%.\n */\n static int168(v: BigNumberish): Typed { return n(v, -168); }\n\n /**\n * Return a new ``int176`` type for %%v%%.\n */\n static int176(v: BigNumberish): Typed { return n(v, -176); }\n\n /**\n * Return a new ``int184`` type for %%v%%.\n */\n static int184(v: BigNumberish): Typed { return n(v, -184); }\n\n /**\n * Return a new ``int92`` type for %%v%%.\n */\n static int192(v: BigNumberish): Typed { return n(v, -192); }\n\n /**\n * Return a new ``int200`` type for %%v%%.\n */\n static int200(v: BigNumberish): Typed { return n(v, -200); }\n\n /**\n * Return a new ``int208`` type for %%v%%.\n */\n static int208(v: BigNumberish): Typed { return n(v, -208); }\n\n /**\n * Return a new ``int216`` type for %%v%%.\n */\n static int216(v: BigNumberish): Typed { return n(v, -216); }\n\n /**\n * Return a new ``int224`` type for %%v%%.\n */\n static int224(v: BigNumberish): Typed { return n(v, -224); }\n\n /**\n * Return a new ``int232`` type for %%v%%.\n */\n static int232(v: BigNumberish): Typed { return n(v, -232); }\n\n /**\n * Return a new ``int240`` type for %%v%%.\n */\n static int240(v: BigNumberish): Typed { return n(v, -240); }\n\n /**\n * Return a new ``int248`` type for %%v%%.\n */\n static int248(v: BigNumberish): Typed { return n(v, -248); }\n\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int256(v: BigNumberish): Typed { return n(v, -256); }\n\n /**\n * Return a new ``int256`` type for %%v%%.\n */\n static int(v: BigNumberish): Typed { return n(v, -256); }\n\n /**\n * Return a new ``bytes1`` type for %%v%%.\n */\n static bytes1(v: BytesLike): Typed { return b(v, 1); }\n\n /**\n * Return a new ``bytes2`` type for %%v%%.\n */\n static bytes2(v: BytesLike): Typed { return b(v, 2); }\n\n /**\n * Return a new ``bytes3`` type for %%v%%.\n */\n static bytes3(v: BytesLike): Typed { return b(v, 3); }\n\n /**\n * Return a new ``bytes4`` type for %%v%%.\n */\n static bytes4(v: BytesLike): Typed { return b(v, 4); }\n\n /**\n * Return a new ``bytes5`` type for %%v%%.\n */\n static bytes5(v: BytesLike): Typed { return b(v, 5); }\n\n /**\n * Return a new ``bytes6`` type for %%v%%.\n */\n static bytes6(v: BytesLike): Typed { return b(v, 6); }\n\n /**\n * Return a new ``bytes7`` type for %%v%%.\n */\n static bytes7(v: BytesLike): Typed { return b(v, 7); }\n\n /**\n * Return a new ``bytes8`` type for %%v%%.\n */\n static bytes8(v: BytesLike): Typed { return b(v, 8); }\n\n /**\n * Return a new ``bytes9`` type for %%v%%.\n */\n static bytes9(v: BytesLike): Typed { return b(v, 9); }\n\n /**\n * Return a new ``bytes10`` type for %%v%%.\n */\n static bytes10(v: BytesLike): Typed { return b(v, 10); }\n\n /**\n * Return a new ``bytes11`` type for %%v%%.\n */\n static bytes11(v: BytesLike): Typed { return b(v, 11); }\n\n /**\n * Return a new ``bytes12`` type for %%v%%.\n */\n static bytes12(v: BytesLike): Typed { return b(v, 12); }\n\n /**\n * Return a new ``bytes13`` type for %%v%%.\n */\n static bytes13(v: BytesLike): Typed { return b(v, 13); }\n\n /**\n * Return a new ``bytes14`` type for %%v%%.\n */\n static bytes14(v: BytesLike): Typed { return b(v, 14); }\n\n /**\n * Return a new ``bytes15`` type for %%v%%.\n */\n static bytes15(v: BytesLike): Typed { return b(v, 15); }\n\n /**\n * Return a new ``bytes16`` type for %%v%%.\n */\n static bytes16(v: BytesLike): Typed { return b(v, 16); }\n\n /**\n * Return a new ``bytes17`` type for %%v%%.\n */\n static bytes17(v: BytesLike): Typed { return b(v, 17); }\n\n /**\n * Return a new ``bytes18`` type for %%v%%.\n */\n static bytes18(v: BytesLike): Typed { return b(v, 18); }\n\n /**\n * Return a new ``bytes19`` type for %%v%%.\n */\n static bytes19(v: BytesLike): Typed { return b(v, 19); }\n\n /**\n * Return a new ``bytes20`` type for %%v%%.\n */\n static bytes20(v: BytesLike): Typed { return b(v, 20); }\n\n /**\n * Return a new ``bytes21`` type for %%v%%.\n */\n static bytes21(v: BytesLike): Typed { return b(v, 21); }\n\n /**\n * Return a new ``bytes22`` type for %%v%%.\n */\n static bytes22(v: BytesLike): Typed { return b(v, 22); }\n\n /**\n * Return a new ``bytes23`` type for %%v%%.\n */\n static bytes23(v: BytesLike): Typed { return b(v, 23); }\n\n /**\n * Return a new ``bytes24`` type for %%v%%.\n */\n static bytes24(v: BytesLike): Typed { return b(v, 24); }\n\n /**\n * Return a new ``bytes25`` type for %%v%%.\n */\n static bytes25(v: BytesLike): Typed { return b(v, 25); }\n\n /**\n * Return a new ``bytes26`` type for %%v%%.\n */\n static bytes26(v: BytesLike): Typed { return b(v, 26); }\n\n /**\n * Return a new ``bytes27`` type for %%v%%.\n */\n static bytes27(v: BytesLike): Typed { return b(v, 27); }\n\n /**\n * Return a new ``bytes28`` type for %%v%%.\n */\n static bytes28(v: BytesLike): Typed { return b(v, 28); }\n\n /**\n * Return a new ``bytes29`` type for %%v%%.\n */\n static bytes29(v: BytesLike): Typed { return b(v, 29); }\n\n /**\n * Return a new ``bytes30`` type for %%v%%.\n */\n static bytes30(v: BytesLike): Typed { return b(v, 30); }\n\n /**\n * Return a new ``bytes31`` type for %%v%%.\n */\n static bytes31(v: BytesLike): Typed { return b(v, 31); }\n\n /**\n * Return a new ``bytes32`` type for %%v%%.\n */\n static bytes32(v: BytesLike): Typed { return b(v, 32); }\n\n\n /**\n * Return a new ``address`` type for %%v%%.\n */\n static address(v: string | Addressable): Typed { return new Typed(_gaurd, \"address\", v); }\n\n /**\n * Return a new ``bool`` type for %%v%%.\n */\n static bool(v: any): Typed { return new Typed(_gaurd, \"bool\", !!v); }\n\n /**\n * Return a new ``bytes`` type for %%v%%.\n */\n static bytes(v: BytesLike): Typed { return new Typed(_gaurd, \"bytes\", v); }\n\n /**\n * Return a new ``string`` type for %%v%%.\n */\n static string(v: string): Typed { return new Typed(_gaurd, \"string\", v); }\n\n\n /**\n * Return a new ``array`` type for %%v%%, allowing %%dynamic%% length.\n */\n static array(v: Array<any | Typed>, dynamic?: null | boolean): Typed {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"array\", v, dynamic);\n }\n\n\n /**\n * Return a new ``tuple`` type for %%v%%, with the optional %%name%%.\n */\n static tuple(v: Array<any | Typed> | Record<string, any | Typed>, name?: string): Typed {\n throw new Error(\"not implemented yet\");\n return new Typed(_gaurd, \"tuple\", v, name);\n }\n\n\n /**\n * Return a new ``uint8`` type for %%v%%.\n */\n static overrides(v: Record<string, any>): Typed {\n return new Typed(_gaurd, \"overrides\", Object.assign({ }, v));\n }\n\n /**\n * Returns true only if %%value%% is a [[Typed]] instance.\n */\n static isTyped(value: any): value is Typed {\n return (value\n && typeof(value) === \"object\"\n && \"_typedSymbol\" in value\n && value._typedSymbol === _typedSymbol);\n }\n\n /**\n * If the value is a [[Typed]] instance, validates the underlying value\n * and returns it, otherwise returns value directly.\n *\n * This is useful for functions that with to accept either a [[Typed]]\n * object or values.\n */\n static dereference<T>(value: Typed | T, type: string): T {\n if (Typed.isTyped(value)) {\n if (value.type !== type) {\n throw new Error(`invalid type: expecetd ${ type }, got ${ value.type }`);\n }\n return value.value;\n }\n return value;\n }\n}\n","import { getAddress } from \"../../address/index.js\";\nimport { toBeHex } from \"../../utils/maths.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class AddressCoder extends Coder {\n\n constructor(localName: string) {\n super(\"address\", \"address\", localName, false);\n }\n\n defaultValue(): string {\n return \"0x0000000000000000000000000000000000000000\";\n }\n\n encode(writer: Writer, _value: string | Typed): number {\n let value = Typed.dereference(_value, \"string\");\n try {\n value = getAddress(value);\n } catch (error: any) {\n return this._throwError(error.message, _value);\n }\n return writer.writeValue(value);\n }\n\n decode(reader: Reader): any {\n return getAddress(toBeHex(reader.readValue(), 20));\n }\n}\n","import { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * Clones the functionality of an existing Coder, but without a localName\n *\n * @_ignore\n */\nexport class AnonymousCoder extends Coder {\n private coder: Coder;\n\n constructor(coder: Coder) {\n super(coder.name, coder.type, \"_\", coder.dynamic);\n this.coder = coder;\n }\n\n defaultValue(): any {\n return this.coder.defaultValue();\n }\n\n encode(writer: Writer, value: any): number {\n return this.coder.encode(writer, value);\n }\n\n decode(reader: Reader): any {\n return this.coder.decode(reader);\n }\n}\n","import {\n defineProperties, isError, assert, assertArgument, assertArgumentCount\n} from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\n\nimport { Coder, Result, WordSize, Writer } from \"./abstract-coder.js\";\nimport { AnonymousCoder } from \"./anonymous.js\";\n\nimport type { Reader } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport function pack(writer: Writer, coders: ReadonlyArray<Coder>, values: Array<any> | { [ name: string ]: any }): number {\n let arrayValues: Array<any> = [ ];\n\n if (Array.isArray(values)) {\n arrayValues = values;\n\n } else if (values && typeof(values) === \"object\") {\n let unique: { [ name: string ]: boolean } = { };\n\n arrayValues = coders.map((coder) => {\n const name = coder.localName;\n assert(name, \"cannot encode object for signature with missing names\",\n \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n\n assert(!unique[name], \"cannot encode object for signature with duplicate names\",\n \"INVALID_ARGUMENT\", { argument: \"values\", info: { coder }, value: values });\n\n unique[name] = true;\n\n return values[name];\n });\n\n } else {\n assertArgument(false, \"invalid tuple value\", \"tuple\", values);\n }\n\n assertArgument(coders.length === arrayValues.length, \"types/value length mismatch\", \"tuple\", values);\n\n let staticWriter = new Writer();\n let dynamicWriter = new Writer();\n\n let updateFuncs: Array<(baseOffset: number) => void> = [];\n coders.forEach((coder, index) => {\n let value = arrayValues[index];\n\n if (coder.dynamic) {\n // Get current dynamic offset (for the future pointer)\n let dynamicOffset = dynamicWriter.length;\n\n // Encode the dynamic value into the dynamicWriter\n coder.encode(dynamicWriter, value);\n\n // Prepare to populate the correct offset once we are done\n let updateFunc = staticWriter.writeUpdatableValue();\n updateFuncs.push((baseOffset: number) => {\n updateFunc(baseOffset + dynamicOffset);\n });\n\n } else {\n coder.encode(staticWriter, value);\n }\n });\n\n // Backfill all the dynamic offsets, now that we know the static length\n updateFuncs.forEach((func) => { func(staticWriter.length); });\n\n let length = writer.appendWriter(staticWriter);\n length += writer.appendWriter(dynamicWriter);\n return length;\n}\n\n/**\n * @_ignore\n */\nexport function unpack(reader: Reader, coders: ReadonlyArray<Coder>): Result {\n let values: Array<any> = [];\n let keys: Array<null | string> = [ ];\n\n // A reader anchored to this base\n let baseReader = reader.subReader(0);\n\n coders.forEach((coder) => {\n let value: any = null;\n\n if (coder.dynamic) {\n let offset = reader.readIndex();\n let offsetReader = baseReader.subReader(offset);\n try {\n value = coder.decode(offsetReader);\n } catch (error: any) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n\n } else {\n try {\n value = coder.decode(reader);\n } catch (error: any) {\n // Cannot recover from this\n if (isError(error, \"BUFFER_OVERRUN\")) {\n throw error;\n }\n\n value = error;\n value.baseType = coder.name;\n value.name = coder.localName;\n value.type = coder.type;\n }\n }\n\n if (value == undefined) {\n throw new Error(\"investigate\");\n }\n\n values.push(value);\n keys.push(coder.localName || null);\n });\n\n return Result.fromItems(values, keys);\n}\n\n/**\n * @_ignore\n */\nexport class ArrayCoder extends Coder {\n readonly coder!: Coder;\n readonly length!: number;\n\n constructor(coder: Coder, length: number, localName: string) {\n const type = (coder.type + \"[\" + (length >= 0 ? length: \"\") + \"]\");\n const dynamic = (length === -1 || coder.dynamic);\n super(\"array\", type, localName, dynamic);\n defineProperties<ArrayCoder>(this, { coder, length });\n }\n\n defaultValue(): Array<any> {\n // Verifies the child coder is valid (even if the array is dynamic or 0-length)\n const defaultChild = this.coder.defaultValue();\n\n const result: Array<any> = [];\n for (let i = 0; i < this.length; i++) {\n result.push(defaultChild);\n }\n return result;\n }\n\n encode(writer: Writer, _value: Array<any> | Typed): number {\n const value = Typed.dereference(_value, \"array\");\n\n if(!Array.isArray(value)) {\n this._throwError(\"expected array value\", value);\n }\n\n let count = this.length;\n\n if (count === -1) {\n count = value.length;\n writer.writeValue(value.length);\n }\n\n assertArgumentCount(value.length, count, \"coder array\" + (this.localName? (\" \"+ this.localName): \"\"));\n\n let coders: Array<Coder> = [ ];\n for (let i = 0; i < value.length; i++) { coders.push(this.coder); }\n\n return pack(writer, coders, value);\n }\n\n decode(reader: Reader): any {\n let count = this.length;\n if (count === -1) {\n count = reader.readIndex();\n\n // Check that there is *roughly* enough data to ensure\n // stray random data is not being read as a length. Each\n // slot requires at least 32 bytes for their value (or 32\n // bytes as a link to the data). This could use a much\n // tighter bound, but we are erroring on the side of safety.\n assert(count * WordSize <= reader.dataLength, \"insufficient data length\",\n \"BUFFER_OVERRUN\", { buffer: reader.bytes, offset: count * WordSize, length: reader.dataLength });\n }\n let coders: Array<Coder> = [];\n for (let i = 0; i < count; i++) { coders.push(new AnonymousCoder(this.coder)); }\n\n return unpack(reader, coders);\n }\n}\n\n","import { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport class BooleanCoder extends Coder {\n\n constructor(localName: string) {\n super(\"bool\", \"bool\", localName, false);\n }\n\n defaultValue(): boolean {\n return false;\n }\n\n encode(writer: Writer, _value: boolean | Typed): number {\n const value = Typed.dereference(_value, \"bool\");\n return writer.writeValue(value ? 1: 0);\n }\n\n decode(reader: Reader): any {\n return !!reader.readValue();\n }\n}\n","import { getBytesCopy, hexlify } from \"../../utils/index.js\";\n\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class DynamicBytesCoder extends Coder {\n constructor(type: string, localName: string) {\n super(type, type, localName, true);\n }\n\n defaultValue(): string {\n return \"0x\";\n }\n\n encode(writer: Writer, value: any): number {\n value = getBytesCopy(value);\n let length = writer.writeValue(value.length);\n length += writer.writeBytes(value);\n return length;\n }\n\n decode(reader: Reader): any {\n return reader.readBytes(reader.readIndex(), true);\n }\n}\n\n/**\n * @_ignore\n */\nexport class BytesCoder extends DynamicBytesCoder {\n constructor(localName: string) {\n super(\"bytes\", localName);\n }\n\n decode(reader: Reader): any {\n return hexlify(super.decode(reader));\n }\n}\n","\nimport { defineProperties, getBytesCopy, hexlify } from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport type { BytesLike } from \"../../utils/index.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class FixedBytesCoder extends Coder {\n readonly size!: number;\n\n constructor(size: number, localName: string) {\n let name = \"bytes\" + String(size);\n super(name, name, localName, false);\n defineProperties<FixedBytesCoder>(this, { size }, { size: \"number\" });\n }\n\n defaultValue(): string {\n return (\"0x0000000000000000000000000000000000000000000000000000000000000000\").substring(0, 2 + this.size * 2);\n }\n\n encode(writer: Writer, _value: BytesLike | Typed): number {\n let data = getBytesCopy(Typed.dereference(_value, this.type));\n if (data.length !== this.size) { this._throwError(\"incorrect data length\", _value); }\n return writer.writeBytes(data);\n }\n\n decode(reader: Reader): any {\n return hexlify(reader.readBytes(this.size));\n }\n}\n","import { Coder } from \"./abstract-coder.js\";\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\nconst Empty = new Uint8Array([ ]);\n\n/**\n * @_ignore\n */\nexport class NullCoder extends Coder {\n\n constructor(localName: string) {\n super(\"null\", \"\", localName, false);\n }\n\n defaultValue(): null {\n return null;\n }\n\n encode(writer: Writer, value: any): number {\n if (value != null) { this._throwError(\"not null\", value); }\n return writer.writeBytes(Empty);\n }\n\n decode(reader: Reader): any {\n reader.readBytes(0);\n return null;\n }\n}\n","import {\n defineProperties, fromTwos, getBigInt, mask, toTwos\n} from \"../../utils/index.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder, WordSize } from \"./abstract-coder.js\";\n\nimport type { BigNumberish } from \"../../utils/index.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\nconst BN_0 = BigInt(0);\nconst BN_1 = BigInt(1);\nconst BN_MAX_UINT256 = BigInt(\"0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff\");\n\n/**\n * @_ignore\n */\nexport class NumberCoder extends Coder {\n readonly size!: number;\n readonly signed!: boolean;\n\n constructor(size: number, signed: boolean, localName: string) {\n const name = ((signed ? \"int\": \"uint\") + (size * 8));\n super(name, name, localName, false);\n\n defineProperties<NumberCoder>(this, { size, signed }, { size: \"number\", signed: \"boolean\" });\n }\n\n defaultValue(): number {\n return 0;\n }\n\n encode(writer: Writer, _value: BigNumberish | Typed): number {\n let value = getBigInt(Typed.dereference(_value, this.type));\n\n // Check bounds are safe for encoding\n let maxUintValue = mask(BN_MAX_UINT256, WordSize * 8);\n if (this.signed) {\n let bounds = mask(maxUintValue, (this.size * 8) - 1);\n if (value > bounds || value < -(bounds + BN_1)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n value = toTwos(value, 8 * WordSize);\n } else if (value < BN_0 || value > mask(maxUintValue, this.size * 8)) {\n this._throwError(\"value out-of-bounds\", _value);\n }\n\n return writer.writeValue(value);\n }\n\n decode(reader: Reader): any {\n let value = mask(reader.readValue(), this.size * 8);\n\n if (this.signed) {\n value = fromTwos(value, this.size * 8);\n }\n\n return value;\n }\n}\n\n","import { toUtf8Bytes, toUtf8String } from \"../../utils/utf8.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { DynamicBytesCoder } from \"./bytes.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n\n/**\n * @_ignore\n */\nexport class StringCoder extends DynamicBytesCoder {\n\n constructor(localName: string) {\n super(\"string\", localName);\n }\n\n defaultValue(): string {\n return \"\";\n }\n\n encode(writer: Writer, _value: string | Typed): number {\n return super.encode(writer, toUtf8Bytes(Typed.dereference(_value, \"string\")));\n }\n\n decode(reader: Reader): any {\n return toUtf8String(super.decode(reader));\n }\n}\n","import { defineProperties } from \"../../utils/properties.js\";\n\nimport { Typed } from \"../typed.js\";\nimport { Coder } from \"./abstract-coder.js\";\n\nimport { pack, unpack } from \"./array.js\";\n\nimport type { Reader, Writer } from \"./abstract-coder.js\";\n\n/**\n * @_ignore\n */\nexport class TupleCoder extends Coder {\n readonly coders!: ReadonlyArray<Coder>;\n\n constructor(coders: Array<Coder>, localName: string) {\n let dynamic = false;\n const types: Array<string> = [];\n coders.forEach((coder) => {\n if (coder.dynamic) { dynamic = true; }\n types.push(coder.type);\n });\n const type = (\"tuple(\" + types.join(\",\") + \")\");\n\n super(\"tuple\", type, localName, dynamic);\n defineProperties<TupleCoder>(this, { coders: Object.freeze(coders.slice()) });\n }\n\n defaultValue(): any {\n const values: any = [ ];\n this.coders.forEach((coder) => {\n values.push(coder.defaultValue());\n });\n\n // We only output named properties for uniquely named coders\n const uniqueNames = this.coders.reduce((accum, coder) => {\n const name = coder.localName;\n if (name) {\n if (!accum[name]) { accum[name] = 0; }\n accum[name]++;\n }\n return accum;\n }, <{ [ name: string ]: number }>{ });\n\n // Add named values\n this.coders.forEach((coder: Coder, index: number) => {\n let name = coder.localName;\n if (!name || uniqueNames[name] !== 1) { return; }\n\n if (name === \"length\") { name = \"_length\"; }\n\n if (values[name] != null) { return; }\n\n values[name] = values[index];\n });\n\n return Object.freeze(values);\n }\n\n encode(writer: Writer, _value: Array<any> | { [ name: string ]: any } | Typed): number {\n const value = Typed.dereference(_value, \"tuple\");\n return pack(writer, this.coders, value);\n }\n\n decode(reader: Reader): any {\n return unpack(reader, this.coders);\n }\n}\n\n","import { keccak256 } from \"../crypto/index.js\";\nimport { toUtf8Bytes } from \"../utils/index.js\";\n\n/**\n * A simple hashing function which operates on UTF-8 strings to\n * compute an 32-byte identifier.\n *\n * This simply computes the [UTF-8 bytes](toUtf8Bytes) and computes\n * the [[keccak256]].\n *\n * @example:\n * id(\"hello world\")\n * //_result:\n */\nexport function id(value: string): string {\n return keccak256(toUtf8Bytes(value));\n}\n","import { getAddress } from \"../address/index.js\";\nimport { assertArgument, isHexString } from \"../utils/index.js\";\n\nimport type { AccessList, AccessListish } from \"./index.js\";\n\n\nfunction accessSetify(addr: string, storageKeys: Array<string>): { address: string,storageKeys: Array<string> } {\n return {\n address: getAddress(addr),\n storageKeys: storageKeys.map((storageKey, index) => {\n assertArgument(isHexString(storageKey, 32), \"invalid slot\", `storageKeys[${ index }]`, storageKey);\n return storageKey.toLowerCase();\n })\n };\n}\n\n/**\n * Returns a [[AccessList]] from any ethers-supported access-list structure.\n */\nexport function accessListify(value: AccessListish): AccessList {\n if (Array.isArray(value)) {\n return (<Array<[ string, Array<string>] | { address: string, storageKeys: Array<string>}>>value).map((set, index) => {\n if (Array.isArray(set)) {\n assertArgument(set.length === 2, \"invalid slot set\", `value[${ index }]`, set);\n return accessSetify(set[0], set[1])\n }\n assertArgument(set != null && typeof(set) === \"object\", \"invalid address-slot set\", \"value\", value);\n return accessSetify(set.address, set.storageKeys);\n });\n }\n\n assertArgument(value != null && typeof(value) === \"object\", \"invalid access list\", \"value\", value);\n\n const result: Array<{ address: string, storageKeys: Array<string> }> = Object.keys(value).map((addr) => {\n const storageKeys: Record<string, true> = value[addr].reduce((accum, storageKey) => {\n accum[storageKey] = true;\n return accum;\n }, <Record<string, true>>{ });\n return accessSetify(addr, Object.keys(storageKeys).sort())\n });\n result.sort((a, b) => (a.address.localeCompare(b.address)));\n return result;\n}\n","/**\n * A fragment is a single item from an ABI, which may represent any of:\n *\n * - [Functions](FunctionFragment)\n * - [Events](EventFragment)\n * - [Constructors](ConstructorFragment)\n * - Custom [Errors](ErrorFragment)\n * - [Fallback or Receive](FallbackFragment) functions\n *\n * @_subsection api/abi/abi-coder:Fragments [about-fragments]\n */\n\nimport {\n defineProperties, getBigInt, getNumber,\n assert, assertPrivate, assertArgument\n} from \"../utils/index.js\";\nimport { id } from \"../hash/index.js\";\n\n/**\n * A Type description in a [JSON ABI format](link-solc-jsonabi).\n */\nexport interface JsonFragmentType {\n /**\n * The parameter name.\n */\n readonly name?: string;\n\n /**\n * If the parameter is indexed.\n */\n readonly indexed?: boolean;\n\n /**\n * The type of the parameter.\n */\n readonly type?: string;\n\n /**\n * The internal Solidity type.\n */\n readonly internalType?: string;\n\n /**\n * The components for a tuple.\n */\n readonly components?: ReadonlyArray<JsonFragmentType>;\n}\n\n/**\n * A fragment for a method, event or error in a [JSON ABI format](link-solc-jsonabi).\n */\nexport interface JsonFragment {\n /**\n * The name of the error, event, function, etc.\n */\n readonly name?: string;\n\n /**\n * The type of the fragment (e.g. ``event``, ``\"function\"``, etc.)\n */\n readonly type?: string;\n\n /**\n * If the event is anonymous.\n */\n readonly anonymous?: boolean;\n\n /**\n * If the function is payable.\n */\n readonly payable?: boolean;\n\n /**\n * If the function is constant.\n */\n readonly constant?: boolean;\n\n /**\n * The mutability state of the function.\n */\n readonly stateMutability?: string;\n\n /**\n * The input parameters.\n */\n readonly inputs?: ReadonlyArray<JsonFragmentType>;\n\n /**\n * The output parameters.\n */\n readonly outputs?: ReadonlyArray<JsonFragmentType>;\n\n /**\n * The gas limit to use when sending a transaction for this function.\n */\n readonly gas?: string;\n};\n\n/**\n * The format to serialize the output as.\n *\n * **``\"sighash\"``** - the bare formatting, used to compute the selector\n * or topic hash; this format cannot be reversed (as it discards ``indexed``)\n * so cannot by used to export an [[Interface]].\n *\n * **``\"minimal\"``** - Human-Readable ABI with minimal spacing and without\n * names, so it is compact, but will result in Result objects that cannot\n * be accessed by name.\n *\n * **``\"full\"``** - Full Human-Readable ABI, with readable spacing and names\n * intact; this is generally the recommended format.\n *\n * **``\"json\"``** - The [JSON ABI format](link-solc-jsonabi).\n */\nexport type FormatType = \"sighash\" | \"minimal\" | \"full\" | \"json\";\n\n// [ \"a\", \"b\" ] => { \"a\": 1, \"b\": 1 }\nfunction setify(items: Array<string>): ReadonlySet<string> {\n const result: Set<string> = new Set();\n items.forEach((k) => result.add(k));\n return Object.freeze(result);\n}\n\nconst _kwVisibDeploy = \"external public payable override\";\nconst KwVisibDeploy = setify(_kwVisibDeploy.split(\" \"));\n\n// Visibility Keywords\nconst _kwVisib = \"constant external internal payable private public pure view override\";\nconst KwVisib = setify(_kwVisib.split(\" \"));\n\nconst _kwTypes = \"constructor error event fallback function receive struct\";\nconst KwTypes = setify(_kwTypes.split(\" \"));\n\nconst _kwModifiers = \"calldata memory storage payable indexed\";\nconst KwModifiers = setify(_kwModifiers.split(\" \"));\n\nconst _kwOther = \"tuple returns\";\n\n// All Keywords\nconst _keywords = [ _kwTypes, _kwModifiers, _kwOther, _kwVisib ].join(\" \");\nconst Keywords = setify(_keywords.split(\" \"));\n\n// Single character tokens\nconst SimpleTokens: Record<string, string> = {\n \"(\": \"OPEN_PAREN\", \")\": \"CLOSE_PAREN\",\n \"[\": \"OPEN_BRACKET\", \"]\": \"CLOSE_BRACKET\",\n \",\": \"COMMA\", \"@\": \"AT\"\n};\n\n// Parser regexes to consume the next token\nconst regexWhitespacePrefix = new RegExp(\"^(\\\\s*)\");\nconst regexNumberPrefix = new RegExp(\"^([0-9]+)\");\nconst regexIdPrefix = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)\");\n\n// Parser regexs to check validity\nconst regexId = new RegExp(\"^([a-zA-Z$_][a-zA-Z0-9$_]*)$\");\nconst regexType = new RegExp(\"^(address|bool|bytes([0-9]*)|string|u?int([0-9]*))$\");\n\n/**\n * @ignore:\n */\ntype Token = Readonly<{\n // Type of token (e.g. TYPE, KEYWORD, NUMBER, etc)\n type: string;\n\n // Offset into the original source code\n offset: number;\n\n // Actual text content of the token\n text: string;\n\n // The parenthesis depth\n depth: number;\n\n // If a parenthesis, the offset (in tokens) that balances it\n match: number;\n\n // For parenthesis and commas, the offset (in tokens) to the\n // previous/next parenthesis or comma in the list\n linkBack: number;\n linkNext: number;\n\n // If a BRACKET, the value inside\n value: number;\n}>;\n\nclass TokenString {\n #offset: number;\n #tokens: ReadonlyArray<Token>;\n\n get offset(): number { return this.#offset; }\n get length(): number { return this.#tokens.length - this.#offset; }\n\n constructor(tokens: ReadonlyArray<Token>) {\n this.#offset = 0;\n this.#tokens = tokens.slice();\n }\n\n clone(): TokenString { return new TokenString(this.#tokens); }\n reset(): void { this.#offset = 0; }\n\n #subTokenString(from: number = 0, to: number = 0): TokenString {\n return new TokenString(this.#tokens.slice(from, to).map((t) => {\n return Object.freeze(Object.assign({ }, t, {\n match: (t.match - from),\n linkBack: (t.linkBack - from),\n linkNext: (t.linkNext - from),\n }));\n }));\n }\n\n // Pops and returns the value of the next token, if it is a keyword in allowed; throws if out of tokens\n popKeyword(allowed: ReadonlySet<string>): string {\n const top = this.peek();\n if (top.type !== \"KEYWORD\" || !allowed.has(top.text)) { throw new Error(`expected keyword ${ top.text }`); }\n return this.pop().text;\n }\n\n // Pops and returns the value of the next token if it is `type`; throws if out of tokens\n popType(type: string): string {\n if (this.peek().type !== type) {\n const top = this.peek();\n throw new Error(`expected ${ type }; got ${ top.type } ${ JSON.stringify(top.text) }`);\n }\n return this.pop().text;\n }\n\n // Pops and returns a \"(\" TOKENS \")\"\n popParen(): TokenString {\n const top = this.peek();\n if (top.type !== \"OPEN_PAREN\") { throw new Error(\"bad start\"); }\n const result = this.#subTokenString(this.#offset + 1, top.match + 1);\n this.#offset = top.match + 1;\n return result;\n }\n\n // Pops and returns the items within \"(\" ITEM1 \",\" ITEM2 \",\" ... \")\"\n popParams(): Array<TokenString> {\n const top = this.peek();\n\n if (top.type !== \"OPEN_PAREN\") { throw new Error(\"bad start\"); }\n\n const result: Array<TokenString> = [ ];\n\n while(this.#offset < top.match - 1) {\n const link = this.peek().linkNext;\n result.push(this.#subTokenString(this.#offset + 1, link));\n this.#offset = link;\n }\n\n this.#offset = top.match + 1;\n\n return result;\n }\n\n // Returns the top Token, throwing if out of tokens\n peek(): Token {\n if (this.#offset >= this.#tokens.length) {\n throw new Error(\"out-of-bounds\");\n }\n return this.#tokens[this.#offset];\n }\n\n // Returns the next value, if it is a keyword in `allowed`\n peekKeyword(allowed: ReadonlySet<string>): null | string {\n const top = this.peekType(\"KEYWORD\");\n return (top != null && allowed.has(top)) ? top: null;\n }\n\n // Returns the value of the next token if it is `type`\n peekType(type: string): null | string {\n if (this.length === 0) { return null; }\n const top = this.peek();\n return (top.type === type) ? top.text: null;\n }\n\n // Returns the next token; throws if out of tokens\n pop(): Token {\n const result = this.peek();\n this.#offset++;\n return result;\n }\n\n toString(): string {\n const tokens: Array<string> = [ ];\n for (let i = this.#offset; i < this.#tokens.length; i++) {\n const token = this.#tokens[i];\n tokens.push(`${ token.type }:${ token.text }`);\n }\n return `<TokenString ${ tokens.join(\" \") }>`\n }\n}\n\ntype Writeable<T> = { -readonly [P in keyof T]: T[P] };\n\nfunction lex(text: string): TokenString {\n const tokens: Array<Token> = [ ];\n\n const throwError = (message: string) => {\n const token = (offset < text.length) ? JSON.stringify(text[offset]): \"$EOI\";\n throw new Error(`invalid token ${ token } at ${ offset }: ${ message }`);\n };\n\n let brackets: Array<number> = [ ];\n let commas: Array<number> = [ ];\n\n let offset = 0;\n while (offset < text.length) {\n\n // Strip off any leading whitespace\n let cur = text.substring(offset);\n let match = cur.match(regexWhitespacePrefix);\n if (match) {\n offset += match[1].length;\n cur = text.substring(offset);\n }\n\n const token = { depth: brackets.length, linkBack: -1, linkNext: -1, match: -1, type: \"\", text: \"\", offset, value: -1 };\n tokens.push(token);\n\n let type = (SimpleTokens[cur[0]] || \"\");\n if (type) {\n token.type = type;\n token.text = cur[0];\n offset++;\n\n if (type === \"OPEN_PAREN\") {\n brackets.push(tokens.length - 1);\n commas.push(tokens.length - 1);\n\n } else if (type == \"CLOSE_PAREN\") {\n if (brackets.length === 0) { throwError(\"no matching open bracket\"); }\n\n token.match = brackets.pop() as number;\n (<Writeable<Token>>(tokens[token.match])).match = tokens.length - 1;\n token.depth--;\n\n token.linkBack = commas.pop() as number;\n (<Writeable<Token>>(tokens[token.linkBack])).linkNext = tokens.length - 1;\n\n } else if (type === \"COMMA\") {\n token.linkBack = commas.pop() as number;\n (<Writeable<Token>>(tokens[token.linkBack])).linkNext = tokens.length - 1;\n commas.push(tokens.length - 1);\n\n } else if (type === \"OPEN_BRACKET\") {\n token.type = \"BRACKET\";\n\n } else if (type === \"CLOSE_BRACKET\") {\n // Remove the CLOSE_BRACKET\n let suffix = (tokens.pop() as Token).text;\n if (tokens.length > 0 && tokens[tokens.length - 1].type === \"NUMBER\") {\n const value = (tokens.pop() as Token).text;\n suffix = value + suffix;\n (<Writeable<Token>>(tokens[tokens.length - 1])).value = getNumber(value);\n }\n if (tokens.length === 0 || tokens[tokens.length - 1].type !== \"BRACKET\") {\n throw new Error(\"missing opening bracket\");\n }\n (<Writeable<Token>>(tokens[tokens.length - 1])).text += suffix;\n }\n\n continue;\n }\n\n match = cur.match(regexIdPrefix);\n if (match) {\n token.text = match[1];\n offset += token.text.length;\n\n if (Keywords.has(token.text)) {\n token.type = \"KEYWORD\";\n continue;\n }\n\n if (token.text.match(regexType)) {\n token.type = \"TYPE\";\n continue;\n }\n\n token.type = \"ID\";\n continue;\n }\n\n match = cur.match(regexNumberPrefix);\n if (match) {\n token.text = match[1];\n token.type = \"NUMBER\";\n offset += token.text.length;\n continue;\n }\n\n throw new Error(`unexpected token ${ JSON.stringify(cur[0]) } at position ${ offset }`);\n }\n\n return new TokenString(tokens.map((t) => Object.freeze(t)));\n}\n\n// Check only one of `allowed` is in `set`\nfunction allowSingle(set: ReadonlySet<string>, allowed: ReadonlySet<string>): void {\n let included: Array<string> = [ ];\n for (const key in allowed.keys()) {\n if (set.has(key)) { included.push(key); }\n }\n if (included.length > 1) { throw new Error(`conflicting types: ${ included.join(\", \") }`); }\n}\n\n// Functions to process a Solidity Signature TokenString from left-to-right for...\n\n// ...the name with an optional type, returning the name\nfunction consumeName(type: string, tokens: TokenString): string {\n if (tokens.peekKeyword(KwTypes)) {\n const keyword = tokens.pop().text;\n if (keyword !== type) {\n throw new Error(`expected ${ type }, got ${ keyword }`);\n }\n }\n\n return tokens.popType(\"ID\");\n}\n\n// ...all keywords matching allowed, returning the keywords\nfunction consumeKeywords(tokens: TokenString, allowed?: ReadonlySet<string>): ReadonlySet<string> {\n const keywords: Set<string> = new Set();\n while (true) {\n const keyword = tokens.peekType(\"KEYWORD\");\n\n if (keyword == null || (allowed && !allowed.has(keyword))) { break; }\n tokens.pop();\n\n if (keywords.has(keyword)) { throw new Error(`duplicate keywords: ${ JSON.stringify(keyword) }`); }\n keywords.add(keyword);\n }\n\n return Object.freeze(keywords);\n}\n\n// ...all visibility keywords, returning the coalesced mutability\nfunction consumeMutability(tokens: TokenString): \"payable\" | \"nonpayable\" | \"view\" | \"pure\" {\n let modifiers = consumeKeywords(tokens, KwVisib);\n\n // Detect conflicting modifiers\n allowSingle(modifiers, setify(\"constant payable nonpayable\".split(\" \")));\n allowSingle(modifiers, setify(\"pure view payable nonpayable\".split(\" \")));\n\n // Process mutability states\n if (modifiers.has(\"view\")) { return \"view\"; }\n if (modifiers.has(\"pure\")) { return \"pure\"; }\n if (modifiers.has(\"payable\")) { return \"payable\"; }\n if (modifiers.has(\"nonpayable\")) { return \"nonpayable\"; }\n\n // Process legacy `constant` last\n if (modifiers.has(\"constant\")) { return \"view\"; }\n\n return \"nonpayable\";\n}\n\n// ...a parameter list, returning the ParamType list\nfunction consumeParams(tokens: TokenString, allowIndexed?: boolean): Array<ParamType> {\n return tokens.popParams().map((t) => ParamType.from(t, allowIndexed));\n}\n\n// ...a gas limit, returning a BigNumber or null if none\nfunction consumeGas(tokens: TokenString): null | bigint {\n if (tokens.peekType(\"AT\")) {\n tokens.pop();\n if (tokens.peekType(\"NUMBER\")) {\n return getBigInt(tokens.pop().text);\n }\n throw new Error(\"invalid gas\");\n }\n return null;\n}\n\nfunction consumeEoi(tokens: TokenString): void {\n if (tokens.length) {\n throw new Error(`unexpected tokens at offset ${ tokens.offset }: ${ tokens.toString() }`);\n }\n}\n\nconst regexArrayType = new RegExp(/^(.*)\\[([0-9]*)\\]$/);\n\nfunction verifyBasicType(type: string): string {\n const match = type.match(regexType);\n assertArgument(match, \"invalid type\", \"type\", type);\n if (type === \"uint\") { return \"uint256\"; }\n if (type === \"int\") { return \"int256\"; }\n\n if (match[2]) {\n // bytesXX\n const length = parseInt(match[2]);\n assertArgument(length !== 0 && length <= 32, \"invalid bytes length\", \"type\", type);\n\n } else if (match[3]) {\n // intXX or uintXX\n const size = parseInt(match[3] as string);\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0, \"invalid numeric width\", \"type\", type);\n }\n\n return type;\n}\n\n// Make the Fragment constructors effectively private\nconst _guard = { };\n\n\n/**\n * When [walking](ParamType-walk) a [[ParamType]], this is called\n * on each component.\n */\nexport type ParamTypeWalkFunc = (type: string, value: any) => any;\n\n/**\n * When [walking asynchronously](ParamType-walkAsync) a [[ParamType]],\n * this is called on each component.\n */\nexport type ParamTypeWalkAsyncFunc = (type: string, value: any) => any | Promise<any>;\n\nconst internal = Symbol.for(\"_ethers_internal\");\n\nconst ParamTypeInternal = \"_ParamTypeInternal\";\nconst ErrorFragmentInternal = \"_ErrorInternal\";\nconst EventFragmentInternal = \"_EventInternal\";\nconst ConstructorFragmentInternal = \"_ConstructorInternal\";\nconst FallbackFragmentInternal = \"_FallbackInternal\";\nconst FunctionFragmentInternal = \"_FunctionInternal\";\nconst StructFragmentInternal = \"_StructInternal\";\n\n/**\n * Each input and output of a [[Fragment]] is an Array of **ParamType**.\n */\nexport class ParamType {\n\n /**\n * The local name of the parameter (or ``\"\"`` if unbound)\n */\n readonly name!: string;\n\n /**\n * The fully qualified type (e.g. ``\"address\"``, ``\"tuple(address)\"``,\n * ``\"uint256[3][]\"``)\n */\n readonly type!: string;\n\n /**\n * The base type (e.g. ``\"address\"``, ``\"tuple\"``, ``\"array\"``)\n */\n readonly baseType!: string;\n\n /**\n * True if the parameters is indexed.\n *\n * For non-indexable types this is ``null``.\n */\n readonly indexed!: null | boolean;\n\n /**\n * The components for the tuple.\n *\n * For non-tuple types this is ``null``.\n */\n readonly components!: null | ReadonlyArray<ParamType>;\n\n /**\n * The array length, or ``-1`` for dynamic-lengthed arrays.\n *\n * For non-array types this is ``null``.\n */\n readonly arrayLength!: null | number;\n\n /**\n * The type of each child in the array.\n *\n * For non-array types this is ``null``.\n */\n readonly arrayChildren!: null | ParamType;\n\n\n /**\n * @private\n */\n constructor(guard: any, name: string, type: string, baseType: string, indexed: null | boolean, components: null | ReadonlyArray<ParamType>, arrayLength: null | number, arrayChildren: null | ParamType) {\n assertPrivate(guard, _guard, \"ParamType\");\n Object.defineProperty(this, internal, { value: ParamTypeInternal });\n\n if (components) { components = Object.freeze(components.slice()); }\n\n if (baseType === \"array\") {\n if (arrayLength == null || arrayChildren == null) {\n throw new Error(\"\");\n }\n } else if (arrayLength != null || arrayChildren != null) {\n throw new Error(\"\");\n }\n\n if (baseType === \"tuple\") {\n if (components == null) { throw new Error(\"\"); }\n } else if (components != null) {\n throw new Error(\"\");\n }\n\n defineProperties<ParamType>(this, {\n name, type, baseType, indexed, components, arrayLength, arrayChildren\n });\n }\n\n /**\n * Return a string representation of this type.\n *\n * For example,\n *\n * ``sighash\" => \"(uint256,address)\"``\n *\n * ``\"minimal\" => \"tuple(uint256,address) indexed\"``\n *\n * ``\"full\" => \"tuple(uint256 foo, address bar) indexed baz\"``\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n const name = this.name || \"\";\n\n if (this.isArray()) {\n const result = JSON.parse(this.arrayChildren.format(\"json\"));\n result.name = name;\n result.type += `[${ (this.arrayLength < 0 ? \"\": String(this.arrayLength)) }]`;\n return JSON.stringify(result);\n }\n\n const result: any = {\n type: ((this.baseType === \"tuple\") ? \"tuple\": this.type),\n name\n };\n\n\n if (typeof(this.indexed) === \"boolean\") { result.indexed = this.indexed; }\n if (this.isTuple()) {\n result.components = this.components.map((c) => JSON.parse(c.format(format)));\n }\n return JSON.stringify(result);\n }\n\n let result = \"\";\n\n // Array\n if (this.isArray()) {\n result += this.arrayChildren.format(format);\n result += `[${ (this.arrayLength < 0 ? \"\": String(this.arrayLength)) }]`;\n } else {\n if (this.isTuple()) {\n result += \"(\" + this.components.map(\n (comp) => comp.format(format)\n ).join((format === \"full\") ? \", \": \",\") + \")\";\n } else {\n result += this.type;\n }\n }\n\n if (format !== \"sighash\") {\n if (this.indexed === true) { result += \" indexed\"; }\n if (format === \"full\" && this.name) {\n result += \" \" + this.name;\n }\n }\n\n return result;\n }\n\n /**\n * Returns true if %%this%% is an Array type.\n *\n * This provides a type gaurd ensuring that [[arrayChildren]]\n * and [[arrayLength]] are non-null.\n */\n isArray(): this is (ParamType & { arrayChildren: ParamType, arrayLength: number }) {\n return (this.baseType === \"array\")\n }\n\n /**\n * Returns true if %%this%% is a Tuple type.\n *\n * This provides a type gaurd ensuring that [[components]]\n * is non-null.\n */\n isTuple(): this is (ParamType & { components: ReadonlyArray<ParamType> }) {\n return (this.baseType === \"tuple\");\n }\n\n /**\n * Returns true if %%this%% is an Indexable type.\n *\n * This provides a type gaurd ensuring that [[indexed]]\n * is non-null.\n */\n isIndexable(): this is (ParamType & { indexed: boolean }) {\n return (this.indexed != null);\n }\n\n /**\n * Walks the **ParamType** with %%value%%, calling %%process%%\n * on each type, destructing the %%value%% recursively.\n */\n walk(value: any, process: ParamTypeWalkFunc): any {\n if (this.isArray()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid array value\"); }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v) => (_this.arrayChildren.walk(v, process)));\n }\n\n if (this.isTuple()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid tuple value\"); }\n if (value.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n const _this = this;\n return value.map((v, i) => (_this.components[i].walk(v, process)));\n }\n\n return process(this.type, value);\n }\n\n #walkAsync(promises: Array<Promise<void>>, value: any, process: ParamTypeWalkAsyncFunc, setValue: (value: any) => void): void {\n\n if (this.isArray()) {\n if (!Array.isArray(value)) { throw new Error(\"invalid array value\"); }\n if (this.arrayLength !== -1 && value.length !== this.arrayLength) {\n throw new Error(\"array is wrong length\");\n }\n const childType = this.arrayChildren;\n\n const result = value.slice();\n result.forEach((value, index) => {\n childType.#walkAsync(promises, value, process, (value: any) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n\n if (this.isTuple()) {\n const components = this.components;\n\n // Convert the object into an array\n let result: Array<any>;\n if (Array.isArray(value)) {\n result = value.slice();\n\n } else {\n if (value == null || typeof(value) !== \"object\") {\n throw new Error(\"invalid tuple value\");\n }\n\n result = components.map((param) => {\n if (!param.name) { throw new Error(\"cannot use object value with unnamed components\"); }\n if (!(param.name in value)) {\n throw new Error(`missing value for component ${ param.name }`);\n }\n return value[param.name];\n });\n }\n\n if (result.length !== this.components.length) {\n throw new Error(\"array is wrong length\");\n }\n\n result.forEach((value, index) => {\n components[index].#walkAsync(promises, value, process, (value: any) => {\n result[index] = value;\n });\n });\n setValue(result);\n return;\n }\n\n const result = process(this.type, value);\n if (result.then) {\n promises.push((async function() { setValue(await result); })());\n } else {\n setValue(result);\n }\n }\n\n /**\n * Walks the **ParamType** with %%value%%, asynchronously calling\n * %%process%% on each type, destructing the %%value%% recursively.\n *\n * This can be used to resolve ENS names by walking and resolving each\n * ``\"address\"`` type.\n */\n async walkAsync(value: any, process: ParamTypeWalkAsyncFunc): Promise<any> {\n const promises: Array<Promise<void>> = [ ];\n const result: [ any ] = [ value ];\n this.#walkAsync(promises, value, process, (value: any) => {\n result[0] = value;\n });\n if (promises.length) { await Promise.all(promises); }\n return result[0];\n }\n\n /**\n * Creates a new **ParamType** for %%obj%%.\n *\n * If %%allowIndexed%% then the ``indexed`` keyword is permitted,\n * otherwise the ``indexed`` keyword will throw an error.\n */\n static from(obj: any, allowIndexed?: boolean): ParamType {\n if (ParamType.isParamType(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return ParamType.from(lex(obj), allowIndexed);\n } catch (error) {\n assertArgument(false, \"invalid param type\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n let type = \"\", baseType = \"\";\n let comps: null | Array<ParamType> = null;\n\n if (consumeKeywords(obj, setify([ \"tuple\" ])).has(\"tuple\") || obj.peekType(\"OPEN_PAREN\")) {\n // Tuple\n baseType = \"tuple\";\n comps = obj.popParams().map((t) => ParamType.from(t));\n type = `tuple(${ comps.map((c) => c.format()).join(\",\") })`;\n } else {\n // Normal\n type = verifyBasicType(obj.popType(\"TYPE\"));\n baseType = type;\n }\n\n // Check for Array\n let arrayChildren: null | ParamType = null;\n let arrayLength: null | number = null;\n\n while (obj.length && obj.peekType(\"BRACKET\")) {\n const bracket = obj.pop(); //arrays[i];\n arrayChildren = new ParamType(_guard, \"\", type, baseType, null, comps, arrayLength, arrayChildren);\n arrayLength = bracket.value;\n type += bracket.text;\n baseType = \"array\";\n comps = null;\n }\n\n let indexed: null | boolean = null;\n const keywords = consumeKeywords(obj, KwModifiers);\n if (keywords.has(\"indexed\")) {\n if (!allowIndexed) { throw new Error(\"\"); }\n indexed = true;\n }\n\n const name = (obj.peekType(\"ID\") ? obj.pop().text: \"\");\n\n if (obj.length) { throw new Error(\"leftover tokens\"); }\n\n return new ParamType(_guard, name, type, baseType, indexed, comps, arrayLength, arrayChildren);\n }\n\n const name = obj.name;\n assertArgument(!name || (typeof(name) === \"string\" && name.match(regexId)),\n \"invalid name\", \"obj.name\", name);\n\n let indexed = obj.indexed;\n if (indexed == true) {\n assertArgument(allowIndexed, \"parameter cannot be indexed\", \"obj.indexed\", obj.indexed);\n indexed = true;\n } else {\n indexed = false\n }\n\n let type = obj.type;\n\n let arrayMatch = type.match(regexArrayType);\n if (arrayMatch) {\n const arrayLength = parseInt(arrayMatch[2] || \"-1\");\n const arrayChildren = ParamType.from({\n type: arrayMatch[1],\n components: obj.components\n });\n\n return new ParamType(_guard, name || \"\", type, \"array\", indexed, null, arrayLength, arrayChildren);\n }\n\n if (type === \"tuple\" || type.startsWith(\"tuple(\"/* fix: ) */) || type.startsWith(\"(\" /* fix: ) */)) {\n const comps = (obj.components != null) ? obj.components.map((c: any) => ParamType.from(c)): null;\n const tuple = new ParamType(_guard, name || \"\", type, \"tuple\", indexed, comps, null, null);\n // @TODO: use lexer to validate and normalize type\n return tuple;\n }\n\n type = verifyBasicType(obj.type);\n\n return new ParamType(_guard, name || \"\", type, type, indexed, null, null, null);\n }\n\n /**\n * Returns true if %%value%% is a **ParamType**.\n */\n static isParamType(value: any): value is ParamType {\n return (value && value[internal] === ParamTypeInternal);\n }\n}\n\n/**\n * The type of a [[Fragment]].\n */\nexport type FragmentType = \"constructor\" | \"error\" | \"event\" | \"fallback\" | \"function\" | \"struct\";\n\n/**\n * An abstract class to represent An individual fragment from a parse ABI.\n */\nexport abstract class Fragment {\n /**\n * The type of the fragment.\n */\n readonly type!: FragmentType;\n\n /**\n * The inputs for the fragment.\n */\n readonly inputs!: ReadonlyArray<ParamType>;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>) {\n assertPrivate(guard, _guard, \"Fragment\");\n inputs = Object.freeze(inputs.slice());\n defineProperties<Fragment>(this, { type, inputs });\n }\n\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n abstract format(format?: FormatType): string;\n\n /**\n * Creates a new **Fragment** for %%obj%%, wich can be any supported\n * ABI frgament type.\n */\n static from(obj: any): Fragment {\n if (typeof(obj) === \"string\") {\n\n // Try parsing JSON...\n try {\n Fragment.from(JSON.parse(obj));\n } catch (e) { }\n\n // ...otherwise, use the human-readable lexer\n return Fragment.from(lex(obj));\n }\n\n if (obj instanceof TokenString) {\n // Human-readable ABI (already lexed)\n\n const type = obj.peekKeyword(KwTypes);\n\n switch (type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\": case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n\n } else if (typeof(obj) === \"object\") {\n // JSON ABI\n\n switch (obj.type) {\n case \"constructor\": return ConstructorFragment.from(obj);\n case \"error\": return ErrorFragment.from(obj);\n case \"event\": return EventFragment.from(obj);\n case \"fallback\": case \"receive\":\n return FallbackFragment.from(obj);\n case \"function\": return FunctionFragment.from(obj);\n case \"struct\": return StructFragment.from(obj);\n }\n\n assert(false, `unsupported type: ${ obj.type }`, \"UNSUPPORTED_OPERATION\", {\n operation: \"Fragment.from\"\n });\n }\n\n assertArgument(false, \"unsupported frgament object\", \"obj\", obj);\n }\n\n /**\n * Returns true if %%value%% is a [[ConstructorFragment]].\n */\n static isConstructor(value: any): value is ConstructorFragment {\n return ConstructorFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is an [[ErrorFragment]].\n */\n static isError(value: any): value is ErrorFragment {\n return ErrorFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is an [[EventFragment]].\n */\n static isEvent(value: any): value is EventFragment {\n return EventFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is a [[FunctionFragment]].\n */\n static isFunction(value: any): value is FunctionFragment {\n return FunctionFragment.isFragment(value);\n }\n\n /**\n * Returns true if %%value%% is a [[StructFragment]].\n */\n static isStruct(value: any): value is StructFragment {\n return StructFragment.isFragment(value);\n }\n}\n\n/**\n * An abstract class to represent An individual fragment\n * which has a name from a parse ABI.\n */\nexport abstract class NamedFragment extends Fragment {\n /**\n * The name of the fragment.\n */\n readonly name!: string;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, name: string, inputs: ReadonlyArray<ParamType>) {\n super(guard, type, inputs);\n assertArgument(typeof(name) === \"string\" && name.match(regexId),\n \"invalid identifier\", \"name\", name);\n inputs = Object.freeze(inputs.slice());\n defineProperties<NamedFragment>(this, { name });\n }\n}\n\nfunction joinParams(format: FormatType, params: ReadonlyArray<ParamType>): string {\n return \"(\" + params.map((p) => p.format(format)).join((format === \"full\") ? \", \": \",\") + \")\";\n}\n\n/**\n * A Fragment which represents a //Custom Error//.\n */\nexport class ErrorFragment extends NamedFragment {\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>) {\n super(guard, \"error\", name, inputs);\n Object.defineProperty(this, internal, { value: ErrorFragmentInternal });\n }\n\n /**\n * The Custom Error selector.\n */\n get selector(): string {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n\n /**\n * Returns a string representation of this fragment as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"error\",\n name: this.name,\n inputs: this.inputs.map((input) => JSON.parse(input.format(format))),\n });\n }\n\n const result: Array<string> = [ ];\n if (format !== \"sighash\") { result.push(\"error\"); }\n result.push(this.name + joinParams(format, this.inputs));\n return result.join(\" \");\n }\n\n /**\n * Returns a new **ErrorFragment** for %%obj%%.\n */\n static from(obj: any): ErrorFragment {\n if (ErrorFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n return ErrorFragment.from(lex(obj));\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"error\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n\n return new ErrorFragment(_guard, name, inputs);\n }\n\n return new ErrorFragment(_guard, obj.name,\n obj.inputs ? obj.inputs.map(ParamType.from): [ ]);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **ErrorFragment**.\n */\n static isFragment(value: any): value is ErrorFragment {\n return (value && value[internal] === ErrorFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents an Event.\n */\nexport class EventFragment extends NamedFragment {\n /**\n * Whether this event is anonymous.\n */\n readonly anonymous!: boolean;\n\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>, anonymous: boolean) {\n super(guard, \"event\", name, inputs);\n Object.defineProperty(this, internal, { value: EventFragmentInternal });\n defineProperties<EventFragment>(this, { anonymous });\n }\n\n /**\n * The Event topic hash.\n */\n get topicHash(): string {\n return id(this.format(\"sighash\"));\n }\n\n /**\n * Returns a string representation of this event as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"event\",\n anonymous: this.anonymous,\n name: this.name,\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n\n const result: Array<string> = [ ];\n if (format !== \"sighash\") { result.push(\"event\"); }\n result.push(this.name + joinParams(format, this.inputs));\n if (format !== \"sighash\" && this.anonymous) { result.push(\"anonymous\"); }\n return result.join(\" \");\n }\n\n /**\n * Return the topic hash for an event with %%name%% and %%params%%.\n */\n static getTopicHash(name: string, params?: Array<any>): string {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new EventFragment(_guard, name, params, false);\n return fragment.topicHash;\n }\n\n /**\n * Returns a new **EventFragment** for %%obj%%.\n */\n static from(obj: any): EventFragment {\n if (EventFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return EventFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid event fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"event\", obj);\n const inputs = consumeParams(obj, true);\n const anonymous = !!consumeKeywords(obj, setify([ \"anonymous\" ])).has(\"anonymous\");\n consumeEoi(obj);\n\n return new EventFragment(_guard, name, inputs, anonymous);\n }\n\n return new EventFragment(_guard, obj.name,\n obj.inputs ? obj.inputs.map((p: any) => ParamType.from(p, true)): [ ], !!obj.anonymous);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is an\n * **EventFragment**.\n */\n static isFragment(value: any): value is EventFragment {\n return (value && value[internal] === EventFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a constructor.\n */\nexport class ConstructorFragment extends Fragment {\n\n /**\n * Whether the constructor can receive an endowment.\n */\n readonly payable!: boolean;\n\n /**\n * The recommended gas limit for deployment or ``null``.\n */\n readonly gas!: null | bigint;\n\n /**\n * @private\n */\n constructor(guard: any, type: FragmentType, inputs: ReadonlyArray<ParamType>, payable: boolean, gas: null | bigint) {\n super(guard, type, inputs);\n Object.defineProperty(this, internal, { value: ConstructorFragmentInternal });\n defineProperties<ConstructorFragment>(this, { payable, gas });\n }\n\n /**\n * Returns a string representation of this constructor as %%format%%.\n */\n format(format?: FormatType): string {\n assert(format != null && format !== \"sighash\", \"cannot format a constructor for sighash\",\n \"UNSUPPORTED_OPERATION\", { operation: \"format(sighash)\" });\n\n if (format === \"json\") {\n return JSON.stringify({\n type: \"constructor\",\n stateMutability: (this.payable ? \"payable\": \"undefined\"),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas: undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format)))\n });\n }\n\n const result = [ `constructor${ joinParams(format, this.inputs) }` ];\n if (this.payable) { result.push(\"payable\"); }\n if (this.gas != null) { result.push(`@${ this.gas.toString() }`); }\n return result.join(\" \");\n }\n\n /**\n * Returns a new **ConstructorFragment** for %%obj%%.\n */\n static from(obj: any): ConstructorFragment {\n if (ConstructorFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return ConstructorFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid constuctor fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n consumeKeywords(obj, setify([ \"constructor\" ]));\n const inputs = consumeParams(obj);\n const payable = !!consumeKeywords(obj, KwVisibDeploy).has(\"payable\");\n const gas = consumeGas(obj);\n consumeEoi(obj);\n\n return new ConstructorFragment(_guard, \"constructor\", inputs, payable, gas);\n }\n\n return new ConstructorFragment(_guard, \"constructor\",\n obj.inputs ? obj.inputs.map(ParamType.from): [ ],\n !!obj.payable, (obj.gas != null) ? obj.gas: null);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **ConstructorFragment**.\n */\n static isFragment(value: any): value is ConstructorFragment {\n return (value && value[internal] === ConstructorFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a method.\n */\nexport class FallbackFragment extends Fragment {\n\n /**\n * If the function can be sent value during invocation.\n */\n readonly payable!: boolean;\n\n constructor(guard: any, inputs: ReadonlyArray<ParamType>, payable: boolean) {\n super(guard, \"fallback\", inputs);\n Object.defineProperty(this, internal, { value: FallbackFragmentInternal });\n defineProperties<FallbackFragment>(this, { payable });\n }\n\n /**\n * Returns a string representation of this fallback as %%format%%.\n */\n format(format?: FormatType): string {\n const type = ((this.inputs.length === 0) ? \"receive\": \"fallback\");\n\n if (format === \"json\") {\n const stateMutability = (this.payable ? \"payable\": \"nonpayable\");\n return JSON.stringify({ type, stateMutability });\n }\n\n return `${ type }()${ this.payable ? \" payable\": \"\" }`;\n }\n\n /**\n * Returns a new **FallbackFragment** for %%obj%%.\n */\n static from(obj: any): FallbackFragment {\n if (FallbackFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return FallbackFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid fallback fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const errorObj = obj.toString();\n\n const topIsValid = obj.peekKeyword(setify([ \"fallback\", \"receive\" ]));\n assertArgument(topIsValid, \"type must be fallback or receive\", \"obj\", errorObj);\n\n const type = obj.popKeyword(setify([ \"fallback\", \"receive\" ]));\n\n // receive()\n if (type === \"receive\") {\n const inputs = consumeParams(obj);\n assertArgument(inputs.length === 0, `receive cannot have arguments`, \"obj.inputs\", inputs);\n consumeKeywords(obj, setify([ \"payable\" ]));\n consumeEoi(obj);\n return new FallbackFragment(_guard, [ ], true);\n }\n\n // fallback() [payable]\n // fallback(bytes) [payable] returns (bytes)\n let inputs = consumeParams(obj);\n if (inputs.length) {\n assertArgument(inputs.length === 1 && inputs[0].type === \"bytes\",\n \"invalid fallback inputs\", \"obj.inputs\",\n inputs.map((i) => i.format(\"minimal\")).join(\", \"));\n } else {\n inputs = [ ParamType.from(\"bytes\") ];\n }\n\n const mutability = consumeMutability(obj);\n assertArgument(mutability === \"nonpayable\" || mutability === \"payable\", \"fallback cannot be constants\", \"obj.stateMutability\", mutability);\n\n if (consumeKeywords(obj, setify([ \"returns\" ])).has(\"returns\")) {\n const outputs = consumeParams(obj);\n assertArgument(outputs.length === 1 && outputs[0].type === \"bytes\",\n \"invalid fallback outputs\", \"obj.outputs\",\n outputs.map((i) => i.format(\"minimal\")).join(\", \"));\n }\n\n consumeEoi(obj);\n\n return new FallbackFragment(_guard, inputs, mutability === \"payable\");\n }\n\n if (obj.type === \"receive\") {\n return new FallbackFragment(_guard, [ ], true);\n }\n\n if (obj.type === \"fallback\") {\n const inputs = [ ParamType.from(\"bytes\") ];\n const payable = (obj.stateMutability === \"payable\");\n return new FallbackFragment(_guard, inputs, payable);\n }\n\n assertArgument(false, \"invalid fallback description\", \"obj\", obj);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FallbackFragment**.\n */\n static isFragment(value: any): value is FallbackFragment {\n return (value && value[internal] === FallbackFragmentInternal);\n }\n}\n\n\n/**\n * A Fragment which represents a method.\n */\nexport class FunctionFragment extends NamedFragment {\n /**\n * If the function is constant (e.g. ``pure`` or ``view`` functions).\n */\n readonly constant!: boolean;\n\n /**\n * The returned types for the result of calling this function.\n */\n readonly outputs!: ReadonlyArray<ParamType>;\n\n /**\n * The state mutability (e.g. ``payable``, ``nonpayable``, ``view``\n * or ``pure``)\n */\n readonly stateMutability!: \"payable\" | \"nonpayable\" | \"view\" | \"pure\";\n\n /**\n * If the function can be sent value during invocation.\n */\n readonly payable!: boolean;\n\n /**\n * The recommended gas limit to send when calling this function.\n */\n readonly gas!: null | bigint;\n\n /**\n * @private\n */\n constructor(guard: any, name: string, stateMutability: \"payable\" | \"nonpayable\" | \"view\" | \"pure\", inputs: ReadonlyArray<ParamType>, outputs: ReadonlyArray<ParamType>, gas: null | bigint) {\n super(guard, \"function\", name, inputs);\n Object.defineProperty(this, internal, { value: FunctionFragmentInternal });\n outputs = Object.freeze(outputs.slice());\n const constant = (stateMutability === \"view\" || stateMutability === \"pure\");\n const payable = (stateMutability === \"payable\");\n defineProperties<FunctionFragment>(this, { constant, gas, outputs, payable, stateMutability });\n }\n\n /**\n * The Function selector.\n */\n get selector(): string {\n return id(this.format(\"sighash\")).substring(0, 10);\n }\n\n /**\n * Returns a string representation of this function as %%format%%.\n */\n format(format?: FormatType): string {\n if (format == null) { format = \"sighash\"; }\n if (format === \"json\") {\n return JSON.stringify({\n type: \"function\",\n name: this.name,\n constant: this.constant,\n stateMutability: ((this.stateMutability !== \"nonpayable\") ? this.stateMutability: undefined),\n payable: this.payable,\n gas: ((this.gas != null) ? this.gas: undefined),\n inputs: this.inputs.map((i) => JSON.parse(i.format(format))),\n outputs: this.outputs.map((o) => JSON.parse(o.format(format))),\n });\n }\n\n const result: Array<string> = [];\n\n if (format !== \"sighash\") { result.push(\"function\"); }\n\n result.push(this.name + joinParams(format, this.inputs));\n\n if (format !== \"sighash\") {\n if (this.stateMutability !== \"nonpayable\") {\n result.push(this.stateMutability);\n }\n\n if (this.outputs && this.outputs.length) {\n result.push(\"returns\");\n result.push(joinParams(format, this.outputs));\n }\n\n if (this.gas != null) { result.push(`@${ this.gas.toString() }`); }\n }\n return result.join(\" \");\n }\n\n /**\n * Return the selector for a function with %%name%% and %%params%%.\n */\n static getSelector(name: string, params?: Array<any>): string {\n params = (params || []).map((p) => ParamType.from(p));\n const fragment = new FunctionFragment(_guard, name, \"view\", params, [ ], null);\n return fragment.selector;\n }\n\n /**\n * Returns a new **FunctionFragment** for %%obj%%.\n */\n static from(obj: any): FunctionFragment {\n if (FunctionFragment.isFragment(obj)) { return obj; }\n\n if (typeof(obj) === \"string\") {\n try {\n return FunctionFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid function fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"function\", obj);\n const inputs = consumeParams(obj);\n const mutability = consumeMutability(obj);\n\n let outputs: Array<ParamType> = [ ];\n if (consumeKeywords(obj, setify([ \"returns\" ])).has(\"returns\")) {\n outputs = consumeParams(obj);\n }\n\n const gas = consumeGas(obj);\n\n consumeEoi(obj);\n\n return new FunctionFragment(_guard, name, mutability, inputs, outputs, gas);\n }\n\n let stateMutability = obj.stateMutability;\n\n // Use legacy Solidity ABI logic if stateMutability is missing\n if (stateMutability == null) {\n stateMutability = \"payable\";\n\n if (typeof(obj.constant) === \"boolean\") {\n stateMutability = \"view\";\n if (!obj.constant) {\n stateMutability = \"payable\"\n if (typeof(obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n } else if (typeof(obj.payable) === \"boolean\" && !obj.payable) {\n stateMutability = \"nonpayable\";\n }\n }\n\n // @TODO: verifyState for stateMutability (e.g. throw if\n // payable: false but stateMutability is \"nonpayable\")\n\n return new FunctionFragment(_guard, obj.name, stateMutability,\n obj.inputs ? obj.inputs.map(ParamType.from): [ ],\n obj.outputs ? obj.outputs.map(ParamType.from): [ ],\n (obj.gas != null) ? obj.gas: null);\n }\n\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **FunctionFragment**.\n */\n static isFragment(value: any): value is FunctionFragment {\n return (value && value[internal] === FunctionFragmentInternal);\n }\n}\n\n/**\n * A Fragment which represents a structure.\n */\nexport class StructFragment extends NamedFragment {\n\n /**\n * @private\n */\n constructor(guard: any, name: string, inputs: ReadonlyArray<ParamType>) {\n super(guard, \"struct\", name, inputs);\n Object.defineProperty(this, internal, { value: StructFragmentInternal });\n }\n\n /**\n * Returns a string representation of this struct as %%format%%.\n */\n format(): string {\n throw new Error(\"@TODO\");\n }\n\n /**\n * Returns a new **StructFragment** for %%obj%%.\n */\n static from(obj: any): StructFragment {\n if (typeof(obj) === \"string\") {\n try {\n return StructFragment.from(lex(obj));\n } catch (error) {\n assertArgument(false, \"invalid struct fragment\", \"obj\", obj);\n }\n\n } else if (obj instanceof TokenString) {\n const name = consumeName(\"struct\", obj);\n const inputs = consumeParams(obj);\n consumeEoi(obj);\n return new StructFragment(_guard, name, inputs);\n }\n\n return new StructFragment(_guard, obj.name, obj.inputs ? obj.inputs.map(ParamType.from): [ ]);\n }\n\n// @TODO: fix this return type\n /**\n * Returns ``true`` and provides a type guard if %%value%% is a\n * **StructFragment**.\n */\n static isFragment(value: any): value is FunctionFragment {\n return (value && value[internal] === StructFragmentInternal);\n }\n}\n\n","/**\n * When sending values to or receiving values from a [[Contract]], the\n * data is generally encoded using the [ABI standard](link-solc-abi).\n *\n * The AbiCoder provides a utility to encode values to ABI data and\n * decode values from ABI data.\n *\n * Most of the time, developers should favour the [[Contract]] class,\n * which further abstracts a lot of the finer details of ABI data.\n *\n * @_section api/abi/abi-coder:ABI Encoding\n */\n\n// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI\n\nimport { assertArgumentCount, assertArgument } from \"../utils/index.js\";\n\nimport { Coder, Reader, Result, Writer } from \"./coders/abstract-coder.js\";\nimport { AddressCoder } from \"./coders/address.js\";\nimport { ArrayCoder } from \"./coders/array.js\";\nimport { BooleanCoder } from \"./coders/boolean.js\";\nimport { BytesCoder } from \"./coders/bytes.js\";\nimport { FixedBytesCoder } from \"./coders/fixed-bytes.js\";\nimport { NullCoder } from \"./coders/null.js\";\nimport { NumberCoder } from \"./coders/number.js\";\nimport { StringCoder } from \"./coders/string.js\";\nimport { TupleCoder } from \"./coders/tuple.js\";\nimport { ParamType } from \"./fragments.js\";\n\nimport { getAddress } from \"../address/index.js\";\nimport { getBytes, hexlify, makeError } from \"../utils/index.js\";\n\nimport type {\n BytesLike,\n CallExceptionAction, CallExceptionError, CallExceptionTransaction\n} from \"../utils/index.js\";\n\n// https://docs.soliditylang.org/en/v0.8.17/control-structures.html\nconst PanicReasons: Map<number, string> = new Map();\nPanicReasons.set(0x00, \"GENERIC_PANIC\");\nPanicReasons.set(0x01, \"ASSERT_FALSE\");\nPanicReasons.set(0x11, \"OVERFLOW\");\nPanicReasons.set(0x12, \"DIVIDE_BY_ZERO\");\nPanicReasons.set(0x21, \"ENUM_RANGE_ERROR\");\nPanicReasons.set(0x22, \"BAD_STORAGE_DATA\");\nPanicReasons.set(0x31, \"STACK_UNDERFLOW\");\nPanicReasons.set(0x32, \"ARRAY_RANGE_ERROR\");\nPanicReasons.set(0x41, \"OUT_OF_MEMORY\");\nPanicReasons.set(0x51, \"UNINITIALIZED_FUNCTION_CALL\");\n\nconst paramTypeBytes = new RegExp(/^bytes([0-9]*)$/);\nconst paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);\n\n\nlet defaultCoder: null | AbiCoder = null;\nlet defaultMaxInflation = 1024;\n\nfunction getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike, abiCoder: AbiCoder): CallExceptionError {\n let message = \"missing revert data\";\n\n let reason: null | string = null;\n const invocation = null;\n let revert: null | { signature: string, name: string, args: Array<any> } = null;\n\n if (data) {\n message = \"execution reverted\";\n\n const bytes = getBytes(data);\n data = hexlify(data);\n\n if (bytes.length === 0) {\n message += \" (no data present; likely require(false) occurred\";\n reason = \"require(false)\";\n\n } else if (bytes.length % 32 !== 4) {\n message += \" (could not decode reason; invalid data length)\";\n\n } else if (hexlify(bytes.slice(0, 4)) === \"0x08c379a0\") {\n // Error(string)\n try {\n reason = abiCoder.decode([ \"string\" ], bytes.slice(4))[0]\n revert = {\n signature: \"Error(string)\",\n name: \"Error\",\n args: [ reason ]\n };\n message += `: ${ JSON.stringify(reason) }`;\n\n } catch (error) {\n message += \" (could not decode reason; invalid string data)\";\n }\n\n } else if (hexlify(bytes.slice(0, 4)) === \"0x4e487b71\") {\n // Panic(uint256)\n try {\n const code = Number(abiCoder.decode([ \"uint256\" ], bytes.slice(4))[0]);\n revert = {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n args: [ code ]\n };\n reason = `Panic due to ${ PanicReasons.get(code) || \"UNKNOWN\" }(${ code })`;\n message += `: ${ reason }`;\n } catch (error) {\n message += \" (could not decode panic code)\";\n }\n } else {\n message += \" (unknown custom error)\";\n }\n }\n\n const transaction: CallExceptionTransaction = {\n to: (tx.to ? getAddress(tx.to): null),\n data: (tx.data || \"0x\")\n };\n if (tx.from) { transaction.from = getAddress(tx.from); }\n\n return makeError(message, \"CALL_EXCEPTION\", {\n action, data, reason, transaction, invocation, revert\n });\n}\n\n/**\n * The **AbiCoder** is a low-level class responsible for encoding JavaScript\n * values into binary data and decoding binary data into JavaScript values.\n */\nexport class AbiCoder {\n\n #getCoder(param: ParamType): Coder {\n if (param.isArray()) {\n return new ArrayCoder(this.#getCoder(param.arrayChildren), param.arrayLength, param.name);\n }\n\n if (param.isTuple()) {\n return new TupleCoder(param.components.map((c) => this.#getCoder(c)), param.name);\n }\n\n switch (param.baseType) {\n case \"address\":\n return new AddressCoder(param.name);\n case \"bool\":\n return new BooleanCoder(param.name);\n case \"string\":\n return new StringCoder(param.name);\n case \"bytes\":\n return new BytesCoder(param.name);\n case \"\":\n return new NullCoder(param.name);\n }\n\n // u?int[0-9]*\n let match = param.type.match(paramTypeNumber);\n if (match) {\n let size = parseInt(match[2] || \"256\");\n assertArgument(size !== 0 && size <= 256 && (size % 8) === 0,\n \"invalid \" + match[1] + \" bit length\", \"param\", param);\n return new NumberCoder(size / 8, (match[1] === \"int\"), param.name);\n }\n\n // bytes[0-9]+\n match = param.type.match(paramTypeBytes);\n if (match) {\n let size = parseInt(match[1]);\n assertArgument(size !== 0 && size <= 32, \"invalid bytes length\", \"param\", param);\n return new FixedBytesCoder(size, param.name);\n }\n\n assertArgument(false, \"invalid type\", \"type\", param.type);\n }\n\n /**\n * Get the default values for the given %%types%%.\n *\n * For example, a ``uint`` is by default ``0`` and ``bool``\n * is by default ``false``.\n */\n getDefaultValue(types: ReadonlyArray<string | ParamType>): Result {\n const coders: Array<Coder> = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.defaultValue();\n }\n\n /**\n * Encode the %%values%% as the %%types%% into ABI data.\n *\n * @returns DataHexstring\n */\n encode(types: ReadonlyArray<string | ParamType>, values: ReadonlyArray<any>): string {\n assertArgumentCount(values.length, types.length, \"types/values length mismatch\");\n\n const coders = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = (new TupleCoder(coders, \"_\"));\n\n const writer = new Writer();\n coder.encode(writer, values);\n return writer.data;\n }\n\n /**\n * Decode the ABI %%data%% as the %%types%% into values.\n *\n * If %%loose%% decoding is enabled, then strict padding is\n * not enforced. Some older versions of Solidity incorrectly\n * padded event data emitted from ``external`` functions.\n */\n decode(types: ReadonlyArray<string | ParamType>, data: BytesLike, loose?: boolean): Result {\n const coders: Array<Coder> = types.map((type) => this.#getCoder(ParamType.from(type)));\n const coder = new TupleCoder(coders, \"_\");\n return coder.decode(new Reader(data, loose, defaultMaxInflation));\n }\n\n static _setDefaultMaxInflation(value: number): void {\n assertArgument(typeof(value) === \"number\" && Number.isInteger(value), \"invalid defaultMaxInflation factor\", \"value\", value);\n defaultMaxInflation = value;\n }\n\n /**\n * Returns the shared singleton instance of a default [[AbiCoder]].\n *\n * On the first call, the instance is created internally.\n */\n static defaultAbiCoder(): AbiCoder {\n if (defaultCoder == null) {\n defaultCoder = new AbiCoder();\n }\n return defaultCoder;\n }\n\n /**\n * Returns an ethers-compatible [[CallExceptionError]] Error for the given\n * result %%data%% for the [[CallExceptionAction]] %%action%% against\n * the Transaction %%tx%%.\n */\n static getBuiltinCallException(action: CallExceptionAction, tx: { to?: null | string, from?: null | string, data?: string }, data: null | BytesLike): CallExceptionError {\n return getBuiltinCallException(action, tx, data, AbiCoder.defaultAbiCoder());\n }\n}\n","/**\n * About bytes32 strings...\n *\n * @_docloc: api/utils:Bytes32 Strings\n */\n\nimport {\n getBytes, toUtf8Bytes, toUtf8String, zeroPadBytes\n} from \"../utils/index.js\";\n\nimport type { BytesLike } from \"../utils/index.js\";\n\n/**\n * Encodes %%text%% as a Bytes32 string.\n */\nexport function encodeBytes32String(text: string): string {\n\n // Get the bytes\n const bytes = toUtf8Bytes(text);\n\n // Check we have room for null-termination\n if (bytes.length > 31) { throw new Error(\"bytes32 string must be less than 32 bytes\"); }\n\n // Zero-pad (implicitly null-terminates)\n return zeroPadBytes(bytes, 32);\n}\n\n/**\n * Encodes the Bytes32-encoded %%bytes%% into a string.\n */\nexport function decodeBytes32String(_bytes: BytesLike): string {\n const data = getBytes(_bytes, \"bytes\");\n\n // Must be 32 bytes with a null-termination\n if (data.length !== 32) { throw new Error(\"invalid bytes32 - not 32 bytes long\"); }\n if (data[31] !== 0) { throw new Error(\"invalid bytes32 string - no null terminator\"); }\n\n // Find the null termination\n let length = 31;\n while (data[length - 1] === 0) { length--; }\n\n // Determine the string value\n return toUtf8String(data.slice(0, length));\n}\n\n","/**\n * The Interface class is a low-level class that accepts an\n * ABI and provides all the necessary functionality to encode\n * and decode paramaters to and results from methods, events\n * and errors.\n *\n * It also provides several convenience methods to automatically\n * search and find matching transactions and events to parse them.\n *\n * @_subsection api/abi:Interfaces [interfaces]\n */\n\nimport { keccak256 } from \"../crypto/index.js\"\nimport { id } from \"../hash/index.js\"\nimport {\n concat, dataSlice, getBigInt, getBytes, getBytesCopy,\n hexlify, zeroPadBytes, zeroPadValue, isHexString, defineProperties,\n assertArgument, toBeHex, assert\n} from \"../utils/index.js\";\n\nimport { AbiCoder } from \"./abi-coder.js\";\nimport { checkResultErrors, Result } from \"./coders/abstract-coder.js\";\nimport {\n ConstructorFragment, ErrorFragment, EventFragment, FallbackFragment,\n Fragment, FunctionFragment, ParamType\n} from \"./fragments.js\";\nimport { Typed } from \"./typed.js\";\n\nimport type { BigNumberish, BytesLike, CallExceptionError, CallExceptionTransaction } from \"../utils/index.js\";\n\nimport type { JsonFragment } from \"./fragments.js\";\n\n\nexport { checkResultErrors, Result };\n\n/**\n * When using the [[Interface-parseLog]] to automatically match a Log to its event\n * for parsing, a **LogDescription** is returned.\n */\nexport class LogDescription {\n /**\n * The matching fragment for the ``topic0``.\n */\n readonly fragment!: EventFragment;\n\n /**\n * The name of the Event.\n */\n readonly name!: string;\n\n /**\n * The full Event signature.\n */\n readonly signature!: string;\n\n /**\n * The topic hash for the Event.\n */\n readonly topic!: string;\n\n /**\n * The arguments passed into the Event with ``emit``.\n */\n readonly args!: Result\n\n /**\n * @_ignore:\n */\n constructor(fragment: EventFragment, topic: string, args: Result) {\n const name = fragment.name, signature = fragment.format();\n defineProperties<LogDescription>(this, {\n fragment, name, signature, topic, args\n });\n }\n}\n\n/**\n * When using the [[Interface-parseTransaction]] to automatically match\n * a transaction data to its function for parsing,\n * a **TransactionDescription** is returned.\n */\nexport class TransactionDescription {\n /**\n * The matching fragment from the transaction ``data``.\n */\n readonly fragment!: FunctionFragment;\n\n /**\n * The name of the Function from the transaction ``data``.\n */\n readonly name!: string;\n\n /**\n * The arguments passed to the Function from the transaction ``data``.\n */\n readonly args!: Result;\n\n /**\n * The full Function signature from the transaction ``data``.\n */\n readonly signature!: string;\n\n /**\n * The selector for the Function from the transaction ``data``.\n */\n readonly selector!: string;\n\n /**\n * The ``value`` (in wei) from the transaction.\n */\n readonly value!: bigint;\n\n /**\n * @_ignore:\n */\n constructor(fragment: FunctionFragment, selector: string, args: Result, value: bigint) {\n const name = fragment.name, signature = fragment.format();\n defineProperties<TransactionDescription>(this, {\n fragment, name, args, signature, selector, value\n });\n }\n}\n\n/**\n * When using the [[Interface-parseError]] to automatically match an\n * error for a call result for parsing, an **ErrorDescription** is returned.\n */\nexport class ErrorDescription {\n /**\n * The matching fragment.\n */\n readonly fragment!: ErrorFragment;\n\n /**\n * The name of the Error.\n */\n readonly name!: string;\n\n /**\n * The arguments passed to the Error with ``revert``.\n */\n readonly args!: Result;\n\n /**\n * The full Error signature.\n */\n readonly signature!: string;\n\n /**\n * The selector for the Error.\n */\n readonly selector!: string;\n\n /**\n * @_ignore:\n */\n constructor(fragment: ErrorFragment, selector: string, args: Result) {\n const name = fragment.name, signature = fragment.format();\n defineProperties<ErrorDescription>(this, {\n fragment, name, args, signature, selector\n });\n }\n}\n\n/**\n * An **Indexed** is used as a value when a value that does not\n * fit within a topic (i.e. not a fixed-length, 32-byte type). It\n * is the ``keccak256`` of the value, and used for types such as\n * arrays, tuples, bytes and strings.\n */\nexport class Indexed {\n /**\n * The ``keccak256`` of the value logged.\n */\n readonly hash!: null | string;\n\n /**\n * @_ignore:\n */\n readonly _isIndexed!: boolean;\n\n /**\n * Returns ``true`` if %%value%% is an **Indexed**.\n *\n * This provides a Type Guard for property access.\n */\n static isIndexed(value: any): value is Indexed {\n return !!(value && value._isIndexed);\n }\n\n /**\n * @_ignore:\n */\n constructor(hash: null | string) {\n defineProperties<Indexed>(this, { hash, _isIndexed: true })\n }\n}\n\ntype ErrorInfo = {\n signature: string,\n inputs: Array<string>,\n name: string,\n reason: (...args: Array<any>) => string;\n};\n\n// https://docs.soliditylang.org/en/v0.8.13/control-structures.html?highlight=panic#panic-via-assert-and-error-via-require\nconst PanicReasons: Record<string, string> = {\n \"0\": \"generic panic\",\n \"1\": \"assert(false)\",\n \"17\": \"arithmetic overflow\",\n \"18\": \"division or modulo by zero\",\n \"33\": \"enum overflow\",\n \"34\": \"invalid encoded storage byte array accessed\",\n \"49\": \"out-of-bounds array access; popping on an empty array\",\n \"50\": \"out-of-bounds access of an array or bytesN\",\n \"65\": \"out of memory\",\n \"81\": \"uninitialized function\",\n}\n\nconst BuiltinErrors: Record<string, ErrorInfo> = {\n \"0x08c379a0\": {\n signature: \"Error(string)\",\n name: \"Error\",\n inputs: [ \"string\" ],\n reason: (message: string) => {\n return `reverted with reason string ${ JSON.stringify(message) }`;\n }\n },\n \"0x4e487b71\": {\n signature: \"Panic(uint256)\",\n name: \"Panic\",\n inputs: [ \"uint256\" ],\n reason: (code: bigint) => {\n let reason = \"unknown panic code\";\n if (code >= 0 && code <= 0xff && PanicReasons[code.toString()]) {\n reason = PanicReasons[code.toString()];\n }\n return `reverted with panic code 0x${ code.toString(16) } (${ reason })`;\n }\n }\n}\n\n/*\nfunction wrapAccessError(property: string, error: Error): Error {\n const wrap = new Error(`deferred error during ABI decoding triggered accessing ${ property }`);\n (<any>wrap).error = error;\n return wrap;\n}\n*/\n/*\nfunction checkNames(fragment: Fragment, type: \"input\" | \"output\", params: Array<ParamType>): void {\n params.reduce((accum, param) => {\n if (param.name) {\n if (accum[param.name]) {\n logger.throwArgumentError(`duplicate ${ type } parameter ${ JSON.stringify(param.name) } in ${ fragment.format(\"full\") }`, \"fragment\", fragment);\n }\n accum[param.name] = true;\n }\n return accum;\n }, <{ [ name: string ]: boolean }>{ });\n}\n*/\n\n/**\n * An **InterfaceAbi** may be any supported ABI format.\n *\n * A string is expected to be a JSON string, which will be parsed\n * using ``JSON.parse``. This means that the value **must** be a valid\n * JSON string, with no stray commas, etc.\n *\n * An array may contain any combination of:\n * - Human-Readable fragments\n * - Parsed JSON fragment\n * - [[Fragment]] instances\n *\n * A **Human-Readable Fragment** is a string which resembles a Solidity\n * signature and is introduced in [this blog entry](link-ricmoo-humanreadableabi).\n * For example, ``function balanceOf(address) view returns (uint)``.\n *\n * A **Parsed JSON Fragment** is a JavaScript Object desribed in the\n * [Solidity documentation](link-solc-jsonabi).\n */\nexport type InterfaceAbi = string | ReadonlyArray<Fragment | JsonFragment | string>;\n\n/**\n * An Interface abstracts many of the low-level details for\n * encoding and decoding the data on the blockchain.\n *\n * An ABI provides information on how to encode data to send to\n * a Contract, how to decode the results and events and how to\n * interpret revert errors.\n *\n * The ABI can be specified by [any supported format](InterfaceAbi).\n */\nexport class Interface {\n\n /**\n * All the Contract ABI members (i.e. methods, events, errors, etc).\n */\n readonly fragments!: ReadonlyArray<Fragment>;\n\n /**\n * The Contract constructor.\n */\n readonly deploy!: ConstructorFragment;\n\n /**\n * The Fallback method, if any.\n */\n readonly fallback!: null | FallbackFragment;\n\n /**\n * If receiving ether is supported.\n */\n readonly receive!: boolean;\n\n #errors: Map<string, ErrorFragment>;\n #events: Map<string, EventFragment>;\n #functions: Map<string, FunctionFragment>;\n// #structs: Map<string, StructFragment>;\n\n #abiCoder: AbiCoder;\n\n /**\n * Create a new Interface for the %%fragments%%.\n */\n constructor(fragments: InterfaceAbi) {\n let abi: ReadonlyArray<Fragment | JsonFragment | string> = [ ];\n if (typeof(fragments) === \"string\") {\n abi = JSON.parse(fragments);\n } else {\n abi = fragments;\n }\n\n this.#functions = new Map();\n this.#errors = new Map();\n this.#events = new Map();\n// this.#structs = new Map();\n\n\n const frags: Array<Fragment> = [ ];\n for (const a of abi) {\n try {\n frags.push(Fragment.from(a));\n } catch (error: any) {\n console.log(`[Warning] Invalid Fragment ${ JSON.stringify(a) }:`, error.message);\n }\n }\n\n defineProperties<Interface>(this, {\n fragments: Object.freeze(frags)\n });\n\n let fallback: null | FallbackFragment = null;\n let receive = false;\n\n this.#abiCoder = this.getAbiCoder();\n\n // Add all fragments by their signature\n this.fragments.forEach((fragment, index) => {\n let bucket: Map<string, Fragment>;\n switch (fragment.type) {\n case \"constructor\":\n if (this.deploy) {\n console.log(\"duplicate definition - constructor\");\n return;\n }\n //checkNames(fragment, \"input\", fragment.inputs);\n defineProperties<Interface>(this, { deploy: <ConstructorFragment>fragment });\n return;\n\n case \"fallback\":\n if (fragment.inputs.length === 0) {\n receive = true;\n } else {\n assertArgument(!fallback || (<FallbackFragment>fragment).payable !== fallback.payable,\n \"conflicting fallback fragments\", `fragments[${ index }]`, fragment);\n fallback = <FallbackFragment>fragment;\n receive = fallback.payable;\n }\n return;\n\n case \"function\":\n //checkNames(fragment, \"input\", fragment.inputs);\n //checkNames(fragment, \"output\", (<FunctionFragment>fragment).outputs);\n bucket = this.#functions;\n break;\n\n case \"event\":\n //checkNames(fragment, \"input\", fragment.inputs);\n bucket = this.#events;\n break;\n\n case \"error\":\n bucket = this.#errors;\n break;\n\n default:\n return;\n }\n\n // Two identical entries; ignore it\n const signature = fragment.format();\n if (bucket.has(signature)) { return; }\n\n bucket.set(signature, fragment);\n });\n\n // If we do not have a constructor add a default\n if (!this.deploy) {\n defineProperties<Interface>(this, {\n deploy: ConstructorFragment.from(\"constructor()\")\n });\n }\n\n defineProperties<Interface>(this, { fallback, receive });\n }\n\n /**\n * Returns the entire Human-Readable ABI, as an array of\n * signatures, optionally as %%minimal%% strings, which\n * removes parameter names and unneceesary spaces.\n */\n format(minimal?: boolean): Array<string> {\n const format = (minimal ? \"minimal\": \"full\");\n const abi = this.fragments.map((f) => f.format(format));\n return abi;\n }\n\n /**\n * Return the JSON-encoded ABI. This is the format Solidiy\n * returns.\n */\n formatJson(): string {\n const abi = this.fragments.map((f) => f.format(\"json\"));\n\n // We need to re-bundle the JSON fragments a bit\n return JSON.stringify(abi.map((j) => JSON.parse(j)));\n }\n\n /**\n * The ABI coder that will be used to encode and decode binary\n * data.\n */\n getAbiCoder(): AbiCoder {\n return AbiCoder.defaultAbiCoder();\n }\n\n // Find a function definition by any means necessary (unless it is ambiguous)\n #getFunction(key: string, values: null | Array<any | Typed>, forceUnique: boolean): null | FunctionFragment {\n\n // Selector\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n for (const fragment of this.#functions.values()) {\n if (selector === fragment.selector) { return fragment; }\n }\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array<FunctionFragment> = [ ];\n for (const [ name, fragment ] of this.#functions) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (values) {\n const lastValue = (values.length > 0) ? values[values.length - 1]: null;\n\n let valueLength = values.length;\n let allowOptions = true;\n if (Typed.isTyped(lastValue) && lastValue.type === \"overrides\") {\n allowOptions = false;\n valueLength--;\n }\n\n // Remove all matches that don't have a compatible length. The args\n // may contain an overrides, so the match may have n or n - 1 parameters\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs.length;\n if (inputs !== valueLength && (!allowOptions || inputs !== valueLength - 1)) {\n matching.splice(i, 1);\n }\n }\n\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) { continue; }\n\n // We are past the inputs\n if (j >= inputs.length) {\n if (values[j].type === \"overrides\") { continue; }\n matching.splice(i, 1);\n break;\n }\n\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n\n // We found a single matching signature with an overrides, but the\n // last value is something that cannot possibly be an options\n if (matching.length === 1 && values && values.length !== matching[0].inputs.length) {\n const lastArg = values[values.length - 1];\n if (lastArg == null || Array.isArray(lastArg) || typeof(lastArg) !== \"object\") {\n matching.splice(0, 1);\n }\n }\n\n if (matching.length === 0) { return null; }\n\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous function description (i.e. matches ${ matchStr })`, \"key\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n const result = this.#functions.get(FunctionFragment.from(key).format());\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Get the function name for %%key%%, which may be a function selector,\n * function name or function signature that belongs to the ABI.\n */\n getFunctionName(key: string): string {\n const fragment = this.#getFunction(key, null, false);\n assertArgument(fragment, \"no matching function\", \"key\", key);\n return fragment.name;\n }\n\n /**\n * Returns true if %%key%% (a function selector, function name or\n * function signature) is present in the ABI.\n *\n * In the case of a function name, the name may be ambiguous, so\n * accessing the [[FunctionFragment]] may require refinement.\n */\n hasFunction(key: string): boolean {\n return !!this.#getFunction(key, null, false);\n }\n\n /**\n * Get the [[FunctionFragment]] for %%key%%, which may be a function\n * selector, function name or function signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple functions match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single function in\n * the ABI, this will throw.\n */\n getFunction(key: string, values?: Array<any | Typed>): null | FunctionFragment {\n return this.#getFunction(key, values || null, true);\n }\n\n /**\n * Iterate over all functions, calling %%callback%%, sorted by their name.\n */\n forEachFunction(callback: (func: FunctionFragment, index: number) => void): void {\n const names = Array.from(this.#functions.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(<FunctionFragment>(this.#functions.get(name)), i);\n }\n }\n\n\n // Find an event definition by any means necessary (unless it is ambiguous)\n #getEvent(key: string, values: null | Array<null | any | Typed>, forceUnique: boolean): null | EventFragment {\n\n // EventTopic\n if (isHexString(key)) {\n const eventTopic = key.toLowerCase();\n for (const fragment of this.#events.values()) {\n if (eventTopic === fragment.topicHash) { return fragment; }\n }\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array<EventFragment> = [ ];\n for (const [ name, fragment ] of this.#events) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (values) {\n // Remove all matches that don't have a compatible length.\n for (let i = matching.length - 1; i >= 0; i--) {\n if (matching[i].inputs.length < values.length) {\n matching.splice(i, 1);\n }\n }\n\n // Remove all matches that don't match the Typed signature\n for (let i = matching.length - 1; i >= 0; i--) {\n const inputs = matching[i].inputs;\n for (let j = 0; j < values.length; j++) {\n // Not a typed value\n if (!Typed.isTyped(values[j])) { continue; }\n\n // Make sure the value type matches the input type\n if (values[j].type !== inputs[j].baseType) {\n matching.splice(i, 1);\n break;\n }\n }\n }\n }\n\n if (matching.length === 0) { return null; }\n\n if (matching.length > 1 && forceUnique) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous event description (i.e. matches ${ matchStr })`, \"key\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n const result = this.#events.get(EventFragment.from(key).format());\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Get the event name for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n */\n getEventName(key: string): string {\n const fragment = this.#getEvent(key, null, false);\n assertArgument(fragment, \"no matching event\", \"key\", key);\n\n return fragment.name;\n }\n\n /**\n * Returns true if %%key%% (an event topic hash, event name or\n * event signature) is present in the ABI.\n *\n * In the case of an event name, the name may be ambiguous, so\n * accessing the [[EventFragment]] may require refinement.\n */\n hasEvent(key: string): boolean {\n return !!this.#getEvent(key, null, false);\n }\n\n /**\n * Get the [[EventFragment]] for %%key%%, which may be a topic hash,\n * event name or event signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple events match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single event in\n * the ABI, this will throw.\n */\n getEvent(key: string, values?: Array<any | Typed>): null | EventFragment {\n return this.#getEvent(key, values || null, true)\n }\n\n /**\n * Iterate over all events, calling %%callback%%, sorted by their name.\n */\n forEachEvent(callback: (func: EventFragment, index: number) => void): void {\n const names = Array.from(this.#events.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(<EventFragment>(this.#events.get(name)), i);\n }\n }\n\n /**\n * Get the [[ErrorFragment]] for %%key%%, which may be an error\n * selector, error name or error signature that belongs to the ABI.\n *\n * If %%values%% is provided, it will use the Typed API to handle\n * ambiguous cases where multiple errors match by name.\n *\n * If the %%key%% and %%values%% do not refine to a single error in\n * the ABI, this will throw.\n */\n getError(key: string, values?: Array<any | Typed>): null | ErrorFragment {\n if (isHexString(key)) {\n const selector = key.toLowerCase();\n\n if (BuiltinErrors[selector]) {\n return ErrorFragment.from(BuiltinErrors[selector].signature);\n }\n\n for (const fragment of this.#errors.values()) {\n if (selector === fragment.selector) { return fragment; }\n }\n\n return null;\n }\n\n // It is a bare name, look up the function (will return null if ambiguous)\n if (key.indexOf(\"(\") === -1) {\n const matching: Array<ErrorFragment> = [ ];\n for (const [ name, fragment ] of this.#errors) {\n if (name.split(\"(\"/* fix:) */)[0] === key) { matching.push(fragment); }\n }\n\n if (matching.length === 0) {\n if (key === \"Error\") { return ErrorFragment.from(\"error Error(string)\"); }\n if (key === \"Panic\") { return ErrorFragment.from(\"error Panic(uint256)\"); }\n return null;\n } else if (matching.length > 1) {\n const matchStr = matching.map((m) => JSON.stringify(m.format())).join(\", \");\n assertArgument(false, `ambiguous error description (i.e. ${ matchStr })`, \"name\", key);\n }\n\n return matching[0];\n }\n\n // Normalize the signature and lookup the function\n key = ErrorFragment.from(key).format()\n if (key === \"Error(string)\") { return ErrorFragment.from(\"error Error(string)\"); }\n if (key === \"Panic(uint256)\") { return ErrorFragment.from(\"error Panic(uint256)\"); }\n\n const result = this.#errors.get(key);\n if (result) { return result; }\n\n return null;\n }\n\n /**\n * Iterate over all errors, calling %%callback%%, sorted by their name.\n */\n forEachError(callback: (func: ErrorFragment, index: number) => void): void {\n const names = Array.from(this.#errors.keys());\n names.sort((a, b) => a.localeCompare(b));\n for (let i = 0; i < names.length; i++) {\n const name = names[i];\n callback(<ErrorFragment>(this.#errors.get(name)), i);\n }\n }\n\n // Get the 4-byte selector used by Solidity to identify a function\n /*\n getSelector(fragment: ErrorFragment | FunctionFragment): string {\n if (typeof(fragment) === \"string\") {\n const matches: Array<Fragment> = [ ];\n\n try { matches.push(this.getFunction(fragment)); } catch (error) { }\n try { matches.push(this.getError(<string>fragment)); } catch (_) { }\n\n if (matches.length === 0) {\n logger.throwArgumentError(\"unknown fragment\", \"key\", fragment);\n } else if (matches.length > 1) {\n logger.throwArgumentError(\"ambiguous fragment matches function and error\", \"key\", fragment);\n }\n\n fragment = matches[0];\n }\n\n return dataSlice(id(fragment.format()), 0, 4);\n }\n */\n\n // Get the 32-byte topic hash used by Solidity to identify an event\n /*\n getEventTopic(fragment: EventFragment): string {\n //if (typeof(fragment) === \"string\") { fragment = this.getEvent(eventFragment); }\n return id(fragment.format());\n }\n */\n\n\n _decodeParams(params: ReadonlyArray<ParamType>, data: BytesLike): Result {\n return this.#abiCoder.decode(params, data)\n }\n\n _encodeParams(params: ReadonlyArray<ParamType>, values: ReadonlyArray<any>): string {\n return this.#abiCoder.encode(params, values)\n }\n\n /**\n * Encodes a ``tx.data`` object for deploying the Contract with\n * the %%values%% as the constructor arguments.\n */\n encodeDeploy(values?: ReadonlyArray<any>): string {\n return this._encodeParams(this.deploy.inputs, values || [ ]);\n }\n\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified error (see [[getError]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeErrorResult(fragment: ErrorFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n\n assertArgument(dataSlice(data, 0, 4) === fragment.selector,\n `data signature does not match error ${ fragment.name }.`, \"data\", data);\n\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n\n /**\n * Encodes the transaction revert data for a call result that\n * reverted from the the Contract with the sepcified %%error%%\n * (see [[getError]] for valid values for %%fragment%%) with the %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeErrorResult(fragment: ErrorFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getError(fragment);\n assertArgument(f, \"unknown error\", \"fragment\", fragment);\n fragment = f;\n }\n\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [ ])\n ]);\n }\n\n /**\n * Decodes the %%data%% from a transaction ``tx.data`` for\n * the function specified (see [[getFunction]] for valid values\n * for %%fragment%%).\n *\n * Most developers should prefer the [[parseTransaction]] method\n * instead, which will automatically detect the fragment.\n */\n decodeFunctionData(fragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n assertArgument(dataSlice(data, 0, 4) === fragment.selector,\n `data signature does not match function ${ fragment.name }.`, \"data\", data);\n\n return this._decodeParams(fragment.inputs, dataSlice(data, 4));\n }\n\n /**\n * Encodes the ``tx.data`` for a transaction that calls the function\n * specified (see [[getFunction]] for valid values for %%fragment%%) with\n * the %%values%%.\n */\n encodeFunctionData(fragment: FunctionFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n return concat([\n fragment.selector,\n this._encodeParams(fragment.inputs, values || [ ])\n ]);\n }\n\n /**\n * Decodes the result %%data%% (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values for\n * %%key%%).\n *\n * Most developers should prefer the [[parseCallResult]] method instead,\n * which will automatically detect a ``CALL_EXCEPTION`` and throw the\n * corresponding error.\n */\n decodeFunctionResult(fragment: FunctionFragment | string, data: BytesLike): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n\n let message = \"invalid length for result data\";\n\n const bytes = getBytesCopy(data);\n if ((bytes.length % 32) === 0) {\n try {\n return this.#abiCoder.decode(fragment.outputs, bytes);\n } catch (error) {\n message = \"could not decode result data\";\n }\n }\n\n // Call returned data with no error, but the data is junk\n assert(false, message, \"BAD_DATA\", {\n value: hexlify(bytes),\n info: { method: fragment.name, signature: fragment.format() }\n });\n }\n\n makeError(_data: BytesLike, tx: CallExceptionTransaction): CallExceptionError {\n const data = getBytes(_data, \"data\");\n\n const error = AbiCoder.getBuiltinCallException(\"call\", tx, data);\n\n // Not a built-in error; try finding a custom error\n const customPrefix = \"execution reverted (unknown custom error)\";\n if (error.message.startsWith(customPrefix)) {\n const selector = hexlify(data.slice(0, 4));\n\n const ef = this.getError(selector);\n if (ef) {\n try {\n const args = this.#abiCoder.decode(ef.inputs, data.slice(4));\n error.revert = {\n name: ef.name, signature: ef.format(), args\n };\n error.reason = error.revert.signature;\n error.message = `execution reverted: ${ error.reason }`\n } catch (e) {\n error.message = `execution reverted (coult not decode custom error)`\n }\n }\n }\n\n // Add the invocation, if available\n const parsed = this.parseTransaction(tx);\n if (parsed) {\n error.invocation = {\n method: parsed.name,\n signature: parsed.signature,\n args: parsed.args\n };\n }\n\n return error;\n }\n\n /**\n * Encodes the result data (e.g. from an ``eth_call``) for the\n * specified function (see [[getFunction]] for valid values\n * for %%fragment%%) with %%values%%.\n *\n * This is generally not used by most developers, unless trying to mock\n * a result from a Contract.\n */\n encodeFunctionResult(fragment: FunctionFragment | string, values?: ReadonlyArray<any>): string {\n if (typeof(fragment) === \"string\") {\n const f = this.getFunction(fragment);\n assertArgument(f, \"unknown function\", \"fragment\", fragment);\n fragment = f;\n }\n return hexlify(this.#abiCoder.encode(fragment.outputs, values || [ ]));\n }\n/*\n spelunk(inputs: Array<ParamType>, values: ReadonlyArray<any>, processfunc: (type: string, value: any) => Promise<any>): Promise<Array<any>> {\n const promises: Array<Promise<>> = [ ];\n const process = function(type: ParamType, value: any): any {\n if (type.baseType === \"array\") {\n return descend(type.child\n }\n if (type. === \"address\") {\n }\n };\n\n const descend = function (inputs: Array<ParamType>, values: ReadonlyArray<any>) {\n if (inputs.length !== values.length) { throw new Error(\"length mismatch\"); }\n \n };\n\n const result: Array<any> = [ ];\n values.forEach((value, index) => {\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n logger.throwArgumentError(\"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n }\n*/\n // Create the filter for the event with search criteria (e.g. for eth_filterLog)\n encodeFilterTopics(fragment: EventFragment | string, values: ReadonlyArray<any>): Array<null | string | Array<string>> {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n assert(values.length <= fragment.inputs.length, `too many arguments for ${ fragment.format() }`,\n \"UNEXPECTED_ARGUMENT\", { count: values.length, expectedCount: fragment.inputs.length })\n\n const topics: Array<null | string | Array<string>> = [];\n if (!fragment.anonymous) { topics.push(fragment.topicHash); }\n\n // @TODO: Use the coders for this; to properly support tuples, etc.\n const encodeTopic = (param: ParamType, value: any): string => {\n if (param.type === \"string\") {\n return id(value);\n } else if (param.type === \"bytes\") {\n return keccak256(hexlify(value));\n }\n\n if (param.type === \"bool\" && typeof(value) === \"boolean\") {\n value = (value ? \"0x01\": \"0x00\");\n } else if (param.type.match(/^u?int/)) {\n value = toBeHex(value); // @TODO: Should this toTwos??\n } else if (param.type.match(/^bytes/)) {\n value = zeroPadBytes(value, 32);\n } else if (param.type === \"address\") {\n // Check addresses are valid\n this.#abiCoder.encode( [ \"address\" ], [ value ]);\n }\n\n return zeroPadValue(hexlify(value), 32);\n };\n\n values.forEach((value, index) => {\n\n const param = (<EventFragment>fragment).inputs[index];\n\n if (!param.indexed) {\n assertArgument(value == null,\n \"cannot filter non-indexed parameters; must be null\", (\"contract.\" + param.name), value);\n return;\n }\n\n if (value == null) {\n topics.push(null);\n } else if (param.baseType === \"array\" || param.baseType === \"tuple\") {\n assertArgument(false, \"filtering with tuples or arrays not supported\", (\"contract.\" + param.name), value);\n } else if (Array.isArray(value)) {\n topics.push(value.map((value) => encodeTopic(param, value)));\n } else {\n topics.push(encodeTopic(param, value));\n }\n });\n\n // Trim off trailing nulls\n while (topics.length && topics[topics.length - 1] === null) {\n topics.pop();\n }\n\n return topics;\n }\n\n encodeEventLog(fragment: EventFragment | string, values: ReadonlyArray<any>): { data: string, topics: Array<string> } {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n const topics: Array<string> = [ ];\n\n const dataTypes: Array<ParamType> = [ ];\n const dataValues: Array<string> = [ ];\n\n if (!fragment.anonymous) {\n topics.push(fragment.topicHash);\n }\n\n assertArgument(values.length === fragment.inputs.length,\n \"event arguments/values mismatch\", \"values\", values);\n\n fragment.inputs.forEach((param, index) => {\n const value = values[index];\n if (param.indexed) {\n if (param.type === \"string\") {\n topics.push(id(value))\n } else if (param.type === \"bytes\") {\n topics.push(keccak256(value))\n } else if (param.baseType === \"tuple\" || param.baseType === \"array\") {\n // @TODO\n throw new Error(\"not implemented\");\n } else {\n topics.push(this.#abiCoder.encode([ param.type] , [ value ]));\n }\n } else {\n dataTypes.push(param);\n dataValues.push(value);\n }\n });\n\n return {\n data: this.#abiCoder.encode(dataTypes , dataValues),\n topics: topics\n };\n }\n\n // Decode a filter for the event and the search criteria\n decodeEventLog(fragment: EventFragment | string, data: BytesLike, topics?: ReadonlyArray<string>): Result {\n if (typeof(fragment) === \"string\") {\n const f = this.getEvent(fragment);\n assertArgument(f, \"unknown event\", \"eventFragment\", fragment);\n fragment = f;\n }\n\n if (topics != null && !fragment.anonymous) {\n const eventTopic = fragment.topicHash;\n assertArgument(isHexString(topics[0], 32) && topics[0].toLowerCase() === eventTopic,\n \"fragment/topic mismatch\", \"topics[0]\", topics[0]);\n topics = topics.slice(1);\n }\n\n const indexed: Array<ParamType> = [];\n const nonIndexed: Array<ParamType> = [];\n const dynamic: Array<boolean> = [];\n\n fragment.inputs.forEach((param, index) => {\n if (param.indexed) {\n if (param.type === \"string\" || param.type === \"bytes\" || param.baseType === \"tuple\" || param.baseType === \"array\") {\n indexed.push(ParamType.from({ type: \"bytes32\", name: param.name }));\n dynamic.push(true);\n } else {\n indexed.push(param);\n dynamic.push(false);\n }\n } else {\n nonIndexed.push(param);\n dynamic.push(false);\n }\n });\n\n const resultIndexed = (topics != null) ? this.#abiCoder.decode(indexed, concat(topics)): null;\n const resultNonIndexed = this.#abiCoder.decode(nonIndexed, data, true);\n\n //const result: (Array<any> & { [ key: string ]: any }) = [ ];\n const values: Array<any> = [ ];\n const keys: Array<null | string> = [ ];\n let nonIndexedIndex = 0, indexedIndex = 0;\n fragment.inputs.forEach((param, index) => {\n let value: null | Indexed | Error = null;\n if (param.indexed) {\n if (resultIndexed == null) {\n value = new Indexed(null);\n\n } else if (dynamic[index]) {\n value = new Indexed(resultIndexed[indexedIndex++]);\n\n } else {\n try {\n value = resultIndexed[indexedIndex++];\n } catch (error: any) {\n value = error;\n }\n }\n } else {\n try {\n value = resultNonIndexed[nonIndexedIndex++];\n } catch (error: any) {\n value = error;\n }\n }\n\n values.push(value);\n keys.push(param.name || null);\n });\n\n return Result.fromItems(values, keys);\n }\n\n /**\n * Parses a transaction, finding the matching function and extracts\n * the parameter values along with other useful function details.\n *\n * If the matching function cannot be found, return null.\n */\n parseTransaction(tx: { data: string, value?: BigNumberish }): null | TransactionDescription {\n const data = getBytes(tx.data, \"tx.data\");\n const value = getBigInt((tx.value != null) ? tx.value: 0, \"tx.value\");\n\n const fragment = this.getFunction(hexlify(data.slice(0, 4)));\n\n if (!fragment) { return null; }\n\n const args = this.#abiCoder.decode(fragment.inputs, data.slice(4));\n return new TransactionDescription(fragment, fragment.selector, args, value);\n }\n\n parseCallResult(data: BytesLike): Result {\n throw new Error(\"@TODO\");\n }\n\n /**\n * Parses a receipt log, finding the matching event and extracts\n * the parameter values along with other useful event details.\n *\n * If the matching event cannot be found, returns null.\n */\n parseLog(log: { topics: ReadonlyArray<string>, data: string}): null | LogDescription {\n const fragment = this.getEvent(log.topics[0]);\n\n if (!fragment || fragment.anonymous) { return null; }\n\n // @TODO: If anonymous, and the only method, and the input count matches, should we parse?\n // Probably not, because just because it is the only event in the ABI does\n // not mean we have the full ABI; maybe just a fragment?\n\n\n return new LogDescription(fragment, fragment.topicHash, this.decodeEventLog(fragment, log.data, log.topics));\n }\n\n /**\n * Parses a revert data, finding the matching error and extracts\n * the parameter values along with other useful error details.\n *\n * If the matching error cannot be found, returns null.\n */\n parseError(data: BytesLike): null | ErrorDescription {\n const hexData = hexlify(data);\n\n const fragment = this.getError(dataSlice(hexData, 0, 4));\n\n if (!fragment) { return null; }\n\n const args = this.#abiCoder.decode(fragment.inputs, dataSlice(hexData, 4));\n return new ErrorDescription(fragment, fragment.selector, args);\n }\n\n /**\n * Creates a new [[Interface]] from the ABI %%value%%.\n *\n * The %%value%% may be provided as an existing [[Interface]] object,\n * a JSON-encoded ABI or any Human-Readable ABI format.\n */\n static from(value: InterfaceAbi | Interface): Interface {\n // Already an Interface, which is immutable\n if (value instanceof Interface) { return value; }\n\n // JSON\n if (typeof(value) === \"string\") { return new Interface(JSON.parse(value)); }\n\n // An Interface; possibly from another v6 instance\n if (typeof((<any>value).formatJson) === \"function\") {\n return new Interface((<any>value).formatJson());\n }\n\n // A legacy Interface; from an older version\n if (typeof((<any>value).format) === \"function\") {\n return new Interface((<any>value).format(\"json\"));\n }\n\n // Array of fragments\n return new Interface(value);\n }\n}\n","//import { resolveAddress } from \"@ethersproject/address\";\nimport {\n defineProperties, getBigInt, getNumber, hexlify, isBytesLike,\n resolveProperties,\n assert, assertArgument, isError, makeError\n} from \"../utils/index.js\";\nimport { accessListify } from \"../transaction/index.js\";\n\nimport type { AddressLike, NameResolver } from \"../address/index.js\";\nimport type { BigNumberish, EventEmitterable } from \"../utils/index.js\";\nimport type { Signature } from \"../crypto/index.js\";\nimport type {\n AccessList, AccessListish, BlobLike, KzgLibrary, TransactionLike\n} from \"../transaction/index.js\";\n\nimport type { ContractRunner } from \"./contracts.js\";\nimport type { Network } from \"./network.js\";\n\n\nconst BN_0 = BigInt(0);\n\n/**\n * A **BlockTag** specifies a specific block.\n *\n * **numeric value** - specifies the block height, where\n * the genesis block is block 0; many operations accept a negative\n * value which indicates the block number should be deducted from\n * the most recent block. A numeric value may be a ``number``, ``bigint``,\n * or a decimal of hex string.\n *\n * **blockhash** - specifies a specific block by its blockhash; this allows\n * potentially orphaned blocks to be specifed, without ambiguity, but many\n * backends do not support this for some operations.\n */\nexport type BlockTag = BigNumberish | string;\n\nimport {\n BlockParams, LogParams, TransactionReceiptParams,\n TransactionResponseParams\n} from \"./formatting.js\";\n\n// -----------------------\n\nfunction getValue<T>(value: undefined | null | T): null | T {\n if (value == null) { return null; }\n return value;\n}\n\nfunction toJson(value: null | bigint): null | string {\n if (value == null) { return null; }\n return value.toString();\n}\n\n// @TODO? <T extends FeeData = { }> implements Required<T>\n\n/**\n * A **FeeData** wraps all the fee-related values associated with\n * the network.\n */\nexport class FeeData {\n /**\n * The gas price for legacy networks.\n */\n readonly gasPrice!: null | bigint;\n\n /**\n * The maximum fee to pay per gas.\n *\n * The base fee per gas is defined by the network and based on\n * congestion, increasing the cost during times of heavy load\n * and lowering when less busy.\n *\n * The actual fee per gas will be the base fee for the block\n * and the priority fee, up to the max fee per gas.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n readonly maxFeePerGas!: null | bigint;\n\n /**\n * The additional amout to pay per gas to encourage a validator\n * to include the transaction.\n *\n * The purpose of this is to compensate the validator for the\n * adjusted risk for including a given transaction.\n *\n * This will be ``null`` on legacy networks (i.e. [pre-EIP-1559](link-eip-1559))\n */\n readonly maxPriorityFeePerGas!: null | bigint;\n\n /**\n * Creates a new FeeData for %%gasPrice%%, %%maxFeePerGas%% and\n * %%maxPriorityFeePerGas%%.\n */\n constructor(gasPrice?: null | bigint, maxFeePerGas?: null | bigint, maxPriorityFeePerGas?: null | bigint) {\n defineProperties<FeeData>(this, {\n gasPrice: getValue(gasPrice),\n maxFeePerGas: getValue(maxFeePerGas),\n maxPriorityFeePerGas: getValue(maxPriorityFeePerGas)\n });\n }\n\n /**\n * Returns a JSON-friendly value.\n */\n toJSON(): any {\n const {\n gasPrice, maxFeePerGas, maxPriorityFeePerGas\n } = this;\n return {\n _type: \"FeeData\",\n gasPrice: toJson(gasPrice),\n maxFeePerGas: toJson(maxFeePerGas),\n maxPriorityFeePerGas: toJson(maxPriorityFeePerGas),\n };\n }\n}\n\n\n/**\n * A **TransactionRequest** is a transactions with potentially various\n * properties not defined, or with less strict types for its values.\n *\n * This is used to pass to various operations, which will internally\n * coerce any types and populate any necessary values.\n */\nexport interface TransactionRequest {\n /**\n * The transaction type.\n */\n type?: null | number;\n\n /**\n * The target of the transaction.\n */\n to?: null | AddressLike;\n\n /**\n * The sender of the transaction.\n */\n from?: null | AddressLike;\n\n /**\n * The nonce of the transaction, used to prevent replay attacks.\n */\n nonce?: null | number;\n\n /**\n * The maximum amount of gas to allow this transaction to consume.\n */\n gasLimit?: null | BigNumberish;\n\n /**\n * The gas price to use for legacy transactions or transactions on\n * legacy networks.\n *\n * Most of the time the ``max*FeePerGas`` is preferred.\n */\n gasPrice?: null | BigNumberish;\n\n /**\n * The [[link-eip-1559]] maximum priority fee to pay per gas.\n */\n maxPriorityFeePerGas?: null | BigNumberish;\n\n /**\n * The [[link-eip-1559]] maximum total fee to pay per gas. The actual\n * value used is protocol enforced to be the block's base fee.\n */\n maxFeePerGas?: null | BigNumberish;\n\n /**\n * The transaction data.\n */\n data?: null | string;\n\n /**\n * The transaction value (in wei).\n */\n value?: null | BigNumberish;\n\n /**\n * The chain ID for the network this transaction is valid on.\n */\n chainId?: null | BigNumberish;\n\n /**\n * The [[link-eip-2930]] access list. Storage slots included in the access\n * list are //warmed// by pre-loading them, so their initial cost to\n * fetch is guaranteed, but then each additional access is cheaper.\n */\n accessList?: null | AccessListish;\n\n /**\n * A custom object, which can be passed along for network-specific\n * values.\n */\n customData?: any;\n\n // Only meaningful when used for call\n\n /**\n * When using ``call`` or ``estimateGas``, this allows a specific\n * block to be queried. Many backends do not support this and when\n * unsupported errors are silently squelched and ``\"latest\"`` is used. \n */\n blockTag?: BlockTag;\n\n /**\n * When using ``call``, this enables CCIP-read, which permits the\n * provider to be redirected to web-based content during execution,\n * which is then further validated by the contract.\n *\n * There are potential security implications allowing CCIP-read, as\n * it could be used to expose the IP address or user activity during\n * the fetch to unexpected parties.\n */\n enableCcipRead?: boolean;\n\n /**\n * The blob versioned hashes (see [[link-eip-4844]]).\n */\n blobVersionedHashes?: null | Array<string>\n\n /**\n * The maximum fee per blob gas (see [[link-eip-4844]]).\n */\n maxFeePerBlobGas?: null | BigNumberish;\n\n /**\n * Any blobs to include in the transaction (see [[link-eip-4844]]).\n */\n blobs?: null | Array<BlobLike>;\n\n /**\n * An external library for computing the KZG commitments and\n * proofs necessary for EIP-4844 transactions (see [[link-eip-4844]]).\n *\n * This is generally ``null``, unless you are creating BLOb\n * transactions.\n */\n kzg?: null | KzgLibrary;\n\n // Todo?\n //gasMultiplier?: number;\n};\n\n/**\n * A **PreparedTransactionRequest** is identical to a [[TransactionRequest]]\n * except all the property types are strictly enforced.\n */\nexport interface PreparedTransactionRequest {\n /**\n * The transaction type.\n */\n type?: number;\n\n\n /**\n * The target of the transaction.\n */\n to?: AddressLike;\n\n /**\n * The sender of the transaction.\n */\n from?: AddressLike;\n\n /**\n * The nonce of the transaction, used to prevent replay attacks.\n */\n\n nonce?: number;\n\n /**\n * The maximum amount of gas to allow this transaction to consime.\n */\n gasLimit?: bigint;\n\n /**\n * The gas price to use for legacy transactions or transactions on\n * legacy networks.\n *\n * Most of the time the ``max*FeePerGas`` is preferred.\n */\n gasPrice?: bigint;\n\n /**\n * The [[link-eip-1559]] maximum priority fee to pay per gas.\n */\n maxPriorityFeePerGas?: bigint;\n\n /**\n * The [[link-eip-1559]] maximum total fee to pay per gas. The actual\n * value used is protocol enforced to be the block's base fee.\n */\n maxFeePerGas?: bigint;\n\n /**\n * The transaction data.\n */\n data?: string;\n\n\n /**\n * The transaction value (in wei).\n */\n value?: bigint;\n\n /**\n * The chain ID for the network this transaction is valid on.\n */\n chainId?: bigint;\n\n /**\n * The [[link-eip-2930]] access list. Storage slots included in the access\n * list are //warmed// by pre-loading them, so their initial cost to\n * fetch is guaranteed, but then each additional access is cheaper.\n */\n accessList?: AccessList;\n\n /**\n * A custom object, which can be passed along for network-specific\n * values.\n */\n customData?: any;\n\n\n\n /**\n * When using ``call`` or ``estimateGas``, this allows a specific\n * block to be queried. Many backends do not support this and when\n * unsupported errors are silently squelched and ``\"latest\"`` is used. \n */\n blockTag?: BlockTag;\n\n /**\n * When using ``call``, this enables CCIP-read, which permits the\n * provider to be redirected to web-based content during execution,\n * which is then further validated by the contract.\n *\n * There are potential security implications allowing CCIP-read, as\n * it could be used to expose the IP address or user activity during\n * the fetch to unexpected parties.\n */\n enableCcipRead?: boolean;\n}\n\n/**\n * Returns a copy of %%req%% with all properties coerced to their strict\n * types.\n */\nexport function copyRequest(req: TransactionRequest): PreparedTransactionRequest {\n const result: any = { };\n\n // These could be addresses, ENS names or Addressables\n if (req.to) { result.to = req.to; }\n if (req.from) { result.from = req.from; }\n\n if (req.data) { result.data = hexlify(req.data); }\n\n const bigIntKeys = \"chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value\".split(/,/);\n for (const key of bigIntKeys) {\n if (!(key in req) || (<any>req)[key] == null) { continue; }\n result[key] = getBigInt((<any>req)[key], `request.${ key }`);\n }\n\n const numberKeys = \"type,nonce\".split(/,/);\n for (const key of numberKeys) {\n if (!(key in req) || (<any>req)[key] == null) { continue; }\n result[key] = getNumber((<any>req)[key], `request.${ key }`);\n }\n\n if (req.accessList) {\n result.accessList = accessListify(req.accessList);\n }\n\n if (\"blockTag\" in req) { result.blockTag = req.blockTag; }\n\n if (\"enableCcipRead\" in req) {\n result.enableCcipRead = !!req.enableCcipRead\n }\n\n if (\"customData\" in req) {\n result.customData = req.customData;\n }\n\n if (\"blobVersionedHashes\" in req && req.blobVersionedHashes) {\n result.blobVersionedHashes = req.blobVersionedHashes.slice();\n }\n\n if (\"kzg\" in req) { result.kzg = req.kzg; }\n\n if (\"blobs\" in req && req.blobs) {\n result.blobs = req.blobs.map((b) => {\n if (isBytesLike(b)) { return hexlify(b); }\n return Object.assign({ }, b);\n });\n }\n\n return result;\n}\n\n//////////////////////\n// Block\n\n/**\n * An Interface to indicate a [[Block]] has been included in the\n * blockchain. This asserts a Type Guard that necessary properties\n * are non-null.\n *\n * Before a block is included, it is a //pending// block.\n */\nexport interface MinedBlock extends Block {\n /**\n * The block number also known as the block height.\n */\n readonly number: number;\n\n /**\n * The block hash.\n */\n readonly hash: string;\n\n /**\n * The block timestamp, in seconds from epoch.\n */\n readonly timestamp: number;\n\n /**\n * The block date, created from the [[timestamp]].\n */\n readonly date: Date;\n\n /**\n * The miner of the block, also known as the ``author`` or\n * block ``producer``.\n */\n readonly miner: string;\n}\n\n/**\n * A **Block** represents the data associated with a full block on\n * Ethereum.\n */\nexport class Block implements BlockParams, Iterable<string> {\n\n /**\n * The provider connected to the block used to fetch additional details\n * if necessary.\n */\n readonly provider!: Provider;\n\n /**\n * The block number, sometimes called the block height. This is a\n * sequential number that is one higher than the parent block.\n */\n readonly number!: number;\n\n /**\n * The block hash.\n *\n * This hash includes all properties, so can be safely used to identify\n * an exact set of block properties.\n */\n readonly hash!: null | string;\n\n /**\n * The timestamp for this block, which is the number of seconds since\n * epoch that this block was included.\n */\n readonly timestamp!: number;\n\n /**\n * The block hash of the parent block.\n */\n readonly parentHash!: string;\n\n /**\n * The hash tree root of the parent beacon block for the given\n * execution block. See [[link-eip-4788]].\n */\n parentBeaconBlockRoot!: null | string;\n\n /**\n * The nonce.\n *\n * On legacy networks, this is the random number inserted which\n * permitted the difficulty target to be reached.\n */\n readonly nonce!: string;\n\n /**\n * The difficulty target.\n *\n * On legacy networks, this is the proof-of-work target required\n * for a block to meet the protocol rules to be included.\n *\n * On modern networks, this is a random number arrived at using\n * randao. @TODO: Find links?\n */\n readonly difficulty!: bigint;\n\n\n /**\n * The total gas limit for this block.\n */\n readonly gasLimit!: bigint;\n\n /**\n * The total gas used in this block.\n */\n readonly gasUsed!: bigint;\n\n\n /**\n * The root hash for the global state after applying changes\n * in this block.\n */\n readonly stateRoot!: null | string;\n\n /**\n * The hash of the transaction receipts trie.\n */\n readonly receiptsRoot!: null | string;\n\n /**\n * The total amount of blob gas consumed by the transactions\n * within the block. See [[link-eip-4844]].\n */\n readonly blobGasUsed!: null | bigint;\n\n /**\n * The running total of blob gas consumed in excess of the\n * target, prior to the block. See [[link-eip-4844]].\n */\n readonly excessBlobGas!: null | bigint;\n\n /**\n * The miner coinbase address, wihch receives any subsidies for\n * including this block.\n */\n readonly miner!: string;\n\n /**\n * The latest RANDAO mix of the post beacon state of\n * the previous block.\n */\n readonly prevRandao!: null | string;\n\n /**\n * Any extra data the validator wished to include.\n */\n readonly extraData!: string;\n\n /**\n * The base fee per gas that all transactions in this block were\n * charged.\n *\n * This adjusts after each block, depending on how congested the network\n * is.\n */\n readonly baseFeePerGas!: null | bigint;\n\n readonly #transactions: Array<string | TransactionResponse>;\n\n /**\n * Create a new **Block** object.\n *\n * This should generally not be necessary as the unless implementing a\n * low-level library.\n */\n constructor(block: BlockParams, provider: Provider) {\n\n this.#transactions = block.transactions.map((tx) => {\n if (typeof(tx) !== \"string\") {\n return new TransactionResponse(tx, provider);\n }\n return tx;\n });\n\n defineProperties<Block>(this, {\n provider,\n\n hash: getValue(block.hash),\n\n number: block.number,\n timestamp: block.timestamp,\n\n parentHash: block.parentHash,\n parentBeaconBlockRoot: block.parentBeaconBlockRoot,\n\n nonce: block.nonce,\n difficulty: block.difficulty,\n\n gasLimit: block.gasLimit,\n gasUsed: block.gasUsed,\n blobGasUsed: block.blobGasUsed,\n excessBlobGas: block.excessBlobGas,\n miner: block.miner,\n prevRandao: getValue(block.prevRandao),\n extraData: block.extraData,\n\n baseFeePerGas: getValue(block.baseFeePerGas),\n\n stateRoot: block.stateRoot,\n receiptsRoot: block.receiptsRoot,\n });\n }\n\n /**\n * Returns the list of transaction hashes, in the order\n * they were executed within the block.\n */\n get transactions(): ReadonlyArray<string> {\n return this.#transactions.map((tx) => {\n if (typeof(tx) === \"string\") { return tx; }\n return tx.hash;\n });\n }\n\n /**\n * Returns the complete transactions, in the order they\n * were executed within the block.\n *\n * This is only available for blocks which prefetched\n * transactions, by passing ``true`` to %%prefetchTxs%%\n * into [[Provider-getBlock]].\n */\n get prefetchedTransactions(): Array<TransactionResponse> {\n const txs = this.#transactions.slice();\n\n // Doesn't matter...\n if (txs.length === 0) { return [ ]; }\n\n // Make sure we prefetched the transactions\n assert(typeof(txs[0]) === \"object\", \"transactions were not prefetched with block request\", \"UNSUPPORTED_OPERATION\", {\n operation: \"transactionResponses()\"\n });\n\n return <Array<TransactionResponse>>txs;\n }\n\n /**\n * Returns a JSON-friendly value.\n */\n toJSON(): any {\n const {\n baseFeePerGas, difficulty, extraData, gasLimit, gasUsed, hash,\n miner, prevRandao, nonce, number, parentHash, parentBeaconBlockRoot,\n stateRoot, receiptsRoot, timestamp, transactions\n } = this;\n\n return {\n _type: \"Block\",\n baseFeePerGas: toJson(baseFeePerGas),\n difficulty: toJson(difficulty),\n extraData,\n gasLimit: toJson(gasLimit),\n gasUsed: toJson(gasUsed),\n blobGasUsed: toJson(this.blobGasUsed),\n excessBlobGas: toJson(this.excessBlobGas),\n hash, miner, prevRandao, nonce, number, parentHash, timestamp,\n parentBeaconBlockRoot, stateRoot, receiptsRoot,\n transactions,\n };\n }\n\n [Symbol.iterator](): Iterator<string> {\n let index = 0;\n const txs = this.transactions;\n return {\n next: () => {\n if (index < this.length) {\n return {\n value: txs[index++], done: false\n }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n /**\n * The number of transactions in this block.\n */\n get length(): number { return this.#transactions.length; }\n\n /**\n * The [[link-js-date]] this block was included at.\n */\n get date(): null | Date {\n if (this.timestamp == null) { return null; }\n return new Date(this.timestamp * 1000);\n }\n\n /**\n * Get the transaction at %%indexe%% within this block.\n */\n async getTransaction(indexOrHash: number | string): Promise<TransactionResponse> {\n // Find the internal value by its index or hash\n let tx: string | TransactionResponse | undefined = undefined;\n if (typeof(indexOrHash) === \"number\") {\n tx = this.#transactions[indexOrHash];\n\n } else {\n const hash = indexOrHash.toLowerCase();\n for (const v of this.#transactions) {\n if (typeof(v) === \"string\") {\n if (v !== hash) { continue; }\n tx = v;\n break;\n } else {\n if (v.hash === hash) { continue; }\n tx = v;\n break;\n }\n }\n }\n if (tx == null) { throw new Error(\"no such tx\"); }\n\n if (typeof(tx) === \"string\") {\n return <TransactionResponse>(await this.provider.getTransaction(tx));\n } else {\n return tx;\n }\n }\n\n /**\n * If a **Block** was fetched with a request to include the transactions\n * this will allow synchronous access to those transactions.\n *\n * If the transactions were not prefetched, this will throw.\n */\n getPrefetchedTransaction(indexOrHash: number | string): TransactionResponse {\n const txs = this.prefetchedTransactions;\n if (typeof(indexOrHash) === \"number\") {\n return txs[indexOrHash];\n }\n\n indexOrHash = indexOrHash.toLowerCase();\n for (const tx of txs) {\n if (tx.hash === indexOrHash) { return tx; }\n }\n\n assertArgument(false, \"no matching transaction\", \"indexOrHash\", indexOrHash);\n }\n\n /**\n * Returns true if this block been mined. This provides a type guard\n * for all properties on a [[MinedBlock]].\n */\n isMined(): this is MinedBlock { return !!this.hash; }\n\n /**\n * Returns true if this block is an [[link-eip-2930]] block.\n */\n isLondon(): this is (Block & { baseFeePerGas: bigint }) {\n return !!this.baseFeePerGas;\n }\n\n /**\n * @_ignore:\n */\n orphanedEvent(): OrphanFilter {\n if (!this.isMined()) { throw new Error(\"\"); }\n return createOrphanedBlockFilter(this);\n }\n}\n\n//////////////////////\n// Log\n\n/**\n * A **Log** in Ethereum represents an event that has been included in a\n * transaction using the ``LOG*`` opcodes, which are most commonly used by\n * Solidity's emit for announcing events.\n */\nexport class Log implements LogParams {\n\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n readonly provider: Provider;\n\n /**\n * The transaction hash of the transaction this log occurred in. Use the\n * [[Log-getTransaction]] to get the [[TransactionResponse]].\n */\n readonly transactionHash!: string;\n\n /**\n * The block hash of the block this log occurred in. Use the\n * [[Log-getBlock]] to get the [[Block]].\n */\n readonly blockHash!: string;\n\n /**\n * The block number of the block this log occurred in. It is preferred\n * to use the [[Block-hash]] when fetching the related [[Block]],\n * since in the case of an orphaned block, the block at that height may\n * have changed.\n */\n readonly blockNumber!: number;\n\n /**\n * If the **Log** represents a block that was removed due to an orphaned\n * block, this will be true.\n *\n * This can only happen within an orphan event listener.\n */\n readonly removed!: boolean;\n\n /**\n * The address of the contract that emitted this log.\n */\n readonly address!: string;\n\n /**\n * The data included in this log when it was emitted.\n */\n readonly data!: string;\n\n /**\n * The indexed topics included in this log when it was emitted.\n *\n * All topics are included in the bloom filters, so they can be\n * efficiently filtered using the [[Provider-getLogs]] method.\n */\n readonly topics!: ReadonlyArray<string>;\n\n /**\n * The index within the block this log occurred at. This is generally\n * not useful to developers, but can be used with the various roots\n * to proof inclusion within a block.\n */\n readonly index!: number;\n\n /**\n * The index within the transaction of this log.\n */\n readonly transactionIndex!: number;\n\n /**\n * @_ignore:\n */\n constructor(log: LogParams, provider: Provider) {\n this.provider = provider;\n\n const topics = Object.freeze(log.topics.slice());\n defineProperties<Log>(this, {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n\n removed: log.removed,\n\n address: log.address,\n data: log.data,\n\n topics,\n\n index: log.index,\n transactionIndex: log.transactionIndex,\n });\n }\n\n /**\n * Returns a JSON-compatible object.\n */\n toJSON(): any {\n const {\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n } = this;\n\n return {\n _type: \"log\",\n address, blockHash, blockNumber, data, index,\n removed, topics, transactionHash, transactionIndex\n };\n }\n\n /**\n * Returns the block that this log occurred in.\n */\n async getBlock(): Promise<Block> {\n const block = await this.provider.getBlock(this.blockHash);\n assert(!!block, \"failed to find transaction\", \"UNKNOWN_ERROR\", { });\n return block;\n }\n\n /**\n * Returns the transaction that this log occurred in.\n */\n async getTransaction(): Promise<TransactionResponse> {\n const tx = await this.provider.getTransaction(this.transactionHash);\n assert(!!tx, \"failed to find transaction\", \"UNKNOWN_ERROR\", { });\n return tx;\n }\n\n /**\n * Returns the transaction receipt fot the transaction that this\n * log occurred in.\n */\n async getTransactionReceipt(): Promise<TransactionReceipt> {\n const receipt = await this.provider.getTransactionReceipt(this.transactionHash);\n assert(!!receipt, \"failed to find transaction receipt\", \"UNKNOWN_ERROR\", { });\n return receipt;\n }\n\n /**\n * @_ignore:\n */\n removedEvent(): OrphanFilter {\n return createRemovedLogFilter(this);\n }\n}\n\n//////////////////////\n// Transaction Receipt\n\n/*\nexport interface LegacyTransactionReceipt {\n byzantium: false;\n status: null;\n root: string;\n}\n\nexport interface ByzantiumTransactionReceipt {\n byzantium: true;\n status: number;\n root: null;\n}\n*/\n\n/**\n * A **TransactionReceipt** includes additional information about a\n * transaction that is only available after it has been mined.\n */\nexport class TransactionReceipt implements TransactionReceiptParams, Iterable<Log> {\n /**\n * The provider connected to the log used to fetch additional details\n * if necessary.\n */\n readonly provider!: Provider;\n\n /**\n * The address the transaction was sent to.\n */\n readonly to!: null | string;\n\n /**\n * The sender of the transaction.\n */\n readonly from!: string;\n\n /**\n * The address of the contract if the transaction was directly\n * responsible for deploying one.\n *\n * This is non-null **only** if the ``to`` is empty and the ``data``\n * was successfully executed as initcode.\n */\n readonly contractAddress!: null | string;\n\n /**\n * The transaction hash.\n */\n readonly hash!: string;\n\n /**\n * The index of this transaction within the block transactions.\n */\n readonly index!: number;\n\n /**\n * The block hash of the [[Block]] this transaction was included in.\n */\n readonly blockHash!: string;\n\n /**\n * The block number of the [[Block]] this transaction was included in.\n */\n readonly blockNumber!: number;\n\n /**\n * The bloom filter bytes that represent all logs that occurred within\n * this transaction. This is generally not useful for most developers,\n * but can be used to validate the included logs.\n */\n readonly logsBloom!: string;\n\n /**\n * The actual amount of gas used by this transaction.\n *\n * When creating a transaction, the amount of gas that will be used can\n * only be approximated, but the sender must pay the gas fee for the\n * entire gas limit. After the transaction, the difference is refunded.\n */\n readonly gasUsed!: bigint;\n\n /**\n * The gas used for BLObs. See [[link-eip-4844]].\n */\n readonly blobGasUsed!: null | bigint;\n\n /**\n * The amount of gas used by all transactions within the block for this\n * and all transactions with a lower ``index``.\n *\n * This is generally not useful for developers but can be used to\n * validate certain aspects of execution.\n */\n readonly cumulativeGasUsed!: bigint;\n\n /**\n * The actual gas price used during execution.\n *\n * Due to the complexity of [[link-eip-1559]] this value can only\n * be caluclated after the transaction has been mined, snce the base\n * fee is protocol-enforced.\n */\n readonly gasPrice!: bigint;\n\n /**\n * The price paid per BLOB in gas. See [[link-eip-4844]].\n */\n readonly blobGasPrice!: null | bigint;\n\n /**\n * The [[link-eip-2718]] transaction type.\n */\n readonly type!: number;\n //readonly byzantium!: boolean;\n\n /**\n * The status of this transaction, indicating success (i.e. ``1``) or\n * a revert (i.e. ``0``).\n *\n * This is available in post-byzantium blocks, but some backends may\n * backfill this value.\n */\n readonly status!: null | number;\n\n /**\n * The root hash of this transaction.\n *\n * This is no present and was only included in pre-byzantium blocks, but\n * could be used to validate certain parts of the receipt.\n */\n readonly root!: null | string;\n\n readonly #logs: ReadonlyArray<Log>;\n\n /**\n * @_ignore:\n */\n constructor(tx: TransactionReceiptParams, provider: Provider) {\n this.#logs = Object.freeze(tx.logs.map((log) => {\n return new Log(log, provider);\n }));\n\n let gasPrice = BN_0;\n if (tx.effectiveGasPrice != null) {\n gasPrice = tx.effectiveGasPrice;\n } else if (tx.gasPrice != null) {\n gasPrice = tx.gasPrice;\n }\n\n defineProperties<TransactionReceipt>(this, {\n provider,\n\n to: tx.to,\n from: tx.from,\n contractAddress: tx.contractAddress,\n\n hash: tx.hash,\n index: tx.index,\n\n blockHash: tx.blockHash,\n blockNumber: tx.blockNumber,\n\n logsBloom: tx.logsBloom,\n\n gasUsed: tx.gasUsed,\n cumulativeGasUsed: tx.cumulativeGasUsed,\n blobGasUsed: tx.blobGasUsed,\n gasPrice,\n blobGasPrice: tx.blobGasPrice,\n\n type: tx.type,\n //byzantium: tx.byzantium,\n status: tx.status,\n root: tx.root\n });\n }\n\n /**\n * The logs for this transaction.\n */\n get logs(): ReadonlyArray<Log> { return this.#logs; }\n\n /**\n * Returns a JSON-compatible representation.\n */\n toJSON(): any {\n const {\n to, from, contractAddress, hash, index,\n blockHash, blockNumber, logsBloom,\n logs, //byzantium, \n status, root\n } = this;\n\n return {\n _type: \"TransactionReceipt\",\n blockHash, blockNumber,\n //byzantium, \n contractAddress,\n cumulativeGasUsed: toJson(this.cumulativeGasUsed),\n from,\n gasPrice: toJson(this.gasPrice),\n blobGasUsed: toJson(this.blobGasUsed),\n blobGasPrice: toJson(this.blobGasPrice),\n gasUsed: toJson(this.gasUsed),\n hash, index, logs, logsBloom, root, status, to\n };\n }\n\n /**\n * @_ignore:\n */\n get length(): number { return this.logs.length; }\n\n [Symbol.iterator](): Iterator<Log> {\n let index = 0;\n return {\n next: () => {\n if (index < this.length) {\n return { value: this.logs[index++], done: false }\n }\n return { value: undefined, done: true };\n }\n };\n }\n\n /**\n * The total fee for this transaction, in wei.\n */\n get fee(): bigint {\n return this.gasUsed * this.gasPrice;\n }\n\n /**\n * Resolves to the block this transaction occurred in.\n */\n async getBlock(): Promise<Block> {\n const block = await this.provider.getBlock(this.blockHash);\n if (block == null) { throw new Error(\"TODO\"); }\n return block;\n }\n\n /**\n * Resolves to the transaction this transaction occurred in.\n */\n async getTransaction(): Promise<TransactionResponse> {\n const tx = await this.provider.getTransaction(this.hash);\n if (tx == null) { throw new Error(\"TODO\"); }\n return tx;\n }\n\n /**\n * Resolves to the return value of the execution of this transaction.\n *\n * Support for this feature is limited, as it requires an archive node\n * with the ``debug_`` or ``trace_`` API enabled.\n */\n async getResult(): Promise<string> {\n return <string>(await this.provider.getTransactionResult(this.hash));\n }\n\n /**\n * Resolves to the number of confirmations this transaction has.\n */\n async confirmations(): Promise<number> {\n return (await this.provider.getBlockNumber()) - this.blockNumber + 1;\n }\n\n /**\n * @_ignore:\n */\n removedEvent(): OrphanFilter {\n return createRemovedTransactionFilter(this);\n }\n\n /**\n * @_ignore:\n */\n reorderedEvent(other?: TransactionResponse): OrphanFilter {\n assert(!other || other.isMined(), \"unmined 'other' transction cannot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"reorderedEvent(other)\" });\n return createReorderedTransactionFilter(this, other);\n }\n}\n\n\n//////////////////////\n// Transaction Response\n\n/**\n * A **MinedTransactionResponse** is an interface representing a\n * transaction which has been mined and allows for a type guard for its\n * property values being defined.\n */\nexport interface MinedTransactionResponse extends TransactionResponse {\n /**\n * The block number this transaction occurred in.\n */\n blockNumber: number;\n\n /**\n * The block hash this transaction occurred in.\n */\n blockHash: string;\n\n /**\n * The date this transaction occurred on.\n */\n date: Date;\n}\n\n\n/**\n * A **TransactionResponse** includes all properties about a transaction\n * that was sent to the network, which may or may not be included in a\n * block.\n *\n * The [[TransactionResponse-isMined]] can be used to check if the\n * transaction has been mined as well as type guard that the otherwise\n * possibly ``null`` properties are defined.\n */\nexport class TransactionResponse implements TransactionLike<string>, TransactionResponseParams {\n /**\n * The provider this is connected to, which will influence how its\n * methods will resolve its async inspection methods.\n */\n readonly provider: Provider;\n\n /**\n * The block number of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n readonly blockNumber: null | number;\n\n /**\n * The blockHash of the block that this transaction was included in.\n *\n * This is ``null`` for pending transactions.\n */\n readonly blockHash: null | string;\n\n /**\n * The index within the block that this transaction resides at.\n */\n readonly index!: number;\n\n /**\n * The transaction hash.\n */\n readonly hash!: string;\n\n /**\n * The [[link-eip-2718]] transaction envelope type. This is\n * ``0`` for legacy transactions types.\n */\n readonly type!: number;\n\n /**\n * The receiver of this transaction.\n *\n * If ``null``, then the transaction is an initcode transaction.\n * This means the result of executing the [[data]] will be deployed\n * as a new contract on chain (assuming it does not revert) and the\n * address may be computed using [[getCreateAddress]].\n */\n readonly to!: null | string;\n\n /**\n * The sender of this transaction. It is implicitly computed\n * from the transaction pre-image hash (as the digest) and the\n * [[signature]] using ecrecover.\n */\n readonly from!: string;\n\n /**\n * The nonce, which is used to prevent replay attacks and offer\n * a method to ensure transactions from a given sender are explicitly\n * ordered.\n *\n * When sending a transaction, this must be equal to the number of\n * transactions ever sent by [[from]].\n */\n readonly nonce!: number;\n\n /**\n * The maximum units of gas this transaction can consume. If execution\n * exceeds this, the entries transaction is reverted and the sender\n * is charged for the full amount, despite not state changes being made.\n */\n readonly gasLimit!: bigint;\n\n /**\n * The gas price can have various values, depending on the network.\n *\n * In modern networks, for transactions that are included this is\n * the //effective gas price// (the fee per gas that was actually\n * charged), while for transactions that have not been included yet\n * is the [[maxFeePerGas]].\n *\n * For legacy transactions, or transactions on legacy networks, this\n * is the fee that will be charged per unit of gas the transaction\n * consumes.\n */\n readonly gasPrice!: bigint;\n\n /**\n * The maximum priority fee (per unit of gas) to allow a\n * validator to charge the sender. This is inclusive of the\n * [[maxFeeFeePerGas]].\n */\n readonly maxPriorityFeePerGas!: null | bigint;\n\n /**\n * The maximum fee (per unit of gas) to allow this transaction\n * to charge the sender.\n */\n readonly maxFeePerGas!: null | bigint;\n\n /**\n * The [[link-eip-4844]] max fee per BLOb gas.\n */\n readonly maxFeePerBlobGas!: null | bigint;\n\n /**\n * The data.\n */\n readonly data!: string;\n\n /**\n * The value, in wei. Use [[formatEther]] to format this value\n * as ether.\n */\n readonly value!: bigint;\n\n /**\n * The chain ID.\n */\n readonly chainId!: bigint;\n\n /**\n * The signature.\n */\n readonly signature!: Signature;\n\n /**\n * The [[link-eip-2930]] access list for transaction types that\n * support it, otherwise ``null``.\n */\n readonly accessList!: null | AccessList;\n\n /**\n * The [[link-eip-4844]] BLOb versioned hashes.\n */\n readonly blobVersionedHashes!: null | Array<string>;\n\n #startBlock: number;\n\n /**\n * @_ignore:\n */\n constructor(tx: TransactionResponseParams, provider: Provider) {\n this.provider = provider;\n\n this.blockNumber = (tx.blockNumber != null) ? tx.blockNumber: null;\n this.blockHash = (tx.blockHash != null) ? tx.blockHash: null;\n\n this.hash = tx.hash;\n this.index = tx.index;\n\n this.type = tx.type;\n\n this.from = tx.from;\n this.to = tx.to || null;\n\n this.gasLimit = tx.gasLimit;\n this.nonce = tx.nonce;\n this.data = tx.data;\n this.value = tx.value;\n\n this.gasPrice = tx.gasPrice;\n this.maxPriorityFeePerGas = (tx.maxPriorityFeePerGas != null) ? tx.maxPriorityFeePerGas: null;\n this.maxFeePerGas = (tx.maxFeePerGas != null) ? tx.maxFeePerGas: null;\n this.maxFeePerBlobGas = (tx.maxFeePerBlobGas != null) ? tx.maxFeePerBlobGas: null;\n\n this.chainId = tx.chainId;\n this.signature = tx.signature;\n\n this.accessList = (tx.accessList != null) ? tx.accessList: null;\n this.blobVersionedHashes = (tx.blobVersionedHashes != null) ? tx.blobVersionedHashes: null;\n\n this.#startBlock = -1;\n }\n\n /**\n * Returns a JSON-compatible representation of this transaction.\n */\n toJSON(): any {\n const {\n blockNumber, blockHash, index, hash, type, to, from, nonce,\n data, signature, accessList, blobVersionedHashes\n } = this;\n\n return {\n _type: \"TransactionResponse\",\n accessList, blockNumber, blockHash,\n blobVersionedHashes,\n chainId: toJson(this.chainId),\n data, from,\n gasLimit: toJson(this.gasLimit),\n gasPrice: toJson(this.gasPrice),\n hash,\n maxFeePerGas: toJson(this.maxFeePerGas),\n maxPriorityFeePerGas: toJson(this.maxPriorityFeePerGas),\n maxFeePerBlobGas: toJson(this.maxFeePerBlobGas),\n nonce, signature, to, index, type,\n value: toJson(this.value),\n };\n }\n\n /**\n * Resolves to the Block that this transaction was included in.\n *\n * This will return null if the transaction has not been included yet.\n */\n async getBlock(): Promise<null | Block> {\n let blockNumber = this.blockNumber;\n if (blockNumber == null) {\n const tx = await this.getTransaction();\n if (tx) { blockNumber = tx.blockNumber; }\n }\n if (blockNumber == null) { return null; }\n const block = this.provider.getBlock(blockNumber);\n if (block == null) { throw new Error(\"TODO\"); }\n return block;\n }\n\n /**\n * Resolves to this transaction being re-requested from the\n * provider. This can be used if you have an unmined transaction\n * and wish to get an up-to-date populated instance.\n */\n async getTransaction(): Promise<null | TransactionResponse> {\n return this.provider.getTransaction(this.hash);\n }\n\n /**\n * Resolve to the number of confirmations this transaction has.\n */\n async confirmations(): Promise<number> {\n if (this.blockNumber == null) {\n const { tx, blockNumber } = await resolveProperties({\n tx: this.getTransaction(),\n blockNumber: this.provider.getBlockNumber()\n });\n\n // Not mined yet...\n if (tx == null || tx.blockNumber == null) { return 0; }\n\n return blockNumber - tx.blockNumber + 1;\n }\n\n const blockNumber = await this.provider.getBlockNumber();\n return blockNumber - this.blockNumber + 1;\n }\n\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(_confirms?: number, _timeout?: number): Promise<null | TransactionReceipt> {\n const confirms = (_confirms == null) ? 1: _confirms;\n const timeout = (_timeout == null) ? 0: _timeout;\n\n let startBlock = this.#startBlock\n let nextScan = -1;\n let stopScanning = (startBlock === -1) ? true: false;\n const checkReplacement = async () => {\n // Get the current transaction count for this sender\n if (stopScanning) { return null; }\n const { blockNumber, nonce } = await resolveProperties({\n blockNumber: this.provider.getBlockNumber(),\n nonce: this.provider.getTransactionCount(this.from)\n });\n\n // No transaction or our nonce has not been mined yet; but we\n // can start scanning later when we do start\n if (nonce < this.nonce) {\n startBlock = blockNumber;\n return;\n }\n\n // We were mined; no replacement\n if (stopScanning) { return null; }\n const mined = await this.getTransaction();\n if (mined && mined.blockNumber != null) { return; }\n\n // We were replaced; start scanning for that transaction\n\n // Starting to scan; look back a few extra blocks for safety\n if (nextScan === -1) {\n nextScan = startBlock - 3;\n if (nextScan < this.#startBlock) { nextScan = this.#startBlock; }\n }\n\n while (nextScan <= blockNumber) {\n // Get the next block to scan\n if (stopScanning) { return null; }\n const block = await this.provider.getBlock(nextScan, true);\n\n // This should not happen; but we'll try again shortly\n if (block == null) { return; }\n\n // We were mined; no replacement\n for (const hash of block) {\n if (hash === this.hash) { return; }\n }\n\n // Search for the transaction that replaced us\n for (let i = 0; i < block.length; i++) {\n const tx: TransactionResponse = await block.getTransaction(i);\n\n if (tx.from === this.from && tx.nonce === this.nonce) {\n // Get the receipt\n if (stopScanning) { return null; }\n const receipt = await this.provider.getTransactionReceipt(tx.hash);\n\n // This should not happen; but we'll try again shortly\n if (receipt == null) { return; }\n\n // We will retry this on the next block (this case could be optimized)\n if ((blockNumber - receipt.blockNumber + 1) < confirms) { return; }\n\n // The reason we were replaced\n let reason: \"replaced\" | \"repriced\" | \"cancelled\" = \"replaced\";\n if (tx.data === this.data && tx.to === this.to && tx.value === this.value) {\n reason = \"repriced\";\n } else if (tx.data === \"0x\" && tx.from === tx.to && tx.value === BN_0) {\n reason = \"cancelled\"\n }\n\n assert(false, \"transaction was replaced\", \"TRANSACTION_REPLACED\", {\n cancelled: (reason === \"replaced\" || reason === \"cancelled\"),\n reason,\n replacement: tx.replaceableTransaction(startBlock),\n hash: tx.hash,\n receipt\n });\n }\n }\n\n nextScan++;\n }\n return;\n };\n\n const checkReceipt = (receipt: null | TransactionReceipt) => {\n if (receipt == null || receipt.status !== 0) { return receipt; }\n assert(false, \"transaction execution reverted\", \"CALL_EXCEPTION\", {\n action: \"sendTransaction\",\n data: null, reason: null, invocation: null, revert: null,\n transaction: {\n to: receipt.to,\n from: receipt.from,\n data: \"\" // @TODO: in v7, split out sendTransaction properties\n }, receipt\n });\n };\n\n const receipt = await this.provider.getTransactionReceipt(this.hash);\n\n if (confirms === 0) { return checkReceipt(receipt); }\n\n if (receipt) {\n if ((await receipt.confirmations()) >= confirms) {\n return checkReceipt(receipt);\n }\n\n } else {\n // Check for a replacement; throws if a replacement was found\n await checkReplacement();\n\n // Allow null only when the confirms is 0\n if (confirms === 0) { return null; }\n }\n\n const waiter = new Promise((resolve, reject) => {\n // List of things to cancel when we have a result (one way or the other)\n const cancellers: Array<() => void> = [ ];\n const cancel = () => { cancellers.forEach((c) => c()); };\n\n // On cancel, stop scanning for replacements\n cancellers.push(() => { stopScanning = true; });\n\n // Set up any timeout requested\n if (timeout > 0) {\n const timer = setTimeout(() => {\n cancel();\n reject(makeError(\"wait for transaction timeout\", \"TIMEOUT\"));\n }, timeout);\n cancellers.push(() => { clearTimeout(timer); });\n }\n\n const txListener = async (receipt: TransactionReceipt) => {\n // Done; return it!\n if ((await receipt.confirmations()) >= confirms) {\n cancel();\n try {\n resolve(checkReceipt(receipt));\n } catch (error) { reject(error); }\n }\n };\n cancellers.push(() => { this.provider.off(this.hash, txListener); });\n this.provider.on(this.hash, txListener);\n // We support replacement detection; start checking\n if (startBlock >= 0) {\n const replaceListener = async () => {\n try {\n // Check for a replacement; this throws only if one is found\n await checkReplacement();\n\n } catch (error) {\n // We were replaced (with enough confirms); re-throw the error\n if (isError(error, \"TRANSACTION_REPLACED\")) {\n cancel();\n reject(error);\n return;\n }\n }\n\n // Rescheudle a check on the next block\n if (!stopScanning) {\n this.provider.once(\"block\", replaceListener);\n }\n };\n cancellers.push(() => { this.provider.off(\"block\", replaceListener); });\n this.provider.once(\"block\", replaceListener);\n }\n });\n\n return await <Promise<TransactionReceipt>>waiter;\n }\n\n /**\n * Returns ``true`` if this transaction has been included.\n *\n * This is effective only as of the time the TransactionResponse\n * was instantiated. To get up-to-date information, use\n * [[getTransaction]].\n *\n * This provides a Type Guard that this transaction will have\n * non-null property values for properties that are null for\n * unmined transactions.\n */\n isMined(): this is MinedTransactionResponse {\n return (this.blockHash != null);\n }\n\n /**\n * Returns true if the transaction is a legacy (i.e. ``type == 0``)\n * transaction.\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLegacy(): this is (TransactionResponse & { accessList: null, maxFeePerGas: null, maxPriorityFeePerGas: null }) {\n return (this.type === 0)\n }\n\n /**\n * Returns true if the transaction is a Berlin (i.e. ``type == 1``)\n * transaction. See [[link-eip-2070]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isBerlin(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: null, maxPriorityFeePerGas: null }) {\n return (this.type === 1);\n }\n\n /**\n * Returns true if the transaction is a London (i.e. ``type == 2``)\n * transaction. See [[link-eip-1559]].\n *\n * This provides a Type Guard that this transaction will have\n * the ``null``-ness for hardfork-specific properties set correctly.\n */\n isLondon(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint }){\n return (this.type === 2);\n }\n\n /**\n * Returns true if hte transaction is a Cancun (i.e. ``type == 3``)\n * transaction. See [[link-eip-4844]].\n */\n isCancun(): this is (TransactionResponse & { accessList: AccessList, maxFeePerGas: bigint, maxPriorityFeePerGas: bigint, maxFeePerBlobGas: bigint, blobVersionedHashes: Array<string> }){\n return (this.type === 3);\n }\n\n /**\n * Returns a filter which can be used to listen for orphan events\n * that evict this transaction.\n */\n removedEvent(): OrphanFilter {\n assert(this.isMined(), \"unmined transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n return createRemovedTransactionFilter(this);\n }\n\n /**\n * Returns a filter which can be used to listen for orphan events\n * that re-order this event against %%other%%.\n */\n reorderedEvent(other?: TransactionResponse): OrphanFilter {\n assert(this.isMined(), \"unmined transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n\n assert(!other || other.isMined(), \"unmined 'other' transaction canot be orphaned\",\n \"UNSUPPORTED_OPERATION\", { operation: \"removeEvent()\" });\n\n return createReorderedTransactionFilter(this, other);\n }\n\n /**\n * Returns a new TransactionResponse instance which has the ability to\n * detect (and throw an error) if the transaction is replaced, which\n * will begin scanning at %%startBlock%%.\n *\n * This should generally not be used by developers and is intended\n * primarily for internal use. Setting an incorrect %%startBlock%% can\n * have devastating performance consequences if used incorrectly.\n */\n replaceableTransaction(startBlock: number): TransactionResponse {\n assertArgument(Number.isInteger(startBlock) && startBlock >= 0, \"invalid startBlock\", \"startBlock\", startBlock);\n const tx = new TransactionResponse(this, this.provider);\n tx.#startBlock = startBlock;\n return tx;\n }\n}\n\n\n//////////////////////\n// OrphanFilter\n\n/**\n * An Orphan Filter allows detecting when an orphan block has\n * resulted in dropping a block or transaction or has resulted\n * in transactions changing order.\n *\n * Not currently fully supported.\n */\nexport type OrphanFilter = {\n orphan: \"drop-block\",\n hash: string,\n number: number\n} | {\n orphan: \"drop-transaction\",\n tx: { hash: string, blockHash: string, blockNumber: number },\n other?: { hash: string, blockHash: string, blockNumber: number }\n} | {\n orphan: \"reorder-transaction\",\n tx: { hash: string, blockHash: string, blockNumber: number },\n other?: { hash: string, blockHash: string, blockNumber: number }\n} | {\n orphan: \"drop-log\",\n log: {\n transactionHash: string,\n blockHash: string,\n blockNumber: number,\n address: string,\n data: string,\n topics: ReadonlyArray<string>,\n index: number\n }\n};\n\nfunction createOrphanedBlockFilter(block: { hash: string, number: number }): OrphanFilter {\n return { orphan: \"drop-block\", hash: block.hash, number: block.number };\n}\n\nfunction createReorderedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }, other?: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter {\n return { orphan: \"reorder-transaction\", tx, other };\n}\n\nfunction createRemovedTransactionFilter(tx: { hash: string, blockHash: string, blockNumber: number }): OrphanFilter {\n return { orphan: \"drop-transaction\", tx };\n}\n\nfunction createRemovedLogFilter(log: { blockHash: string, transactionHash: string, blockNumber: number, address: string, data: string, topics: ReadonlyArray<string>, index: number }): OrphanFilter {\n return { orphan: \"drop-log\", log: {\n transactionHash: log.transactionHash,\n blockHash: log.blockHash,\n blockNumber: log.blockNumber,\n address: log.address,\n data: log.data,\n topics: Object.freeze(log.topics.slice()),\n index: log.index\n } };\n}\n\n//////////////////////\n// EventFilter\n\n/**\n * A **TopicFilter** provides a struture to define bloom-filter\n * queries.\n *\n * Each field that is ``null`` matches **any** value, a field that is\n * a ``string`` must match exactly that value and ``array`` is\n * effectively an ``OR``-ed set, where any one of those values must\n * match.\n */\nexport type TopicFilter = Array<null | string | Array<string>>;\n\n// @TODO:\n//export type DeferableTopicFilter = Array<null | string | Promise<string> | Array<string | Promise<string>>>;\n\n/**\n * An **EventFilter** allows efficiently filtering logs (also known as\n * events) using bloom filters included within blocks.\n */\nexport interface EventFilter {\n address?: AddressLike | Array<AddressLike>;\n topics?: TopicFilter;\n}\n\n/**\n * A **Filter** allows searching a specific range of blocks for mathcing\n * logs.\n */\nexport interface Filter extends EventFilter {\n\n /**\n * The start block for the filter (inclusive).\n */\n fromBlock?: BlockTag;\n\n /**\n * The end block for the filter (inclusive).\n */\n toBlock?: BlockTag;\n}\n\n/**\n * A **FilterByBlockHash** allows searching a specific block for mathcing\n * logs.\n */\nexport interface FilterByBlockHash extends EventFilter {\n /**\n * The blockhash of the specific block for the filter.\n */\n blockHash?: string;\n}\n\n\n//////////////////////\n// ProviderEvent\n\n/**\n * A **ProviderEvent** provides the types of events that can be subscribed\n * to on a [[Provider]].\n *\n * Each provider may include additional possible events it supports, but\n * the most commonly supported are:\n *\n * **``\"block\"``** - calls the listener with the current block number on each\n * new block.\n *\n * **``\"error\"``** - calls the listener on each async error that occurs during\n * the event loop, with the error.\n *\n * **``\"debug\"``** - calls the listener on debug events, which can be used to\n * troubleshoot network errors, provider problems, etc.\n *\n * **``transaction hash``** - calls the listener on each block after the\n * transaction has been mined; generally ``.once`` is more appropriate for\n * this event.\n *\n * **``Array``** - calls the listener on each log that matches the filter.\n *\n * [[EventFilter]] - calls the listener with each matching log\n */\nexport type ProviderEvent = string | Array<string | Array<string>> | EventFilter | OrphanFilter;\n\n\n//////////////////////\n// Provider\n\n/**\n * A **Provider** is the primary method to interact with the read-only\n * content on Ethereum.\n *\n * It allows access to details about accounts, blocks and transactions\n * and the ability to query event logs and simulate contract execution.\n *\n * Account data includes the [balance](getBalance),\n * [transaction count](getTransactionCount), [code](getCode) and\n * [state trie storage](getStorage).\n *\n * Simulating execution can be used to [call](call),\n * [estimate gas](estimateGas) and\n * [get transaction results](getTransactionResult).\n *\n * The [[broadcastTransaction]] is the only method which allows updating\n * the blockchain, but it is usually accessed by a [[Signer]], since a\n * private key must be used to sign the transaction before it can be\n * broadcast.\n */\nexport interface Provider extends ContractRunner, EventEmitterable<ProviderEvent>, NameResolver {\n\n /**\n * The provider iteself.\n *\n * This is part of the necessary API for executing a contract, as\n * it provides a common property on any [[ContractRunner]] that\n * can be used to access the read-only portion of the runner.\n */\n provider: this;\n\n /**\n * Shutdown any resources this provider is using. No additional\n * calls should be made to this provider after calling this.\n */\n destroy(): void;\n\n ////////////////////\n // State\n\n /**\n * Get the current block number.\n */\n getBlockNumber(): Promise<number>;\n\n /**\n * Get the connected [[Network]].\n */\n getNetwork(): Promise<Network>;\n\n /**\n * Get the best guess at the recommended [[FeeData]].\n */\n getFeeData(): Promise<FeeData>;\n\n\n ////////////////////\n // Account\n\n /**\n * Get the account balance (in wei) of %%address%%. If %%blockTag%%\n * is specified and the node supports archive access for that\n * %%blockTag%%, the balance is as of that [[BlockTag]].\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getBalance(address: AddressLike, blockTag?: BlockTag): Promise<bigint>;\n\n /**\n * Get the number of transactions ever sent for %%address%%, which\n * is used as the ``nonce`` when sending a transaction. If\n * %%blockTag%% is specified and the node supports archive access\n * for that %%blockTag%%, the transaction count is as of that\n * [[BlockTag]].\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getTransactionCount(address: AddressLike, blockTag?: BlockTag): Promise<number>;\n\n /**\n * Get the bytecode for %%address%%.\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getCode(address: AddressLike, blockTag?: BlockTag): Promise<string>\n\n /**\n * Get the storage slot value for %%address%% at slot %%position%%.\n *\n * @note On nodes without archive access enabled, the %%blockTag%% may be\n * **silently ignored** by the node, which may cause issues if relied on.\n */\n getStorage(address: AddressLike, position: BigNumberish, blockTag?: BlockTag): Promise<string>\n\n\n ////////////////////\n // Execution\n\n /**\n * Estimates the amount of gas required to execute %%tx%%.\n */\n estimateGas(tx: TransactionRequest): Promise<bigint>;\n\n /**\n * Simulate the execution of %%tx%%. If the call reverts, it will\n * throw a [[CallExceptionError]] which includes the revert data.\n */\n call(tx: TransactionRequest): Promise<string>\n\n /**\n * Broadcasts the %%signedTx%% to the network, adding it to the\n * memory pool of any node for which the transaction meets the\n * rebroadcast requirements.\n */\n broadcastTransaction(signedTx: string): Promise<TransactionResponse>;\n\n\n ////////////////////\n // Queries\n\n /**\n * Resolves to the block for %%blockHashOrBlockTag%%.\n *\n * If %%prefetchTxs%%, and the backend supports including transactions\n * with block requests, all transactions will be included and the\n * [[Block]] object will not need to make remote calls for getting\n * transactions.\n */\n getBlock(blockHashOrBlockTag: BlockTag | string, prefetchTxs?: boolean): Promise<null | Block>;\n\n /**\n * Resolves to the transaction for %%hash%%.\n *\n * If the transaction is unknown or on pruning nodes which\n * discard old transactions this resolves to ``null``.\n */\n getTransaction(hash: string): Promise<null | TransactionResponse>;\n\n /**\n * Resolves to the transaction receipt for %%hash%%, if mined.\n *\n * If the transaction has not been mined, is unknown or on\n * pruning nodes which discard old transactions this resolves to\n * ``null``.\n */\n getTransactionReceipt(hash: string): Promise<null | TransactionReceipt>;\n\n /**\n * Resolves to the result returned by the executions of %%hash%%.\n *\n * This is only supported on nodes with archive access and with\n * the necessary debug APIs enabled.\n */\n getTransactionResult(hash: string): Promise<null | string>;\n\n\n ////////////////////\n // Bloom-filter Queries\n\n /**\n * Resolves to the list of Logs that match %%filter%%\n */\n getLogs(filter: Filter | FilterByBlockHash): Promise<Array<Log>>;\n\n\n ////////////////////\n // ENS\n\n /**\n * Resolves to the address configured for the %%ensName%% or\n * ``null`` if unconfigured.\n */\n resolveName(ensName: string): Promise<null | string>;\n\n /**\n * Resolves to the ENS name associated for the %%address%% or\n * ``null`` if the //primary name// is not configured.\n *\n * Users must perform additional steps to configure a //primary name//,\n * which is not currently common.\n */\n lookupAddress(address: string): Promise<null | string>;\n\n /**\n * Waits until the transaction %%hash%% is mined and has %%confirms%%\n * confirmations.\n */\n waitForTransaction(hash: string, confirms?: number, timeout?: number): Promise<null | TransactionReceipt>;\n\n /**\n * Resolves to the block at %%blockTag%% once it has been mined.\n *\n * This can be useful for waiting some number of blocks by using\n * the ``currentBlockNumber + N``.\n */\n waitForBlock(blockTag?: BlockTag): Promise<Block>;\n}\n","// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport {\n Block, Log, TransactionReceipt, TransactionResponse\n} from \"../providers/provider.js\";\nimport { defineProperties, EventPayload } from \"../utils/index.js\";\n\nimport type { EventFragment, Interface, Result } from \"../abi/index.js\";\nimport type { Listener } from \"../utils/index.js\";\nimport type {\n Provider\n} from \"../providers/index.js\";\n\nimport type { BaseContract } from \"./contract.js\";\nimport type { ContractEventName } from \"./types.js\";\n\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class EventLog extends Log {\n /**\n * The Contract Interface.\n */\n readonly interface!: Interface;\n\n /**\n * The matching event.\n */\n readonly fragment!: EventFragment;\n\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n readonly args!: Result;\n\n /**\n * @_ignore:\n */\n constructor(log: Log, iface: Interface, fragment: EventFragment) {\n super(log, log.provider);\n const args = iface.decodeEventLog(fragment, log.data, log.topics);\n defineProperties<EventLog>(this, { args, fragment, interface: iface });\n }\n\n /**\n * The name of the event.\n */\n get eventName(): string { return this.fragment.name; }\n\n /**\n * The signature of the event.\n */\n get eventSignature(): string { return this.fragment.format(); }\n}\n\n/**\n * An **EventLog** contains additional properties parsed from the [[Log]].\n */\nexport class UndecodedEventLog extends Log {\n\n /**\n * The error encounted when trying to decode the log.\n */\n readonly error!: Error;\n\n /**\n * @_ignore:\n */\n constructor(log: Log, error: Error) {\n super(log, log.provider);\n defineProperties<UndecodedEventLog>(this, { error });\n }\n}\n\n/**\n * A **ContractTransactionReceipt** includes the parsed logs from a\n * [[TransactionReceipt]].\n */\nexport class ContractTransactionReceipt extends TransactionReceipt {\n readonly #iface: Interface;\n\n /**\n * @_ignore:\n */\n constructor(iface: Interface, provider: Provider, tx: TransactionReceipt) {\n super(tx, provider);\n this.#iface = iface;\n }\n\n /**\n * The parsed logs for any [[Log]] which has a matching event in the\n * Contract ABI.\n */\n get logs(): Array<EventLog | Log> {\n return super.logs.map((log) => {\n const fragment = log.topics.length ? this.#iface.getEvent(log.topics[0]): null;\n if (fragment) {\n try {\n return new EventLog(log, this.#iface, fragment)\n } catch (error: any) {\n return new UndecodedEventLog(log, error);\n }\n }\n\n return log;\n });\n }\n\n}\n\n/**\n * A **ContractTransactionResponse** will return a\n * [[ContractTransactionReceipt]] when waited on.\n */\nexport class ContractTransactionResponse extends TransactionResponse {\n readonly #iface: Interface;\n\n /**\n * @_ignore:\n */\n constructor(iface: Interface, provider: Provider, tx: TransactionResponse) {\n super(tx, provider);\n this.#iface = iface;\n }\n\n /**\n * Resolves once this transaction has been mined and has\n * %%confirms%% blocks including it (default: ``1``) with an\n * optional %%timeout%%.\n *\n * This can resolve to ``null`` only if %%confirms%% is ``0``\n * and the transaction has not been mined, otherwise this will\n * wait until enough confirmations have completed.\n */\n async wait(confirms?: number, timeout?: number): Promise<null | ContractTransactionReceipt> {\n const receipt = await super.wait(confirms, timeout);\n if (receipt == null) { return null; }\n return new ContractTransactionReceipt(this.#iface, this.provider, receipt);\n }\n}\n\n/**\n * A **ContractUnknownEventPayload** is included as the last parameter to\n * Contract Events when the event does not match any events in the ABI.\n */\nexport class ContractUnknownEventPayload extends EventPayload<ContractEventName> {\n /**\n * The log with no matching events.\n */\n readonly log!: Log;\n\n /**\n * @_event:\n */\n constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, log: Log) {\n super(contract, listener, filter);\n defineProperties<ContractUnknownEventPayload>(this, { log });\n }\n\n /**\n * Resolves to the block the event occured in.\n */\n async getBlock(): Promise<Block> {\n return await this.log.getBlock();\n }\n\n /**\n * Resolves to the transaction the event occured in.\n */\n async getTransaction(): Promise<TransactionResponse> {\n return await this.log.getTransaction();\n }\n\n /**\n * Resolves to the transaction receipt the event occured in.\n */\n async getTransactionReceipt(): Promise<TransactionReceipt> {\n return await this.log.getTransactionReceipt();\n }\n}\n\n/**\n * A **ContractEventPayload** is included as the last parameter to\n * Contract Events when the event is known.\n */\nexport class ContractEventPayload extends ContractUnknownEventPayload {\n\n /**\n * The matching event.\n */\n declare readonly fragment: EventFragment;\n\n /**\n * The log, with parsed properties.\n */\n declare readonly log: EventLog;\n\n /**\n * The parsed arguments passed to the event by ``emit``.\n */\n declare readonly args: Result;\n\n /**\n * @_ignore:\n */\n constructor(contract: BaseContract, listener: null | Listener, filter: ContractEventName, fragment: EventFragment, _log: Log) {\n super(contract, listener, filter, new EventLog(_log, contract.interface, fragment));\n const args = contract.interface.decodeEventLog(fragment, this.log.data, this.log.topics);\n defineProperties<ContractEventPayload>(this, { args, fragment });\n }\n\n /**\n * The event name.\n */\n get eventName(): string {\n return this.fragment.name;\n }\n\n /**\n * The event signature.\n */\n get eventSignature(): string {\n return this.fragment.format();\n }\n}\n","import { Interface, Typed } from \"../abi/index.js\";\nimport { isAddressable, resolveAddress } from \"../address/index.js\";\n// import from provider.ts instead of index.ts to prevent circular dep\n// from EtherscanProvider\nimport { copyRequest, Log, TransactionResponse } from \"../providers/provider.js\";\nimport {\n defineProperties, getBigInt, isCallException, isHexString, resolveProperties,\n isError, makeError, assert, assertArgument\n} from \"../utils/index.js\";\n\nimport {\n ContractEventPayload, ContractUnknownEventPayload,\n ContractTransactionResponse,\n EventLog, UndecodedEventLog\n} from \"./wrappers.js\";\n\nimport type { EventFragment, FunctionFragment, InterfaceAbi, ParamType, Result } from \"../abi/index.js\";\nimport type { Addressable, NameResolver } from \"../address/index.js\";\nimport type { EventEmitterable, Listener } from \"../utils/index.js\";\nimport type {\n BlockTag, ContractRunner, Provider, TransactionRequest, TopicFilter\n} from \"../providers/index.js\";\n\nimport type {\n BaseContractMethod,\n ContractEventName,\n ContractInterface,\n ContractMethodArgs,\n ContractMethod,\n ContractEventArgs,\n ContractEvent,\n ContractTransaction,\n DeferredTopicFilter,\n WrappedFallback\n} from \"./types.js\";\n\nconst BN_0 = BigInt(0);\n\ninterface ContractRunnerCaller extends ContractRunner {\n call: (tx: TransactionRequest) => Promise<string>;\n}\n\ninterface ContractRunnerEstimater extends ContractRunner {\n estimateGas: (tx: TransactionRequest) => Promise<bigint>;\n}\n\ninterface ContractRunnerSender extends ContractRunner {\n sendTransaction: (tx: TransactionRequest) => Promise<TransactionResponse>;\n}\n\ninterface ContractRunnerResolver extends ContractRunner {\n resolveName: (name: string | Addressable) => Promise<null | string>;\n}\n\nfunction canCall(value: any): value is ContractRunnerCaller {\n return (value && typeof(value.call) === \"function\");\n}\n\nfunction canEstimate(value: any): value is ContractRunnerEstimater {\n return (value && typeof(value.estimateGas) === \"function\");\n}\n\nfunction canResolve(value: any): value is ContractRunnerResolver {\n return (value && typeof(value.resolveName) === \"function\");\n}\n\nfunction canSend(value: any): value is ContractRunnerSender {\n return (value && typeof(value.sendTransaction) === \"function\");\n}\n\nfunction getResolver(value: any): undefined | NameResolver {\n if (value != null) {\n if (canResolve(value)) { return value; }\n if (value.provider) { return value.provider; }\n }\n return undefined;\n}\n\nclass PreparedTopicFilter implements DeferredTopicFilter {\n #filter: Promise<TopicFilter>;\n readonly fragment!: EventFragment;\n\n constructor(contract: BaseContract, fragment: EventFragment, args: Array<any>) {\n defineProperties<PreparedTopicFilter>(this, { fragment });\n if (fragment.inputs.length < args.length) {\n throw new Error(\"too many arguments\");\n }\n\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(contract.runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner: null;\n this.#filter = (async function() {\n const resolvedArgs = await Promise.all(fragment.inputs.map((param, index) => {\n const arg = args[index];\n if (arg == null) { return null; }\n\n return param.walkAsync(args[index], (type, value) => {\n if (type === \"address\") {\n if (Array.isArray(value)) {\n return Promise.all(value.map((v) => resolveAddress(v, resolver)));\n }\n return resolveAddress(value, resolver);\n }\n return value;\n });\n }));\n\n return contract.interface.encodeFilterTopics(fragment, resolvedArgs);\n })();\n }\n\n getTopicFilter(): Promise<TopicFilter> {\n return this.#filter;\n }\n}\n\n\n// A = Arguments passed in as a tuple\n// R = The result type of the call (i.e. if only one return type,\n// the qualified type, otherwise Result)\n// D = The type the default call will return (i.e. R for view/pure,\n// TransactionResponse otherwise)\n//export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse> {\n\nfunction getRunner<T extends ContractRunner>(value: any, feature: keyof ContractRunner): null | T {\n if (value == null) { return null; }\n if (typeof(value[feature]) === \"function\") { return value; }\n if (value.provider && typeof(value.provider[feature]) === \"function\") {\n return value.provider;\n }\n return null;\n}\n\nfunction getProvider(value: null | ContractRunner): null | Provider {\n if (value == null) { return null; }\n return value.provider || null;\n}\n\n/**\n * @_ignore:\n */\nexport async function copyOverrides<O extends string = \"data\" | \"to\">(arg: any, allowed?: Array<string>): Promise<Omit<ContractTransaction, O>> {\n\n // Make sure the overrides passed in are a valid overrides object\n const _overrides = Typed.dereference(arg, \"overrides\");\n assertArgument(typeof(_overrides) === \"object\", \"invalid overrides parameter\", \"overrides\", arg);\n\n // Create a shallow copy (we'll deep-ify anything needed during normalizing)\n const overrides = copyRequest(_overrides);\n\n assertArgument(overrides.to == null || (allowed || [ ]).indexOf(\"to\") >= 0,\n \"cannot override to\", \"overrides.to\", overrides.to);\n assertArgument(overrides.data == null || (allowed || [ ]).indexOf(\"data\") >= 0,\n \"cannot override data\", \"overrides.data\", overrides.data);\n\n // Resolve any from\n if (overrides.from) { overrides.from = overrides.from; }\n\n return <Omit<ContractTransaction, O>>overrides;\n}\n\n/**\n * @_ignore:\n */\nexport async function resolveArgs(_runner: null | ContractRunner, inputs: ReadonlyArray<ParamType>, args: Array<any>): Promise<Array<any>> {\n // Recursively descend into args and resolve any addresses\n const runner = getRunner(_runner, \"resolveName\");\n const resolver = canResolve(runner) ? runner: null;\n return await Promise.all(inputs.map((param, index) => {\n return param.walkAsync(args[index], (type, value) => {\n value = Typed.dereference(value, type);\n if (type === \"address\") { return resolveAddress(value, resolver); }\n return value;\n });\n }));\n}\n\nfunction buildWrappedFallback(contract: BaseContract): WrappedFallback {\n\n const populateTransaction = async function(overrides?: Omit<TransactionRequest, \"to\">): Promise<ContractTransaction> {\n // If an overrides was passed in, copy it and normalize the values\n\n const tx: ContractTransaction = <any>(await copyOverrides<\"data\">(overrides, [ \"data\" ]));\n tx.to = await contract.getAddress();\n\n if (tx.from) {\n tx.from = await resolveAddress(tx.from, getResolver(contract.runner));\n }\n\n const iface = contract.interface;\n\n const noValue = (getBigInt((tx.value || BN_0), \"overrides.value\") === BN_0);\n const noData = ((tx.data || \"0x\") === \"0x\");\n\n if (iface.fallback && !iface.fallback.payable && iface.receive && !noData && !noValue) {\n assertArgument(false, \"cannot send data to receive or send value to non-payable fallback\", \"overrides\", overrides);\n }\n\n assertArgument(iface.fallback || noData,\n \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n\n // Only allow payable contracts to set non-zero value\n const payable = iface.receive || (iface.fallback && iface.fallback.payable);\n assertArgument(payable || noValue,\n \"cannot send value to non-payable fallback\", \"overrides.value\", tx.value);\n\n // Only allow fallback contracts to set non-empty data\n assertArgument(iface.fallback || noData,\n \"cannot send data to receive-only contract\", \"overrides.data\", tx.data);\n\n return tx;\n }\n\n const staticCall = async function(overrides?: Omit<TransactionRequest, \"to\">): Promise<string> {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\",\n \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n\n const tx = await populateTransaction(overrides);\n\n try {\n return await runner.call(tx);\n } catch (error: any) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n }\n\n const send = async function(overrides?: Omit<TransactionRequest, \"to\">): Promise<ContractTransactionResponse> {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\",\n \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n\n const tx = await runner.sendTransaction(await populateTransaction(overrides));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, <Provider>provider, tx);\n }\n\n const estimateGas = async function(overrides?: Omit<TransactionRequest, \"to\">): Promise<bigint> {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\",\n \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n\n return await runner.estimateGas(await populateTransaction(overrides));\n }\n\n const method = async (overrides?: Omit<TransactionRequest, \"to\">) => {\n return await send(overrides);\n };\n\n defineProperties<any>(method, {\n _contract: contract,\n\n estimateGas,\n populateTransaction,\n send, staticCall\n });\n\n return <WrappedFallback>method;\n}\n\nfunction buildWrappedMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = ContractTransactionResponse>(contract: BaseContract, key: string): BaseContractMethod<A, R, D> {\n\n const getFragment = function(...args: ContractMethodArgs<A>): FunctionFragment {\n const fragment = contract.interface.getFunction(key, args);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n return fragment;\n }\n\n const populateTransaction = async function(...args: ContractMethodArgs<A>): Promise<ContractTransaction> {\n const fragment = getFragment(...args);\n\n // If an overrides was passed in, copy it and normalize the values\n let overrides: Omit<ContractTransaction, \"data\" | \"to\"> = { };\n if (fragment.inputs.length + 1 === args.length) {\n overrides = await copyOverrides(args.pop());\n\n if (overrides.from) {\n overrides.from = await resolveAddress(overrides.from, getResolver(contract.runner));\n }\n }\n\n if (fragment.inputs.length !== args.length) {\n throw new Error(\"internal error: fragment inputs doesn't match arguments; should not happen\");\n }\n\n const resolvedArgs = await resolveArgs(contract.runner, fragment.inputs, args);\n\n return Object.assign({ }, overrides, await resolveProperties({\n to: contract.getAddress(),\n data: contract.interface.encodeFunctionData(fragment, resolvedArgs)\n }));\n }\n\n const staticCall = async function(...args: ContractMethodArgs<A>): Promise<R> {\n const result = await staticCallResult(...args);\n if (result.length === 1) { return result[0]; }\n return <R><unknown>result;\n }\n\n const send = async function(...args: ContractMethodArgs<A>): Promise<ContractTransactionResponse> {\n const runner = contract.runner;\n assert(canSend(runner), \"contract runner does not support sending transactions\",\n \"UNSUPPORTED_OPERATION\", { operation: \"sendTransaction\" });\n\n const tx = await runner.sendTransaction(await populateTransaction(...args));\n const provider = getProvider(contract.runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n return new ContractTransactionResponse(contract.interface, <Provider>provider, tx);\n }\n\n const estimateGas = async function(...args: ContractMethodArgs<A>): Promise<bigint> {\n const runner = getRunner(contract.runner, \"estimateGas\");\n assert(canEstimate(runner), \"contract runner does not support gas estimation\",\n \"UNSUPPORTED_OPERATION\", { operation: \"estimateGas\" });\n\n return await runner.estimateGas(await populateTransaction(...args));\n }\n\n const staticCallResult = async function(...args: ContractMethodArgs<A>): Promise<Result> {\n const runner = getRunner(contract.runner, \"call\");\n assert(canCall(runner), \"contract runner does not support calling\",\n \"UNSUPPORTED_OPERATION\", { operation: \"call\" });\n\n let tx\n try {\n tx = await populateTransaction(...args);\n } catch (e) {\n const blockNumber = args.at(-1).blockTag\n if (blockNumber) {\n (e as any).blockNumber = blockNumber\n }\n throw e\n }\n\n let result = \"0x\";\n try {\n result = await runner.call(tx);\n } catch (error: any) {\n if (isCallException(error) && error.data) {\n throw contract.interface.makeError(error.data, tx);\n }\n throw error;\n }\n\n const fragment = getFragment(...args);\n return contract.interface.decodeFunctionResult(fragment, result);\n };\n\n const method = async (...args: ContractMethodArgs<A>) => {\n const fragment = getFragment(...args);\n if (fragment.constant) { return await staticCall(...args); }\n return await send(...args);\n };\n\n defineProperties<any>(method, {\n name: contract.interface.getFunctionName(key),\n _contract: contract, _key: key,\n\n getFragment,\n\n estimateGas,\n populateTransaction,\n send, staticCall, staticCallResult,\n });\n\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getFunction(key);\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n return fragment;\n }\n });\n\n return <BaseContractMethod<A, R, D>>method;\n}\n\nfunction buildWrappedEvent<A extends Array<any> = Array<any>>(contract: BaseContract, key: string): ContractEvent<A> {\n\n const getFragment = function(...args: ContractEventArgs<A>): EventFragment {\n const fragment = contract.interface.getEvent(key, args);\n\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key, args }\n });\n\n return fragment;\n }\n\n const method = function(...args: ContractMethodArgs<A>): PreparedTopicFilter {\n return new PreparedTopicFilter(contract, getFragment(...args), args);\n };\n\n defineProperties<any>(method, {\n name: contract.interface.getEventName(key),\n _contract: contract, _key: key,\n\n getFragment\n });\n\n // Only works on non-ambiguous keys (refined fragment is always non-ambiguous)\n Object.defineProperty(method, \"fragment\", {\n configurable: false,\n enumerable: true,\n get: () => {\n const fragment = contract.interface.getEvent(key);\n\n assert(fragment, \"no matching fragment\", \"UNSUPPORTED_OPERATION\", {\n operation: \"fragment\",\n info: { key }\n });\n\n return fragment;\n }\n });\n\n return <ContractEvent<A>><unknown>method;\n}\n\ntype Sub = {\n tag: string;\n listeners: Array<{ listener: Listener, once: boolean }>,\n start: () => void;\n stop: () => void;\n};\n\n\n// The combination of TypeScrype, Private Fields and Proxies makes\n// the world go boom; so we hide variables with some trickery keeping\n// a symbol attached to each BaseContract which its sub-class (even\n// via a Proxy) can reach and use to look up its internal values.\n\nconst internal = Symbol.for(\"_ethersInternal_contract\");\ntype Internal = {\n addrPromise: Promise<string>;\n addr: null | string;\n\n deployTx: null | ContractTransactionResponse;\n\n subs: Map<string, Sub>;\n};\n\nconst internalValues: WeakMap<BaseContract, Internal> = new WeakMap();\n\nfunction setInternal(contract: BaseContract, values: Internal): void {\n internalValues.set(contract[internal], values);\n}\n\nfunction getInternal(contract: BaseContract): Internal {\n return internalValues.get(contract[internal]) as Internal;\n}\n\nfunction isDeferred(value: any): value is DeferredTopicFilter {\n return (value && typeof(value) === \"object\" && (\"getTopicFilter\" in value) &&\n (typeof(value.getTopicFilter) === \"function\") && value.fragment);\n}\n\nasync function getSubInfo(contract: BaseContract, event: ContractEventName): Promise<{ fragment: null | EventFragment, tag: string, topics: TopicFilter }> {\n let topics: Array<null | string | Array<string>>;\n let fragment: null | EventFragment = null;\n\n // Convert named events to topicHash and get the fragment for\n // events which need deconstructing.\n\n if (Array.isArray(event)) {\n const topicHashify = function(name: string): string {\n if (isHexString(name, 32)) { return name; }\n const fragment = contract.interface.getEvent(name);\n assertArgument(fragment, \"unknown fragment\", \"name\", name);\n return fragment.topicHash;\n }\n\n // Array of Topics and Names; e.g. `[ \"0x1234...89ab\", \"Transfer(address)\" ]`\n topics = event.map((e) => {\n if (e == null) { return null; }\n if (Array.isArray(e)) { return e.map(topicHashify); }\n return topicHashify(e);\n });\n\n } else if (event === \"*\") {\n topics = [ null ];\n\n } else if (typeof(event) === \"string\") {\n if (isHexString(event, 32)) {\n // Topic Hash\n topics = [ event ];\n } else {\n // Name or Signature; e.g. `\"Transfer\", `\"Transfer(address)\"`\n fragment = contract.interface.getEvent(event);\n assertArgument(fragment, \"unknown fragment\", \"event\", event);\n topics = [ fragment.topicHash ];\n }\n\n } else if (isDeferred(event)) {\n // Deferred Topic Filter; e.g. `contract.filter.Transfer(from)`\n topics = await event.getTopicFilter();\n\n } else if (\"fragment\" in event) {\n // ContractEvent; e.g. `contract.filter.Transfer`\n fragment = event.fragment;\n topics = [ fragment.topicHash ];\n\n } else {\n assertArgument(false, \"unknown event name\", \"event\", event);\n }\n\n // Normalize topics and sort TopicSets\n topics = topics.map((t) => {\n if (t == null) { return null; }\n if (Array.isArray(t)) {\n const items = Array.from(new Set(t.map((t) => t.toLowerCase())).values());\n if (items.length === 1) { return items[0]; }\n items.sort();\n return items;\n }\n return t.toLowerCase();\n });\n\n const tag = topics.map((t) => {\n if (t == null) { return \"null\"; }\n if (Array.isArray(t)) { return t.join(\"|\"); }\n return t;\n }).join(\"&\");\n\n return { fragment, tag, topics }\n}\n\nasync function hasSub(contract: BaseContract, event: ContractEventName): Promise<null | Sub> {\n const { subs } = getInternal(contract);\n return subs.get((await getSubInfo(contract, event)).tag) || null;\n}\n\nasync function getSub(contract: BaseContract, operation: string, event: ContractEventName): Promise<Sub> {\n // Make sure our runner can actually subscribe to events\n const provider = getProvider(contract.runner);\n assert(provider, \"contract runner does not support subscribing\",\n \"UNSUPPORTED_OPERATION\", { operation });\n\n const { fragment, tag, topics } = await getSubInfo(contract, event);\n\n const { addr, subs } = getInternal(contract);\n\n let sub = subs.get(tag);\n if (!sub) {\n const address: string | Addressable = (addr ? addr: contract);\n const filter = { address, topics };\n const listener = (log: Log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = contract.interface.getEvent(log.topics[0]);\n } catch (error) { }\n }\n\n // If fragment is null, we do not deconstruct the args to emit\n\n if (foundFragment) {\n const _foundFragment = foundFragment;\n const args = fragment ? contract.interface.decodeEventLog(fragment, log.data, log.topics): [ ];\n emit(contract, event, args, (listener: null | Listener) => {\n return new ContractEventPayload(contract, listener, event, _foundFragment, log);\n });\n } else {\n emit(contract, event, [ ], (listener: null | Listener) => {\n return new ContractUnknownEventPayload(contract, listener, event, log);\n });\n }\n };\n\n let starting: Array<Promise<any>> = [ ];\n const start = () => {\n if (starting.length) { return; }\n starting.push(provider.on(filter, listener));\n };\n\n const stop = async () => {\n if (starting.length == 0) { return; }\n\n let started = starting;\n starting = [ ];\n await Promise.all(started);\n provider.off(filter, listener);\n };\n\n sub = { tag, listeners: [ ], start, stop };\n subs.set(tag, sub);\n }\n return sub;\n}\n\n// We use this to ensure one emit resolves before firing the next to\n// ensure correct ordering (note this cannot throw and just adds the\n// notice to the event queu using setTimeout).\nlet lastEmit: Promise<any> = Promise.resolve();\n\ntype PayloadFunc = (listener: null | Listener) => ContractUnknownEventPayload;\n\nasync function _emit(contract: BaseContract, event: ContractEventName, args: Array<any>, payloadFunc: null | PayloadFunc): Promise<boolean> {\n await lastEmit;\n\n const sub = await hasSub(contract, event);\n if (!sub) { return false; }\n\n const count = sub.listeners.length;\n sub.listeners = sub.listeners.filter(({ listener, once }) => {\n const passArgs = Array.from(args);\n if (payloadFunc) {\n passArgs.push(payloadFunc(once ? null: listener));\n }\n try {\n listener.call(contract, ...passArgs);\n } catch (error) { }\n return !once;\n });\n\n if (sub.listeners.length === 0) {\n sub.stop();\n getInternal(contract).subs.delete(sub.tag);\n }\n\n return (count > 0);\n}\n\nasync function emit(contract: BaseContract, event: ContractEventName, args: Array<any>, payloadFunc: null | PayloadFunc): Promise<boolean> {\n try {\n await lastEmit;\n } catch (error) { }\n\n const resultPromise = _emit(contract, event, args, payloadFunc);\n lastEmit = resultPromise;\n return await resultPromise;\n}\n\nconst passProperties = [ \"then\" ];\nexport class BaseContract implements Addressable, EventEmitterable<ContractEventName> {\n /**\n * The target to connect to.\n *\n * This can be an address, ENS name or any [[Addressable]], such as\n * another contract. To get the resovled address, use the ``getAddress``\n * method.\n */\n readonly target!: string | Addressable;\n\n /**\n * The contract Interface.\n */\n readonly interface!: Interface;\n\n /**\n * The connected runner. This is generally a [[Provider]] or a\n * [[Signer]], which dictates what operations are supported.\n *\n * For example, a **Contract** connected to a [[Provider]] may\n * only execute read-only operations.\n */\n readonly runner!: null | ContractRunner;\n\n /**\n * All the Events available on this contract.\n */\n readonly filters!: Record<string, ContractEvent>;\n\n /**\n * @_ignore:\n */\n readonly [internal]: any;\n\n /**\n * The fallback or receive function if any.\n */\n readonly fallback!: null | WrappedFallback;\n\n /**\n * Creates a new contract connected to %%target%% with the %%abi%% and\n * optionally connected to a %%runner%% to perform operations on behalf\n * of.\n */\n constructor(target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner, _deployTx?: null | TransactionResponse) {\n assertArgument(typeof(target) === \"string\" || isAddressable(target),\n \"invalid value for Contract target\", \"target\", target);\n\n if (runner == null) { runner = null; }\n const iface = Interface.from(abi);\n defineProperties<BaseContract>(this, { target, runner, interface: iface });\n\n Object.defineProperty(this, internal, { value: { } });\n\n let addrPromise;\n let addr: null | string = null;\n\n let deployTx: null | ContractTransactionResponse = null;\n if (_deployTx) {\n const provider = getProvider(runner);\n // @TODO: the provider can be null; make a custom dummy provider that will throw a\n // meaningful error\n deployTx = new ContractTransactionResponse(this.interface, <Provider>provider, _deployTx);\n }\n\n let subs = new Map();\n\n // Resolve the target as the address\n if (typeof(target) === \"string\") {\n if (isHexString(target)) {\n addr = target;\n addrPromise = Promise.resolve(target);\n\n } else {\n const resolver = getRunner(runner, \"resolveName\");\n if (!canResolve(resolver)) {\n throw makeError(\"contract runner does not support name resolution\", \"UNSUPPORTED_OPERATION\", {\n operation: \"resolveName\"\n });\n }\n\n addrPromise = resolver.resolveName(target).then((addr) => {\n if (addr == null) {\n throw makeError(\"an ENS name used for a contract target must be correctly configured\", \"UNCONFIGURED_NAME\", {\n value: target\n });\n }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n } else {\n addrPromise = target.getAddress().then((addr) => {\n if (addr == null) { throw new Error(\"TODO\"); }\n getInternal(this).addr = addr;\n return addr;\n });\n }\n\n // Set our private values\n setInternal(this, { addrPromise, addr, deployTx, subs });\n\n // Add the event filters\n const filters = new Proxy({ }, {\n get: (target, prop, receiver) => {\n // Pass important checks (like `then` for Promise) through\n if (typeof(prop) === \"symbol\" || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n try {\n return this.getEvent(prop);\n } catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n\n return undefined;\n },\n has: (target, prop) => {\n // Pass important checks (like `then` for Promise) through\n if (passProperties.indexOf(<string>prop) >= 0) {\n return Reflect.has(target, prop);\n }\n\n return Reflect.has(target, prop) || this.interface.hasEvent(String(prop));\n }\n });\n defineProperties<BaseContract>(this, { filters });\n\n defineProperties<BaseContract>(this, {\n fallback: ((iface.receive || iface.fallback) ? (buildWrappedFallback(this)): null)\n });\n\n // Return a Proxy that will respond to functions\n return new Proxy(this, {\n get: (target, prop, receiver) => {\n if (typeof(prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.get(target, prop, receiver);\n }\n\n // Undefined properties should return undefined\n try {\n return target.getFunction(prop);\n } catch (error) {\n if (!isError(error, \"INVALID_ARGUMENT\") || error.argument !== \"key\") {\n throw error;\n }\n }\n\n return undefined;\n },\n has: (target, prop) => {\n if (typeof(prop) === \"symbol\" || prop in target || passProperties.indexOf(prop) >= 0) {\n return Reflect.has(target, prop);\n }\n\n return target.interface.hasFunction(prop);\n }\n });\n\n }\n\n /**\n * Return a new Contract instance with the same target and ABI, but\n * a different %%runner%%.\n */\n connect(runner: null | ContractRunner): BaseContract {\n return new BaseContract(this.target, this.interface, runner);\n }\n\n /**\n * Return a new Contract instance with the same ABI and runner, but\n * a different %%target%%.\n */\n attach(target: string | Addressable): BaseContract {\n return new BaseContract(target, this.interface, this.runner);\n }\n\n /**\n * Return the resolved address of this Contract.\n */\n async getAddress(): Promise<string> { return await getInternal(this).addrPromise; }\n\n /**\n * Return the deployed bytecode or null if no bytecode is found.\n */\n async getDeployedCode(): Promise<null | string> {\n const provider = getProvider(this.runner);\n assert(provider, \"runner does not support .provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"getDeployedCode\" });\n\n const code = await provider.getCode(await this.getAddress());\n if (code === \"0x\") { return null; }\n return code;\n }\n\n /**\n * Resolve to this Contract once the bytecode has been deployed, or\n * resolve immediately if already deployed.\n */\n async waitForDeployment(): Promise<this> {\n // We have the deployement transaction; just use that (throws if deployement fails)\n const deployTx = this.deploymentTransaction();\n if (deployTx) {\n await deployTx.wait();\n return this;\n }\n\n // Check for code\n const code = await this.getDeployedCode();\n if (code != null) { return this; }\n\n // Make sure we can subscribe to a provider event\n const provider = getProvider(this.runner);\n assert(provider != null, \"contract runner does not support .provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"waitForDeployment\" });\n\n return new Promise((resolve, reject) => {\n const checkCode = async () => {\n try {\n const code = await this.getDeployedCode();\n if (code != null) { return resolve(this); }\n provider.once(\"block\", checkCode);\n } catch (error) {\n reject(error);\n }\n };\n checkCode();\n });\n }\n\n /**\n * Return the transaction used to deploy this contract.\n *\n * This is only available if this instance was returned from a\n * [[ContractFactory]].\n */\n deploymentTransaction(): null | ContractTransactionResponse {\n return getInternal(this).deployTx;\n }\n\n /**\n * Return the function for a given name. This is useful when a contract\n * method name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getFunction<T extends ContractMethod = ContractMethod>(key: string | FunctionFragment): T {\n if (typeof(key) !== \"string\") { key = key.format(); }\n const func = buildWrappedMethod(this, key);\n return <T>func;\n }\n\n /**\n * Return the event for a given name. This is useful when a contract\n * event name conflicts with a JavaScript name such as ``prototype`` or\n * when using a Contract programatically.\n */\n getEvent(key: string | EventFragment): ContractEvent {\n if (typeof(key) !== \"string\") { key = key.format(); }\n return buildWrappedEvent(this, key);\n }\n\n /**\n * @_ignore:\n */\n async queryTransaction(hash: string): Promise<Array<EventLog>> {\n throw new Error(\"@TODO\");\n }\n\n /*\n // @TODO: this is a non-backwards compatible change, but will be added\n // in v7 and in a potential SmartContract class in an upcoming\n // v6 release\n async getTransactionReceipt(hash: string): Promise<null | ContractTransactionReceipt> {\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryTransaction\" });\n\n const receipt = await provider.getTransactionReceipt(hash);\n if (receipt == null) { return null; }\n\n return new ContractTransactionReceipt(this.interface, provider, receipt);\n }\n */\n\n /**\n * Provide historic access to event data for %%event%% in the range\n * %%fromBlock%% (default: ``0``) to %%toBlock%% (default: ``\"latest\"``)\n * inclusive.\n */\n async queryFilter(event: ContractEventName, fromBlock?: BlockTag, toBlock?: BlockTag): Promise<Array<EventLog | Log>> {\n if (fromBlock == null) { fromBlock = 0; }\n if (toBlock == null) { toBlock = \"latest\"; }\n const { addr, addrPromise } = getInternal(this);\n const address = (addr ? addr: (await addrPromise));\n const { fragment, topics } = await getSubInfo(this, event);\n const filter = { address, topics, fromBlock, toBlock };\n\n const provider = getProvider(this.runner);\n assert(provider, \"contract runner does not have a provider\",\n \"UNSUPPORTED_OPERATION\", { operation: \"queryFilter\" });\n\n return (await provider.getLogs(filter)).map((log) => {\n let foundFragment = fragment;\n if (foundFragment == null) {\n try {\n foundFragment = this.interface.getEvent(log.topics[0]);\n } catch (error) { }\n }\n\n if (foundFragment) {\n try {\n return new EventLog(log, this.interface, foundFragment);\n } catch (error: any) {\n return new UndecodedEventLog(log, error);\n }\n }\n\n return new Log(log, provider);\n });\n }\n\n /**\n * Add an event %%listener%% for the %%event%%.\n */\n async on(event: ContractEventName, listener: Listener): Promise<this> {\n const sub = await getSub(this, \"on\", event);\n sub.listeners.push({ listener, once: false });\n sub.start();\n return this;\n }\n\n /**\n * Add an event %%listener%% for the %%event%%, but remove the listener\n * after it is fired once.\n */\n async once(event: ContractEventName, listener: Listener): Promise<this> {\n const sub = await getSub(this, \"once\", event);\n sub.listeners.push({ listener, once: true });\n sub.start();\n return this;\n }\n\n /**\n * Emit an %%event%% calling all listeners with %%args%%.\n *\n * Resolves to ``true`` if any listeners were called.\n */\n async emit(event: ContractEventName, ...args: Array<any>): Promise<boolean> {\n return await emit(this, event, args, null);\n }\n\n /**\n * Resolves to the number of listeners of %%event%% or the total number\n * of listeners if unspecified.\n */\n async listenerCount(event?: ContractEventName): Promise<number> {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return 0; }\n return sub.listeners.length;\n }\n\n const { subs } = getInternal(this);\n\n let total = 0;\n for (const { listeners } of subs.values()) {\n total += listeners.length;\n }\n return total;\n }\n\n /**\n * Resolves to the listeners subscribed to %%event%% or all listeners\n * if unspecified.\n */\n async listeners(event?: ContractEventName): Promise<Array<Listener>> {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return [ ]; }\n return sub.listeners.map(({ listener }) => listener);\n }\n\n const { subs } = getInternal(this);\n\n let result: Array<Listener> = [ ];\n for (const { listeners } of subs.values()) {\n result = result.concat(listeners.map(({ listener }) => listener));\n }\n return result;\n }\n\n /**\n * Remove the %%listener%% from the listeners for %%event%% or remove\n * all listeners if unspecified.\n */\n async off(event: ContractEventName, listener?: Listener): Promise<this> {\n const sub = await hasSub(this, event);\n if (!sub) { return this; }\n\n if (listener) {\n const index = sub.listeners.map(({ listener }) => listener).indexOf(listener);\n if (index >= 0) { sub.listeners.splice(index, 1); }\n }\n\n if (listener == null || sub.listeners.length === 0) {\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n }\n\n return this;\n }\n\n /**\n * Remove all the listeners for %%event%% or remove all listeners if\n * unspecified.\n */\n async removeAllListeners(event?: ContractEventName): Promise<this> {\n if (event) {\n const sub = await hasSub(this, event);\n if (!sub) { return this; }\n sub.stop();\n getInternal(this).subs.delete(sub.tag);\n } else {\n const { subs } = getInternal(this);\n for (const { tag, stop } of subs.values()) {\n stop();\n subs.delete(tag);\n }\n }\n\n return this;\n }\n\n /**\n * Alias for [on].\n */\n async addListener(event: ContractEventName, listener: Listener): Promise<this> {\n return await this.on(event, listener);\n }\n\n /**\n * Alias for [off].\n */\n async removeListener(event: ContractEventName, listener: Listener): Promise<this> {\n return await this.off(event, listener);\n }\n\n /**\n * Create a new Class for the %%abi%%.\n */\n static buildClass<T = ContractInterface>(abi: Interface | InterfaceAbi): new (target: string, runner?: null | ContractRunner) => BaseContract & Omit<T, keyof BaseContract> {\n class CustomContract extends BaseContract {\n constructor(address: string, runner: null | ContractRunner = null) {\n super(address, abi, runner);\n }\n }\n return CustomContract as any;\n };\n\n /**\n * Create a new BaseContract with a specified Interface.\n */\n static from<T = ContractInterface>(target: string, abi: Interface | InterfaceAbi, runner?: null | ContractRunner): BaseContract & Omit<T, keyof BaseContract> {\n if (runner == null) { runner = null; }\n const contract = new this(target, abi, runner );\n return contract as any;\n }\n}\n\nfunction _ContractBase(): new (target: string | Addressable, abi: Interface | InterfaceAbi, runner?: null | ContractRunner) => BaseContract & Omit<ContractInterface, keyof BaseContract> {\n return BaseContract as any;\n}\n\n/**\n * A [[BaseContract]] with no type guards on its methods or events.\n */\nexport class Contract extends _ContractBase() { }\n","import { Interface, LogDescription, LogParams, ParamType, Result } from 'ethers'\nimport { Piscina } from 'piscina'\nimport { ServerError, Status } from 'nice-grpc'\n\nexport interface IResult {\n array?: any[]\n keys: string[]\n}\n\nexport function decodeTraceInline(contractViewInterface: any, inputs: readonly ParamType[], traceData: string): Result {\n return contractViewInterface.getAbiCoder().decode(inputs, traceData, true)\n}\n\nexport function decodeTrace({ inputs, traceData }: { inputs: ParamType[]; traceData: string }): IResult | null {\n const fragments = Piscina['workerData']\n const contractViewInterface = new Interface(fragments)\n const result = decodeTraceInline(contractViewInterface, inputs, traceData)\n\n const argsObj = result?.args.toObject(true)\n const argsArray: any[] = []\n const keys: string[] = []\n for (const [key, value] of Object.entries(argsObj)) {\n keys.push(key)\n argsArray.push(value)\n }\n\n return {\n array: argsArray,\n keys: keys\n }\n}\n\nexport interface ILogDescription {\n topic: string\n args: {\n array?: any[]\n keys: string[]\n } | null\n}\n\nexport function parseLogInline(contractViewInterface: any, log: LogParams): LogDescription | null {\n if (!log) {\n throw new ServerError(Status.INVALID_ARGUMENT, 'Log is empty')\n }\n const logParam = log as any as { topics: Array<string>; data: string }\n return contractViewInterface.parseLog(logParam)\n}\n\nexport function parseLog({ log }: { log: LogParams }): ILogDescription | null {\n const fragments = Piscina['workerData']\n const contractViewInterface = new Interface(fragments)\n const result = parseLogInline(contractViewInterface, log)\n if (!result) {\n return null\n }\n\n // can't serialize LogDescription, so return args and topics only\n if (result?.args == null) {\n return {\n args: null,\n topic: result.topic\n }\n }\n\n const argsObj = result?.args.toObject(true)\n const argsArray: any[] = []\n const keys: string[] = []\n for (const [key, value] of Object.entries(argsObj)) {\n keys.push(key)\n argsArray.push(value)\n }\n\n return {\n args: {\n array: argsArray,\n keys: keys\n },\n topic: result.topic\n }\n}\n\nexport default {\n parseLog,\n decodeTrace\n}\n;import(\"node:process\").then((p) => p.stdout.write(\"\"));"],"mappings":";;;;;;;;;;AAKO,IAAM,UAAkB;;;ACC/B,SAAS,UAAU,OAAY,MAAc,MAAY;AACrD,QAAM,QAAQ,KAAK,MAAM,GAAG,EAAE,IAAI,OAAK,EAAE,KAAI,CAAE;AAC/C,WAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACnC,YAAQ,MAAM;MACV,KAAK;AACD;MACJ,KAAK;MACL,KAAK;MACL,KAAK;MACL,KAAK;AACD,YAAI,OAAO,UAAW,MAAM;AAAE;;;;AAI1C,QAAM,QAAa,IAAI,MAAM,0BAA2B,IAAK,EAAE;AAC/D,QAAM,OAAO;AACb,QAAM,WAAW,SAAU,IAAK;AAChC,QAAM,QAAQ;AAEd,QAAM;AACV;AApBS;AA0BT,eAAsB,kBAAqB,OAAgD;AACvF,QAAM,OAAO,OAAO,KAAK,KAAK;AAC9B,QAAM,UAAU,MAAM,QAAQ,IAAI,KAAK,IAAI,CAAC,MAAM,QAAQ,QAAQ,MAAe,CAAC,CAAC,CAAC,CAAC;AACrF,SAAO,QAAQ,OAAO,CAAC,OAAY,GAAG,UAAS;AAC3C,UAAM,KAAK,KAAK,CAAC,IAAI;AACrB,WAAO;EACX,GAA8B,CAAA,CAAG;AACrC;AAPsB;AAchB,SAAU,iBACf,QACA,QACA,OAAqC;AAElC,WAAS,OAAO,QAAQ;AACpB,QAAI,QAAQ,OAAO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ytes","length","args","bytes","n","b","n","bytes","BN_0","BN_1","_guard","bytes","r","s","v","BN_0","BN_0","BN_0","BN_1","b","throwError","_guard","result","value","type","indexed","name","inputs","bytes","PanicReasons","b","bytes","value","BN_0","b","BN_0","blockNumber","receipt","BN_0","internal","fragment","t","listener","passProperties","addr","target","code"]}
|