viem 0.2.0-jxom-local-accounts.20230321T210352 → 0.2.0-jxom-local-accounts.20230321T212822

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 (56) hide show
  1. package/accounts/package.json +4 -0
  2. package/dist/abi.js +2 -2
  3. package/dist/abi.mjs +1 -1
  4. package/dist/accounts/index.d.ts +33 -0
  5. package/dist/accounts/index.js +89 -0
  6. package/dist/accounts/index.js.map +1 -0
  7. package/dist/accounts/index.mjs +89 -0
  8. package/dist/accounts/index.mjs.map +1 -0
  9. package/dist/chains.js +63 -63
  10. package/dist/chains.mjs +1 -1
  11. package/dist/{chunk-IXGTN6B7.mjs → chunk-6UKHPIXX.mjs} +2 -2
  12. package/dist/chunk-FNVFGFWN.mjs +31 -0
  13. package/dist/chunk-FNVFGFWN.mjs.map +1 -0
  14. package/dist/chunk-FQM5MF6U.js +31 -0
  15. package/dist/chunk-FQM5MF6U.js.map +1 -0
  16. package/dist/{chunk-PB263D6W.mjs → chunk-IVRML3IK.mjs} +869 -880
  17. package/dist/chunk-IVRML3IK.mjs.map +1 -0
  18. package/dist/{chunk-K66BKQUH.js → chunk-LYQKHD7R.js} +19 -19
  19. package/dist/{chunk-FHJTO6BQ.js → chunk-NJSAEA2H.js} +821 -832
  20. package/dist/chunk-NJSAEA2H.js.map +1 -0
  21. package/dist/contract.d.ts +3 -2
  22. package/dist/contract.js +2 -2
  23. package/dist/contract.mjs +1 -1
  24. package/dist/{createPublicClient-62c74ebc.d.ts → createPublicClient-d2c37c92.d.ts} +2 -2
  25. package/dist/ens.d.ts +3 -2
  26. package/dist/ens.js +3 -3
  27. package/dist/ens.mjs +2 -2
  28. package/dist/ethers.d.ts +2 -1
  29. package/dist/ethers.js +5 -3
  30. package/dist/ethers.js.map +1 -1
  31. package/dist/ethers.mjs +4 -2
  32. package/dist/ethers.mjs.map +1 -1
  33. package/dist/index.d.ts +5 -4
  34. package/dist/index.js +91 -91
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +2 -2
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/parseAccount-2d7ea01d.d.ts +6 -0
  39. package/dist/{parseGwei-7efc43fc.d.ts → parseGwei-377678bc.d.ts} +7 -7
  40. package/dist/public.d.ts +3 -2
  41. package/dist/public.js +2 -2
  42. package/dist/public.mjs +1 -1
  43. package/dist/test.js +2 -2
  44. package/dist/test.mjs +1 -1
  45. package/dist/{typedData-0514bb3c.d.ts → typedData-ade018d6.d.ts} +19 -2
  46. package/dist/utils/index.d.ts +7 -5
  47. package/dist/utils/index.js +4 -2
  48. package/dist/utils/index.mjs +3 -1
  49. package/dist/wallet.d.ts +3 -2
  50. package/dist/wallet.js +2 -2
  51. package/dist/wallet.mjs +1 -1
  52. package/package.json +7 -1
  53. package/dist/chunk-FHJTO6BQ.js.map +0 -1
  54. package/dist/chunk-PB263D6W.mjs.map +0 -1
  55. /package/dist/{chunk-IXGTN6B7.mjs.map → chunk-6UKHPIXX.mjs.map} +0 -0
  56. /package/dist/{chunk-K66BKQUH.js.map → chunk-LYQKHD7R.js.map} +0 -0
@@ -25,7 +25,7 @@ var package_default = {
25
25
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
26
26
  bench: "vitest bench --no-threads",
27
27
  "bench:ci": "CI=true vitest bench --no-threads",
28
- build: "tsup",
28
+ build: "tsup && size-limit",
29
29
  changeset: "changeset",
30
30
  "changeset:release": "pnpm build && changeset publish",
31
31
  "changeset:version": "changeset version && pnpm install --lockfile-only",
@@ -53,6 +53,7 @@ var package_default = {
53
53
  entry: [
54
54
  "src/index.ts",
55
55
  "src/abi.ts",
56
+ "src/accounts/index.ts",
56
57
  "src/chains.ts",
57
58
  "src/contract.ts",
58
59
  "src/ens.ts",
@@ -66,6 +67,7 @@ var package_default = {
66
67
  },
67
68
  files: [
68
69
  "/abi",
70
+ "/accounts",
69
71
  "/dist",
70
72
  "/chains",
71
73
  "/contract",
@@ -88,6 +90,11 @@ var package_default = {
88
90
  module: "./dist/abi.mts",
89
91
  default: "./dist/abi.js"
90
92
  },
93
+ "./accounts": {
94
+ types: "./dist/accounts/index.d.ts",
95
+ module: "./dist/accounts/index.mts",
96
+ default: "./dist/accounts/index.js"
97
+ },
91
98
  "./chains": {
92
99
  types: "./dist/chains.d.ts",
93
100
  module: "./dist/chains.mts",
@@ -156,6 +163,7 @@ var package_default = {
156
163
  "@adraffy/ens-normalize": "^1.8.9",
157
164
  "@changesets/changelog-github": "^0.4.5",
158
165
  "@changesets/cli": "^2.23.2",
166
+ "@size-limit/preset-big-lib": "^8.2.4",
159
167
  "@types/dedent": "^0.7.0",
160
168
  "@types/fs-extra": "^9.0.13",
161
169
  "@types/node": "^17.0.45",
@@ -173,6 +181,7 @@ var package_default = {
173
181
  rimraf: "^4.1.2",
174
182
  rome: "^11.0.0",
175
183
  "simple-git-hooks": "^2.8.1",
184
+ "size-limit": "^8.2.4",
176
185
  tsup: "^6.6.0",
177
186
  typescript: "^4.9.4",
178
187
  vite: "^4.1.4",
@@ -191,6 +200,11 @@ var package_default = {
191
200
  "wallet",
192
201
  "web3"
193
202
  ],
203
+ "size-limit": [
204
+ {
205
+ path: "dist/index.js"
206
+ }
207
+ ],
194
208
  "simple-git-hooks": {
195
209
  "pre-commit": "pnpm format && pnpm lint:fix"
196
210
  },
@@ -616,714 +630,157 @@ var ChainNotFoundError = class extends BaseError {
616
630
  }
617
631
  };
618
632
 
619
- // src/accounts/index.ts
620
- var _bip32 = require('@scure/bip32');
621
-
622
- // src/accounts/utils/parseAccount.ts
623
- function parseAccount(account) {
624
- if (typeof account === "string")
625
- return { address: account, type: "json-rpc" };
626
- return account;
627
- }
628
-
629
- // src/utils/data/concat.ts
630
- function concat(values) {
631
- if (typeof values[0] === "string")
632
- return concatHex(values);
633
- return concatBytes(values);
634
- }
635
- function concatBytes(values) {
636
- let length = 0;
637
- for (const arr of values) {
638
- length += arr.length;
639
- }
640
- const result = new Uint8Array(length);
641
- let offset = 0;
642
- for (const arr of values) {
643
- result.set(arr, offset);
644
- offset += arr.length;
633
+ // src/constants/abis.ts
634
+ var multicall3Abi = [
635
+ {
636
+ inputs: [
637
+ {
638
+ components: [
639
+ {
640
+ name: "target",
641
+ type: "address"
642
+ },
643
+ {
644
+ name: "allowFailure",
645
+ type: "bool"
646
+ },
647
+ {
648
+ name: "callData",
649
+ type: "bytes"
650
+ }
651
+ ],
652
+ name: "calls",
653
+ type: "tuple[]"
654
+ }
655
+ ],
656
+ name: "aggregate3",
657
+ outputs: [
658
+ {
659
+ components: [
660
+ {
661
+ name: "success",
662
+ type: "bool"
663
+ },
664
+ {
665
+ name: "returnData",
666
+ type: "bytes"
667
+ }
668
+ ],
669
+ name: "returnData",
670
+ type: "tuple[]"
671
+ }
672
+ ],
673
+ stateMutability: "view",
674
+ type: "function"
645
675
  }
646
- return result;
647
- }
648
- function concatHex(values) {
649
- return `0x${values.reduce(
650
- (acc, x) => acc + x.replace("0x", ""),
651
- ""
652
- )}`;
653
- }
676
+ ];
654
677
 
655
- // src/utils/data/isBytes.ts
656
- function isBytes(value) {
657
- if (!value)
658
- return false;
659
- if (typeof value !== "object")
660
- return false;
661
- if (!("BYTES_PER_ELEMENT" in value))
662
- return false;
663
- return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
664
- }
678
+ // src/constants/solidity.ts
679
+ var panicReasons = {
680
+ 1: "An `assert` condition failed.",
681
+ 17: "Arithmic operation resulted in underflow or overflow.",
682
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
683
+ 33: "Attempted to convert to an invalid type.",
684
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
685
+ 49: "Performed `.pop()` on an empty array",
686
+ 50: "Array index is out of bounds.",
687
+ 65: "Allocated too much memory or created an array which is too large.",
688
+ 81: "Attempted to call a zero-initialized variable of internal function type."
689
+ };
690
+ var solidityError = {
691
+ inputs: [
692
+ {
693
+ name: "message",
694
+ type: "string"
695
+ }
696
+ ],
697
+ name: "Error",
698
+ type: "error"
699
+ };
700
+ var solidityPanic = {
701
+ inputs: [
702
+ {
703
+ name: "reason",
704
+ type: "uint256"
705
+ }
706
+ ],
707
+ name: "Panic",
708
+ type: "error"
709
+ };
665
710
 
666
- // src/utils/data/isHex.ts
667
- function isHex(value) {
668
- if (!value)
669
- return false;
670
- if (typeof value !== "string")
671
- return false;
672
- return /^0x[0-9a-fA-F]*$/.test(value);
673
- }
711
+ // src/constants/unit.ts
712
+ var etherUnits = {
713
+ gwei: 9,
714
+ wei: 18
715
+ };
716
+ var gweiUnits = {
717
+ ether: -9,
718
+ wei: 9
719
+ };
720
+ var weiUnits = {
721
+ ether: -18,
722
+ gwei: -9
723
+ };
674
724
 
675
- // src/utils/data/pad.ts
676
- function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
677
- if (typeof hexOrBytes === "string")
678
- return padHex(hexOrBytes, { dir, size: size2 });
679
- return padBytes(hexOrBytes, { dir, size: size2 });
725
+ // src/errors/transaction.ts
726
+ function prettyPrint(args) {
727
+ const entries = Object.entries(args).map(([key, value]) => {
728
+ if (value === void 0 || value === false)
729
+ return null;
730
+ return [key, value];
731
+ }).filter(Boolean);
732
+ const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
733
+ return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
680
734
  }
681
- function padHex(hex_, { dir, size: size2 = 32 } = {}) {
682
- if (size2 === null)
683
- return hex_;
684
- let hex = hex_.replace("0x", "");
685
- if (hex.length > size2 * 2)
686
- throw new SizeExceedsPaddingSizeError({
687
- size: Math.ceil(hex.length / 2),
688
- targetSize: size2,
689
- type: "hex"
735
+ var FeeConflictError = class extends BaseError {
736
+ constructor() {
737
+ super(
738
+ [
739
+ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
740
+ "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
741
+ ].join("\n")
742
+ );
743
+ __publicField(this, "name", "FeeConflictError");
744
+ }
745
+ };
746
+ var TransactionExecutionError = class extends BaseError {
747
+ constructor(cause, {
748
+ account,
749
+ docsPath: docsPath6,
750
+ chain,
751
+ data,
752
+ gas,
753
+ gasPrice,
754
+ maxFeePerGas,
755
+ maxPriorityFeePerGas,
756
+ nonce,
757
+ to,
758
+ value
759
+ }) {
760
+ const prettyArgs = prettyPrint({
761
+ chain: chain && `${_optionalChain([chain, 'optionalAccess', _4 => _4.name])} (id: ${_optionalChain([chain, 'optionalAccess', _5 => _5.id])})`,
762
+ from: _optionalChain([account, 'optionalAccess', _6 => _6.address]),
763
+ to,
764
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _7 => _7.nativeCurrency, 'access', _8 => _8.symbol]) || "ETH"}`,
765
+ data,
766
+ gas,
767
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
768
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
769
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
770
+ nonce
690
771
  });
691
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](
692
- size2 * 2,
693
- "0"
694
- )}`;
695
- }
696
- function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
697
- if (size2 === null)
698
- return bytes;
699
- if (bytes.length > size2)
700
- throw new SizeExceedsPaddingSizeError({
701
- size: bytes.length,
702
- targetSize: size2,
703
- type: "bytes"
772
+ super(cause.shortMessage, {
773
+ cause,
774
+ docsPath: docsPath6,
775
+ metaMessages: [
776
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
777
+ "Request Arguments:",
778
+ prettyArgs
779
+ ].filter(Boolean)
704
780
  });
705
- const paddedBytes = new Uint8Array(size2);
706
- for (let i = 0; i < size2; i++) {
707
- const padEnd = dir === "right";
708
- paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
709
- }
710
- return paddedBytes;
711
- }
712
-
713
- // src/utils/data/trim.ts
714
- function trim(hexOrBytes, { dir = "left" } = {}) {
715
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
716
- let sliceLength = 0;
717
- for (let i = 0; i < data.length - 1; i++) {
718
- if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
719
- sliceLength++;
720
- else
721
- break;
722
- }
723
- data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
724
- if (typeof hexOrBytes === "string") {
725
- if (data.length === 1 && dir === "right")
726
- data = `${data}0`;
727
- return `0x${data}`;
728
- }
729
- return data;
730
- }
731
-
732
- // src/utils/data/size.ts
733
- function size(value) {
734
- if (isHex(value))
735
- return Math.ceil((value.length - 2) / 2);
736
- return value.length;
737
- }
738
-
739
- // src/utils/data/slice.ts
740
- function slice(value, start, end) {
741
- if (isHex(value))
742
- return sliceHex(value, start, end);
743
- return sliceBytes(value, start, end);
744
- }
745
- function assertStartOffset(value, start) {
746
- if (typeof start === "number" && start > 0 && start > size(value) - 1)
747
- throw new Error(
748
- `Slice starting at offset "${start}" is out-of-bounds (size: ${size(
749
- value
750
- )}).`
751
- );
752
- }
753
- function sliceBytes(value, start, end) {
754
- assertStartOffset(value, start);
755
- return value.slice(start, end);
756
- }
757
- function sliceHex(value_, start, end) {
758
- assertStartOffset(value_, start);
759
- const value = value_.replace("0x", "").slice((_nullishCoalesce(start, () => ( 0))) * 2, (_nullishCoalesce(end, () => ( value_.length))) * 2);
760
- return `0x${value}`;
761
- }
762
-
763
- // src/utils/encoding/toHex.ts
764
- var hexes = Array.from(
765
- { length: 256 },
766
- (_v, i) => i.toString(16).padStart(2, "0")
767
- );
768
- function boolToHex(value) {
769
- return `0x${Number(value)}`;
770
- }
771
- function bytesToHex(value) {
772
- let hex = "";
773
- for (let i = 0; i < value.length; i++) {
774
- hex += hexes[value[i]];
775
- }
776
- return `0x${hex}`;
777
- }
778
- function toHex(value) {
779
- if (typeof value === "number" || typeof value === "bigint")
780
- return numberToHex(value);
781
- if (typeof value === "string") {
782
- return stringToHex(value);
783
- }
784
- if (typeof value === "boolean")
785
- return boolToHex(value);
786
- return bytesToHex(value);
787
- }
788
- function numberToHex(value_, opts = {}) {
789
- const { signed, size: size2 } = opts;
790
- let value = BigInt(value_);
791
- let maxValue;
792
- if (size2) {
793
- if (signed)
794
- maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
795
- else
796
- maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
797
- } else if (typeof value_ === "number") {
798
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
799
- }
800
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
801
- if (maxValue && value > maxValue || value < minValue) {
802
- const suffix = typeof value_ === "bigint" ? "n" : "";
803
- throw new IntegerOutOfRangeError({
804
- max: maxValue ? `${maxValue}${suffix}` : void 0,
805
- min: `${minValue}${suffix}`,
806
- signed,
807
- size: size2,
808
- value: `${value_}${suffix}`
809
- });
810
- }
811
- const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
812
- if (size2)
813
- return pad(hex, { size: size2 });
814
- return hex;
815
- }
816
- var encoder = new TextEncoder();
817
- function stringToHex(value_) {
818
- const value = encoder.encode(value_);
819
- return toHex(value);
820
- }
821
-
822
- // src/utils/encoding/toBytes.ts
823
- var encoder2 = new TextEncoder();
824
- function toBytes(value) {
825
- if (typeof value === "number" || typeof value === "bigint")
826
- return numberToBytes(value);
827
- if (typeof value === "boolean")
828
- return boolToBytes(value);
829
- if (value.startsWith("0x"))
830
- return hexToBytes(value);
831
- return stringToBytes(value);
832
- }
833
- function boolToBytes(value) {
834
- const bytes = new Uint8Array(1);
835
- bytes[0] = Number(value);
836
- return bytes;
837
- }
838
- function hexToBytes(hex_) {
839
- let hex = hex_.slice(2);
840
- if (hex.length % 2)
841
- hex = `0${hex}`;
842
- const bytes = new Uint8Array(hex.length / 2);
843
- for (let index = 0; index < bytes.length; index++) {
844
- const start = index * 2;
845
- const hexByte = hex.slice(start, start + 2);
846
- const byte = Number.parseInt(hexByte, 16);
847
- if (Number.isNaN(byte) || byte < 0)
848
- throw new BaseError(`Invalid byte sequence ("${hexByte}" in "${hex}").`);
849
- bytes[index] = byte;
850
- }
851
- return bytes;
852
- }
853
- function numberToBytes(value, opts) {
854
- const hex = numberToHex(value, opts);
855
- return hexToBytes(hex);
856
- }
857
- function stringToBytes(value) {
858
- return encoder2.encode(value);
859
- }
860
-
861
- // src/utils/encoding/toRlp.ts
862
- function toRlp(hexOrBytes, to_) {
863
- const to = to_ || "hex";
864
- return format(bytesToRlp(parse(hexOrBytes)), to);
865
- }
866
- function parse(hexOrBytes) {
867
- if (Array.isArray(hexOrBytes))
868
- return hexOrBytes.map(parse);
869
- return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
870
- }
871
- function format(bytes, type = "bytes") {
872
- return type === "hex" ? bytesToHex(bytes) : bytes;
873
- }
874
- function bytesToRlp(bytes) {
875
- if (Array.isArray(bytes)) {
876
- const encoded = concat(bytes.map(bytesToRlp));
877
- return new Uint8Array([...encodeLength(encoded.length, 192), ...encoded]);
878
- }
879
- if (bytes.length === 1 && bytes[0] < 128)
880
- return bytes;
881
- return new Uint8Array([...encodeLength(bytes.length, 128), ...bytes]);
882
- }
883
- function encodeLength(length, offset) {
884
- if (length < 56)
885
- return [offset + length];
886
- return [toBytes(length).length + offset + 55, ...toBytes(length)];
887
- }
888
-
889
- // src/utils/encoding/fromHex.ts
890
- function fromHex(hex, to) {
891
- if (to === "number")
892
- return hexToNumber(hex);
893
- if (to === "bigint")
894
- return hexToBigInt(hex);
895
- if (to === "string")
896
- return hexToString(hex);
897
- if (to === "boolean")
898
- return hexToBool(hex);
899
- return hexToBytes(hex);
900
- }
901
- function hexToBigInt(hex, opts = {}) {
902
- const { signed } = opts;
903
- const value = BigInt(hex);
904
- if (!signed)
905
- return value;
906
- const size2 = (hex.length - 2) / 2;
907
- const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
908
- if (value <= max)
909
- return value;
910
- return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
911
- }
912
- function hexToBool(hex) {
913
- if (trim(hex) === "0x0")
914
- return false;
915
- if (trim(hex) === "0x1")
916
- return true;
917
- throw new InvalidHexBooleanError(hex);
918
- }
919
- function hexToNumber(hex, opts = {}) {
920
- return Number(hexToBigInt(hex, opts));
921
- }
922
- function hexToString(hex) {
923
- const bytes = hexToBytes(hex);
924
- return new TextDecoder().decode(bytes);
925
- }
926
-
927
- // src/utils/encoding/fromBytes.ts
928
- function fromBytes(bytes, to) {
929
- if (to === "number")
930
- return bytesToNumber(bytes);
931
- if (to === "bigint")
932
- return bytesToBigint(bytes);
933
- if (to === "boolean")
934
- return bytesToBool(bytes);
935
- if (to === "string")
936
- return bytesToString(bytes);
937
- return bytesToHex(bytes);
938
- }
939
- function bytesToBigint(bytes) {
940
- const hex = bytesToHex(bytes);
941
- return hexToBigInt(hex);
942
- }
943
- function bytesToBool(bytes) {
944
- if (bytes.length > 1 || bytes[0] > 1)
945
- throw new InvalidBytesBooleanError(bytes);
946
- return Boolean(bytes[0]);
947
- }
948
- function bytesToNumber(bytes) {
949
- const hex = bytesToHex(bytes);
950
- return hexToNumber(hex);
951
- }
952
- function bytesToString(bytes) {
953
- return new TextDecoder().decode(bytes);
954
- }
955
-
956
- // src/utils/encoding/fromRlp.ts
957
- function fromRlp(value, to) {
958
- const bytes = parse2(value);
959
- const [data, consumed] = rlpToBytes(bytes);
960
- if (consumed < bytes.length)
961
- throw new DataLengthTooLongError({
962
- consumed,
963
- length: bytes.length
964
- });
965
- return format2(data, to);
966
- }
967
- function parse2(value) {
968
- if (typeof value === "string") {
969
- if (value.length > 3 && value.length % 2 !== 0)
970
- throw new InvalidHexValueError(value);
971
- return hexToBytes(value);
972
- }
973
- return value;
974
- }
975
- function format2(bytes, to) {
976
- if (Array.isArray(bytes))
977
- return bytes.map((b) => format2(b, to));
978
- return to === "hex" ? trim(bytesToHex(bytes)) : bytes;
979
- }
980
- function rlpToBytes(bytes, offset = 0) {
981
- if (bytes.length === 0)
982
- return [new Uint8Array([]), 0];
983
- const prefix = bytes[offset];
984
- if (prefix <= 127)
985
- return [new Uint8Array([bytes[offset]]), 1];
986
- if (prefix <= 183) {
987
- const length2 = prefix - 128;
988
- const offset_ = offset + 1;
989
- if (offset_ + length2 > bytes.length)
990
- throw new DataLengthTooShortError({
991
- length: offset_ + length2,
992
- dataLength: bytes.length
993
- });
994
- return [bytes.slice(offset_, offset_ + length2), 1 + length2];
995
- }
996
- if (prefix <= 191) {
997
- const lengthOfLength2 = prefix - 183;
998
- const offset_ = offset + 1;
999
- const length2 = bytesToNumber(bytes.slice(offset_, offset_ + lengthOfLength2));
1000
- if (offset_ + lengthOfLength2 + length2 > bytes.length)
1001
- throw new DataLengthTooShortError({
1002
- length: lengthOfLength2 + length2,
1003
- dataLength: bytes.length - lengthOfLength2
1004
- });
1005
- return [
1006
- bytes.slice(offset_ + lengthOfLength2, offset_ + lengthOfLength2 + length2),
1007
- 1 + lengthOfLength2 + length2
1008
- ];
1009
- }
1010
- let lengthOfLength = 0;
1011
- let length = prefix - 192;
1012
- if (prefix > 247) {
1013
- lengthOfLength = prefix - 247;
1014
- length = bytesToNumber(bytes.slice(offset + 1, offset + 1 + lengthOfLength));
1015
- }
1016
- let nextOffset = offset + 1 + lengthOfLength;
1017
- if (nextOffset > bytes.length)
1018
- throw new DataLengthTooShortError({
1019
- length: nextOffset,
1020
- dataLength: bytes.length
1021
- });
1022
- let consumed = 1 + lengthOfLength + length;
1023
- let result = [];
1024
- while (nextOffset < offset + consumed) {
1025
- const decoded = rlpToBytes(bytes, nextOffset);
1026
- result.push(decoded[0]);
1027
- nextOffset += decoded[1];
1028
- if (nextOffset > offset + consumed)
1029
- throw new OffsetOutOfBoundsError({
1030
- nextOffset,
1031
- offset: offset + consumed
1032
- });
1033
- }
1034
- return [result, consumed];
1035
- }
1036
-
1037
- // src/utils/contract/extractFunctionParts.ts
1038
- var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1039
- function extractFunctionParts(def) {
1040
- const parts = def.match(paramsRegex);
1041
- const type = _optionalChain([parts, 'optionalAccess', _4 => _4[2]]) || void 0;
1042
- const name = _optionalChain([parts, 'optionalAccess', _5 => _5[3]]);
1043
- const params = _optionalChain([parts, 'optionalAccess', _6 => _6[5]]) || void 0;
1044
- return { type, name, params };
1045
- }
1046
- function extractFunctionName(def) {
1047
- return extractFunctionParts(def).name;
1048
- }
1049
- function extractFunctionParams(def) {
1050
- const params = extractFunctionParts(def).params;
1051
- const splitParams = _optionalChain([params, 'optionalAccess', _7 => _7.split, 'call', _8 => _8(","), 'access', _9 => _9.map, 'call', _10 => _10((x) => x.trim().split(" "))]);
1052
- return _optionalChain([splitParams, 'optionalAccess', _11 => _11.map, 'call', _12 => _12((param) => ({
1053
- type: param[0],
1054
- name: param[1] === "indexed" ? param[2] : param[1],
1055
- ...param[1] === "indexed" ? { indexed: true } : {}
1056
- }))]);
1057
- }
1058
- function extractFunctionType(def) {
1059
- return extractFunctionParts(def).type;
1060
- }
1061
-
1062
- // src/utils/hash/keccak256.ts
1063
- var _sha3 = require('@noble/hashes/sha3');
1064
- function keccak256(value, to_) {
1065
- const to = to_ || "hex";
1066
- const bytes = _sha3.keccak_256.call(void 0, isHex(value) ? toBytes(value) : value);
1067
- if (to === "bytes")
1068
- return bytes;
1069
- return toHex(bytes);
1070
- }
1071
-
1072
- // src/utils/hash/hashFunction.ts
1073
- var hash = (value) => keccak256(toBytes(value));
1074
- function hashFunction(def) {
1075
- const name = extractFunctionName(def);
1076
- const params = extractFunctionParams(def);
1077
- if (!params || params.length === 0)
1078
- return hash(def.replace(/ /g, ""));
1079
- return hash(`${name}(${params.map(({ type }) => type).join(",")})`);
1080
- }
1081
-
1082
- // src/utils/hash/getEventSelector.ts
1083
- var getEventSelector = (event) => hashFunction(event);
1084
-
1085
- // src/utils/hash/getFunctionSelector.ts
1086
- var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
1087
-
1088
- // src/utils/address/isAddress.ts
1089
- var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1090
- function isAddress(address) {
1091
- return addressRegex.test(address);
1092
- }
1093
-
1094
- // src/utils/address/getAddress.ts
1095
- function checksumAddress(address_) {
1096
- const hexAddress = address_.substring(2).toLowerCase();
1097
- const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1098
- let address = hexAddress.split("");
1099
- for (let i = 0; i < 40; i += 2) {
1100
- if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1101
- address[i] = address[i].toUpperCase();
1102
- }
1103
- if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1104
- address[i + 1] = address[i + 1].toUpperCase();
1105
- }
1106
- }
1107
- return `0x${address.join("")}`;
1108
- }
1109
- function getAddress(address) {
1110
- if (!isAddress(address))
1111
- throw new InvalidAddressError({ address });
1112
- return checksumAddress(address);
1113
- }
1114
-
1115
- // src/utils/address/getContractAddress.ts
1116
- function getContractAddress2(opts) {
1117
- if (opts.opcode === "CREATE2")
1118
- return getCreate2Address(opts);
1119
- return getCreateAddress(opts);
1120
- }
1121
- function getCreateAddress(opts) {
1122
- const from = toBytes(getAddress(opts.from));
1123
- let nonce = toBytes(opts.nonce);
1124
- if (nonce[0] === 0)
1125
- nonce = new Uint8Array([]);
1126
- return getAddress(
1127
- `0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
1128
- );
1129
- }
1130
- function getCreate2Address(opts) {
1131
- const from = toBytes(getAddress(opts.from));
1132
- const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
1133
- size: 32
1134
- });
1135
- const bytecodeHash = toBytes(
1136
- keccak256(
1137
- isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
1138
- )
1139
- );
1140
- return getAddress(
1141
- slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
1142
- );
1143
- }
1144
-
1145
- // src/utils/address/isAddressEqual.ts
1146
- function isAddressEqual(a, b) {
1147
- if (!isAddress(a))
1148
- throw new InvalidAddressError({ address: a });
1149
- if (!isAddress(b))
1150
- throw new InvalidAddressError({ address: b });
1151
- return a.toLowerCase() === b.toLowerCase();
1152
- }
1153
-
1154
- // src/accounts/toAccount.ts
1155
- function toAccount(source) {
1156
- if (typeof source === "string") {
1157
- if (!isAddress(source))
1158
- throw new InvalidAddressError({ address: source });
1159
- return {
1160
- address: source,
1161
- type: "json-rpc"
1162
- };
1163
- }
1164
- if (!isAddress(source.address))
1165
- throw new InvalidAddressError({ address: source.address });
1166
- return {
1167
- address: source.address,
1168
- signMessage: source.signMessage,
1169
- signTransaction: source.signTransaction,
1170
- signTypedData: source.signTypedData,
1171
- source: "custom",
1172
- type: "local"
1173
- };
1174
- }
1175
-
1176
- // src/constants/abis.ts
1177
- var multicall3Abi = [
1178
- {
1179
- inputs: [
1180
- {
1181
- components: [
1182
- {
1183
- name: "target",
1184
- type: "address"
1185
- },
1186
- {
1187
- name: "allowFailure",
1188
- type: "bool"
1189
- },
1190
- {
1191
- name: "callData",
1192
- type: "bytes"
1193
- }
1194
- ],
1195
- name: "calls",
1196
- type: "tuple[]"
1197
- }
1198
- ],
1199
- name: "aggregate3",
1200
- outputs: [
1201
- {
1202
- components: [
1203
- {
1204
- name: "success",
1205
- type: "bool"
1206
- },
1207
- {
1208
- name: "returnData",
1209
- type: "bytes"
1210
- }
1211
- ],
1212
- name: "returnData",
1213
- type: "tuple[]"
1214
- }
1215
- ],
1216
- stateMutability: "view",
1217
- type: "function"
1218
- }
1219
- ];
1220
-
1221
- // src/constants/solidity.ts
1222
- var panicReasons = {
1223
- 1: "An `assert` condition failed.",
1224
- 17: "Arithmic operation resulted in underflow or overflow.",
1225
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
1226
- 33: "Attempted to convert to an invalid type.",
1227
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
1228
- 49: "Performed `.pop()` on an empty array",
1229
- 50: "Array index is out of bounds.",
1230
- 65: "Allocated too much memory or created an array which is too large.",
1231
- 81: "Attempted to call a zero-initialized variable of internal function type."
1232
- };
1233
- var solidityError = {
1234
- inputs: [
1235
- {
1236
- name: "message",
1237
- type: "string"
1238
- }
1239
- ],
1240
- name: "Error",
1241
- type: "error"
1242
- };
1243
- var solidityPanic = {
1244
- inputs: [
1245
- {
1246
- name: "reason",
1247
- type: "uint256"
1248
- }
1249
- ],
1250
- name: "Panic",
1251
- type: "error"
1252
- };
1253
-
1254
- // src/constants/unit.ts
1255
- var etherUnits = {
1256
- gwei: 9,
1257
- wei: 18
1258
- };
1259
- var gweiUnits = {
1260
- ether: -9,
1261
- wei: 9
1262
- };
1263
- var weiUnits = {
1264
- ether: -18,
1265
- gwei: -9
1266
- };
1267
-
1268
- // src/errors/transaction.ts
1269
- function prettyPrint(args) {
1270
- const entries = Object.entries(args).map(([key, value]) => {
1271
- if (value === void 0 || value === false)
1272
- return null;
1273
- return [key, value];
1274
- }).filter(Boolean);
1275
- const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
1276
- return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
1277
- }
1278
- var FeeConflictError = class extends BaseError {
1279
- constructor() {
1280
- super(
1281
- [
1282
- "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
1283
- "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
1284
- ].join("\n")
1285
- );
1286
- __publicField(this, "name", "FeeConflictError");
1287
- }
1288
- };
1289
- var TransactionExecutionError = class extends BaseError {
1290
- constructor(cause, {
1291
- account,
1292
- docsPath: docsPath6,
1293
- chain,
1294
- data,
1295
- gas,
1296
- gasPrice,
1297
- maxFeePerGas,
1298
- maxPriorityFeePerGas,
1299
- nonce,
1300
- to,
1301
- value
1302
- }) {
1303
- const prettyArgs = prettyPrint({
1304
- chain: chain && `${_optionalChain([chain, 'optionalAccess', _13 => _13.name])} (id: ${_optionalChain([chain, 'optionalAccess', _14 => _14.id])})`,
1305
- from: _optionalChain([account, 'optionalAccess', _15 => _15.address]),
1306
- to,
1307
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _16 => _16.nativeCurrency, 'access', _17 => _17.symbol]) || "ETH"}`,
1308
- data,
1309
- gas,
1310
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1311
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1312
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1313
- nonce
1314
- });
1315
- super(cause.shortMessage, {
1316
- cause,
1317
- docsPath: docsPath6,
1318
- metaMessages: [
1319
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1320
- "Request Arguments:",
1321
- prettyArgs
1322
- ].filter(Boolean)
1323
- });
1324
- __publicField(this, "cause");
1325
- __publicField(this, "name", "TransactionExecutionError");
1326
- this.cause = cause;
781
+ __publicField(this, "cause");
782
+ __publicField(this, "name", "TransactionExecutionError");
783
+ this.cause = cause;
1327
784
  }
1328
785
  };
1329
786
  var TransactionNotFoundError = class extends BaseError {
@@ -1381,9 +838,9 @@ var CallExecutionError = class extends BaseError {
1381
838
  }) {
1382
839
  const account = account_ ? parseAccount(account_) : void 0;
1383
840
  const prettyArgs = prettyPrint({
1384
- from: _optionalChain([account, 'optionalAccess', _18 => _18.address]),
841
+ from: _optionalChain([account, 'optionalAccess', _9 => _9.address]),
1385
842
  to,
1386
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _19 => _19.nativeCurrency, 'access', _20 => _20.symbol]) || "ETH"}`,
843
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _10 => _10.nativeCurrency, 'access', _11 => _11.symbol]) || "ETH"}`,
1387
844
  data,
1388
845
  gas,
1389
846
  gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
@@ -1425,7 +882,7 @@ var ContractFunctionExecutionError = class extends BaseError {
1425
882
  const prettyArgs = prettyPrint({
1426
883
  address: contractAddress && getContractAddress(contractAddress),
1427
884
  function: functionWithParams,
1428
- args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _21 => _21.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
885
+ args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _12 => _12.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
1429
886
  sender
1430
887
  });
1431
888
  super(
@@ -1484,7 +941,7 @@ var ContractFunctionRevertedError = class extends BaseError {
1484
941
  }) : void 0;
1485
942
  metaMessages = [
1486
943
  errorWithParams ? `Error: ${errorWithParams}` : "",
1487
- formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _22 => _22.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
944
+ formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _13 => _13.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
1488
945
  ];
1489
946
  }
1490
947
  } else if (message)
@@ -1622,9 +1079,9 @@ var EstimateGasExecutionError = class extends BaseError {
1622
1079
  value
1623
1080
  }) {
1624
1081
  const prettyArgs = prettyPrint({
1625
- from: _optionalChain([account, 'optionalAccess', _23 => _23.address]),
1082
+ from: _optionalChain([account, 'optionalAccess', _14 => _14.address]),
1626
1083
  to,
1627
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _24 => _24.nativeCurrency, 'access', _25 => _25.symbol]) || "ETH"}`,
1084
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _15 => _15.nativeCurrency, 'access', _16 => _16.symbol]) || "ETH"}`,
1628
1085
  data,
1629
1086
  gas,
1630
1087
  gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
@@ -1661,7 +1118,7 @@ var ExecutionRevertedError = class extends BaseError {
1661
1118
  cause,
1662
1119
  message
1663
1120
  } = {}) {
1664
- const reason = _optionalChain([message, 'optionalAccess', _26 => _26.replace, 'call', _27 => _27("execution reverted: ", ""), 'optionalAccess', _28 => _28.replace, 'call', _29 => _29("execution reverted", "")]);
1121
+ const reason = _optionalChain([message, 'optionalAccess', _17 => _17.replace, 'call', _18 => _18("execution reverted: ", ""), 'optionalAccess', _19 => _19.replace, 'call', _20 => _20("execution reverted", "")]);
1665
1122
  super(
1666
1123
  `Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`,
1667
1124
  {
@@ -1813,7 +1270,7 @@ var TipAboveFeeCapError = class extends BaseError {
1813
1270
  __publicField(TipAboveFeeCapError, "nodeMessage", /max priority fee per gas higher than max fee per gas|tip higher than fee cap/);
1814
1271
  var UnknownNodeError = class extends BaseError {
1815
1272
  constructor({ cause }) {
1816
- super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _30 => _30.message])}`, {
1273
+ super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _21 => _21.message])}`, {
1817
1274
  cause
1818
1275
  });
1819
1276
  __publicField(this, "name", "UnknownNodeError");
@@ -1926,131 +1383,656 @@ var MethodNotSupportedRpcError = class extends RpcRequestError {
1926
1383
  __publicField(this, "name", "MethodNotSupportedRpcError");
1927
1384
  __publicField(this, "code", -32004);
1928
1385
  }
1929
- };
1930
- var LimitExceededRpcError = class extends RpcRequestError {
1931
- constructor(err) {
1932
- super(err, { shortMessage: "Request exceeds defined limit." });
1933
- __publicField(this, "name", "LimitExceededRpcError");
1934
- __publicField(this, "code", -32005);
1386
+ };
1387
+ var LimitExceededRpcError = class extends RpcRequestError {
1388
+ constructor(err) {
1389
+ super(err, { shortMessage: "Request exceeds defined limit." });
1390
+ __publicField(this, "name", "LimitExceededRpcError");
1391
+ __publicField(this, "code", -32005);
1392
+ }
1393
+ };
1394
+ var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1395
+ constructor(err) {
1396
+ super(err, {
1397
+ shortMessage: "Version of JSON-RPC protocol is not supported."
1398
+ });
1399
+ __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1400
+ __publicField(this, "code", -32006);
1401
+ }
1402
+ };
1403
+ var UserRejectedRequestError = class extends RpcRequestError {
1404
+ constructor(err) {
1405
+ super(err, {
1406
+ shortMessage: "User rejected the request."
1407
+ });
1408
+ __publicField(this, "name", "UserRejectedRequestError");
1409
+ __publicField(this, "code", 4001);
1410
+ }
1411
+ };
1412
+ var SwitchChainError = class extends RpcRequestError {
1413
+ constructor(err) {
1414
+ super(err, {
1415
+ shortMessage: "An error occurred when attempting to switch chain."
1416
+ });
1417
+ __publicField(this, "name", "SwitchChainError");
1418
+ __publicField(this, "code", 4902);
1419
+ }
1420
+ };
1421
+ var UnknownRpcError = class extends RequestError {
1422
+ constructor(err) {
1423
+ super(err, {
1424
+ shortMessage: "An unknown RPC error occurred."
1425
+ });
1426
+ __publicField(this, "name", "UnknownRpcError");
1427
+ }
1428
+ };
1429
+
1430
+ // src/errors/rpc.ts
1431
+ var HttpRequestError = class extends BaseError {
1432
+ constructor({
1433
+ body,
1434
+ details,
1435
+ headers,
1436
+ status,
1437
+ url
1438
+ }) {
1439
+ super("HTTP request failed.", {
1440
+ details,
1441
+ metaMessages: [
1442
+ status && `Status: ${status}`,
1443
+ `URL: ${getUrl(url)}`,
1444
+ `Request body: ${stringify(body)}`
1445
+ ].filter(Boolean)
1446
+ });
1447
+ __publicField(this, "name", "HttpRequestError");
1448
+ __publicField(this, "body");
1449
+ __publicField(this, "headers");
1450
+ __publicField(this, "status");
1451
+ __publicField(this, "url");
1452
+ this.body = body;
1453
+ this.headers = headers;
1454
+ this.status = status;
1455
+ this.url = url;
1456
+ }
1457
+ };
1458
+ var WebSocketRequestError = class extends BaseError {
1459
+ constructor({
1460
+ body,
1461
+ details,
1462
+ url
1463
+ }) {
1464
+ super("WebSocket request failed.", {
1465
+ details,
1466
+ metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1467
+ });
1468
+ __publicField(this, "name", "WebSocketRequestError");
1469
+ }
1470
+ };
1471
+ var RpcError = class extends BaseError {
1472
+ constructor({
1473
+ body,
1474
+ error,
1475
+ url
1476
+ }) {
1477
+ super("RPC Request failed.", {
1478
+ cause: error,
1479
+ details: error.message,
1480
+ metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1481
+ });
1482
+ __publicField(this, "code");
1483
+ __publicField(this, "name", "RpcError");
1484
+ this.code = error.code;
1485
+ }
1486
+ };
1487
+ var TimeoutError = class extends BaseError {
1488
+ constructor({
1489
+ body,
1490
+ url
1491
+ }) {
1492
+ super("The request took too long to respond.", {
1493
+ details: "The request timed out.",
1494
+ metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1495
+ });
1496
+ __publicField(this, "name", "TimeoutError");
1497
+ }
1498
+ };
1499
+
1500
+ // src/errors/transport.ts
1501
+ var UrlRequiredError = class extends BaseError {
1502
+ constructor() {
1503
+ super(
1504
+ "No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
1505
+ {
1506
+ docsPath: "/docs/clients/intro"
1507
+ }
1508
+ );
1509
+ }
1510
+ };
1511
+
1512
+ // src/utils/data/concat.ts
1513
+ function concat(values) {
1514
+ if (typeof values[0] === "string")
1515
+ return concatHex(values);
1516
+ return concatBytes(values);
1517
+ }
1518
+ function concatBytes(values) {
1519
+ let length = 0;
1520
+ for (const arr of values) {
1521
+ length += arr.length;
1522
+ }
1523
+ const result = new Uint8Array(length);
1524
+ let offset = 0;
1525
+ for (const arr of values) {
1526
+ result.set(arr, offset);
1527
+ offset += arr.length;
1528
+ }
1529
+ return result;
1530
+ }
1531
+ function concatHex(values) {
1532
+ return `0x${values.reduce(
1533
+ (acc, x) => acc + x.replace("0x", ""),
1534
+ ""
1535
+ )}`;
1536
+ }
1537
+
1538
+ // src/utils/data/isBytes.ts
1539
+ function isBytes(value) {
1540
+ if (!value)
1541
+ return false;
1542
+ if (typeof value !== "object")
1543
+ return false;
1544
+ if (!("BYTES_PER_ELEMENT" in value))
1545
+ return false;
1546
+ return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
1547
+ }
1548
+
1549
+ // src/utils/data/isHex.ts
1550
+ function isHex(value) {
1551
+ if (!value)
1552
+ return false;
1553
+ if (typeof value !== "string")
1554
+ return false;
1555
+ return /^0x[0-9a-fA-F]*$/.test(value);
1556
+ }
1557
+
1558
+ // src/utils/data/pad.ts
1559
+ function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
1560
+ if (typeof hexOrBytes === "string")
1561
+ return padHex(hexOrBytes, { dir, size: size2 });
1562
+ return padBytes(hexOrBytes, { dir, size: size2 });
1563
+ }
1564
+ function padHex(hex_, { dir, size: size2 = 32 } = {}) {
1565
+ if (size2 === null)
1566
+ return hex_;
1567
+ let hex = hex_.replace("0x", "");
1568
+ if (hex.length > size2 * 2)
1569
+ throw new SizeExceedsPaddingSizeError({
1570
+ size: Math.ceil(hex.length / 2),
1571
+ targetSize: size2,
1572
+ type: "hex"
1573
+ });
1574
+ return `0x${hex[dir === "right" ? "padEnd" : "padStart"](
1575
+ size2 * 2,
1576
+ "0"
1577
+ )}`;
1578
+ }
1579
+ function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
1580
+ if (size2 === null)
1581
+ return bytes;
1582
+ if (bytes.length > size2)
1583
+ throw new SizeExceedsPaddingSizeError({
1584
+ size: bytes.length,
1585
+ targetSize: size2,
1586
+ type: "bytes"
1587
+ });
1588
+ const paddedBytes = new Uint8Array(size2);
1589
+ for (let i = 0; i < size2; i++) {
1590
+ const padEnd = dir === "right";
1591
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
1592
+ }
1593
+ return paddedBytes;
1594
+ }
1595
+
1596
+ // src/utils/data/trim.ts
1597
+ function trim(hexOrBytes, { dir = "left" } = {}) {
1598
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
1599
+ let sliceLength = 0;
1600
+ for (let i = 0; i < data.length - 1; i++) {
1601
+ if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
1602
+ sliceLength++;
1603
+ else
1604
+ break;
1605
+ }
1606
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
1607
+ if (typeof hexOrBytes === "string") {
1608
+ if (data.length === 1 && dir === "right")
1609
+ data = `${data}0`;
1610
+ return `0x${data}`;
1611
+ }
1612
+ return data;
1613
+ }
1614
+
1615
+ // src/utils/data/size.ts
1616
+ function size(value) {
1617
+ if (isHex(value))
1618
+ return Math.ceil((value.length - 2) / 2);
1619
+ return value.length;
1620
+ }
1621
+
1622
+ // src/utils/data/slice.ts
1623
+ function slice(value, start, end) {
1624
+ if (isHex(value))
1625
+ return sliceHex(value, start, end);
1626
+ return sliceBytes(value, start, end);
1627
+ }
1628
+ function assertStartOffset(value, start) {
1629
+ if (typeof start === "number" && start > 0 && start > size(value) - 1)
1630
+ throw new Error(
1631
+ `Slice starting at offset "${start}" is out-of-bounds (size: ${size(
1632
+ value
1633
+ )}).`
1634
+ );
1635
+ }
1636
+ function sliceBytes(value, start, end) {
1637
+ assertStartOffset(value, start);
1638
+ return value.slice(start, end);
1639
+ }
1640
+ function sliceHex(value_, start, end) {
1641
+ assertStartOffset(value_, start);
1642
+ const value = value_.replace("0x", "").slice((_nullishCoalesce(start, () => ( 0))) * 2, (_nullishCoalesce(end, () => ( value_.length))) * 2);
1643
+ return `0x${value}`;
1644
+ }
1645
+
1646
+ // src/utils/encoding/toHex.ts
1647
+ var hexes = Array.from(
1648
+ { length: 256 },
1649
+ (_v, i) => i.toString(16).padStart(2, "0")
1650
+ );
1651
+ function boolToHex(value) {
1652
+ return `0x${Number(value)}`;
1653
+ }
1654
+ function bytesToHex(value) {
1655
+ let hex = "";
1656
+ for (let i = 0; i < value.length; i++) {
1657
+ hex += hexes[value[i]];
1658
+ }
1659
+ return `0x${hex}`;
1660
+ }
1661
+ function toHex(value) {
1662
+ if (typeof value === "number" || typeof value === "bigint")
1663
+ return numberToHex(value);
1664
+ if (typeof value === "string") {
1665
+ return stringToHex(value);
1935
1666
  }
1936
- };
1937
- var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1938
- constructor(err) {
1939
- super(err, {
1940
- shortMessage: "Version of JSON-RPC protocol is not supported."
1941
- });
1942
- __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1943
- __publicField(this, "code", -32006);
1667
+ if (typeof value === "boolean")
1668
+ return boolToHex(value);
1669
+ return bytesToHex(value);
1670
+ }
1671
+ function numberToHex(value_, opts = {}) {
1672
+ const { signed, size: size2 } = opts;
1673
+ let value = BigInt(value_);
1674
+ let maxValue;
1675
+ if (size2) {
1676
+ if (signed)
1677
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
1678
+ else
1679
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
1680
+ } else if (typeof value_ === "number") {
1681
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
1944
1682
  }
1945
- };
1946
- var UserRejectedRequestError = class extends RpcRequestError {
1947
- constructor(err) {
1948
- super(err, {
1949
- shortMessage: "User rejected the request."
1683
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
1684
+ if (maxValue && value > maxValue || value < minValue) {
1685
+ const suffix = typeof value_ === "bigint" ? "n" : "";
1686
+ throw new IntegerOutOfRangeError({
1687
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
1688
+ min: `${minValue}${suffix}`,
1689
+ signed,
1690
+ size: size2,
1691
+ value: `${value_}${suffix}`
1950
1692
  });
1951
- __publicField(this, "name", "UserRejectedRequestError");
1952
- __publicField(this, "code", 4001);
1953
1693
  }
1954
- };
1955
- var SwitchChainError = class extends RpcRequestError {
1956
- constructor(err) {
1957
- super(err, {
1958
- shortMessage: "An error occurred when attempting to switch chain."
1959
- });
1960
- __publicField(this, "name", "SwitchChainError");
1961
- __publicField(this, "code", 4902);
1694
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
1695
+ if (size2)
1696
+ return pad(hex, { size: size2 });
1697
+ return hex;
1698
+ }
1699
+ var encoder = new TextEncoder();
1700
+ function stringToHex(value_) {
1701
+ const value = encoder.encode(value_);
1702
+ return toHex(value);
1703
+ }
1704
+
1705
+ // src/utils/encoding/toBytes.ts
1706
+ var encoder2 = new TextEncoder();
1707
+ function toBytes(value) {
1708
+ if (typeof value === "number" || typeof value === "bigint")
1709
+ return numberToBytes(value);
1710
+ if (typeof value === "boolean")
1711
+ return boolToBytes(value);
1712
+ if (value.startsWith("0x"))
1713
+ return hexToBytes(value);
1714
+ return stringToBytes(value);
1715
+ }
1716
+ function boolToBytes(value) {
1717
+ const bytes = new Uint8Array(1);
1718
+ bytes[0] = Number(value);
1719
+ return bytes;
1720
+ }
1721
+ function hexToBytes(hex_) {
1722
+ let hex = hex_.slice(2);
1723
+ if (hex.length % 2)
1724
+ hex = `0${hex}`;
1725
+ const bytes = new Uint8Array(hex.length / 2);
1726
+ for (let index = 0; index < bytes.length; index++) {
1727
+ const start = index * 2;
1728
+ const hexByte = hex.slice(start, start + 2);
1729
+ const byte = Number.parseInt(hexByte, 16);
1730
+ if (Number.isNaN(byte) || byte < 0)
1731
+ throw new BaseError(`Invalid byte sequence ("${hexByte}" in "${hex}").`);
1732
+ bytes[index] = byte;
1962
1733
  }
1963
- };
1964
- var UnknownRpcError = class extends RequestError {
1965
- constructor(err) {
1966
- super(err, {
1967
- shortMessage: "An unknown RPC error occurred."
1968
- });
1969
- __publicField(this, "name", "UnknownRpcError");
1734
+ return bytes;
1735
+ }
1736
+ function numberToBytes(value, opts) {
1737
+ const hex = numberToHex(value, opts);
1738
+ return hexToBytes(hex);
1739
+ }
1740
+ function stringToBytes(value) {
1741
+ return encoder2.encode(value);
1742
+ }
1743
+
1744
+ // src/utils/encoding/toRlp.ts
1745
+ function toRlp(hexOrBytes, to_) {
1746
+ const to = to_ || "hex";
1747
+ return format(bytesToRlp(parse(hexOrBytes)), to);
1748
+ }
1749
+ function parse(hexOrBytes) {
1750
+ if (Array.isArray(hexOrBytes))
1751
+ return hexOrBytes.map(parse);
1752
+ return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
1753
+ }
1754
+ function format(bytes, type = "bytes") {
1755
+ return type === "hex" ? bytesToHex(bytes) : bytes;
1756
+ }
1757
+ function bytesToRlp(bytes) {
1758
+ if (Array.isArray(bytes)) {
1759
+ const encoded = concat(bytes.map(bytesToRlp));
1760
+ return new Uint8Array([...encodeLength(encoded.length, 192), ...encoded]);
1970
1761
  }
1971
- };
1762
+ if (bytes.length === 1 && bytes[0] < 128)
1763
+ return bytes;
1764
+ return new Uint8Array([...encodeLength(bytes.length, 128), ...bytes]);
1765
+ }
1766
+ function encodeLength(length, offset) {
1767
+ if (length < 56)
1768
+ return [offset + length];
1769
+ return [toBytes(length).length + offset + 55, ...toBytes(length)];
1770
+ }
1972
1771
 
1973
- // src/errors/rpc.ts
1974
- var HttpRequestError = class extends BaseError {
1975
- constructor({
1976
- body,
1977
- details,
1978
- headers,
1979
- status,
1980
- url
1981
- }) {
1982
- super("HTTP request failed.", {
1983
- details,
1984
- metaMessages: [
1985
- status && `Status: ${status}`,
1986
- `URL: ${getUrl(url)}`,
1987
- `Request body: ${stringify(body)}`
1988
- ].filter(Boolean)
1772
+ // src/utils/encoding/fromHex.ts
1773
+ function fromHex(hex, to) {
1774
+ if (to === "number")
1775
+ return hexToNumber(hex);
1776
+ if (to === "bigint")
1777
+ return hexToBigInt(hex);
1778
+ if (to === "string")
1779
+ return hexToString(hex);
1780
+ if (to === "boolean")
1781
+ return hexToBool(hex);
1782
+ return hexToBytes(hex);
1783
+ }
1784
+ function hexToBigInt(hex, opts = {}) {
1785
+ const { signed } = opts;
1786
+ const value = BigInt(hex);
1787
+ if (!signed)
1788
+ return value;
1789
+ const size2 = (hex.length - 2) / 2;
1790
+ const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
1791
+ if (value <= max)
1792
+ return value;
1793
+ return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
1794
+ }
1795
+ function hexToBool(hex) {
1796
+ if (trim(hex) === "0x0")
1797
+ return false;
1798
+ if (trim(hex) === "0x1")
1799
+ return true;
1800
+ throw new InvalidHexBooleanError(hex);
1801
+ }
1802
+ function hexToNumber(hex, opts = {}) {
1803
+ return Number(hexToBigInt(hex, opts));
1804
+ }
1805
+ function hexToString(hex) {
1806
+ const bytes = hexToBytes(hex);
1807
+ return new TextDecoder().decode(bytes);
1808
+ }
1809
+
1810
+ // src/utils/encoding/fromBytes.ts
1811
+ function fromBytes(bytes, to) {
1812
+ if (to === "number")
1813
+ return bytesToNumber(bytes);
1814
+ if (to === "bigint")
1815
+ return bytesToBigint(bytes);
1816
+ if (to === "boolean")
1817
+ return bytesToBool(bytes);
1818
+ if (to === "string")
1819
+ return bytesToString(bytes);
1820
+ return bytesToHex(bytes);
1821
+ }
1822
+ function bytesToBigint(bytes) {
1823
+ const hex = bytesToHex(bytes);
1824
+ return hexToBigInt(hex);
1825
+ }
1826
+ function bytesToBool(bytes) {
1827
+ if (bytes.length > 1 || bytes[0] > 1)
1828
+ throw new InvalidBytesBooleanError(bytes);
1829
+ return Boolean(bytes[0]);
1830
+ }
1831
+ function bytesToNumber(bytes) {
1832
+ const hex = bytesToHex(bytes);
1833
+ return hexToNumber(hex);
1834
+ }
1835
+ function bytesToString(bytes) {
1836
+ return new TextDecoder().decode(bytes);
1837
+ }
1838
+
1839
+ // src/utils/encoding/fromRlp.ts
1840
+ function fromRlp(value, to) {
1841
+ const bytes = parse2(value);
1842
+ const [data, consumed] = rlpToBytes(bytes);
1843
+ if (consumed < bytes.length)
1844
+ throw new DataLengthTooLongError({
1845
+ consumed,
1846
+ length: bytes.length
1989
1847
  });
1990
- __publicField(this, "name", "HttpRequestError");
1991
- __publicField(this, "body");
1992
- __publicField(this, "headers");
1993
- __publicField(this, "status");
1994
- __publicField(this, "url");
1995
- this.body = body;
1996
- this.headers = headers;
1997
- this.status = status;
1998
- this.url = url;
1848
+ return format2(data, to);
1849
+ }
1850
+ function parse2(value) {
1851
+ if (typeof value === "string") {
1852
+ if (value.length > 3 && value.length % 2 !== 0)
1853
+ throw new InvalidHexValueError(value);
1854
+ return hexToBytes(value);
1999
1855
  }
2000
- };
2001
- var WebSocketRequestError = class extends BaseError {
2002
- constructor({
2003
- body,
2004
- details,
2005
- url
2006
- }) {
2007
- super("WebSocket request failed.", {
2008
- details,
2009
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
2010
- });
2011
- __publicField(this, "name", "WebSocketRequestError");
1856
+ return value;
1857
+ }
1858
+ function format2(bytes, to) {
1859
+ if (Array.isArray(bytes))
1860
+ return bytes.map((b) => format2(b, to));
1861
+ return to === "hex" ? trim(bytesToHex(bytes)) : bytes;
1862
+ }
1863
+ function rlpToBytes(bytes, offset = 0) {
1864
+ if (bytes.length === 0)
1865
+ return [new Uint8Array([]), 0];
1866
+ const prefix = bytes[offset];
1867
+ if (prefix <= 127)
1868
+ return [new Uint8Array([bytes[offset]]), 1];
1869
+ if (prefix <= 183) {
1870
+ const length2 = prefix - 128;
1871
+ const offset_ = offset + 1;
1872
+ if (offset_ + length2 > bytes.length)
1873
+ throw new DataLengthTooShortError({
1874
+ length: offset_ + length2,
1875
+ dataLength: bytes.length
1876
+ });
1877
+ return [bytes.slice(offset_, offset_ + length2), 1 + length2];
2012
1878
  }
2013
- };
2014
- var RpcError = class extends BaseError {
2015
- constructor({
2016
- body,
2017
- error,
2018
- url
2019
- }) {
2020
- super("RPC Request failed.", {
2021
- cause: error,
2022
- details: error.message,
2023
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
2024
- });
2025
- __publicField(this, "code");
2026
- __publicField(this, "name", "RpcError");
2027
- this.code = error.code;
1879
+ if (prefix <= 191) {
1880
+ const lengthOfLength2 = prefix - 183;
1881
+ const offset_ = offset + 1;
1882
+ const length2 = bytesToNumber(bytes.slice(offset_, offset_ + lengthOfLength2));
1883
+ if (offset_ + lengthOfLength2 + length2 > bytes.length)
1884
+ throw new DataLengthTooShortError({
1885
+ length: lengthOfLength2 + length2,
1886
+ dataLength: bytes.length - lengthOfLength2
1887
+ });
1888
+ return [
1889
+ bytes.slice(offset_ + lengthOfLength2, offset_ + lengthOfLength2 + length2),
1890
+ 1 + lengthOfLength2 + length2
1891
+ ];
2028
1892
  }
2029
- };
2030
- var TimeoutError = class extends BaseError {
2031
- constructor({
2032
- body,
2033
- url
2034
- }) {
2035
- super("The request took too long to respond.", {
2036
- details: "The request timed out.",
2037
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1893
+ let lengthOfLength = 0;
1894
+ let length = prefix - 192;
1895
+ if (prefix > 247) {
1896
+ lengthOfLength = prefix - 247;
1897
+ length = bytesToNumber(bytes.slice(offset + 1, offset + 1 + lengthOfLength));
1898
+ }
1899
+ let nextOffset = offset + 1 + lengthOfLength;
1900
+ if (nextOffset > bytes.length)
1901
+ throw new DataLengthTooShortError({
1902
+ length: nextOffset,
1903
+ dataLength: bytes.length
2038
1904
  });
2039
- __publicField(this, "name", "TimeoutError");
1905
+ let consumed = 1 + lengthOfLength + length;
1906
+ let result = [];
1907
+ while (nextOffset < offset + consumed) {
1908
+ const decoded = rlpToBytes(bytes, nextOffset);
1909
+ result.push(decoded[0]);
1910
+ nextOffset += decoded[1];
1911
+ if (nextOffset > offset + consumed)
1912
+ throw new OffsetOutOfBoundsError({
1913
+ nextOffset,
1914
+ offset: offset + consumed
1915
+ });
2040
1916
  }
2041
- };
1917
+ return [result, consumed];
1918
+ }
2042
1919
 
2043
- // src/errors/transport.ts
2044
- var UrlRequiredError = class extends BaseError {
2045
- constructor() {
2046
- super(
2047
- "No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
2048
- {
2049
- docsPath: "/docs/clients/intro"
2050
- }
2051
- );
1920
+ // src/utils/contract/extractFunctionParts.ts
1921
+ var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1922
+ function extractFunctionParts(def) {
1923
+ const parts = def.match(paramsRegex);
1924
+ const type = _optionalChain([parts, 'optionalAccess', _22 => _22[2]]) || void 0;
1925
+ const name = _optionalChain([parts, 'optionalAccess', _23 => _23[3]]);
1926
+ const params = _optionalChain([parts, 'optionalAccess', _24 => _24[5]]) || void 0;
1927
+ return { type, name, params };
1928
+ }
1929
+ function extractFunctionName(def) {
1930
+ return extractFunctionParts(def).name;
1931
+ }
1932
+ function extractFunctionParams(def) {
1933
+ const params = extractFunctionParts(def).params;
1934
+ const splitParams = _optionalChain([params, 'optionalAccess', _25 => _25.split, 'call', _26 => _26(","), 'access', _27 => _27.map, 'call', _28 => _28((x) => x.trim().split(" "))]);
1935
+ return _optionalChain([splitParams, 'optionalAccess', _29 => _29.map, 'call', _30 => _30((param) => ({
1936
+ type: param[0],
1937
+ name: param[1] === "indexed" ? param[2] : param[1],
1938
+ ...param[1] === "indexed" ? { indexed: true } : {}
1939
+ }))]);
1940
+ }
1941
+ function extractFunctionType(def) {
1942
+ return extractFunctionParts(def).type;
1943
+ }
1944
+
1945
+ // src/utils/hash/keccak256.ts
1946
+ var _sha3 = require('@noble/hashes/sha3');
1947
+ function keccak256(value, to_) {
1948
+ const to = to_ || "hex";
1949
+ const bytes = _sha3.keccak_256.call(void 0, isHex(value) ? toBytes(value) : value);
1950
+ if (to === "bytes")
1951
+ return bytes;
1952
+ return toHex(bytes);
1953
+ }
1954
+
1955
+ // src/utils/hash/hashFunction.ts
1956
+ var hash = (value) => keccak256(toBytes(value));
1957
+ function hashFunction(def) {
1958
+ const name = extractFunctionName(def);
1959
+ const params = extractFunctionParams(def);
1960
+ if (!params || params.length === 0)
1961
+ return hash(def.replace(/ /g, ""));
1962
+ return hash(`${name}(${params.map(({ type }) => type).join(",")})`);
1963
+ }
1964
+
1965
+ // src/utils/hash/getEventSelector.ts
1966
+ var getEventSelector = (event) => hashFunction(event);
1967
+
1968
+ // src/utils/hash/getFunctionSelector.ts
1969
+ var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
1970
+
1971
+ // src/utils/address/isAddress.ts
1972
+ var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1973
+ function isAddress(address) {
1974
+ return addressRegex.test(address);
1975
+ }
1976
+
1977
+ // src/utils/address/getAddress.ts
1978
+ function checksumAddress(address_) {
1979
+ const hexAddress = address_.substring(2).toLowerCase();
1980
+ const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1981
+ let address = hexAddress.split("");
1982
+ for (let i = 0; i < 40; i += 2) {
1983
+ if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1984
+ address[i] = address[i].toUpperCase();
1985
+ }
1986
+ if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1987
+ address[i + 1] = address[i + 1].toUpperCase();
1988
+ }
2052
1989
  }
2053
- };
1990
+ return `0x${address.join("")}`;
1991
+ }
1992
+ function getAddress(address) {
1993
+ if (!isAddress(address))
1994
+ throw new InvalidAddressError({ address });
1995
+ return checksumAddress(address);
1996
+ }
1997
+
1998
+ // src/utils/address/getContractAddress.ts
1999
+ function getContractAddress2(opts) {
2000
+ if (opts.opcode === "CREATE2")
2001
+ return getCreate2Address(opts);
2002
+ return getCreateAddress(opts);
2003
+ }
2004
+ function getCreateAddress(opts) {
2005
+ const from = toBytes(getAddress(opts.from));
2006
+ let nonce = toBytes(opts.nonce);
2007
+ if (nonce[0] === 0)
2008
+ nonce = new Uint8Array([]);
2009
+ return getAddress(
2010
+ `0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
2011
+ );
2012
+ }
2013
+ function getCreate2Address(opts) {
2014
+ const from = toBytes(getAddress(opts.from));
2015
+ const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
2016
+ size: 32
2017
+ });
2018
+ const bytecodeHash = toBytes(
2019
+ keccak256(
2020
+ isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
2021
+ )
2022
+ );
2023
+ return getAddress(
2024
+ slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
2025
+ );
2026
+ }
2027
+
2028
+ // src/utils/address/isAddressEqual.ts
2029
+ function isAddressEqual(a, b) {
2030
+ if (!isAddress(a))
2031
+ throw new InvalidAddressError({ address: a });
2032
+ if (!isAddress(b))
2033
+ throw new InvalidAddressError({ address: b });
2034
+ return a.toLowerCase() === b.toLowerCase();
2035
+ }
2054
2036
 
2055
2037
  // src/utils/abi/encodeAbiParameters.ts
2056
2038
  function encodeAbiParameters(params, values) {
@@ -2893,6 +2875,13 @@ function formatAbiItemWithArgs({
2893
2875
  ).join(", ")})`;
2894
2876
  }
2895
2877
 
2878
+ // src/accounts/utils/parseAccount.ts
2879
+ function parseAccount(account) {
2880
+ if (typeof account === "string")
2881
+ return { address: account, type: "json-rpc" };
2882
+ return account;
2883
+ }
2884
+
2896
2885
  // src/utils/promise/withCache.ts
2897
2886
  var promiseCache = /* @__PURE__ */ new Map();
2898
2887
  var responseCache = /* @__PURE__ */ new Map();
@@ -3767,16 +3756,16 @@ function encodeField({
3767
3756
  }
3768
3757
 
3769
3758
  // src/utils/signature/recoverAddress.ts
3770
- var _secp256k1 = require('@noble/secp256k1');
3771
- function recoverAddress({
3759
+ async function recoverAddress({
3772
3760
  hash: hash2,
3773
3761
  signature
3774
3762
  }) {
3775
3763
  const signatureHex = isHex(signature) ? signature : toHex(signature);
3776
3764
  const hashHex = isHex(hash2) ? hash2 : toHex(hash2);
3777
3765
  const v = hexToNumber(`0x${signatureHex.slice(130)}`);
3766
+ const { recoverPublicKey } = await Promise.resolve().then(() => require("@noble/secp256k1"));
3778
3767
  const publicKey = toHex(
3779
- _secp256k1.recoverPublicKey.call(void 0,
3768
+ recoverPublicKey(
3780
3769
  hashHex.substring(2),
3781
3770
  signatureHex.substring(2, 130),
3782
3771
  v - 27
@@ -3787,7 +3776,7 @@ function recoverAddress({
3787
3776
  }
3788
3777
 
3789
3778
  // src/utils/signature/recoverMessageAddress.ts
3790
- function recoverMessageAddress({
3779
+ async function recoverMessageAddress({
3791
3780
  message,
3792
3781
  signature
3793
3782
  }) {
@@ -3795,7 +3784,7 @@ function recoverMessageAddress({
3795
3784
  }
3796
3785
 
3797
3786
  // src/utils/signature/recoverTypedDataAddress.ts
3798
- function recoverTypedDataAddress({
3787
+ async function recoverTypedDataAddress({
3799
3788
  domain,
3800
3789
  message,
3801
3790
  primaryType,
@@ -3814,19 +3803,19 @@ function recoverTypedDataAddress({
3814
3803
  }
3815
3804
 
3816
3805
  // src/utils/signature/verifyMessage.ts
3817
- function verifyMessage({
3806
+ async function verifyMessage({
3818
3807
  address,
3819
3808
  message,
3820
3809
  signature
3821
3810
  }) {
3822
3811
  return isAddressEqual(
3823
3812
  getAddress(address),
3824
- recoverMessageAddress({ message, signature })
3813
+ await recoverMessageAddress({ message, signature })
3825
3814
  );
3826
3815
  }
3827
3816
 
3828
3817
  // src/utils/signature/verifyTypedData.ts
3829
- function verifyTypedData({
3818
+ async function verifyTypedData({
3830
3819
  address,
3831
3820
  domain,
3832
3821
  message,
@@ -3836,7 +3825,7 @@ function verifyTypedData({
3836
3825
  }) {
3837
3826
  return isAddressEqual(
3838
3827
  getAddress(address),
3839
- recoverTypedDataAddress({
3828
+ await recoverTypedDataAddress({
3840
3829
  domain,
3841
3830
  message,
3842
3831
  primaryType,
@@ -5425,7 +5414,7 @@ async function sendTransaction(client, args) {
5425
5414
  }
5426
5415
 
5427
5416
  // src/actions/wallet/signMessage.ts
5428
- async function signMessage2(client, {
5417
+ async function signMessage(client, {
5429
5418
  account: account_ = client.account,
5430
5419
  data,
5431
5420
  message
@@ -5910,5 +5899,5 @@ function parseEther(ether, unit = "wei") {
5910
5899
 
5911
5900
 
5912
5901
 
5913
- 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.AbiEventSignatureEmptyTopicsError = AbiEventSignatureEmptyTopicsError; exports.AbiEventSignatureNotFoundError = AbiEventSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.DecodeLogTopicsMismatch = DecodeLogTopicsMismatch; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.parseAccount = parseAccount; exports.concat = concat; exports.concatBytes = concatBytes; exports.concatHex = concatHex; 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.toHex = toHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.toBytes = toBytes; exports.boolToBytes = boolToBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.toRlp = toRlp; exports.fromHex = fromHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.fromBytes = fromBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.fromRlp = fromRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.keccak256 = keccak256; exports.getEventSelector = getEventSelector; exports.getFunctionSelector = getFunctionSelector; exports.isAddress = isAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress2; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddressEqual = isAddressEqual; exports.toAccount = toAccount; exports.multicall3Abi = multicall3Abi; exports.panicReasons = panicReasons; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.TransactionExecutionError = TransactionExecutionError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.CallExecutionError = CallExecutionError; 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.EstimateGasExecutionError = EstimateGasExecutionError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.ExecutionRevertedError = ExecutionRevertedError; exports.FeeCapTooHighError = FeeCapTooHighError; exports.FeeCapTooLowError = FeeCapTooLowError; exports.NonceTooHighError = NonceTooHighError; exports.NonceTooLowError = NonceTooLowError; exports.NonceMaxValueError = NonceMaxValueError; exports.InsufficientFundsError = InsufficientFundsError; exports.IntrinsicGasTooHighError = IntrinsicGasTooHighError; exports.IntrinsicGasTooLowError = IntrinsicGasTooLowError; exports.TransactionTypeNotSupportedError = TransactionTypeNotSupportedError; exports.TipAboveFeeCapError = TipAboveFeeCapError; exports.UnknownNodeError = UnknownNodeError; 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.UserRejectedRequestError = UserRejectedRequestError; exports.SwitchChainError = SwitchChainError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.UrlRequiredError = UrlRequiredError; exports.encodeAbiParameters = encodeAbiParameters; exports.decodeAbiParameters = decodeAbiParameters; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeEventLog = decodeEventLog; 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.arrayRegex = arrayRegex; exports.bytesRegex = bytesRegex; exports.integerRegex = integerRegex; exports.encodePacked = encodePacked; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.parseAbi = _abitype.parseAbi; exports.parseAbiItem = _abitype.parseAbiItem; exports.parseAbiParameter = _abitype.parseAbiParameter; exports.parseAbiParameters = _abitype.parseAbiParameters; exports.isDeterministicError = isDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.getChainContractAddress = getChainContractAddress; 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.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.containsNodeError = containsNodeError; exports.getNodeError = getNodeError; exports.getCallError = getCallError; exports.getContractError = getContractError; exports.getEstimateGasError = getEstimateGasError; exports.getTransactionError = getTransactionError; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.hashMessage = hashMessage; exports.validateTypedData = validateTypedData; exports.hashTypedData = hashTypedData; exports.recoverAddress = recoverAddress; exports.recoverMessageAddress = recoverMessageAddress; exports.recoverTypedDataAddress = recoverTypedDataAddress; exports.verifyMessage = verifyMessage; exports.verifyTypedData = verifyTypedData; exports.assertRequest = assertRequest; exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.estimateGas = estimateGas; exports.estimateContractGas = estimateContractGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions; exports.dropTransaction = dropTransaction; exports.getAutomine = getAutomine; exports.getTxpoolContent = getTxpoolContent; exports.getTxpoolStatus = getTxpoolStatus; exports.impersonateAccount = impersonateAccount; exports.increaseTime = increaseTime; exports.inspectTxpool = inspectTxpool; exports.mine = mine; exports.removeBlockTimestampInterval = removeBlockTimestampInterval; exports.reset = reset; exports.revert = revert; exports.sendUnsignedTransaction = sendUnsignedTransaction; exports.setAutomine = setAutomine; exports.setBalance = setBalance; exports.setBlockGasLimit = setBlockGasLimit; exports.setBlockTimestampInterval = setBlockTimestampInterval; exports.setCode = setCode; exports.setCoinbase = setCoinbase; exports.setIntervalMining = setIntervalMining; exports.setLoggingEnabled = setLoggingEnabled; exports.setMinGasPrice = setMinGasPrice; exports.setNextBlockBaseFeePerGas = setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = setNextBlockTimestamp; exports.setNonce = setNonce; exports.setRpcUrl = setRpcUrl; exports.setStorageAt = setStorageAt; exports.snapshot = snapshot; exports.stopImpersonatingAccount = stopImpersonatingAccount; exports.addChain = addChain; exports.deployContract = deployContract; exports.getAddresses = getAddresses; exports.getPermissions = getPermissions; exports.requestAddresses = requestAddresses; exports.requestPermissions = requestPermissions; exports.sendTransaction = sendTransaction; exports.signMessage = signMessage2; exports.signTypedData = signTypedData; exports.switchChain = switchChain; exports.watchAsset = watchAsset; exports.writeContract = writeContract; exports.parseUnits = parseUnits; exports.parseGwei = parseGwei; exports.prepareRequest = prepareRequest; exports.formatUnits = formatUnits; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseEther = parseEther;
5914
- //# sourceMappingURL=chunk-FHJTO6BQ.js.map
5902
+ 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.AbiEventSignatureEmptyTopicsError = AbiEventSignatureEmptyTopicsError; exports.AbiEventSignatureNotFoundError = AbiEventSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.DecodeLogTopicsMismatch = DecodeLogTopicsMismatch; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.multicall3Abi = multicall3Abi; exports.panicReasons = panicReasons; exports.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.TransactionExecutionError = TransactionExecutionError; exports.TransactionNotFoundError = TransactionNotFoundError; exports.TransactionReceiptNotFoundError = TransactionReceiptNotFoundError; exports.WaitForTransactionReceiptTimeoutError = WaitForTransactionReceiptTimeoutError; exports.CallExecutionError = CallExecutionError; 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.EstimateGasExecutionError = EstimateGasExecutionError; exports.FilterTypeNotSupportedError = FilterTypeNotSupportedError; exports.ExecutionRevertedError = ExecutionRevertedError; exports.FeeCapTooHighError = FeeCapTooHighError; exports.FeeCapTooLowError = FeeCapTooLowError; exports.NonceTooHighError = NonceTooHighError; exports.NonceTooLowError = NonceTooLowError; exports.NonceMaxValueError = NonceMaxValueError; exports.InsufficientFundsError = InsufficientFundsError; exports.IntrinsicGasTooHighError = IntrinsicGasTooHighError; exports.IntrinsicGasTooLowError = IntrinsicGasTooLowError; exports.TransactionTypeNotSupportedError = TransactionTypeNotSupportedError; exports.TipAboveFeeCapError = TipAboveFeeCapError; exports.UnknownNodeError = UnknownNodeError; 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.UserRejectedRequestError = UserRejectedRequestError; exports.SwitchChainError = SwitchChainError; exports.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.UrlRequiredError = UrlRequiredError; exports.concat = concat; exports.concatBytes = concatBytes; exports.concatHex = concatHex; 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.toHex = toHex; exports.numberToHex = numberToHex; exports.stringToHex = stringToHex; exports.toBytes = toBytes; exports.boolToBytes = boolToBytes; exports.hexToBytes = hexToBytes; exports.numberToBytes = numberToBytes; exports.stringToBytes = stringToBytes; exports.toRlp = toRlp; exports.fromHex = fromHex; exports.hexToBigInt = hexToBigInt; exports.hexToBool = hexToBool; exports.hexToNumber = hexToNumber; exports.hexToString = hexToString; exports.fromBytes = fromBytes; exports.bytesToBigint = bytesToBigint; exports.bytesToBool = bytesToBool; exports.bytesToNumber = bytesToNumber; exports.bytesToString = bytesToString; exports.fromRlp = fromRlp; exports.extractFunctionParts = extractFunctionParts; exports.extractFunctionName = extractFunctionName; exports.extractFunctionParams = extractFunctionParams; exports.extractFunctionType = extractFunctionType; exports.keccak256 = keccak256; exports.getEventSelector = getEventSelector; exports.getFunctionSelector = getFunctionSelector; exports.isAddress = isAddress; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress2; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddressEqual = isAddressEqual; exports.encodeAbiParameters = encodeAbiParameters; exports.decodeAbiParameters = decodeAbiParameters; exports.formatAbiItem = formatAbiItem; exports.decodeErrorResult = decodeErrorResult; exports.decodeEventLog = decodeEventLog; 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.arrayRegex = arrayRegex; exports.bytesRegex = bytesRegex; exports.integerRegex = integerRegex; exports.encodePacked = encodePacked; exports.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.parseAbi = _abitype.parseAbi; exports.parseAbiItem = _abitype.parseAbiItem; exports.parseAbiParameter = _abitype.parseAbiParameter; exports.parseAbiParameters = _abitype.parseAbiParameters; exports.parseAccount = parseAccount; exports.isDeterministicError = isDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.getChainContractAddress = getChainContractAddress; 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.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.containsNodeError = containsNodeError; exports.getNodeError = getNodeError; exports.getCallError = getCallError; exports.getContractError = getContractError; exports.getEstimateGasError = getEstimateGasError; exports.getTransactionError = getTransactionError; exports.stringify = stringify; exports.getSocket = getSocket; exports.rpc = rpc; exports.hashMessage = hashMessage; exports.validateTypedData = validateTypedData; exports.hashTypedData = hashTypedData; exports.recoverAddress = recoverAddress; exports.recoverMessageAddress = recoverMessageAddress; exports.recoverTypedDataAddress = recoverTypedDataAddress; exports.verifyMessage = verifyMessage; exports.verifyTypedData = verifyTypedData; exports.assertRequest = assertRequest; exports.call = call; exports.simulateContract = simulateContract; exports.createPendingTransactionFilter = createPendingTransactionFilter; exports.createBlockFilter = createBlockFilter; exports.createEventFilter = createEventFilter; exports.createContractEventFilter = createContractEventFilter; exports.estimateGas = estimateGas; exports.estimateContractGas = estimateContractGas; exports.getBalance = getBalance; exports.getBlock = getBlock; exports.getBlockNumberCache = getBlockNumberCache; exports.getBlockNumber = getBlockNumber; exports.getBlockTransactionCount = getBlockTransactionCount; exports.getBytecode = getBytecode; exports.getChainId = getChainId; exports.getFeeHistory = getFeeHistory; exports.getFilterChanges = getFilterChanges; exports.getFilterLogs = getFilterLogs; exports.getGasPrice = getGasPrice; exports.getLogs = getLogs; exports.getStorageAt = getStorageAt; exports.getTransaction = getTransaction; exports.getTransactionConfirmations = getTransactionConfirmations; exports.getTransactionCount = getTransactionCount; exports.getTransactionReceipt = getTransactionReceipt; exports.readContract = readContract; exports.multicall = multicall; exports.uninstallFilter = uninstallFilter; exports.waitForTransactionReceipt = waitForTransactionReceipt; exports.watchBlockNumber = watchBlockNumber; exports.watchBlocks = watchBlocks; exports.watchContractEvent = watchContractEvent; exports.watchEvent = watchEvent; exports.watchPendingTransactions = watchPendingTransactions; exports.dropTransaction = dropTransaction; exports.getAutomine = getAutomine; exports.getTxpoolContent = getTxpoolContent; exports.getTxpoolStatus = getTxpoolStatus; exports.impersonateAccount = impersonateAccount; exports.increaseTime = increaseTime; exports.inspectTxpool = inspectTxpool; exports.mine = mine; exports.removeBlockTimestampInterval = removeBlockTimestampInterval; exports.reset = reset; exports.revert = revert; exports.sendUnsignedTransaction = sendUnsignedTransaction; exports.setAutomine = setAutomine; exports.setBalance = setBalance; exports.setBlockGasLimit = setBlockGasLimit; exports.setBlockTimestampInterval = setBlockTimestampInterval; exports.setCode = setCode; exports.setCoinbase = setCoinbase; exports.setIntervalMining = setIntervalMining; exports.setLoggingEnabled = setLoggingEnabled; exports.setMinGasPrice = setMinGasPrice; exports.setNextBlockBaseFeePerGas = setNextBlockBaseFeePerGas; exports.setNextBlockTimestamp = setNextBlockTimestamp; exports.setNonce = setNonce; exports.setRpcUrl = setRpcUrl; exports.setStorageAt = setStorageAt; exports.snapshot = snapshot; exports.stopImpersonatingAccount = stopImpersonatingAccount; exports.addChain = addChain; exports.deployContract = deployContract; exports.getAddresses = getAddresses; exports.getPermissions = getPermissions; exports.requestAddresses = requestAddresses; exports.requestPermissions = requestPermissions; exports.sendTransaction = sendTransaction; exports.signMessage = signMessage; exports.signTypedData = signTypedData; exports.switchChain = switchChain; exports.watchAsset = watchAsset; exports.writeContract = writeContract; exports.parseUnits = parseUnits; exports.parseGwei = parseGwei; exports.prepareRequest = prepareRequest; exports.formatUnits = formatUnits; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseEther = parseEther;
5903
+ //# sourceMappingURL=chunk-NJSAEA2H.js.map