hardhat 3.0.4 → 3.0.6

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 (156) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts +1 -1
  3. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.d.ts.map +1 -1
  4. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js +7 -3
  5. package/dist/src/internal/builtin-plugins/artifacts/artifact-manager.js.map +1 -1
  6. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.d.ts.map +1 -1
  7. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js +10 -6
  8. package/dist/src/internal/builtin-plugins/coverage/coverage-manager.js.map +1 -1
  9. package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.d.ts.map +1 -1
  10. package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js +38 -0
  11. package/dist/src/internal/builtin-plugins/network-manager/chain-descriptors.js.map +1 -1
  12. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js +1 -1
  13. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.js.map +1 -1
  14. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js +1 -1
  15. package/dist/src/internal/builtin-plugins/network-manager/hook-handlers/network.js.map +1 -1
  16. package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts +1 -1
  17. package/dist/src/internal/builtin-plugins/network-manager/http-provider.d.ts.map +1 -1
  18. package/dist/src/internal/builtin-plugins/network-manager/http-provider.js +5 -4
  19. package/dist/src/internal/builtin-plugins/network-manager/http-provider.js.map +1 -1
  20. package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js +2 -6
  21. package/dist/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.js.map +1 -1
  22. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.d.ts.map +1 -1
  23. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js +5 -1
  24. package/dist/src/internal/builtin-plugins/solidity/build-system/build-system.js.map +1 -1
  25. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts +3 -2
  26. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.d.ts.map +1 -1
  27. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js +50 -1
  28. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/index.js.map +1 -1
  29. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts +1 -0
  30. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.d.ts.map +1 -1
  31. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js +1 -0
  32. package/dist/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.js.map +1 -1
  33. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js +1 -1
  34. package/dist/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.js.map +1 -1
  35. package/dist/src/internal/builtin-plugins/solidity/config.d.ts.map +1 -1
  36. package/dist/src/internal/builtin-plugins/solidity/config.js +1 -0
  37. package/dist/src/internal/builtin-plugins/solidity/config.js.map +1 -1
  38. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts +2 -0
  39. package/dist/src/internal/builtin-plugins/solidity/type-extensions.d.ts.map +1 -1
  40. package/dist/src/internal/builtin-plugins/solidity/type-extensions.js.map +1 -1
  41. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts +2 -0
  42. package/dist/src/internal/builtin-plugins/solidity-test/helpers.d.ts.map +1 -1
  43. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js +14 -0
  44. package/dist/src/internal/builtin-plugins/solidity-test/helpers.js.map +1 -1
  45. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.d.ts.map +1 -1
  46. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js +1 -1
  47. package/dist/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.js.map +1 -1
  48. package/dist/src/internal/builtin-plugins/solidity-test/task-action.d.ts.map +1 -1
  49. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js +11 -5
  50. package/dist/src/internal/builtin-plugins/solidity-test/task-action.js.map +1 -1
  51. package/dist/src/internal/cli/main.d.ts +1 -0
  52. package/dist/src/internal/cli/main.d.ts.map +1 -1
  53. package/dist/src/internal/cli/main.js +36 -1
  54. package/dist/src/internal/cli/main.js.map +1 -1
  55. package/dist/src/internal/core/configuration-variables.d.ts.map +1 -1
  56. package/dist/src/internal/core/configuration-variables.js +1 -1
  57. package/dist/src/internal/core/configuration-variables.js.map +1 -1
  58. package/dist/src/internal/core/global-options.js +2 -2
  59. package/dist/src/internal/core/global-options.js.map +1 -1
  60. package/dist/src/internal/core/hook-manager.js +1 -1
  61. package/dist/src/internal/core/hook-manager.js.map +1 -1
  62. package/dist/src/internal/core/user-interruptions.d.ts.map +1 -1
  63. package/dist/src/internal/core/user-interruptions.js +1 -1
  64. package/dist/src/internal/core/user-interruptions.js.map +1 -1
  65. package/dist/src/types/artifacts.d.ts +3 -2
  66. package/dist/src/types/artifacts.d.ts.map +1 -1
  67. package/package.json +4 -4
  68. package/src/internal/builtin-plugins/artifacts/artifact-manager.ts +12 -3
  69. package/src/internal/builtin-plugins/coverage/coverage-manager.ts +12 -6
  70. package/src/internal/builtin-plugins/network-manager/chain-descriptors.ts +38 -0
  71. package/src/internal/builtin-plugins/network-manager/edr/stack-traces/stack-trace-solidity-errors.ts +1 -1
  72. package/src/internal/builtin-plugins/network-manager/hook-handlers/network.ts +1 -1
  73. package/src/internal/builtin-plugins/network-manager/http-provider.ts +6 -3
  74. package/src/internal/builtin-plugins/network-manager/request-handlers/handlers/accounts/local-accounts.ts +9 -9
  75. package/src/internal/builtin-plugins/solidity/build-system/build-system.ts +5 -1
  76. package/src/internal/builtin-plugins/solidity/build-system/compiler/index.ts +73 -3
  77. package/src/internal/builtin-plugins/solidity/build-system/compiler/solcjs-wrapper.ts +2 -0
  78. package/src/internal/builtin-plugins/solidity/build-system/resolver/dependency-resolver.ts +1 -1
  79. package/src/internal/builtin-plugins/solidity/config.ts +1 -0
  80. package/src/internal/builtin-plugins/solidity/type-extensions.ts +2 -0
  81. package/src/internal/builtin-plugins/solidity-test/helpers.ts +27 -0
  82. package/src/internal/builtin-plugins/solidity-test/stack-trace-solidity-errors.ts +2 -1
  83. package/src/internal/builtin-plugins/solidity-test/task-action.ts +19 -7
  84. package/src/internal/cli/main.ts +60 -1
  85. package/src/internal/core/configuration-variables.ts +1 -2
  86. package/src/internal/core/global-options.ts +2 -2
  87. package/src/internal/core/hook-manager.ts +1 -1
  88. package/src/internal/core/user-interruptions.ts +1 -2
  89. package/src/types/artifacts.ts +3 -2
  90. package/templates/hardhat-3/01-node-test-runner-viem/package.json +1 -1
  91. package/templates/hardhat-3/02-mocha-ethers/package.json +1 -1
  92. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/panic-errors.d.ts +0 -2
  93. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/panic-errors.d.ts.map +0 -1
  94. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/panic-errors.js +0 -32
  95. package/dist/src/internal/builtin-plugins/network-manager/edr/stack-traces/panic-errors.js.map +0 -1
  96. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/access-list.d.ts +0 -10
  97. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/access-list.d.ts.map +0 -1
  98. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/access-list.js +0 -9
  99. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/access-list.js.map +0 -1
  100. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/address.d.ts +0 -4
  101. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/address.d.ts.map +0 -1
  102. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/address.js +0 -16
  103. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/address.js.map +0 -1
  104. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/any.d.ts +0 -3
  105. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/any.d.ts.map +0 -1
  106. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/any.js +0 -3
  107. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/any.js.map +0 -1
  108. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/authorization-list.d.ts +0 -14
  109. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/authorization-list.d.ts.map +0 -1
  110. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/authorization-list.js +0 -15
  111. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/authorization-list.js.map +0 -1
  112. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/data.d.ts +0 -3
  113. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/data.d.ts.map +0 -1
  114. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/data.js +0 -9
  115. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/data.js.map +0 -1
  116. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/hash.d.ts +0 -3
  117. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/hash.d.ts.map +0 -1
  118. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/hash.js +0 -13
  119. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/hash.js.map +0 -1
  120. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/quantity.d.ts +0 -3
  121. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/quantity.d.ts.map +0 -1
  122. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/quantity.js +0 -8
  123. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/quantity.js.map +0 -1
  124. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.d.ts +0 -3
  125. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.d.ts.map +0 -1
  126. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.js +0 -15
  127. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.js.map +0 -1
  128. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/tx-request.d.ts +0 -29
  129. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/tx-request.d.ts.map +0 -1
  130. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/tx-request.js +0 -25
  131. package/dist/src/internal/builtin-plugins/network-manager/rpc/types/tx-request.js.map +0 -1
  132. package/dist/src/internal/builtin-plugins/network-manager/rpc/utils.d.ts +0 -3
  133. package/dist/src/internal/builtin-plugins/network-manager/rpc/utils.d.ts.map +0 -1
  134. package/dist/src/internal/builtin-plugins/network-manager/rpc/utils.js +0 -7
  135. package/dist/src/internal/builtin-plugins/network-manager/rpc/utils.js.map +0 -1
  136. package/dist/src/internal/builtin-plugins/network-manager/rpc/validate-params.d.ts +0 -5
  137. package/dist/src/internal/builtin-plugins/network-manager/rpc/validate-params.d.ts.map +0 -1
  138. package/dist/src/internal/builtin-plugins/network-manager/rpc/validate-params.js +0 -40
  139. package/dist/src/internal/builtin-plugins/network-manager/rpc/validate-params.js.map +0 -1
  140. package/dist/src/internal/core/async-mutex.d.ts +0 -18
  141. package/dist/src/internal/core/async-mutex.d.ts.map +0 -1
  142. package/dist/src/internal/core/async-mutex.js +0 -47
  143. package/dist/src/internal/core/async-mutex.js.map +0 -1
  144. package/src/internal/builtin-plugins/network-manager/edr/stack-traces/panic-errors.ts +0 -35
  145. package/src/internal/builtin-plugins/network-manager/rpc/types/access-list.ts +0 -20
  146. package/src/internal/builtin-plugins/network-manager/rpc/types/address.ts +0 -25
  147. package/src/internal/builtin-plugins/network-manager/rpc/types/any.ts +0 -5
  148. package/src/internal/builtin-plugins/network-manager/rpc/types/authorization-list.ts +0 -31
  149. package/src/internal/builtin-plugins/network-manager/rpc/types/data.ts +0 -15
  150. package/src/internal/builtin-plugins/network-manager/rpc/types/hash.ts +0 -21
  151. package/src/internal/builtin-plugins/network-manager/rpc/types/quantity.ts +0 -14
  152. package/src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.ts +0 -24
  153. package/src/internal/builtin-plugins/network-manager/rpc/types/tx-request.ts +0 -53
  154. package/src/internal/builtin-plugins/network-manager/rpc/utils.ts +0 -9
  155. package/src/internal/builtin-plugins/network-manager/rpc/validate-params.ts +0 -62
  156. package/src/internal/core/async-mutex.ts +0 -51
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AASnC,eAAO,MAAM,OAAO,EAAE,OAAO,CAAC,UAAU,CAWvC,CAAC"}
@@ -1,13 +0,0 @@
1
- import { isHash } from "@nomicfoundation/hardhat-utils/eth";
2
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
3
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
4
- import { z } from "zod";
5
- const HASH_LENGTH_BYTES = 32;
6
- export const rpcHash = conditionalUnionType([
7
- [
8
- (data) => Buffer.isBuffer(data) && data.length === HASH_LENGTH_BYTES,
9
- z.instanceof(Uint8Array),
10
- ],
11
- [isHash, z.string()],
12
- ], "Expected a Buffer with the correct length or a valid RPC hash string").transform((v) => typeof v === "string" ? Buffer.from(hexStringToBytes(v)) : v);
13
- //# sourceMappingURL=hash.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"hash.js","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/hash.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,iBAAiB,GAAG,EAAE,CAAC;AAE7B,MAAM,CAAC,MAAM,OAAO,GAAwB,oBAAoB,CAC9D;IACE;QACE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,iBAAiB;QACpE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;KACzB;IACD,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;CACrB,EACD,sEAAsE,CACvE,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAChB,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC7D,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ZodType } from "zod";
2
- export declare const rpcQuantity: ZodType<bigint>;
3
- //# sourceMappingURL=quantity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quantity.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/quantity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAOnC,eAAO,MAAM,WAAW,EAAE,OAAO,CAAC,MAAM,CAMmB,CAAC"}
@@ -1,8 +0,0 @@
1
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
2
- import { z } from "zod";
3
- import { isRpcQuantityString } from "../utils.js";
4
- export const rpcQuantity = conditionalUnionType([
5
- [(data) => typeof data === "bigint", z.bigint()],
6
- [isRpcQuantityString, z.string()],
7
- ], "Expected a bigint or a valid RPC quantity string").transform((v) => (typeof v === "string" ? BigInt(v) : v));
8
- //# sourceMappingURL=quantity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"quantity.js","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/quantity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,MAAM,CAAC,MAAM,WAAW,GAAoB,oBAAoB,CAC9D;IACE,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;IAChD,CAAC,mBAAmB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;CAClC,EACD,kDAAkD,CACnD,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- import type { ZodType } from "zod";
2
- export declare const rpcParity: ZodType<Buffer>;
3
- //# sourceMappingURL=rpc-parity.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-parity.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAQnC,eAAO,MAAM,SAAS,EAAE,OAAO,CAAC,MAAM,CAWrC,CAAC"}
@@ -1,15 +0,0 @@
1
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
2
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
3
- import { z } from "zod";
4
- const PARITY_LENGTH_BYTES = 1;
5
- export const rpcParity = conditionalUnionType([
6
- [
7
- (data) => Buffer.isBuffer(data) && data.length === PARITY_LENGTH_BYTES,
8
- z.instanceof(Uint8Array),
9
- ],
10
- [isRpcParityString, z.string()],
11
- ], "Expected a Buffer or valid parity string").transform((v) => typeof v === "string" ? Buffer.from(hexStringToBytes(v)) : v);
12
- function isRpcParityString(u) {
13
- return typeof u === "string" && u.match(/^0x[0-9a-fA-F]{1,2}$/) !== null;
14
- }
15
- //# sourceMappingURL=rpc-parity.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"rpc-parity.js","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/rpc-parity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAE9B,MAAM,CAAC,MAAM,SAAS,GAAoB,oBAAoB,CAC5D;IACE;QACE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,mBAAmB;QACtE,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC;KACzB;IACD,CAAC,iBAAiB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;CAChC,EACD,0CAA0C,CAC3C,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAChB,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAC7D,CAAC;AAEF,SAAS,iBAAiB,CAAC,CAAU;IACnC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,CAAC,CAAC,KAAK,CAAC,sBAAsB,CAAC,KAAK,IAAI,CAAC;AAC3E,CAAC"}
@@ -1,29 +0,0 @@
1
- import type { ZodType } from "zod";
2
- export interface RpcTransactionRequest {
3
- from: Uint8Array;
4
- to?: Uint8Array | null;
5
- gas?: bigint;
6
- gasPrice?: bigint;
7
- value?: bigint;
8
- nonce?: bigint;
9
- data?: Uint8Array;
10
- accessList?: Array<{
11
- address: Uint8Array;
12
- storageKeys: Uint8Array[] | null;
13
- }>;
14
- chainId?: bigint;
15
- maxFeePerGas?: bigint;
16
- maxPriorityFeePerGas?: bigint;
17
- blobs?: Uint8Array[];
18
- blobVersionedHashes?: Uint8Array[];
19
- authorizationList?: Array<{
20
- chainId: bigint;
21
- address: Uint8Array;
22
- nonce: bigint;
23
- yParity: Uint8Array;
24
- r: Uint8Array;
25
- s: Uint8Array;
26
- }>;
27
- }
28
- export declare const rpcTransactionRequest: ZodType<RpcTransactionRequest>;
29
- //# sourceMappingURL=tx-request.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tx-request.d.ts","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/tx-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAanC,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,UAAU,CAAC;IACjB,EAAE,CAAC,EAAE,UAAU,GAAG,IAAI,CAAC;IACvB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,UAAU,CAAC;IAClB,UAAU,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,UAAU,EAAE,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;IAC9E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,KAAK,CAAC,EAAE,UAAU,EAAE,CAAC;IACrB,mBAAmB,CAAC,EAAE,UAAU,EAAE,CAAC;IACnC,iBAAiB,CAAC,EAAE,KAAK,CAAC;QACxB,OAAO,EAAE,MAAM,CAAC;QAChB,OAAO,EAAE,UAAU,CAAC;QACpB,KAAK,EAAE,MAAM,CAAC;QACd,OAAO,EAAE,UAAU,CAAC;QACpB,CAAC,EAAE,UAAU,CAAC;QACd,CAAC,EAAE,UAAU,CAAC;KACf,CAAC,CAAC;CACJ;AAED,eAAO,MAAM,qBAAqB,EAAE,OAAO,CAAC,qBAAqB,CAe/D,CAAC"}
@@ -1,25 +0,0 @@
1
- import { z } from "zod";
2
- import { rpcAccessList } from "./access-list.js";
3
- import { nullableRpcAddress, rpcAddress } from "./address.js";
4
- import { rpcAuthorizationList } from "./authorization-list.js";
5
- import { rpcData } from "./data.js";
6
- import { rpcHash } from "./hash.js";
7
- import { rpcQuantity } from "./quantity.js";
8
- const optional = (schema) => schema.optional();
9
- export const rpcTransactionRequest = z.object({
10
- from: rpcAddress,
11
- to: optional(nullableRpcAddress),
12
- gas: optional(rpcQuantity),
13
- gasPrice: optional(rpcQuantity),
14
- value: optional(rpcQuantity),
15
- nonce: optional(rpcQuantity),
16
- data: optional(rpcData),
17
- accessList: optional(rpcAccessList),
18
- chainId: optional(rpcQuantity),
19
- maxFeePerGas: optional(rpcQuantity),
20
- maxPriorityFeePerGas: optional(rpcQuantity),
21
- blobs: optional(z.array(rpcData)),
22
- blobVersionedHashes: optional(z.array(rpcHash)),
23
- authorizationList: optional(rpcAuthorizationList),
24
- });
25
- //# sourceMappingURL=tx-request.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"tx-request.js","sourceRoot":"","sources":["../../../../../../../src/internal/builtin-plugins/network-manager/rpc/types/tx-request.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,MAAM,QAAQ,GAAG,CAAyB,MAAS,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC;AA0B1E,MAAM,CAAC,MAAM,qBAAqB,GAAmC,CAAC,CAAC,MAAM,CAAC;IAC5E,IAAI,EAAE,UAAU;IAChB,EAAE,EAAE,QAAQ,CAAC,kBAAkB,CAAC;IAChC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC1B,QAAQ,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC/B,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC5B,KAAK,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC5B,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC;IACvB,UAAU,EAAE,QAAQ,CAAC,aAAa,CAAC;IACnC,OAAO,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC;IACnC,oBAAoB,EAAE,QAAQ,CAAC,WAAW,CAAC;IAC3C,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IACjC,mBAAmB,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/C,iBAAiB,EAAE,QAAQ,CAAC,oBAAoB,CAAC;CAClD,CAAC,CAAC"}
@@ -1,3 +0,0 @@
1
- export declare function isRpcQuantityString(u: unknown): u is string;
2
- export declare function isRpcDataString(u: unknown): u is string;
3
- //# sourceMappingURL=utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/rpc/utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAI3D;AAED,wBAAgB,eAAe,CAAC,CAAC,EAAE,OAAO,GAAG,CAAC,IAAI,MAAM,CAEvD"}
@@ -1,7 +0,0 @@
1
- export function isRpcQuantityString(u) {
2
- return (typeof u === "string" && /^0x(?:0|(?:[1-9a-fA-F][0-9a-fA-F]*))$/.test(u));
3
- }
4
- export function isRpcDataString(u) {
5
- return typeof u === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(u);
6
- }
7
- //# sourceMappingURL=utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/rpc/utils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,mBAAmB,CAAC,CAAU;IAC5C,OAAO,CACL,OAAO,CAAC,KAAK,QAAQ,IAAI,uCAAuC,CAAC,IAAI,CAAC,CAAC,CAAC,CACzE,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,CAAU;IACxC,OAAO,OAAO,CAAC,KAAK,QAAQ,IAAI,yBAAyB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpE,CAAC"}
@@ -1,5 +0,0 @@
1
- import type { ZodType } from "zod";
2
- export declare function validateParams<TypesT extends ReadonlyArray<ZodType<any>>>(params: any[], ...types: TypesT): {
3
- [i in keyof TypesT]: TypesT[i] extends ZodType<infer TypeT> ? TypeT : never;
4
- };
5
- //# sourceMappingURL=validate-params.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-params.d.ts","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/rpc/validate-params.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAInC,wBAAgB,cAAc,CAAC,MAAM,SAAS,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,EACvE,MAAM,EAAE,GAAG,EAAE,EACb,GAAG,KAAK,EAAE,MAAM,GACf;KACA,CAAC,IAAI,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,KAAK,CAAC,GAAG,KAAK,GAAG,KAAK;CAC5E,CAoDA"}
@@ -1,40 +0,0 @@
1
- import { HardhatError } from "@nomicfoundation/hardhat-errors";
2
- export function validateParams(params, ...types) {
3
- if (types === undefined && params.length > 0) {
4
- throw new HardhatError(HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS, {
5
- reason: `No argument was expected and got ${params.length}`,
6
- });
7
- }
8
- let optionalParams = 0;
9
- for (let i = types.length - 1; i >= 0; i--) {
10
- if (types[i].isOptional() || types[i].isNullable()) {
11
- optionalParams += 1;
12
- }
13
- else {
14
- break;
15
- }
16
- }
17
- if (optionalParams === 0) {
18
- if (params.length !== types.length) {
19
- throw new HardhatError(HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS, {
20
- reason: `Expected exactly ${types.length} arguments and got ${params.length}`,
21
- });
22
- }
23
- }
24
- else {
25
- if (params.length > types.length ||
26
- params.length < types.length - optionalParams) {
27
- throw new HardhatError(HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS, {
28
- reason: `Expected between ${types.length - optionalParams} and ${types.length} arguments and got ${params.length}`,
29
- });
30
- }
31
- }
32
- const decoded = [];
33
- for (let i = 0; i < types.length; i++) {
34
- const res = types[i].parse(params[i]);
35
- decoded.push(res);
36
- }
37
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- TypeScript can't infer the complex return type
38
- return decoded;
39
- }
40
- //# sourceMappingURL=validate-params.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate-params.js","sourceRoot":"","sources":["../../../../../../src/internal/builtin-plugins/network-manager/rpc/validate-params.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAE/D,MAAM,UAAU,cAAc,CAC5B,MAAa,EACb,GAAG,KAAa;IAIhB,IAAI,KAAK,KAAK,SAAS,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC7C,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EACxD;YACE,MAAM,EAAE,oCAAoC,MAAM,CAAC,MAAM,EAAE;SAC5D,CACF,CAAC;IACJ,CAAC;IAED,IAAI,cAAc,GAAG,CAAC,CAAC;IACvB,KAAK,IAAI,CAAC,GAAG,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3C,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC;YACnD,cAAc,IAAI,CAAC,CAAC;QACtB,CAAC;aAAM,CAAC;YACN,MAAM;QACR,CAAC;IACH,CAAC;IAED,IAAI,cAAc,KAAK,CAAC,EAAE,CAAC;QACzB,IAAI,MAAM,CAAC,MAAM,KAAK,KAAK,CAAC,MAAM,EAAE,CAAC;YACnC,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EACxD;gBACE,MAAM,EAAE,oBAAoB,KAAK,CAAC,MAAM,sBAAsB,MAAM,CAAC,MAAM,EAAE;aAC9E,CACF,CAAC;QACJ,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IACE,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM;YAC5B,MAAM,CAAC,MAAM,GAAG,KAAK,CAAC,MAAM,GAAG,cAAc,EAC7C,CAAC;YACD,MAAM,IAAI,YAAY,CACpB,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,uBAAuB,EACxD;gBACE,MAAM,EAAE,oBAAoB,KAAK,CAAC,MAAM,GAAG,cAAc,QACvD,KAAK,CAAC,MACR,sBAAsB,MAAM,CAAC,MAAM,EAAE;aACtC,CACF,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,OAAO,GAAU,EAAE,CAAC;IAC1B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACtC,MAAM,GAAG,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;QACtC,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACpB,CAAC;IAED,2HAA2H;IAC3H,OAAO,OAAc,CAAC;AACxB,CAAC"}
@@ -1,18 +0,0 @@
1
- /**
2
- * A class that implements an asynchronous mutex (mutual exclusion) lock.
3
- *
4
- * The mutex ensures that only one asynchronous operation can be executed at a time,
5
- * providing exclusive access to a shared resource.
6
- */
7
- export declare class AsyncMutex {
8
- #private;
9
- /**
10
- * Acquires the mutex, running the provided function exclusively,
11
- * and releasing it afterwards.
12
- *
13
- * @param f The function to run.
14
- * @returns The result of the function.
15
- */
16
- exclusiveRun<ReturnT>(f: () => ReturnT): Promise<Awaited<ReturnT>>;
17
- }
18
- //# sourceMappingURL=async-mutex.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-mutex.d.ts","sourceRoot":"","sources":["../../../../src/internal/core/async-mutex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,qBAAa,UAAU;;IAIrB;;;;;;OAMG;IACU,YAAY,CAAC,OAAO,EAC/B,CAAC,EAAE,MAAM,OAAO,GACf,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;CA+B7B"}
@@ -1,47 +0,0 @@
1
- /**
2
- * A class that implements an asynchronous mutex (mutual exclusion) lock.
3
- *
4
- * The mutex ensures that only one asynchronous operation can be executed at a time,
5
- * providing exclusive access to a shared resource.
6
- */
7
- export class AsyncMutex {
8
- #acquired = false;
9
- #queue = [];
10
- /**
11
- * Acquires the mutex, running the provided function exclusively,
12
- * and releasing it afterwards.
13
- *
14
- * @param f The function to run.
15
- * @returns The result of the function.
16
- */
17
- async exclusiveRun(f) {
18
- const release = await this.#acquire();
19
- try {
20
- return await f();
21
- }
22
- finally {
23
- await release();
24
- }
25
- }
26
- /**
27
- * Acquires the mutex, returning a function that releases it.
28
- */
29
- async #acquire() {
30
- if (!this.#acquired) {
31
- this.#acquired = true;
32
- return async () => {
33
- this.#acquired = false;
34
- const next = this.#queue.shift();
35
- if (next !== undefined) {
36
- next();
37
- }
38
- };
39
- }
40
- return new Promise((resolve) => {
41
- this.#queue.push(() => {
42
- resolve(this.#acquire());
43
- });
44
- });
45
- }
46
- }
47
- //# sourceMappingURL=async-mutex.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"async-mutex.js","sourceRoot":"","sources":["../../../../src/internal/core/async-mutex.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,OAAO,UAAU;IACrB,SAAS,GAAG,KAAK,CAAC;IACT,MAAM,GAAsB,EAAE,CAAC;IAExC;;;;;;OAMG;IACI,KAAK,CAAC,YAAY,CACvB,CAAgB;QAEhB,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEtC,IAAI,CAAC;YACH,OAAO,MAAM,CAAC,EAAE,CAAC;QACnB,CAAC;gBAAS,CAAC;YACT,MAAM,OAAO,EAAE,CAAC;QAClB,CAAC;IACH,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,QAAQ;QACZ,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC;YACpB,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;YACtB,OAAO,KAAK,IAAI,EAAE;gBAChB,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;gBACvB,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;gBACjC,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;oBACvB,IAAI,EAAE,CAAC;gBACT,CAAC;YACH,CAAC,CAAC;QACJ,CAAC;QAED,OAAO,IAAI,OAAO,CAAsB,CAAC,OAAO,EAAE,EAAE;YAClD,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE;gBACpB,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC3B,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,35 +0,0 @@
1
- import { numberToHexString } from "@nomicfoundation/hardhat-utils/hex";
2
-
3
- export function panicErrorCodeToMessage(errorCode: bigint): string {
4
- const reason = panicErrorCodeToReason(errorCode);
5
-
6
- if (reason !== undefined) {
7
- return `reverted with panic code ${numberToHexString(errorCode)} (${reason})`;
8
- }
9
-
10
- return `reverted with unknown panic code ${numberToHexString(errorCode)}`;
11
- }
12
-
13
- function panicErrorCodeToReason(errorCode: bigint): string | undefined {
14
- // eslint-disable-next-line @typescript-eslint/switch-exhaustiveness-check -- we are only covering some of the integer range
15
- switch (errorCode) {
16
- case 0x1n:
17
- return "Assertion error";
18
- case 0x11n:
19
- return "Arithmetic operation overflowed outside of an unchecked block";
20
- case 0x12n:
21
- return "Division or modulo division by zero";
22
- case 0x21n:
23
- return "Tried to convert a value into an enum, but the value was too big or negative";
24
- case 0x22n:
25
- return "Incorrectly encoded storage byte array";
26
- case 0x31n:
27
- return ".pop() was called on an empty array";
28
- case 0x32n:
29
- return "Array accessed at an out-of-bounds or negative index";
30
- case 0x41n:
31
- return "Too much memory was allocated, or an array was created that is too large";
32
- case 0x51n:
33
- return "Called a zero-initialized variable of internal function type";
34
- }
35
- }
@@ -1,20 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { z } from "zod";
4
-
5
- import { rpcData } from "./data.js";
6
-
7
- const nullable = <T extends ZodType<any>>(schema: T) => schema.nullable();
8
-
9
- const rpcAccessListTuple: ZodType<{
10
- address: Uint8Array;
11
- storageKeys: Uint8Array[] | null;
12
- }> = z.object({
13
- address: rpcData,
14
- storageKeys: nullable(z.array(rpcData)),
15
- });
16
-
17
- export type RpcAccessListTuple = z.infer<typeof rpcAccessListTuple>;
18
-
19
- export const rpcAccessList: ZodType<RpcAccessListTuple[]> =
20
- z.array(rpcAccessListTuple);
@@ -1,25 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { isAddress } from "@nomicfoundation/hardhat-utils/eth";
4
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
5
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
6
- import { z } from "zod";
7
-
8
- const ADDRESS_LENGTH_BYTES = 20;
9
-
10
- export const rpcAddress: ZodType<Uint8Array> = conditionalUnionType(
11
- [
12
- [
13
- (data) => Buffer.isBuffer(data) && data.length === ADDRESS_LENGTH_BYTES,
14
- z.instanceof(Uint8Array),
15
- ],
16
- [isAddress, z.string()],
17
- ],
18
- "Expected a Buffer with correct length or a valid RPC address string",
19
- ).transform((v) => (typeof v === "string" ? hexStringToBytes(v) : v));
20
-
21
- export const nullableRpcAddress: ZodType<Uint8Array | null> = rpcAddress
22
- .or(z.null())
23
- .describe(
24
- "Expected a Buffer with correct length, a valid RPC address string, or the null value",
25
- );
@@ -1,5 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { z } from "zod";
4
-
5
- export const rpcAny: ZodType<any> = z.any();
@@ -1,31 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { z } from "zod";
4
-
5
- import { rpcAddress } from "./address.js";
6
- import { rpcHash } from "./hash.js";
7
- import { rpcQuantity } from "./quantity.js";
8
- import { rpcParity } from "./rpc-parity.js";
9
-
10
- const rpcAuthorizationListTuple: ZodType<{
11
- chainId: bigint;
12
- address: Uint8Array;
13
- nonce: bigint;
14
- yParity: Uint8Array;
15
- r: Uint8Array;
16
- s: Uint8Array;
17
- }> = z.object({
18
- chainId: rpcQuantity,
19
- address: rpcAddress,
20
- nonce: rpcQuantity,
21
- yParity: rpcParity,
22
- r: rpcHash,
23
- s: rpcHash,
24
- });
25
-
26
- export type RpcAuthorizationListTuple = z.infer<
27
- typeof rpcAuthorizationListTuple
28
- >;
29
-
30
- export const rpcAuthorizationList: ZodType<RpcAuthorizationListTuple[]> =
31
- z.array(rpcAuthorizationListTuple);
@@ -1,15 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
4
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
5
- import { z } from "zod";
6
-
7
- import { isRpcDataString } from "../utils.js";
8
-
9
- export const rpcData: ZodType<Uint8Array> = conditionalUnionType(
10
- [
11
- [Buffer.isBuffer, z.instanceof(Uint8Array)],
12
- [isRpcDataString, z.string()],
13
- ],
14
- "Expected a Buffer or a valid RPC data string",
15
- ).transform((v) => (typeof v === "string" ? hexStringToBytes(v) : v));
@@ -1,21 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { isHash } from "@nomicfoundation/hardhat-utils/eth";
4
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
5
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
6
- import { z } from "zod";
7
-
8
- const HASH_LENGTH_BYTES = 32;
9
-
10
- export const rpcHash: ZodType<Uint8Array> = conditionalUnionType(
11
- [
12
- [
13
- (data) => Buffer.isBuffer(data) && data.length === HASH_LENGTH_BYTES,
14
- z.instanceof(Uint8Array),
15
- ],
16
- [isHash, z.string()],
17
- ],
18
- "Expected a Buffer with the correct length or a valid RPC hash string",
19
- ).transform((v) =>
20
- typeof v === "string" ? Buffer.from(hexStringToBytes(v)) : v,
21
- );
@@ -1,14 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
4
- import { z } from "zod";
5
-
6
- import { isRpcQuantityString } from "../utils.js";
7
-
8
- export const rpcQuantity: ZodType<bigint> = conditionalUnionType(
9
- [
10
- [(data) => typeof data === "bigint", z.bigint()],
11
- [isRpcQuantityString, z.string()],
12
- ],
13
- "Expected a bigint or a valid RPC quantity string",
14
- ).transform((v) => (typeof v === "string" ? BigInt(v) : v));
@@ -1,24 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { hexStringToBytes } from "@nomicfoundation/hardhat-utils/hex";
4
- import { conditionalUnionType } from "@nomicfoundation/hardhat-zod-utils";
5
- import { z } from "zod";
6
-
7
- const PARITY_LENGTH_BYTES = 1;
8
-
9
- export const rpcParity: ZodType<Buffer> = conditionalUnionType(
10
- [
11
- [
12
- (data) => Buffer.isBuffer(data) && data.length === PARITY_LENGTH_BYTES,
13
- z.instanceof(Uint8Array),
14
- ],
15
- [isRpcParityString, z.string()],
16
- ],
17
- "Expected a Buffer or valid parity string",
18
- ).transform((v) =>
19
- typeof v === "string" ? Buffer.from(hexStringToBytes(v)) : v,
20
- );
21
-
22
- function isRpcParityString(u: unknown): u is string {
23
- return typeof u === "string" && u.match(/^0x[0-9a-fA-F]{1,2}$/) !== null;
24
- }
@@ -1,53 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { z } from "zod";
4
-
5
- import { rpcAccessList } from "./access-list.js";
6
- import { nullableRpcAddress, rpcAddress } from "./address.js";
7
- import { rpcAuthorizationList } from "./authorization-list.js";
8
- import { rpcData } from "./data.js";
9
- import { rpcHash } from "./hash.js";
10
- import { rpcQuantity } from "./quantity.js";
11
-
12
- const optional = <T extends ZodType<any>>(schema: T) => schema.optional();
13
-
14
- export interface RpcTransactionRequest {
15
- from: Uint8Array;
16
- to?: Uint8Array | null;
17
- gas?: bigint;
18
- gasPrice?: bigint;
19
- value?: bigint;
20
- nonce?: bigint;
21
- data?: Uint8Array;
22
- accessList?: Array<{ address: Uint8Array; storageKeys: Uint8Array[] | null }>;
23
- chainId?: bigint;
24
- maxFeePerGas?: bigint;
25
- maxPriorityFeePerGas?: bigint;
26
- blobs?: Uint8Array[];
27
- blobVersionedHashes?: Uint8Array[];
28
- authorizationList?: Array<{
29
- chainId: bigint;
30
- address: Uint8Array;
31
- nonce: bigint;
32
- yParity: Uint8Array;
33
- r: Uint8Array;
34
- s: Uint8Array;
35
- }>;
36
- }
37
-
38
- export const rpcTransactionRequest: ZodType<RpcTransactionRequest> = z.object({
39
- from: rpcAddress,
40
- to: optional(nullableRpcAddress),
41
- gas: optional(rpcQuantity),
42
- gasPrice: optional(rpcQuantity),
43
- value: optional(rpcQuantity),
44
- nonce: optional(rpcQuantity),
45
- data: optional(rpcData),
46
- accessList: optional(rpcAccessList),
47
- chainId: optional(rpcQuantity),
48
- maxFeePerGas: optional(rpcQuantity),
49
- maxPriorityFeePerGas: optional(rpcQuantity),
50
- blobs: optional(z.array(rpcData)),
51
- blobVersionedHashes: optional(z.array(rpcHash)),
52
- authorizationList: optional(rpcAuthorizationList),
53
- });
@@ -1,9 +0,0 @@
1
- export function isRpcQuantityString(u: unknown): u is string {
2
- return (
3
- typeof u === "string" && /^0x(?:0|(?:[1-9a-fA-F][0-9a-fA-F]*))$/.test(u)
4
- );
5
- }
6
-
7
- export function isRpcDataString(u: unknown): u is string {
8
- return typeof u === "string" && /^0x(?:[0-9a-fA-F]{2})*$/.test(u);
9
- }
@@ -1,62 +0,0 @@
1
- import type { ZodType } from "zod";
2
-
3
- import { HardhatError } from "@nomicfoundation/hardhat-errors";
4
-
5
- export function validateParams<TypesT extends ReadonlyArray<ZodType<any>>>(
6
- params: any[],
7
- ...types: TypesT
8
- ): {
9
- [i in keyof TypesT]: TypesT[i] extends ZodType<infer TypeT> ? TypeT : never;
10
- } {
11
- if (types === undefined && params.length > 0) {
12
- throw new HardhatError(
13
- HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS,
14
- {
15
- reason: `No argument was expected and got ${params.length}`,
16
- },
17
- );
18
- }
19
-
20
- let optionalParams = 0;
21
- for (let i = types.length - 1; i >= 0; i--) {
22
- if (types[i].isOptional() || types[i].isNullable()) {
23
- optionalParams += 1;
24
- } else {
25
- break;
26
- }
27
- }
28
-
29
- if (optionalParams === 0) {
30
- if (params.length !== types.length) {
31
- throw new HardhatError(
32
- HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS,
33
- {
34
- reason: `Expected exactly ${types.length} arguments and got ${params.length}`,
35
- },
36
- );
37
- }
38
- } else {
39
- if (
40
- params.length > types.length ||
41
- params.length < types.length - optionalParams
42
- ) {
43
- throw new HardhatError(
44
- HardhatError.ERRORS.CORE.NETWORK.WRONG_VALIDATION_PARAMS,
45
- {
46
- reason: `Expected between ${types.length - optionalParams} and ${
47
- types.length
48
- } arguments and got ${params.length}`,
49
- },
50
- );
51
- }
52
- }
53
-
54
- const decoded: any[] = [];
55
- for (let i = 0; i < types.length; i++) {
56
- const res = types[i].parse(params[i]);
57
- decoded.push(res);
58
- }
59
-
60
- // eslint-disable-next-line @typescript-eslint/consistent-type-assertions -- TypeScript can't infer the complex return type
61
- return decoded as any;
62
- }