viem 0.0.1-alpha.21 → 0.0.1-alpha.23

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.
Files changed (181) hide show
  1. package/dist/{chain-32f56cfa.d.ts → chain-4b39613a.d.ts} +2 -2
  2. package/dist/{chain-f12cdc7f.d.ts → chain-aa4898d0.d.ts} +1 -1
  3. package/dist/chains.d.ts +3 -3
  4. package/dist/chains.js +46 -46
  5. package/dist/chains.mjs +1 -1
  6. package/dist/{chunk-EC3NUIJE.js → chunk-7Y5QVLX7.js} +13 -13
  7. package/dist/{chunk-EC3NUIJE.js.map → chunk-7Y5QVLX7.js.map} +1 -1
  8. package/dist/{chunk-KEHGSYDO.js → chunk-BV5NTHUX.js} +14 -13
  9. package/dist/chunk-BV5NTHUX.js.map +1 -0
  10. package/dist/{chunk-46BO7YAQ.mjs → chunk-EGVXCZNJ.mjs} +4 -3
  11. package/dist/chunk-EGVXCZNJ.mjs.map +1 -0
  12. package/dist/{chunk-57ZOFERP.mjs → chunk-GX2KDAM3.mjs} +2 -2
  13. package/dist/{chunk-57ZOFERP.mjs.map → chunk-GX2KDAM3.mjs.map} +0 -0
  14. package/dist/{chunk-W7BWWAC4.js → chunk-NW6724MI.js} +14 -14
  15. package/dist/{chunk-W7BWWAC4.js.map → chunk-NW6724MI.js.map} +0 -0
  16. package/dist/{chunk-DGO77E2H.mjs → chunk-RJLUZTJS.mjs} +86 -3
  17. package/dist/chunk-RJLUZTJS.mjs.map +1 -0
  18. package/dist/{chunk-O2GYLJVD.js → chunk-SSPRUPGN.js} +405 -165
  19. package/dist/chunk-SSPRUPGN.js.map +1 -0
  20. package/dist/{chunk-DSPMAIDO.mjs → chunk-TXHOG6KU.mjs} +2 -2
  21. package/dist/{chunk-DSPMAIDO.mjs.map → chunk-TXHOG6KU.mjs.map} +1 -1
  22. package/dist/{chunk-62VTYU2V.mjs → chunk-XBUH66KN.mjs} +406 -166
  23. package/dist/chunk-XBUH66KN.mjs.map +1 -0
  24. package/dist/{chunk-KZMJR27B.js → chunk-ZKYGWITF.js} +147 -64
  25. package/dist/chunk-ZKYGWITF.js.map +1 -0
  26. package/dist/clients/index.d.ts +7 -7
  27. package/dist/clients/index.js +3 -3
  28. package/dist/clients/index.mjs +2 -2
  29. package/dist/{contract-9af4608b.d.ts → contract-4c3a37b3.d.ts} +14 -3
  30. package/dist/{createClient-5d316c7e.d.ts → createClient-55a04188.d.ts} +2 -2
  31. package/dist/{createPublicClient-9d2b42e1.d.ts → createPublicClient-3b27b282.d.ts} +3 -3
  32. package/dist/{createTestClient-79498dab.d.ts → createTestClient-93f9eac6.d.ts} +3 -3
  33. package/dist/{createWalletClient-f69a5230.d.ts → createWalletClient-c10df94d.d.ts} +3 -3
  34. package/dist/{eip1193-6c485d63.d.ts → eip1193-4c24765a.d.ts} +1 -1
  35. package/dist/ens.d.ts +1 -0
  36. package/dist/ens.js +11 -0
  37. package/dist/ens.js.map +1 -0
  38. package/dist/ens.mjs +11 -0
  39. package/dist/ens.mjs.map +1 -0
  40. package/dist/index.d.ts +174 -113
  41. package/dist/index.js +16 -6
  42. package/dist/index.mjs +15 -5
  43. package/dist/normalize-ef9240c0.d.ts +33 -0
  44. package/dist/{parseGwei-4308ad80.d.ts → parseGwei-3411cf2d.d.ts} +101 -37
  45. package/dist/public.d.ts +9 -9
  46. package/dist/public.js +4 -4
  47. package/dist/public.mjs +3 -3
  48. package/dist/{sendTransaction-1c8290a9.d.ts → sendTransaction-f17a2389.d.ts} +3 -3
  49. package/dist/{stopImpersonatingAccount-7781842a.d.ts → stopImpersonatingAccount-afb26486.d.ts} +2 -2
  50. package/dist/test.d.ts +5 -5
  51. package/dist/test.js +3 -3
  52. package/dist/test.mjs +2 -2
  53. package/dist/{transactionRequest-341b6ed2.d.ts → transactionRequest-93e9f001.d.ts} +2 -2
  54. package/dist/utils/index.d.ts +14 -16
  55. package/dist/utils/index.js +8 -2
  56. package/dist/utils/index.mjs +7 -1
  57. package/dist/wallet.d.ts +7 -7
  58. package/dist/wallet.js +3 -3
  59. package/dist/wallet.mjs +2 -2
  60. package/dist/{watchAsset-afaad3c7.d.ts → watchAsset-efd3dd05.d.ts} +3 -3
  61. package/dist/{watchPendingTransactions-3b722547.d.ts → watchPendingTransactions-57df1a13.d.ts} +17 -27
  62. package/dist/{webSocket-b180e679.d.ts → webSocket-d2e7bd0e.d.ts} +2 -2
  63. package/dist/window.d.ts +2 -2
  64. package/package.json +8 -2
  65. package/src/_test/abis.ts +7 -0
  66. package/src/_test/bench.ts +4 -4
  67. package/src/_test/constants.ts +4 -3
  68. package/src/_test/index.ts +4 -2
  69. package/src/_test/utils.ts +39 -1
  70. package/src/actions/index.test.ts +1 -0
  71. package/src/actions/index.ts +2 -0
  72. package/src/actions/public/call.bench.ts +5 -5
  73. package/src/actions/public/deployContract.ts +4 -4
  74. package/src/actions/public/estimateGas.bench.ts +6 -6
  75. package/src/actions/public/getBlock.bench.ts +5 -5
  76. package/src/actions/public/getBlockNumber.bench.ts +5 -5
  77. package/src/actions/public/getFilterChanges.test.ts +9 -9
  78. package/src/actions/public/getFilterLogs.test.ts +7 -7
  79. package/src/actions/public/getGasPrice.bench.ts +1 -10
  80. package/src/actions/public/getLogs.test.ts +7 -7
  81. package/src/actions/public/getTransaction.bench.ts +5 -5
  82. package/src/actions/public/getTransactionReceipt.bench.ts +5 -5
  83. package/src/actions/public/index.test.ts +1 -0
  84. package/src/actions/public/index.ts +3 -0
  85. package/src/actions/public/multicall.test.ts +452 -0
  86. package/src/actions/public/multicall.ts +103 -0
  87. package/src/actions/public/readContract.test.ts +226 -26
  88. package/src/actions/public/readContract.ts +13 -27
  89. package/src/actions/public/simulateContract.bench.ts +10 -0
  90. package/src/actions/public/simulateContract.test.ts +209 -37
  91. package/src/actions/public/simulateContract.ts +17 -21
  92. package/src/actions/public/watchContractEvent.test.ts +61 -57
  93. package/src/actions/public/watchEvent.test.ts +42 -37
  94. package/src/actions/test/impersonateAccount.test.ts +4 -6
  95. package/src/actions/test/sendUnsignedTransaction.test.ts +2 -2
  96. package/src/actions/test/stopImpersonatingAccount.test.ts +5 -7
  97. package/src/actions/wallet/signMessage.test.ts +0 -1
  98. package/src/actions/wallet/switchChain.test.ts +1 -2
  99. package/src/actions/wallet/watchAsset.test.ts +1 -2
  100. package/src/actions/wallet/writeContract.test.ts +37 -7
  101. package/src/actions/wallet/writeContract.ts +5 -14
  102. package/src/clients/transports/fallback.test.ts +34 -0
  103. package/src/clients/transports/fallback.ts +3 -1
  104. package/src/clients/transports/http.test.ts +0 -1
  105. package/src/clients/transports/webSocket.test.ts +0 -1
  106. package/src/constants/abis.test.ts +53 -0
  107. package/src/constants/abis.ts +44 -0
  108. package/src/constants/index.test.ts +14 -0
  109. package/src/constants/index.ts +3 -0
  110. package/src/constants/solidity.test.ts +41 -0
  111. package/src/constants/solidity.ts +35 -0
  112. package/src/ens.ts +5 -0
  113. package/src/errors/abi.test.ts +0 -2
  114. package/src/errors/base.test.ts +44 -2
  115. package/src/errors/base.ts +12 -12
  116. package/src/errors/block.test.ts +6 -6
  117. package/src/errors/contract.test.ts +233 -0
  118. package/src/errors/contract.ts +133 -80
  119. package/src/errors/index.ts +4 -2
  120. package/src/errors/request.test.ts +3 -4
  121. package/src/errors/request.ts +17 -17
  122. package/src/errors/rpc.test.ts +1 -2
  123. package/src/errors/transaction.test.ts +12 -12
  124. package/src/errors/transport.test.ts +0 -1
  125. package/src/index.test.ts +47 -0
  126. package/src/index.ts +10 -0
  127. package/src/types/contract.ts +55 -4
  128. package/src/types/index.ts +5 -0
  129. package/src/types/multicall.ts +82 -0
  130. package/src/utils/abi/decodeAbi.test.ts +1 -2
  131. package/src/utils/abi/decodeAbi.ts +11 -7
  132. package/src/utils/abi/decodeDeployData.test.ts +7 -15
  133. package/src/utils/abi/decodeDeployData.ts +10 -7
  134. package/src/utils/abi/decodeErrorResult.test.ts +103 -3
  135. package/src/utils/abi/decodeErrorResult.ts +30 -13
  136. package/src/utils/abi/decodeFunctionData.test.ts +0 -1
  137. package/src/utils/abi/decodeFunctionResult.test.ts +80 -9
  138. package/src/utils/abi/decodeFunctionResult.ts +15 -11
  139. package/src/utils/abi/encodeAbi.test.ts +3 -4
  140. package/src/utils/abi/encodeAbi.ts +19 -10
  141. package/src/utils/abi/encodeDeployData.test.ts +6 -13
  142. package/src/utils/abi/encodeDeployData.ts +10 -7
  143. package/src/utils/abi/encodeErrorResult.test.ts +2 -7
  144. package/src/utils/abi/encodeErrorResult.ts +18 -11
  145. package/src/utils/abi/encodeEventTopics.test.ts +11 -14
  146. package/src/utils/abi/encodeEventTopics.ts +15 -9
  147. package/src/utils/abi/encodeFunctionData.test.ts +5 -7
  148. package/src/utils/abi/encodeFunctionData.ts +16 -9
  149. package/src/utils/abi/encodeFunctionResult.test.ts +10 -15
  150. package/src/utils/abi/encodeFunctionResult.ts +9 -7
  151. package/src/utils/abi/getAbiItem.test.ts +547 -0
  152. package/src/utils/abi/getAbiItem.ts +93 -3
  153. package/src/utils/abi/index.ts +5 -1
  154. package/src/utils/address/getAddress.test.ts +6 -6
  155. package/src/utils/contract/getContractError.test.ts +247 -62
  156. package/src/utils/contract/getContractError.ts +30 -38
  157. package/src/utils/data/pad.bench.ts +0 -9
  158. package/src/utils/data/trim.bench.ts +0 -16
  159. package/src/utils/encoding/encodeBytes.bench.ts +0 -12
  160. package/src/utils/encoding/encodeHex.bench.ts +0 -11
  161. package/src/utils/ens/index.test.ts +13 -0
  162. package/src/utils/ens/index.ts +5 -0
  163. package/src/utils/ens/labelhash.test.ts +55 -0
  164. package/src/utils/ens/labelhash.ts +16 -0
  165. package/src/utils/ens/namehash.test.ts +65 -0
  166. package/src/utils/ens/namehash.ts +28 -0
  167. package/src/utils/ens/normalize.bench.ts +14 -0
  168. package/src/utils/ens/normalize.test.ts +35 -0
  169. package/src/utils/ens/normalize.ts +14 -0
  170. package/src/utils/hash/keccak256.ts +3 -5
  171. package/src/utils/index.test.ts +3 -0
  172. package/src/utils/index.ts +4 -0
  173. package/src/utils/rpc.test.ts +3 -6
  174. package/src/utils/unit/formatUnit.bench.ts +0 -5
  175. package/src/utils/unit/parseUnit.bench.ts +0 -5
  176. package/dist/chunk-46BO7YAQ.mjs.map +0 -1
  177. package/dist/chunk-62VTYU2V.mjs.map +0 -1
  178. package/dist/chunk-DGO77E2H.mjs.map +0 -1
  179. package/dist/chunk-KEHGSYDO.js.map +0 -1
  180. package/dist/chunk-KZMJR27B.js.map +0 -1
  181. package/dist/chunk-O2GYLJVD.js.map +0 -1
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
9
9
  var package_default = {
10
10
  name: "viem",
11
11
  description: "TypeScript Interface for Ethereum",
12
- version: "0.0.1-alpha.21",
12
+ version: "0.0.1-alpha.23",
13
13
  scripts: {
14
14
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
15
15
  bench: "vitest bench --no-threads",
@@ -18,6 +18,7 @@ var package_default = {
18
18
  changeset: "changeset",
19
19
  "changeset:release": "pnpm build && changeset publish",
20
20
  "changeset:version": "changeset version && pnpm install --lockfile-only",
21
+ "contracts:build": "wagmi generate",
21
22
  dev: "DEV=true tsup",
22
23
  "dev:docs": "pnpm -r --filter site dev",
23
24
  format: "rome format src/ test/ --write",
@@ -25,11 +26,11 @@ var package_default = {
25
26
  "lint:fix": "pnpm lint --apply-suggested",
26
27
  playground: "pnpm --filter playground-dev dev",
27
28
  "playground:benchmark": "pnpm --filter playground-benchmark dev",
28
- postinstall: "pnpm dev",
29
+ postinstall: "pnpm dev && pnpm contracts:build",
29
30
  preinstall: "npx only-allow pnpm",
30
31
  prepublishOnly: "pnpm ts-node scripts/generate-package-json.ts",
31
32
  prepare: "npx simple-git-hooks",
32
- test: "vitest dev --coverage --no-threads",
33
+ test: "vitest dev --no-threads",
33
34
  "test:ci": "CI=true vitest --coverage --no-threads",
34
35
  "test:ui": "vitest dev --ui --no-threads",
35
36
  "ts-node": "node --loader esbuild-register/loader -r esbuild-register",
@@ -61,6 +62,11 @@ var package_default = {
61
62
  module: "./dist/clients/index.mjs",
62
63
  default: "./dist/clients/index.js"
63
64
  },
65
+ "./ens": {
66
+ types: "./dist/ens.d.ts",
67
+ module: "./dist/ens.mjs",
68
+ default: "./dist/ens.js"
69
+ },
64
70
  "./public": {
65
71
  types: "./dist/public.d.ts",
66
72
  module: "./dist/public.mjs",
@@ -95,11 +101,13 @@ var package_default = {
95
101
  dependencies: {
96
102
  "@noble/hashes": "^1.1.2",
97
103
  "@wagmi/chains": "~0.2.6",
98
- abitype: "~0.2.5"
104
+ abitype: "~0.3.0",
105
+ "idna-uts46-hx": "^4.1.2"
99
106
  },
100
107
  devDependencies: {
101
108
  "@actions/core": "^1.10.0",
102
109
  "@actions/github": "^5.1.1",
110
+ "@adraffy/ens-normalize": "^1.8.9",
103
111
  "@changesets/changelog-github": "^0.4.5",
104
112
  "@changesets/cli": "^2.23.2",
105
113
  "@testing-library/jest-dom": "^5.16.5",
@@ -108,19 +116,20 @@ var package_default = {
108
116
  "@types/node": "^17.0.45",
109
117
  "@vitest/coverage-c8": "^0.24.3",
110
118
  "@vitest/ui": "^0.19.1",
119
+ "@wagmi/cli": "^0.1.5",
111
120
  bundlewatch: "^0.3.3",
112
121
  dedent: "^0.7.0",
113
122
  esbuild: "^0.16.12",
114
123
  "esbuild-register": "^3.4.2",
115
- "essential-eth": "^0.6.2",
116
124
  ethers: "^5.7.2",
125
+ "ethers@6": "npm:ethers@^6.0.2",
117
126
  execa: "^6.1.0",
118
127
  "fs-extra": "^10.1.0",
119
128
  jsdom: "^20.0.0",
120
129
  rome: "^11.0.0",
121
130
  "simple-git-hooks": "^2.8.1",
122
131
  tsup: "^6.5.0",
123
- typescript: "^4.9.3",
132
+ typescript: "^4.9.4",
124
133
  vite: "^3.0.4",
125
134
  vitest: "^0.25.2",
126
135
  web3: "^1.8.1"
@@ -148,38 +157,32 @@ var package_default = {
148
157
  }
149
158
  };
150
159
 
151
- // src/utils/stringify.ts
152
- function stringify(value) {
153
- return JSON.stringify(
154
- value,
155
- (_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
156
- );
157
- }
158
-
159
160
  // src/errors/base.ts
160
161
  var version = process.env.TEST ? "1.0.2" : package_default.version;
161
162
  var BaseError = class extends Error {
162
- constructor(humanMessage, args = {}) {
163
+ constructor(shortMessage, args = {}) {
163
164
  const details = args.cause instanceof BaseError ? args.cause.details : _optionalChain([args, 'access', _2 => _2.cause, 'optionalAccess', _3 => _3.message]) ? args.cause.message : args.details;
164
165
  const docsPath5 = args.cause instanceof BaseError ? args.cause.docsPath || args.docsPath : args.docsPath;
165
166
  const message = [
166
- humanMessage,
167
- ...docsPath5 ? ["", `Docs: https://viem.sh${docsPath5}`] : [],
167
+ shortMessage || "An error occurred.",
168
168
  "",
169
+ ...args.metaMessages ? [...args.metaMessages, ""] : [],
170
+ ...docsPath5 ? [`Docs: https://viem.sh${docsPath5}`] : [],
169
171
  ...details ? [`Details: ${details}`] : [],
170
- `Version: viem@${version}`,
171
- ...args.cause && !(args.cause instanceof BaseError) && Object.keys(args.cause).length > 0 ? [`Internal Error: ${stringify(args.cause)}`] : []
172
+ `Version: viem@${version}`
172
173
  ].join("\n");
173
174
  super(message);
174
- __publicField(this, "humanMessage");
175
175
  __publicField(this, "details");
176
176
  __publicField(this, "docsPath");
177
+ __publicField(this, "metaMessages");
178
+ __publicField(this, "shortMessage");
177
179
  __publicField(this, "name", "ViemError");
178
180
  if (args.cause)
179
181
  this.cause = args.cause;
180
182
  this.details = details;
181
183
  this.docsPath = docsPath5;
182
- this.humanMessage = humanMessage;
184
+ this.metaMessages = args.metaMessages;
185
+ this.shortMessage = shortMessage;
183
186
  }
184
187
  };
185
188
 
@@ -428,82 +431,201 @@ var BlockNotFoundError = class extends BaseError {
428
431
  }
429
432
  };
430
433
 
434
+ // src/constants/abis.ts
435
+ var multicall3Abi = [
436
+ {
437
+ inputs: [
438
+ {
439
+ components: [
440
+ {
441
+ name: "target",
442
+ type: "address"
443
+ },
444
+ {
445
+ name: "allowFailure",
446
+ type: "bool"
447
+ },
448
+ {
449
+ name: "callData",
450
+ type: "bytes"
451
+ }
452
+ ],
453
+ name: "calls",
454
+ type: "tuple[]"
455
+ }
456
+ ],
457
+ name: "aggregate3",
458
+ outputs: [
459
+ {
460
+ components: [
461
+ {
462
+ name: "success",
463
+ type: "bool"
464
+ },
465
+ {
466
+ name: "returnData",
467
+ type: "bytes"
468
+ }
469
+ ],
470
+ name: "returnData",
471
+ type: "tuple[]"
472
+ }
473
+ ],
474
+ stateMutability: "view",
475
+ type: "function"
476
+ }
477
+ ];
478
+
479
+ // src/constants/solidity.ts
480
+ var panicReasons = {
481
+ 1: "An `assert` condition failed.",
482
+ 17: "Arithmic operation resulted in underflow or overflow.",
483
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
484
+ 33: "Attempted to convert to an invalid type.",
485
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
486
+ 49: "Performed `.pop()` on an empty array",
487
+ 50: "Array index is out of bounds.",
488
+ 65: "Allocated too much memory or created an array which is too large.",
489
+ 81: "Attempted to call a zero-initialized variable of internal function type."
490
+ };
491
+ var solidityError = {
492
+ inputs: [
493
+ {
494
+ name: "message",
495
+ type: "string"
496
+ }
497
+ ],
498
+ name: "Error",
499
+ type: "error"
500
+ };
501
+ var solidityPanic = {
502
+ inputs: [
503
+ {
504
+ name: "reason",
505
+ type: "uint256"
506
+ }
507
+ ],
508
+ name: "Panic",
509
+ type: "error"
510
+ };
511
+
431
512
  // src/errors/contract.ts
432
- var ContractMethodExecutionError = class extends BaseError {
433
- constructor(message, {
513
+ var ContractFunctionExecutionError = class extends BaseError {
514
+ constructor(cause, {
434
515
  abi,
435
516
  args,
436
- cause,
437
517
  contractAddress,
438
- formattedArgs,
518
+ docsPath: docsPath5,
439
519
  functionName,
440
- functionWithParams,
441
520
  sender
442
- } = {}) {
521
+ }) {
522
+ const abiItem = getAbiItem({ abi, args, name: functionName });
523
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
524
+ abiItem,
525
+ args,
526
+ includeFunctionName: false,
527
+ includeName: false
528
+ }) : void 0;
529
+ const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
443
530
  super(
444
- [
445
- message,
446
- " ",
447
- sender && `Sender: ${sender}`,
448
- contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
449
- functionWithParams && `Function: ${functionWithParams}`,
450
- formattedArgs && `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _4 => _4.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`
451
- ].filter(Boolean).join("\n"),
531
+ cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
452
532
  {
453
- cause
533
+ cause,
534
+ docsPath: docsPath5,
535
+ metaMessages: [
536
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
537
+ contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
538
+ functionWithParams && `Function: ${functionWithParams}`,
539
+ formattedArgs && formattedArgs !== "()" && `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _4 => _4.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
540
+ sender && `Sender: ${sender}`
541
+ ].filter(Boolean)
454
542
  }
455
543
  );
456
544
  __publicField(this, "abi");
457
545
  __publicField(this, "args");
546
+ __publicField(this, "cause");
458
547
  __publicField(this, "contractAddress");
459
548
  __publicField(this, "formattedArgs");
460
549
  __publicField(this, "functionName");
461
- __publicField(this, "reason");
462
550
  __publicField(this, "sender");
463
- __publicField(this, "name", "ContractMethodExecutionError");
464
- if (message)
465
- this.reason = message;
551
+ __publicField(this, "name", "ContractFunctionExecutionError");
466
552
  this.abi = abi;
467
553
  this.args = args;
554
+ this.cause = cause;
468
555
  this.contractAddress = contractAddress;
469
556
  this.functionName = functionName;
470
557
  this.sender = sender;
471
558
  }
472
559
  };
473
- var ContractMethodZeroDataError = class extends BaseError {
560
+ var ContractFunctionRevertedError = class extends BaseError {
474
561
  constructor({
475
562
  abi,
476
- args,
477
- cause,
478
- contractAddress,
563
+ data,
479
564
  functionName,
480
- functionWithParams
481
- } = {}) {
565
+ message
566
+ }) {
567
+ let decodedData = void 0;
568
+ let metaMessages;
569
+ let reason;
570
+ if (data && data !== "0x") {
571
+ decodedData = decodeErrorResult({ abi, data });
572
+ const { abiItem, errorName, args: errorArgs } = decodedData;
573
+ if (errorName === "Error") {
574
+ reason = errorArgs[0];
575
+ } else if (errorName === "Panic") {
576
+ const [firstArg] = errorArgs;
577
+ reason = panicReasons[firstArg];
578
+ } else if (errorArgs) {
579
+ const errorWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
580
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
581
+ abiItem,
582
+ args: errorArgs,
583
+ includeFunctionName: false,
584
+ includeName: false
585
+ }) : void 0;
586
+ metaMessages = [
587
+ errorWithParams ? `Error: ${errorWithParams}` : "",
588
+ formattedArgs && formattedArgs !== "()" ? `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _5 => _5.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
589
+ ];
590
+ }
591
+ } else if (message)
592
+ reason = message;
482
593
  super(
483
- [
484
- `The contract method "${functionName}" returned no data ("0x"). This could be due to any of the following:`,
485
- `- The contract does not have the function "${functionName}",`,
486
- "- The parameters passed to the contract function may be invalid, or",
487
- "- The address is not a contract.",
488
- " ",
489
- contractAddress && `Contract: ${process.env.TEST ? "0x0000000000000000000000000000000000000000" : contractAddress}`,
490
- functionWithParams && `Function: ${functionWithParams}`,
491
- functionWithParams && ` > "0x"`
492
- ].filter(Boolean).join("\n"),
594
+ reason ? [
595
+ `The contract function "${functionName}" reverted with the following reason:`,
596
+ reason
597
+ ].join("\n") : `The contract function "${functionName}" reverted.`,
493
598
  {
494
- cause
599
+ metaMessages
495
600
  }
496
601
  );
497
- __publicField(this, "abi");
498
- __publicField(this, "args");
499
- __publicField(this, "contractAddress");
500
- __publicField(this, "functionName");
501
- __publicField(this, "functionWithParams");
502
- __publicField(this, "name", "ContractMethodZeroDataError");
503
- this.abi = abi;
504
- this.args = args;
505
- this.contractAddress = contractAddress;
506
- this.functionName = functionName;
602
+ __publicField(this, "name", "ContractFunctionRevertedError");
603
+ __publicField(this, "data");
604
+ __publicField(this, "reason");
605
+ this.reason = reason;
606
+ this.data = decodedData;
607
+ }
608
+ };
609
+ var ContractFunctionZeroDataError = class extends BaseError {
610
+ constructor({ functionName }) {
611
+ super(`The contract function "${functionName}" returned no data ("0x").`, {
612
+ metaMessages: [
613
+ "This could be due to any of the following:",
614
+ `- The contract does not have the function "${functionName}",`,
615
+ "- The parameters passed to the contract function may be invalid, or",
616
+ "- The address is not a contract."
617
+ ]
618
+ });
619
+ __publicField(this, "name", "ContractFunctionZeroDataError");
620
+ }
621
+ };
622
+ var RawContractError = class extends BaseError {
623
+ constructor({ data, message }) {
624
+ super(message || "");
625
+ __publicField(this, "code", 3);
626
+ __publicField(this, "name", "RawContractError");
627
+ __publicField(this, "data");
628
+ this.data = data;
507
629
  }
508
630
  };
509
631
 
@@ -581,8 +703,8 @@ var FilterTypeNotSupportedError = class extends BaseError {
581
703
 
582
704
  // src/errors/request.ts
583
705
  var RequestError = class extends BaseError {
584
- constructor(err, { docsPath: docsPath5, humanMessage }) {
585
- super(humanMessage, {
706
+ constructor(err, { docsPath: docsPath5, shortMessage }) {
707
+ super(shortMessage, {
586
708
  cause: err,
587
709
  docsPath: docsPath5
588
710
  });
@@ -590,8 +712,8 @@ var RequestError = class extends BaseError {
590
712
  }
591
713
  };
592
714
  var RpcRequestError = class extends RequestError {
593
- constructor(err, { docsPath: docsPath5, humanMessage }) {
594
- super(err, { docsPath: docsPath5, humanMessage });
715
+ constructor(err, { docsPath: docsPath5, shortMessage }) {
716
+ super(err, { docsPath: docsPath5, shortMessage });
595
717
  __publicField(this, "code");
596
718
  this.code = err.code;
597
719
  this.name = err.name;
@@ -600,7 +722,7 @@ var RpcRequestError = class extends RequestError {
600
722
  var ParseRpcError = class extends RpcRequestError {
601
723
  constructor(err) {
602
724
  super(err, {
603
- humanMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
725
+ shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
604
726
  });
605
727
  __publicField(this, "name", "ParseRpcError");
606
728
  __publicField(this, "code", -32700);
@@ -608,7 +730,7 @@ var ParseRpcError = class extends RpcRequestError {
608
730
  };
609
731
  var InvalidRequestRpcError = class extends RpcRequestError {
610
732
  constructor(err) {
611
- super(err, { humanMessage: "JSON is not a valid request object." });
733
+ super(err, { shortMessage: "JSON is not a valid request object." });
612
734
  __publicField(this, "name", "InvalidRequestRpcError");
613
735
  __publicField(this, "code", -32600);
614
736
  }
@@ -616,7 +738,7 @@ var InvalidRequestRpcError = class extends RpcRequestError {
616
738
  var MethodNotFoundRpcError = class extends RpcRequestError {
617
739
  constructor(err) {
618
740
  super(err, {
619
- humanMessage: "The method does not exist / is not available."
741
+ shortMessage: "The method does not exist / is not available."
620
742
  });
621
743
  __publicField(this, "name", "MethodNotFoundRpcError");
622
744
  __publicField(this, "code", -32601);
@@ -625,7 +747,7 @@ var MethodNotFoundRpcError = class extends RpcRequestError {
625
747
  var InvalidParamsRpcError = class extends RpcRequestError {
626
748
  constructor(err) {
627
749
  super(err, {
628
- humanMessage: [
750
+ shortMessage: [
629
751
  "Invalid parameters were provided to the RPC method.",
630
752
  "Double check you have provided the correct parameters."
631
753
  ].join("\n")
@@ -636,7 +758,7 @@ var InvalidParamsRpcError = class extends RpcRequestError {
636
758
  };
637
759
  var InternalRpcError = class extends RpcRequestError {
638
760
  constructor(err) {
639
- super(err, { humanMessage: "An internal error was received." });
761
+ super(err, { shortMessage: "An internal error was received." });
640
762
  __publicField(this, "name", "InternalRpcError");
641
763
  __publicField(this, "code", -32603);
642
764
  }
@@ -644,7 +766,7 @@ var InternalRpcError = class extends RpcRequestError {
644
766
  var InvalidInputRpcError = class extends RpcRequestError {
645
767
  constructor(err) {
646
768
  super(err, {
647
- humanMessage: [
769
+ shortMessage: [
648
770
  "Missing or invalid parameters.",
649
771
  "Double check you have provided the correct parameters."
650
772
  ].join("\n")
@@ -655,35 +777,35 @@ var InvalidInputRpcError = class extends RpcRequestError {
655
777
  };
656
778
  var ResourceNotFoundRpcError = class extends RpcRequestError {
657
779
  constructor(err) {
658
- super(err, { humanMessage: "Requested resource not found." });
780
+ super(err, { shortMessage: "Requested resource not found." });
659
781
  __publicField(this, "name", "ResourceNotFoundRpcError");
660
782
  __publicField(this, "code", -32001);
661
783
  }
662
784
  };
663
785
  var ResourceUnavailableRpcError = class extends RpcRequestError {
664
786
  constructor(err) {
665
- super(err, { humanMessage: "Requested resource not available." });
787
+ super(err, { shortMessage: "Requested resource not available." });
666
788
  __publicField(this, "name", "ResourceUnavailableRpcError");
667
789
  __publicField(this, "code", -32002);
668
790
  }
669
791
  };
670
792
  var TransactionRejectedRpcError = class extends RpcRequestError {
671
793
  constructor(err) {
672
- super(err, { humanMessage: "Transaction creation failed." });
794
+ super(err, { shortMessage: "Transaction creation failed." });
673
795
  __publicField(this, "name", "TransactionRejectedRpcError");
674
796
  __publicField(this, "code", -32003);
675
797
  }
676
798
  };
677
799
  var MethodNotSupportedRpcError = class extends RpcRequestError {
678
800
  constructor(err) {
679
- super(err, { humanMessage: "Method is not implemented." });
801
+ super(err, { shortMessage: "Method is not implemented." });
680
802
  __publicField(this, "name", "MethodNotSupportedRpcError");
681
803
  __publicField(this, "code", -32004);
682
804
  }
683
805
  };
684
806
  var LimitExceededRpcError = class extends RpcRequestError {
685
807
  constructor(err) {
686
- super(err, { humanMessage: "Request exceeds defined limit." });
808
+ super(err, { shortMessage: "Request exceeds defined limit." });
687
809
  __publicField(this, "name", "LimitExceededRpcError");
688
810
  __publicField(this, "code", -32005);
689
811
  }
@@ -691,7 +813,7 @@ var LimitExceededRpcError = class extends RpcRequestError {
691
813
  var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
692
814
  constructor(err) {
693
815
  super(err, {
694
- humanMessage: "Version of JSON-RPC protocol is not supported."
816
+ shortMessage: "Version of JSON-RPC protocol is not supported."
695
817
  });
696
818
  __publicField(this, "name", "JsonRpcVersionUnsupportedError");
697
819
  __publicField(this, "code", -32006);
@@ -700,7 +822,7 @@ var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
700
822
  var UnknownRpcError = class extends RequestError {
701
823
  constructor(err) {
702
824
  super(err, {
703
- humanMessage: "An unknown RPC error occurred."
825
+ shortMessage: "An unknown RPC error occurred."
704
826
  });
705
827
  __publicField(this, "name", "UnknownRpcError");
706
828
  }
@@ -1255,9 +1377,9 @@ function rlpToBytes(bytes, offset = 0) {
1255
1377
  var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1256
1378
  function extractFunctionParts(def) {
1257
1379
  const parts = def.match(paramsRegex);
1258
- const type = _optionalChain([parts, 'optionalAccess', _5 => _5[2]]) || void 0;
1259
- const name = _optionalChain([parts, 'optionalAccess', _6 => _6[3]]);
1260
- const params = _optionalChain([parts, 'optionalAccess', _7 => _7[5]]) || void 0;
1380
+ const type = _optionalChain([parts, 'optionalAccess', _6 => _6[2]]) || void 0;
1381
+ const name = _optionalChain([parts, 'optionalAccess', _7 => _7[3]]);
1382
+ const params = _optionalChain([parts, 'optionalAccess', _8 => _8[5]]) || void 0;
1261
1383
  return { type, name, params };
1262
1384
  }
1263
1385
  function extractFunctionName(def) {
@@ -1265,8 +1387,8 @@ function extractFunctionName(def) {
1265
1387
  }
1266
1388
  function extractFunctionParams(def) {
1267
1389
  const params = extractFunctionParts(def).params;
1268
- const splitParams = _optionalChain([params, 'optionalAccess', _8 => _8.split, 'call', _9 => _9(","), 'access', _10 => _10.map, 'call', _11 => _11((x) => x.trim().split(" "))]);
1269
- return _optionalChain([splitParams, 'optionalAccess', _12 => _12.map, 'call', _13 => _13((param) => ({
1390
+ const splitParams = _optionalChain([params, 'optionalAccess', _9 => _9.split, 'call', _10 => _10(","), 'access', _11 => _11.map, 'call', _12 => _12((x) => x.trim().split(" "))]);
1391
+ return _optionalChain([splitParams, 'optionalAccess', _13 => _13.map, 'call', _14 => _14((param) => ({
1270
1392
  type: param[0],
1271
1393
  name: param[1] === "indexed" ? param[2] : param[1],
1272
1394
  ...param[1] === "indexed" ? { indexed: true } : {}
@@ -1277,46 +1399,35 @@ function extractFunctionType(def) {
1277
1399
  }
1278
1400
 
1279
1401
  // src/utils/contract/getContractError.ts
1402
+ var EXECUTION_REVERTED_ERROR_CODE = 3;
1280
1403
  function getContractError(err, {
1281
1404
  abi,
1282
1405
  address,
1283
1406
  args,
1407
+ docsPath: docsPath5,
1284
1408
  functionName,
1285
1409
  sender
1286
1410
  }) {
1287
- const { code, message } = err.cause || {};
1288
- const abiItem = getAbiItem({ abi, name: functionName });
1289
- const formattedArgs = abiItem ? formatAbiItemWithArgs({
1290
- abiItem,
1291
- args,
1292
- includeFunctionName: false,
1293
- includeName: false
1294
- }) : void 0;
1295
- const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
1411
+ const { code, data, message } = err instanceof RawContractError ? err : err.cause || {};
1412
+ let cause = err;
1296
1413
  if (err instanceof AbiDecodingZeroDataError) {
1297
- return new ContractMethodZeroDataError({
1298
- abi,
1299
- args,
1300
- cause: err,
1301
- contractAddress: address,
1302
- functionName,
1303
- functionWithParams
1304
- });
1305
- }
1306
- if (code === 3 || _optionalChain([message, 'optionalAccess', _14 => _14.includes, 'call', _15 => _15("execution reverted")])) {
1307
- const message_ = _optionalChain([message, 'optionalAccess', _16 => _16.replace, 'call', _17 => _17("execution reverted: ", "")]);
1308
- return new ContractMethodExecutionError(message_, {
1414
+ cause = new ContractFunctionZeroDataError({ functionName });
1415
+ } else if (code === EXECUTION_REVERTED_ERROR_CODE && (data || message)) {
1416
+ cause = new ContractFunctionRevertedError({
1309
1417
  abi,
1310
- args,
1311
- cause: err,
1312
- contractAddress: address,
1313
- formattedArgs,
1418
+ data,
1314
1419
  functionName,
1315
- functionWithParams,
1316
- sender
1420
+ message
1317
1421
  });
1318
1422
  }
1319
- return err;
1423
+ return new ContractFunctionExecutionError(cause, {
1424
+ abi,
1425
+ args,
1426
+ contractAddress: address,
1427
+ docsPath: docsPath5,
1428
+ functionName,
1429
+ sender
1430
+ });
1320
1431
  }
1321
1432
 
1322
1433
  // src/utils/hash/keccak256.ts
@@ -1352,7 +1463,7 @@ function checksumAddress(address_) {
1352
1463
  const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1353
1464
  let address = hexAddress.split("");
1354
1465
  for (let i = 0; i < 40; i += 2) {
1355
- if (_optionalChain([hash2, 'optionalAccess', _18 => _18[i >> 1]]) >> 4 >= 8 && address[i]) {
1466
+ if (_optionalChain([hash2, 'optionalAccess', _15 => _15[i >> 1]]) >> 4 >= 8 && address[i]) {
1356
1467
  address[i] = address[i].toUpperCase();
1357
1468
  }
1358
1469
  if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
@@ -1416,16 +1527,16 @@ function isAddressEqual(a, b) {
1416
1527
  }
1417
1528
 
1418
1529
  // src/utils/abi/encodeAbi.ts
1419
- function encodeAbi({
1420
- params,
1421
- values
1422
- }) {
1530
+ function encodeAbi({ params, values }) {
1423
1531
  if (params.length !== values.length)
1424
1532
  throw new AbiEncodingLengthMismatchError({
1425
1533
  expectedLength: params.length,
1426
1534
  givenLength: values.length
1427
1535
  });
1428
- const preparedParams = prepareParams({ params, values });
1536
+ const preparedParams = prepareParams({
1537
+ params,
1538
+ values
1539
+ });
1429
1540
  const data = encodeParams(preparedParams);
1430
1541
  if (data.length === 0)
1431
1542
  return "0x";
@@ -1603,10 +1714,7 @@ function getArrayComponents(type) {
1603
1714
  }
1604
1715
 
1605
1716
  // src/utils/abi/decodeAbi.ts
1606
- function decodeAbi({
1607
- data,
1608
- params
1609
- }) {
1717
+ function decodeAbi({ data, params }) {
1610
1718
  if (data === "0x" && params.length > 0)
1611
1719
  throw new AbiDecodingZeroDataError();
1612
1720
  if (size(data) % 32 !== 0)
@@ -1696,7 +1804,7 @@ function decodeArray(data, {
1696
1804
  }
1697
1805
  if (hasDynamicChild(param)) {
1698
1806
  const arrayComponents = getArrayComponents(param.type);
1699
- const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _19 => _19[0]]);
1807
+ const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _16 => _16[0]]);
1700
1808
  let consumed2 = 0;
1701
1809
  let value2 = [];
1702
1810
  for (let i = 0; i < length; ++i) {
@@ -1768,7 +1876,7 @@ function decodeTuple(data, { param, position }) {
1768
1876
  position: consumed
1769
1877
  });
1770
1878
  consumed += decodedChild.consumed;
1771
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _20 => _20.name])] = decodedChild.value;
1879
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _17 => _17.name])] = decodedChild.value;
1772
1880
  }
1773
1881
  return { consumed: 32, value };
1774
1882
  }
@@ -1780,7 +1888,7 @@ function decodeTuple(data, { param, position }) {
1780
1888
  position: position + consumed
1781
1889
  });
1782
1890
  consumed += decodedChild.consumed;
1783
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _21 => _21.name])] = decodedChild.value;
1891
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _18 => _18.name])] = decodedChild.value;
1784
1892
  }
1785
1893
  return { consumed, value };
1786
1894
  }
@@ -1793,7 +1901,7 @@ function hasDynamicChild(param) {
1793
1901
  if (type.endsWith("[]"))
1794
1902
  return true;
1795
1903
  if (type === "tuple")
1796
- return _optionalChain([param, 'access', _22 => _22.components, 'optionalAccess', _23 => _23.some, 'call', _24 => _24(hasDynamicChild)]);
1904
+ return _optionalChain([param, 'access', _19 => _19.components, 'optionalAccess', _20 => _20.some, 'call', _21 => _21(hasDynamicChild)]);
1797
1905
  const arrayComponents = getArrayComponents(param.type);
1798
1906
  if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
1799
1907
  return true;
@@ -1822,18 +1930,25 @@ function getParam(param, { includeName }) {
1822
1930
  }
1823
1931
 
1824
1932
  // src/utils/abi/decodeErrorResult.ts
1825
- function decodeErrorResult({ abi, data }) {
1933
+ function decodeErrorResult({
1934
+ abi,
1935
+ data
1936
+ }) {
1826
1937
  const signature = slice(data, 0, 4);
1827
- const description = abi.find(
1828
- (x) => signature === getFunctionSignature(formatAbiItem(x))
1938
+ if (signature === "0x")
1939
+ throw new AbiDecodingZeroDataError();
1940
+ const abi_ = [...abi || [], solidityError, solidityPanic];
1941
+ const abiItem = abi_.find(
1942
+ (x) => x.type === "error" && signature === getFunctionSignature(formatAbiItem(x))
1829
1943
  );
1830
- if (!description)
1944
+ if (!abiItem)
1831
1945
  throw new AbiErrorSignatureNotFoundError(signature, {
1832
1946
  docsPath: "/docs/contract/decodeErrorResult"
1833
1947
  });
1834
1948
  return {
1835
- errorName: description.name,
1836
- args: "inputs" in description && description.inputs && description.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: description.inputs }) : void 0
1949
+ abiItem,
1950
+ args: "inputs" in abiItem && abiItem.inputs && abiItem.inputs.length > 0 ? decodeAbi({ data: slice(data, 4), params: abiItem.inputs }) : void 0,
1951
+ errorName: abiItem.name
1837
1952
  };
1838
1953
  }
1839
1954
 
@@ -1853,16 +1968,90 @@ function decodeFunctionData({ abi, data }) {
1853
1968
  };
1854
1969
  }
1855
1970
 
1971
+ // src/utils/abi/getAbiItem.ts
1972
+ function getAbiItem({ abi, args = [], name }) {
1973
+ const abiItems = abi.filter((x) => "name" in x && x.name === name);
1974
+ if (abiItems.length === 0)
1975
+ return void 0;
1976
+ if (abiItems.length === 1)
1977
+ return abiItems[0];
1978
+ for (const abiItem of abiItems) {
1979
+ if (!("inputs" in abiItem))
1980
+ continue;
1981
+ if (!args || args.length === 0) {
1982
+ if (!abiItem.inputs || abiItem.inputs.length === 0)
1983
+ return abiItem;
1984
+ continue;
1985
+ }
1986
+ if (!abiItem.inputs)
1987
+ continue;
1988
+ if (abiItem.inputs.length === 0)
1989
+ continue;
1990
+ const matched = args.every((arg, index) => {
1991
+ const abiParameter = "inputs" in abiItem && abiItem.inputs[index];
1992
+ if (!abiParameter)
1993
+ return false;
1994
+ return isArgOfType(arg, abiParameter);
1995
+ });
1996
+ if (matched)
1997
+ return abiItem;
1998
+ }
1999
+ return abiItems[0];
2000
+ }
2001
+ function isArgOfType(arg, abiParameter) {
2002
+ const argType = typeof arg;
2003
+ const abiParameterType = abiParameter.type;
2004
+ switch (abiParameterType) {
2005
+ case "address":
2006
+ return isAddress(arg);
2007
+ case "bool":
2008
+ return argType === "boolean";
2009
+ case "function":
2010
+ return argType === "string";
2011
+ case "string":
2012
+ return argType === "string";
2013
+ default: {
2014
+ if (abiParameterType === "tuple" && "components" in abiParameter)
2015
+ return Object.values(abiParameter.components).every(
2016
+ (component, index) => {
2017
+ return isArgOfType(
2018
+ Object.values(arg)[index],
2019
+ component
2020
+ );
2021
+ }
2022
+ );
2023
+ if (/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(
2024
+ abiParameterType
2025
+ ))
2026
+ return argType === "number" || argType === "bigint";
2027
+ if (/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(abiParameterType))
2028
+ return argType === "string" || arg instanceof Uint8Array;
2029
+ if (/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(abiParameterType)) {
2030
+ return Array.isArray(arg) && arg.every(
2031
+ (x) => isArgOfType(x, {
2032
+ ...abiParameter,
2033
+ type: abiParameterType.replace(/(\[[0-9]{0,}\])$/, "")
2034
+ })
2035
+ );
2036
+ }
2037
+ return false;
2038
+ }
2039
+ }
2040
+ }
2041
+
1856
2042
  // src/utils/abi/decodeFunctionResult.ts
1857
2043
  var docsPath = "/docs/contract/decodeFunctionResult";
1858
2044
  function decodeFunctionResult({
1859
2045
  abi,
2046
+ args,
1860
2047
  functionName,
1861
2048
  data
1862
2049
  }) {
1863
- const description = abi.find(
1864
- (x) => "name" in x && x.name === functionName
1865
- );
2050
+ const description = getAbiItem({
2051
+ abi,
2052
+ args,
2053
+ name: functionName
2054
+ });
1866
2055
  if (!description)
1867
2056
  throw new AbiFunctionNotFoundError(functionName, { docsPath });
1868
2057
  if (!("outputs" in description))
@@ -1884,7 +2073,9 @@ function encodeDeployData({
1884
2073
  }) {
1885
2074
  if (!args || args.length === 0)
1886
2075
  return bytecode;
1887
- const description = abi.find((x) => "type" in x && x.type === "constructor");
2076
+ const description = abi.find(
2077
+ (x) => "type" in x && x.type === "constructor"
2078
+ );
1888
2079
  if (!description)
1889
2080
  throw new AbiConstructorNotFoundError({ docsPath: docsPath2 });
1890
2081
  if (!("inputs" in description))
@@ -1898,15 +2089,14 @@ function encodeDeployData({
1898
2089
  return concatHex([bytecode, data]);
1899
2090
  }
1900
2091
 
1901
- // src/utils/abi/getAbiItem.ts
1902
- function getAbiItem({ abi, name }) {
1903
- return abi.find((x) => "name" in x && x.name === name);
1904
- }
1905
-
1906
2092
  // src/utils/abi/encodeErrorResult.ts
1907
2093
  var docsPath3 = "/docs/contract/encodeErrorResult";
1908
2094
  function encodeErrorResult({ abi, errorName, args }) {
1909
- const description = getAbiItem({ abi, name: errorName });
2095
+ const description = getAbiItem({
2096
+ abi,
2097
+ args,
2098
+ name: errorName
2099
+ });
1910
2100
  if (!description)
1911
2101
  throw new AbiErrorNotFoundError(errorName, { docsPath: docsPath3 });
1912
2102
  const definition = formatAbiItem(description);
@@ -1922,7 +2112,7 @@ function encodeErrorResult({ abi, errorName, args }) {
1922
2112
 
1923
2113
  // src/utils/abi/encodeEventTopics.ts
1924
2114
  function encodeEventTopics({ abi, eventName, args }) {
1925
- const abiItem = getAbiItem({ abi, name: eventName });
2115
+ const abiItem = getAbiItem({ abi, args, name: eventName });
1926
2116
  if (!abiItem)
1927
2117
  throw new AbiEventNotFoundError(eventName, {
1928
2118
  docsPath: "/docs/contract/encodeEventTopics"
@@ -1931,8 +2121,8 @@ function encodeEventTopics({ abi, eventName, args }) {
1931
2121
  const signature = getEventSignature(definition);
1932
2122
  let topics = [];
1933
2123
  if (args && "inputs" in abiItem) {
1934
- const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _25 => _25.inputs, 'optionalAccess', _26 => _26.map, 'call', _27 => _27((x) => args[x.name])]), () => ( []));
1935
- topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _28 => _28.inputs, 'optionalAccess', _29 => _29.filter, 'call', _30 => _30((param) => "indexed" in param && param.indexed), 'access', _31 => _31.map, 'call', _32 => _32(
2124
+ const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _22 => _22.inputs, 'optionalAccess', _23 => _23.map, 'call', _24 => _24((x) => args[x.name])]), () => ( []));
2125
+ topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _25 => _25.inputs, 'optionalAccess', _26 => _26.filter, 'call', _27 => _27((param) => "indexed" in param && param.indexed), 'access', _28 => _28.map, 'call', _29 => _29(
1936
2126
  (param, i) => Array.isArray(args_[i]) ? args_[i].map(
1937
2127
  (_, j) => encodeArg({ param, value: args_[i][j] })
1938
2128
  ) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
@@ -1953,7 +2143,11 @@ function encodeArg({
1953
2143
 
1954
2144
  // src/utils/abi/encodeFunctionData.ts
1955
2145
  function encodeFunctionData({ abi, args, functionName }) {
1956
- const description = getAbiItem({ abi, name: functionName });
2146
+ const description = getAbiItem({
2147
+ abi,
2148
+ args,
2149
+ name: functionName
2150
+ });
1957
2151
  if (!description)
1958
2152
  throw new AbiFunctionNotFoundError(functionName, {
1959
2153
  docsPath: "/docs/contract/encodeFunctionData"
@@ -1974,7 +2168,9 @@ function encodeFunctionResult({
1974
2168
  functionName,
1975
2169
  result
1976
2170
  }) {
1977
- const description = abi.find((x) => "name" in x && x.name === functionName);
2171
+ const description = abi.find(
2172
+ (x) => "name" in x && x.name === functionName
2173
+ );
1978
2174
  if (!description)
1979
2175
  throw new AbiFunctionNotFoundError(functionName, { docsPath: docsPath4 });
1980
2176
  if (!("outputs" in description))
@@ -2046,6 +2242,33 @@ function defineChain(chain) {
2046
2242
  return chain;
2047
2243
  }
2048
2244
 
2245
+ // src/utils/ens/normalize.ts
2246
+ var _idnauts46hx = require('idna-uts46-hx');
2247
+ function normalize(name) {
2248
+ return _idnauts46hx.toUnicode.call(void 0, name, { useStd3ASCII: true });
2249
+ }
2250
+
2251
+ // src/utils/ens/labelhash.ts
2252
+ function labelhash(label) {
2253
+ let result = new Uint8Array(32).fill(0);
2254
+ if (!label)
2255
+ return bytesToHex(result);
2256
+ return keccak256(stringToBytes(normalize(label)));
2257
+ }
2258
+
2259
+ // src/utils/ens/namehash.ts
2260
+ function namehash(name) {
2261
+ let result = new Uint8Array(32).fill(0);
2262
+ if (!name)
2263
+ return bytesToHex(result);
2264
+ const labels = normalize(name).split(".");
2265
+ for (let i = labels.length - 1; i >= 0; i -= 1) {
2266
+ const hashed = keccak256(stringToBytes(labels[i]), "bytes");
2267
+ result = keccak256(concat([result, hashed]), "bytes");
2268
+ }
2269
+ return bytesToHex(result);
2270
+ }
2271
+
2049
2272
  // src/utils/formatters/format.ts
2050
2273
  function format3(data, { formatter }) {
2051
2274
  return formatter(data);
@@ -2065,7 +2288,7 @@ function defineFormatter({
2065
2288
  }
2066
2289
  return {
2067
2290
  ...formatted,
2068
- ..._optionalChain([formatOverride, 'optionalCall', _33 => _33(data)])
2291
+ ..._optionalChain([formatOverride, 'optionalCall', _30 => _30(data)])
2069
2292
  };
2070
2293
  };
2071
2294
  }
@@ -2105,7 +2328,7 @@ var defineTransaction = defineFormatter({ format: formatTransaction });
2105
2328
 
2106
2329
  // src/utils/formatters/block.ts
2107
2330
  function formatBlock(block) {
2108
- const transactions = _optionalChain([block, 'access', _34 => _34.transactions, 'optionalAccess', _35 => _35.map, 'call', _36 => _36((transaction) => {
2331
+ const transactions = _optionalChain([block, 'access', _31 => _31.transactions, 'optionalAccess', _32 => _32.map, 'call', _33 => _33((transaction) => {
2109
2332
  if (typeof transaction === "string")
2110
2333
  return transaction;
2111
2334
  return formatTransaction(transaction);
@@ -2131,7 +2354,7 @@ function extract(value, { formatter }) {
2131
2354
  return {};
2132
2355
  const keys = Object.keys(formatter({}));
2133
2356
  return keys.reduce((data, key) => {
2134
- if (_optionalChain([value, 'optionalAccess', _37 => _37.hasOwnProperty, 'call', _38 => _38(key)])) {
2357
+ if (_optionalChain([value, 'optionalAccess', _34 => _34.hasOwnProperty, 'call', _35 => _35(key)])) {
2135
2358
  ;
2136
2359
  data[key] = value[key];
2137
2360
  }
@@ -2145,7 +2368,7 @@ function formatFeeHistory(feeHistory) {
2145
2368
  baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
2146
2369
  gasUsedRatio: feeHistory.gasUsedRatio,
2147
2370
  oldestBlock: BigInt(feeHistory.oldestBlock),
2148
- reward: _optionalChain([feeHistory, 'access', _39 => _39.reward, 'optionalAccess', _40 => _40.map, 'call', _41 => _41(
2371
+ reward: _optionalChain([feeHistory, 'access', _36 => _36.reward, 'optionalAccess', _37 => _37.map, 'call', _38 => _38(
2149
2372
  (reward) => reward.map((value) => BigInt(value))
2150
2373
  )])
2151
2374
  };
@@ -2297,7 +2520,7 @@ function withTimeout(fn, {
2297
2520
  }
2298
2521
  }, timeout);
2299
2522
  }
2300
- resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _42 => _42.signal]) }));
2523
+ resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _39 => _39.signal]) }));
2301
2524
  } catch (err) {
2302
2525
  if (err.name === "AbortError")
2303
2526
  reject(errorInstance);
@@ -2309,6 +2532,14 @@ function withTimeout(fn, {
2309
2532
  });
2310
2533
  }
2311
2534
 
2535
+ // src/utils/stringify.ts
2536
+ function stringify(value) {
2537
+ return JSON.stringify(
2538
+ value,
2539
+ (_, value2) => typeof value2 === "bigint" ? value2.toString() : value2
2540
+ );
2541
+ }
2542
+
2312
2543
  // src/utils/rpc.ts
2313
2544
  var id = 0;
2314
2545
  async function http(url, {
@@ -2338,8 +2569,8 @@ async function http(url, {
2338
2569
  ),
2339
2570
  {
2340
2571
  delay: ({ count, data: data2 }) => {
2341
- const retryAfter = _optionalChain([data2, 'optionalAccess', _43 => _43.headers, 'access', _44 => _44.get, 'call', _45 => _45("Retry-After")]);
2342
- if (_optionalChain([retryAfter, 'optionalAccess', _46 => _46.match, 'call', _47 => _47(/\d/)]))
2572
+ const retryAfter = _optionalChain([data2, 'optionalAccess', _40 => _40.headers, 'access', _41 => _41.get, 'call', _42 => _42("Retry-After")]);
2573
+ if (_optionalChain([retryAfter, 'optionalAccess', _43 => _43.match, 'call', _44 => _44(/\d/)]))
2343
2574
  return parseInt(retryAfter) * 1e3;
2344
2575
  return ~~((Math.random() + 0.5) * (1 << count)) * retryDelay;
2345
2576
  },
@@ -2354,7 +2585,7 @@ async function http(url, {
2354
2585
  }
2355
2586
  );
2356
2587
  let data;
2357
- if (_optionalChain([response, 'access', _48 => _48.headers, 'access', _49 => _49.get, 'call', _50 => _50("Content-Type"), 'optionalAccess', _51 => _51.startsWith, 'call', _52 => _52("application/json")])) {
2588
+ if (_optionalChain([response, 'access', _45 => _45.headers, 'access', _46 => _46.get, 'call', _47 => _47("Content-Type"), 'optionalAccess', _48 => _48.startsWith, 'call', _49 => _49("application/json")])) {
2358
2589
  data = await response.json();
2359
2590
  } else {
2360
2591
  data = await response.text();
@@ -2432,15 +2663,15 @@ function webSocket(socket, {
2432
2663
  if (typeof message.id === "number" && id_ !== message.id)
2433
2664
  return;
2434
2665
  if (message.error) {
2435
- _optionalChain([onError, 'optionalCall', _53 => _53(new RpcError({ body, error: message.error, url: socket.url }))]);
2666
+ _optionalChain([onError, 'optionalCall', _50 => _50(new RpcError({ body, error: message.error, url: socket.url }))]);
2436
2667
  } else {
2437
- _optionalChain([onData, 'optionalCall', _54 => _54(message)]);
2668
+ _optionalChain([onData, 'optionalCall', _51 => _51(message)]);
2438
2669
  }
2439
2670
  if (body.method === "eth_subscribe" && typeof message.result === "string") {
2440
2671
  socket.subscriptions.set(message.result, callback);
2441
2672
  }
2442
2673
  if (body.method === "eth_unsubscribe") {
2443
- socket.subscriptions.delete(_optionalChain([body, 'access', _55 => _55.params, 'optionalAccess', _56 => _56[0]]));
2674
+ socket.subscriptions.delete(_optionalChain([body, 'access', _52 => _52.params, 'optionalAccess', _53 => _53[0]]));
2444
2675
  }
2445
2676
  };
2446
2677
  socket.requests.set(id_, callback);
@@ -2685,5 +2916,14 @@ function parseGwei(ether, unit = "wei") {
2685
2916
 
2686
2917
 
2687
2918
 
2688
- exports.stringify = stringify; exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeFunctionData = decodeFunctionData; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.getAbiItem = getAbiItem; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.getSocket = getSocket; exports.rpc = rpc; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
2689
- //# sourceMappingURL=chunk-O2GYLJVD.js.map
2919
+
2920
+
2921
+
2922
+
2923
+
2924
+
2925
+
2926
+
2927
+
2928
+ exports.BaseError = BaseError; exports.AbiConstructorNotFoundError = AbiConstructorNotFoundError; exports.AbiConstructorParamsNotFoundError = AbiConstructorParamsNotFoundError; exports.AbiDecodingDataSizeInvalidError = AbiDecodingDataSizeInvalidError; exports.AbiDecodingZeroDataError = AbiDecodingZeroDataError; exports.AbiEncodingArrayLengthMismatchError = AbiEncodingArrayLengthMismatchError; exports.AbiEncodingLengthMismatchError = AbiEncodingLengthMismatchError; exports.AbiErrorInputsNotFoundError = AbiErrorInputsNotFoundError; exports.AbiErrorNotFoundError = AbiErrorNotFoundError; exports.AbiErrorSignatureNotFoundError = AbiErrorSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.multicall3Abi = multicall3Abi; exports.isBytes = isBytes; exports.isHex = isHex; exports.pad = pad; exports.padHex = padHex; exports.padBytes = padBytes; exports.trim = trim; exports.size = size; exports.slice = slice; exports.sliceBytes = sliceBytes; exports.sliceHex = sliceHex; exports.boolToHex = boolToHex; exports.bytesToHex = bytesToHex; exports.encodeHex = encodeHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.boolToBytes = boolToBytes; exports.encodeBytes = encodeBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.encodeRlp = encodeRlp; exports.decodeHex = decodeHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.decodeBytes = decodeBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.decodeRlp = decodeRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.getContractError = getContractError; exports.keccak256 = keccak256; exports.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddress = isAddress; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeFunctionData = decodeFunctionData; exports.getAbiItem = getAbiItem; exports.decodeFunctionResult = decodeFunctionResult; exports.encodeDeployData = encodeDeployData; exports.encodeErrorResult = encodeErrorResult; exports.encodeEventTopics = encodeEventTopics; exports.encodeFunctionData = encodeFunctionData; exports.encodeFunctionResult = encodeFunctionResult; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.normalize = normalize; exports.labelhash = labelhash; exports.namehash = namehash; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei; exports.ContractFunctionExecutionError = ContractFunctionExecutionError; exports.ContractFunctionRevertedError = ContractFunctionRevertedError; exports.ContractFunctionZeroDataError = ContractFunctionZeroDataError; exports.RawContractError = RawContractError; exports.SizeExceedsPaddingSizeError = SizeExceedsPaddingSizeError; exports.DataLengthTooLongError = DataLengthTooLongError; exports.DataLengthTooShortError = DataLengthTooShortError; exports.InvalidBytesBooleanError = InvalidBytesBooleanError; exports.InvalidHexBooleanError = InvalidHexBooleanError; exports.InvalidHexValueError = InvalidHexValueError; exports.OffsetOutOfBoundsError = OffsetOutOfBoundsError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.RequestError = RequestError; exports.RpcRequestError = RpcRequestError; exports.ParseRpcError = ParseRpcError; exports.InvalidRequestRpcError = InvalidRequestRpcError; exports.MethodNotFoundRpcError = MethodNotFoundRpcError; exports.InvalidParamsRpcError = InvalidParamsRpcError; exports.InternalRpcError = InternalRpcError; exports.InvalidInputRpcError = InvalidInputRpcError; exports.ResourceNotFoundRpcError = ResourceNotFoundRpcError; exports.ResourceUnavailableRpcError = ResourceUnavailableRpcError; exports.TransactionRejectedRpcError = TransactionRejectedRpcError; exports.MethodNotSupportedRpcError = MethodNotSupportedRpcError; exports.LimitExceededRpcError = LimitExceededRpcError; exports.JsonRpcVersionUnsupportedError = JsonRpcVersionUnsupportedError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.InvalidGasArgumentsError = InvalidGasArgumentsError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.UrlRequiredError = UrlRequiredError;
2929
+ //# sourceMappingURL=chunk-SSPRUPGN.js.map