viem 0.2.0-jxom-async-verify-message.20230321T000803 → 0.2.0-jxom-local-accounts.20230321T210352

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 (58) hide show
  1. package/dist/abi.d.ts +3 -3
  2. package/dist/abi.js +2 -2
  3. package/dist/abi.mjs +1 -1
  4. package/dist/{chain-b2e88e30.d.ts → chain-75b0942e.d.ts} +60 -60
  5. package/dist/{chain-c4f924cf.d.ts → chain-f8db473f.d.ts} +1 -1
  6. package/dist/chains.d.ts +3 -3
  7. package/dist/chains.js +63 -63
  8. package/dist/chains.mjs +1 -1
  9. package/dist/{chunk-22BDIC7J.js → chunk-FHJTO6BQ.js} +1369 -1349
  10. package/dist/chunk-FHJTO6BQ.js.map +1 -0
  11. package/dist/{chunk-OZCG5IO7.mjs → chunk-IXGTN6B7.mjs} +2 -2
  12. package/dist/{chunk-2NJCP2DN.js → chunk-K66BKQUH.js} +19 -19
  13. package/dist/{chunk-FEPL5HFW.mjs → chunk-PB263D6W.mjs} +1171 -1151
  14. package/dist/chunk-PB263D6W.mjs.map +1 -0
  15. package/dist/contract.d.ts +8 -8
  16. package/dist/contract.js +2 -2
  17. package/dist/contract.mjs +1 -1
  18. package/dist/{createClient-d4f1dea1.d.ts → createClient-f87255c1.d.ts} +2 -2
  19. package/dist/{createPublicClient-3a714a8d.d.ts → createPublicClient-62c74ebc.d.ts} +12 -5
  20. package/dist/{eip1193-cd3e872a.d.ts → eip1193-ae706fd8.d.ts} +1 -1
  21. package/dist/{encodeFunctionResult-750c9055.d.ts → encodeFunctionResult-4792a6a3.d.ts} +1 -1
  22. package/dist/{encodePacked-de74201f.d.ts → encodePacked-3fcdd54b.d.ts} +1 -1
  23. package/dist/ens.d.ts +5 -5
  24. package/dist/ens.js +3 -3
  25. package/dist/ens.mjs +2 -2
  26. package/dist/ethers.d.ts +4 -4
  27. package/dist/ethers.js +5 -5
  28. package/dist/ethers.js.map +1 -1
  29. package/dist/ethers.mjs +5 -5
  30. package/dist/ethers.mjs.map +1 -1
  31. package/dist/{formatAbiItem-fdbdda39.d.ts → formatAbiItem-765ebc53.d.ts} +1 -1
  32. package/dist/{getAbiItem-9d709e3b.d.ts → getAbiItem-693e6e1b.d.ts} +1 -1
  33. package/dist/index.d.ts +14 -14
  34. package/dist/index.js +91 -91
  35. package/dist/index.js.map +1 -1
  36. package/dist/index.mjs +4 -4
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/{parseGwei-b138c041.d.ts → parseGwei-7efc43fc.d.ts} +15 -16
  39. package/dist/public.d.ts +5 -5
  40. package/dist/public.js +2 -2
  41. package/dist/public.mjs +1 -1
  42. package/dist/{test-c70126a6.d.ts → test-98c0b642.d.ts} +3 -3
  43. package/dist/test.d.ts +5 -5
  44. package/dist/test.js +2 -2
  45. package/dist/test.mjs +1 -1
  46. package/dist/{account-07d04222.d.ts → typedData-0514bb3c.d.ts} +29 -27
  47. package/dist/utils/index.d.ts +14 -14
  48. package/dist/utils/index.js +2 -4
  49. package/dist/utils/index.mjs +3 -5
  50. package/dist/wallet.d.ts +5 -5
  51. package/dist/wallet.js +2 -2
  52. package/dist/wallet.mjs +1 -1
  53. package/dist/window.d.ts +2 -2
  54. package/package.json +3 -1
  55. package/dist/chunk-22BDIC7J.js.map +0 -1
  56. package/dist/chunk-FEPL5HFW.mjs.map +0 -1
  57. /package/dist/{chunk-OZCG5IO7.mjs.map → chunk-IXGTN6B7.mjs.map} +0 -0
  58. /package/dist/{chunk-2NJCP2DN.js.map → chunk-K66BKQUH.js.map} +0 -0
@@ -142,6 +142,8 @@ var package_default = {
142
142
  dependencies: {
143
143
  "@noble/hashes": "^1.1.2",
144
144
  "@noble/secp256k1": "^1.7.1",
145
+ "@scure/bip32": "^1.2.0",
146
+ "@scure/bip39": "^1.1.1",
145
147
  "@wagmi/chains": "~0.2.11",
146
148
  abitype: "~0.7.1",
147
149
  "idna-uts46-hx": "^4.1.2",
@@ -614,1409 +616,1441 @@ var ChainNotFoundError = class extends BaseError {
614
616
  }
615
617
  };
616
618
 
617
- // src/constants/abis.ts
618
- var multicall3Abi = [
619
- {
620
- inputs: [
621
- {
622
- components: [
623
- {
624
- name: "target",
625
- type: "address"
626
- },
627
- {
628
- name: "allowFailure",
629
- type: "bool"
630
- },
631
- {
632
- name: "callData",
633
- type: "bytes"
634
- }
635
- ],
636
- name: "calls",
637
- type: "tuple[]"
638
- }
639
- ],
640
- name: "aggregate3",
641
- outputs: [
642
- {
643
- components: [
644
- {
645
- name: "success",
646
- type: "bool"
647
- },
648
- {
649
- name: "returnData",
650
- type: "bytes"
651
- }
652
- ],
653
- name: "returnData",
654
- type: "tuple[]"
655
- }
656
- ],
657
- stateMutability: "view",
658
- type: "function"
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;
659
639
  }
660
- ];
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;
645
+ }
646
+ return result;
647
+ }
648
+ function concatHex(values) {
649
+ return `0x${values.reduce(
650
+ (acc, x) => acc + x.replace("0x", ""),
651
+ ""
652
+ )}`;
653
+ }
661
654
 
662
- // src/constants/solidity.ts
663
- var panicReasons = {
664
- 1: "An `assert` condition failed.",
665
- 17: "Arithmic operation resulted in underflow or overflow.",
666
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
667
- 33: "Attempted to convert to an invalid type.",
668
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
669
- 49: "Performed `.pop()` on an empty array",
670
- 50: "Array index is out of bounds.",
671
- 65: "Allocated too much memory or created an array which is too large.",
672
- 81: "Attempted to call a zero-initialized variable of internal function type."
673
- };
674
- var solidityError = {
675
- inputs: [
676
- {
677
- name: "message",
678
- type: "string"
679
- }
680
- ],
681
- name: "Error",
682
- type: "error"
683
- };
684
- var solidityPanic = {
685
- inputs: [
686
- {
687
- name: "reason",
688
- type: "uint256"
689
- }
690
- ],
691
- name: "Panic",
692
- type: "error"
693
- };
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
+ }
694
665
 
695
- // src/constants/unit.ts
696
- var etherUnits = {
697
- gwei: 9,
698
- wei: 18
699
- };
700
- var gweiUnits = {
701
- ether: -9,
702
- wei: 9
703
- };
704
- var weiUnits = {
705
- ether: -18,
706
- gwei: -9
707
- };
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
+ }
708
674
 
709
- // src/errors/transaction.ts
710
- function prettyPrint(args) {
711
- const entries = Object.entries(args).map(([key, value]) => {
712
- if (value === void 0 || value === false)
713
- return null;
714
- return [key, value];
715
- }).filter(Boolean);
716
- const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
717
- return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
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 });
718
680
  }
719
- var FeeConflictError = class extends BaseError {
720
- constructor() {
721
- super(
722
- [
723
- "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
724
- "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
725
- ].join("\n")
726
- );
727
- __publicField(this, "name", "FeeConflictError");
728
- }
729
- };
730
- var TransactionExecutionError = class extends BaseError {
731
- constructor(cause, {
732
- account,
733
- docsPath: docsPath6,
734
- chain,
735
- data,
736
- gas,
737
- gasPrice,
738
- maxFeePerGas,
739
- maxPriorityFeePerGas,
740
- nonce,
741
- to,
742
- value
743
- }) {
744
- const prettyArgs = prettyPrint({
745
- chain: chain && `${_optionalChain([chain, 'optionalAccess', _4 => _4.name])} (id: ${_optionalChain([chain, 'optionalAccess', _5 => _5.id])})`,
746
- from: _optionalChain([account, 'optionalAccess', _6 => _6.address]),
747
- to,
748
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _7 => _7.nativeCurrency, 'access', _8 => _8.symbol]) || "ETH"}`,
749
- data,
750
- gas,
751
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
752
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
753
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
754
- nonce
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"
755
690
  });
756
- super(cause.shortMessage, {
757
- cause,
758
- docsPath: docsPath6,
759
- metaMessages: [
760
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
761
- "Request Arguments:",
762
- prettyArgs
763
- ].filter(Boolean)
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"
764
704
  });
765
- __publicField(this, "cause");
766
- __publicField(this, "name", "TransactionExecutionError");
767
- this.cause = cause;
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];
768
709
  }
769
- };
770
- var TransactionNotFoundError = class extends BaseError {
771
- constructor({
772
- blockHash,
773
- blockNumber,
774
- blockTag,
775
- hash: hash2,
776
- index
777
- }) {
778
- let identifier = "Transaction";
779
- if (blockTag && index !== void 0)
780
- identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
781
- if (blockHash && index !== void 0)
782
- identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
783
- if (blockNumber && index !== void 0)
784
- identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
785
- if (hash2)
786
- identifier = `Transaction with hash "${hash2}"`;
787
- super(`${identifier} could not be found.`);
788
- __publicField(this, "name", "TransactionNotFoundError");
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;
789
722
  }
790
- };
791
- var TransactionReceiptNotFoundError = class extends BaseError {
792
- constructor({ hash: hash2 }) {
793
- super(
794
- `Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
795
- );
796
- __publicField(this, "name", "TransactionReceiptNotFoundError");
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}`;
797
728
  }
798
- };
799
- var WaitForTransactionReceiptTimeoutError = class extends BaseError {
800
- constructor({ hash: hash2 }) {
801
- super(
802
- `Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
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
+ )}).`
803
751
  );
804
- __publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
805
- }
806
- };
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
+ }
807
762
 
808
- // src/errors/contract.ts
809
- var CallExecutionError = class extends BaseError {
810
- constructor(cause, {
811
- account: account_,
812
- docsPath: docsPath6,
813
- chain,
814
- data,
815
- gas,
816
- gasPrice,
817
- maxFeePerGas,
818
- maxPriorityFeePerGas,
819
- nonce,
820
- to,
821
- value
822
- }) {
823
- const account = account_ ? parseAccount(account_) : void 0;
824
- const prettyArgs = prettyPrint({
825
- from: _optionalChain([account, 'optionalAccess', _9 => _9.address]),
826
- to,
827
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _10 => _10.nativeCurrency, 'access', _11 => _11.symbol]) || "ETH"}`,
828
- data,
829
- gas,
830
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
831
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
832
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
833
- nonce
834
- });
835
- super(cause.shortMessage, {
836
- cause,
837
- docsPath: docsPath6,
838
- metaMessages: [
839
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
840
- "Raw Call Arguments:",
841
- prettyArgs
842
- ].filter(Boolean)
843
- });
844
- __publicField(this, "cause");
845
- __publicField(this, "name", "CallExecutionError");
846
- this.cause = cause;
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]];
847
775
  }
848
- };
849
- var ContractFunctionExecutionError = class extends BaseError {
850
- constructor(cause, {
851
- abi,
852
- args,
853
- contractAddress,
854
- docsPath: docsPath6,
855
- functionName,
856
- sender
857
- }) {
858
- const abiItem = getAbiItem({ abi, args, name: functionName });
859
- const formattedArgs = abiItem ? formatAbiItemWithArgs({
860
- abiItem,
861
- args,
862
- includeFunctionName: false,
863
- includeName: false
864
- }) : void 0;
865
- const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
866
- const prettyArgs = prettyPrint({
867
- address: contractAddress && getContractAddress(contractAddress),
868
- function: functionWithParams,
869
- args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _12 => _12.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
870
- sender
871
- });
872
- super(
873
- cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
874
- {
875
- cause,
876
- docsPath: docsPath6,
877
- metaMessages: [
878
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
879
- "Contract Call:",
880
- prettyArgs
881
- ].filter(Boolean)
882
- }
883
- );
884
- __publicField(this, "abi");
885
- __publicField(this, "args");
886
- __publicField(this, "cause");
887
- __publicField(this, "contractAddress");
888
- __publicField(this, "formattedArgs");
889
- __publicField(this, "functionName");
890
- __publicField(this, "sender");
891
- __publicField(this, "name", "ContractFunctionExecutionError");
892
- this.abi = abi;
893
- this.args = args;
894
- this.cause = cause;
895
- this.contractAddress = contractAddress;
896
- this.functionName = functionName;
897
- this.sender = sender;
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);
898
783
  }
899
- };
900
- var ContractFunctionRevertedError = class extends BaseError {
901
- constructor({
902
- abi,
903
- data,
904
- functionName,
905
- message
906
- }) {
907
- let decodedData = void 0;
908
- let metaMessages;
909
- let reason;
910
- if (data && data !== "0x") {
911
- decodedData = decodeErrorResult({ abi, data });
912
- const { abiItem, errorName, args: errorArgs } = decodedData;
913
- if (errorName === "Error") {
914
- reason = errorArgs[0];
915
- } else if (errorName === "Panic") {
916
- const [firstArg] = errorArgs;
917
- reason = panicReasons[firstArg];
918
- } else if (errorArgs) {
919
- const errorWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
920
- const formattedArgs = abiItem ? formatAbiItemWithArgs({
921
- abiItem,
922
- args: errorArgs,
923
- includeFunctionName: false,
924
- includeName: false
925
- }) : void 0;
926
- metaMessages = [
927
- errorWithParams ? `Error: ${errorWithParams}` : "",
928
- formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _13 => _13.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
929
- ];
930
- }
931
- } else if (message)
932
- reason = message;
933
- super(
934
- reason ? [
935
- `The contract function "${functionName}" reverted with the following reason:`,
936
- reason
937
- ].join("\n") : `The contract function "${functionName}" reverted.`,
938
- {
939
- metaMessages
940
- }
941
- );
942
- __publicField(this, "name", "ContractFunctionRevertedError");
943
- __publicField(this, "data");
944
- __publicField(this, "reason");
945
- this.reason = reason;
946
- this.data = decodedData;
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);
947
799
  }
948
- };
949
- var ContractFunctionZeroDataError = class extends BaseError {
950
- constructor({ functionName }) {
951
- super(`The contract function "${functionName}" returned no data ("0x").`, {
952
- metaMessages: [
953
- "This could be due to any of the following:",
954
- ` - The contract does not have the function "${functionName}",`,
955
- " - The parameters passed to the contract function may be invalid, or",
956
- " - The address is not a contract."
957
- ]
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}`
958
809
  });
959
- __publicField(this, "name", "ContractFunctionZeroDataError");
960
- }
961
- };
962
- var RawContractError = class extends BaseError {
963
- constructor({ data, message }) {
964
- super(message || "");
965
- __publicField(this, "code", 3);
966
- __publicField(this, "name", "RawContractError");
967
- __publicField(this, "data");
968
- this.data = data;
969
810
  }
970
- };
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
+ }
971
821
 
972
- // src/errors/data.ts
973
- var SizeExceedsPaddingSizeError = class extends BaseError {
974
- constructor({
975
- size: size2,
976
- targetSize,
977
- type
978
- }) {
979
- super(
980
- `${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`
981
- );
982
- __publicField(this, "name", "SizeExceedsPaddingSizeError");
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;
983
850
  }
984
- };
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
+ }
985
860
 
986
- // src/errors/encoding.ts
987
- var DataLengthTooLongError = class extends BaseError {
988
- constructor({ consumed, length }) {
989
- super(
990
- `Consumed bytes (${consumed}) is shorter than data length (${length - 1}).`
991
- );
992
- __publicField(this, "name", "DataLengthTooLongError");
993
- }
994
- };
995
- var DataLengthTooShortError = class extends BaseError {
996
- constructor({ length, dataLength }) {
997
- super(
998
- `Data length (${dataLength - 1}) is shorter than prefix length (${length - 1}).`
999
- );
1000
- __publicField(this, "name", "DataLengthTooShortError");
1001
- }
1002
- };
1003
- var IntegerOutOfRangeError = class extends BaseError {
1004
- constructor({
1005
- max,
1006
- min,
1007
- signed,
1008
- size: size2,
1009
- value
1010
- }) {
1011
- super(
1012
- `Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`
1013
- );
1014
- __publicField(this, "name", "IntegerOutOfRangeError");
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]);
1015
878
  }
1016
- };
1017
- var InvalidBytesBooleanError = class extends BaseError {
1018
- constructor(bytes) {
1019
- super(
1020
- `Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`
1021
- );
1022
- __publicField(this, "name", "InvalidBytesBooleanError");
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);
1023
972
  }
1024
- };
1025
- var InvalidHexBooleanError = class extends BaseError {
1026
- constructor(hex) {
1027
- super(
1028
- `Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`
1029
- );
1030
- __publicField(this, "name", "InvalidHexBooleanError");
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];
1031
995
  }
1032
- };
1033
- var InvalidHexValueError = class extends BaseError {
1034
- constructor(value) {
1035
- super(
1036
- `Hex value "${value}" is an odd length (${value.length}). It must be an even length.`
1037
- );
1038
- __publicField(this, "name", "InvalidHexValueError");
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
+ ];
1039
1009
  }
1040
- };
1041
- var OffsetOutOfBoundsError = class extends BaseError {
1042
- constructor({ nextOffset, offset }) {
1043
- super(
1044
- `Next offset (${nextOffset}) is greater than previous offset + consumed bytes (${offset})`
1045
- );
1046
- __publicField(this, "name", "OffsetOutOfBoundsError");
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));
1047
1015
  }
1048
- };
1049
-
1050
- // src/errors/estimateGas.ts
1051
- var EstimateGasExecutionError = class extends BaseError {
1052
- constructor(cause, {
1053
- account,
1054
- docsPath: docsPath6,
1055
- chain,
1056
- data,
1057
- gas,
1058
- gasPrice,
1059
- maxFeePerGas,
1060
- maxPriorityFeePerGas,
1061
- nonce,
1062
- to,
1063
- value
1064
- }) {
1065
- const prettyArgs = prettyPrint({
1066
- from: _optionalChain([account, 'optionalAccess', _14 => _14.address]),
1067
- to,
1068
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _15 => _15.nativeCurrency, 'access', _16 => _16.symbol]) || "ETH"}`,
1069
- data,
1070
- gas,
1071
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1072
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1073
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1074
- nonce
1075
- });
1076
- super(cause.shortMessage, {
1077
- cause,
1078
- docsPath: docsPath6,
1079
- metaMessages: [
1080
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1081
- "Estimate Gas Arguments:",
1082
- prettyArgs
1083
- ].filter(Boolean)
1016
+ let nextOffset = offset + 1 + lengthOfLength;
1017
+ if (nextOffset > bytes.length)
1018
+ throw new DataLengthTooShortError({
1019
+ length: nextOffset,
1020
+ dataLength: bytes.length
1084
1021
  });
1085
- __publicField(this, "cause");
1086
- __publicField(this, "name", "EstimateGasExecutionError");
1087
- this.cause = cause;
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
+ });
1088
1033
  }
1089
- };
1034
+ return [result, consumed];
1035
+ }
1090
1036
 
1091
- // src/errors/log.ts
1092
- var FilterTypeNotSupportedError = class extends BaseError {
1093
- constructor(type) {
1094
- super(`Filter type "${type}" is not supported.`);
1095
- __publicField(this, "name", "FilterTypeNotSupportedError");
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
+ }
1096
1106
  }
1097
- };
1107
+ return `0x${address.join("")}`;
1108
+ }
1109
+ function getAddress(address) {
1110
+ if (!isAddress(address))
1111
+ throw new InvalidAddressError({ address });
1112
+ return checksumAddress(address);
1113
+ }
1098
1114
 
1099
- // src/errors/node.ts
1100
- var ExecutionRevertedError = class extends BaseError {
1101
- constructor({
1102
- cause,
1103
- message
1104
- } = {}) {
1105
- const reason = _optionalChain([message, 'optionalAccess', _17 => _17.replace, 'call', _18 => _18("execution reverted: ", ""), 'optionalAccess', _19 => _19.replace, 'call', _20 => _20("execution reverted", "")]);
1106
- super(
1107
- `Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`,
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: [
1108
1180
  {
1109
- cause
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[]"
1110
1197
  }
1111
- );
1112
- __publicField(this, "name", "ExecutionRevertedError");
1113
- }
1114
- };
1115
- __publicField(ExecutionRevertedError, "code", 3);
1116
- __publicField(ExecutionRevertedError, "nodeMessage", /execution reverted/);
1117
- var FeeCapTooHighError = class extends BaseError {
1118
- constructor({
1119
- cause,
1120
- maxFeePerGas
1121
- } = {}) {
1122
- super(
1123
- `The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`,
1198
+ ],
1199
+ name: "aggregate3",
1200
+ outputs: [
1124
1201
  {
1125
- cause
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[]"
1126
1214
  }
1127
- );
1128
- __publicField(this, "name", "FeeCapTooHigh");
1129
- }
1130
- };
1131
- __publicField(FeeCapTooHighError, "nodeMessage", /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/);
1132
- var FeeCapTooLowError = class extends BaseError {
1133
- constructor({
1134
- cause,
1135
- maxFeePerGas
1136
- } = {}) {
1137
- super(
1138
- `The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`,
1139
- {
1140
- cause
1141
- }
1142
- );
1143
- __publicField(this, "name", "FeeCapTooLow");
1215
+ ],
1216
+ stateMutability: "view",
1217
+ type: "function"
1144
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."
1145
1232
  };
1146
- __publicField(FeeCapTooLowError, "nodeMessage", /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/);
1147
- var NonceTooHighError = class extends BaseError {
1148
- constructor({ cause, nonce } = {}) {
1149
- super(
1150
- `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`,
1151
- { cause }
1152
- );
1153
- __publicField(this, "name", "NonceTooHighError");
1154
- }
1233
+ var solidityError = {
1234
+ inputs: [
1235
+ {
1236
+ name: "message",
1237
+ type: "string"
1238
+ }
1239
+ ],
1240
+ name: "Error",
1241
+ type: "error"
1155
1242
  };
1156
- __publicField(NonceTooHighError, "nodeMessage", /nonce too high/);
1157
- var NonceTooLowError = class extends BaseError {
1158
- constructor({ cause, nonce } = {}) {
1159
- super(
1160
- [
1161
- `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
1162
- "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
1163
- ].join("\n"),
1164
- { cause }
1165
- );
1166
- __publicField(this, "name", "NonceTooLowError");
1167
- }
1243
+ var solidityPanic = {
1244
+ inputs: [
1245
+ {
1246
+ name: "reason",
1247
+ type: "uint256"
1248
+ }
1249
+ ],
1250
+ name: "Panic",
1251
+ type: "error"
1168
1252
  };
1169
- __publicField(NonceTooLowError, "nodeMessage", /nonce too low|transaction already imported/);
1170
- var NonceMaxValueError = class extends BaseError {
1171
- constructor({ cause, nonce } = {}) {
1172
- super(
1173
- `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`,
1174
- { cause }
1175
- );
1176
- __publicField(this, "name", "NonceMaxValueError");
1177
- }
1253
+
1254
+ // src/constants/unit.ts
1255
+ var etherUnits = {
1256
+ gwei: 9,
1257
+ wei: 18
1178
1258
  };
1179
- __publicField(NonceMaxValueError, "nodeMessage", /nonce has max value/);
1180
- var InsufficientFundsError = class extends BaseError {
1181
- constructor({ cause } = {}) {
1182
- super(
1183
- [
1184
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1185
- ].join("\n"),
1186
- {
1187
- cause,
1188
- metaMessages: [
1189
- "This error could arise when the account does not have enough funds to:",
1190
- " - pay for the total gas fee,",
1191
- " - pay for the value to send.",
1192
- " ",
1193
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1194
- " - `gas` is the amount of gas needed for transaction to execute,",
1195
- " - `gas fee` is the gas fee,",
1196
- " - `value` is the amount of ether to send to the recipient."
1197
- ]
1198
- }
1199
- );
1200
- __publicField(this, "name", "InsufficientFundsError");
1201
- }
1259
+ var gweiUnits = {
1260
+ ether: -9,
1261
+ wei: 9
1202
1262
  };
1203
- __publicField(InsufficientFundsError, "nodeMessage", /insufficient funds/);
1204
- var IntrinsicGasTooHighError = class extends BaseError {
1205
- constructor({ cause, gas } = {}) {
1206
- super(
1207
- `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`,
1208
- {
1209
- cause
1210
- }
1211
- );
1212
- __publicField(this, "name", "IntrinsicGasTooHighError");
1213
- }
1263
+ var weiUnits = {
1264
+ ether: -18,
1265
+ gwei: -9
1214
1266
  };
1215
- __publicField(IntrinsicGasTooHighError, "nodeMessage", /intrinsic gas too high|gas limit reached/);
1216
- var IntrinsicGasTooLowError = class extends BaseError {
1217
- constructor({ cause, gas } = {}) {
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() {
1218
1280
  super(
1219
- `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`,
1220
- {
1221
- cause
1222
- }
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")
1223
1285
  );
1224
- __publicField(this, "name", "IntrinsicGasTooLowError");
1286
+ __publicField(this, "name", "FeeConflictError");
1225
1287
  }
1226
1288
  };
1227
- __publicField(IntrinsicGasTooLowError, "nodeMessage", /intrinsic gas too low/);
1228
- var TransactionTypeNotSupportedError = class extends BaseError {
1229
- constructor({ cause }) {
1230
- super("The transaction type is not supported for this chain.", {
1231
- cause
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
1232
1314
  });
1233
- __publicField(this, "name", "TransactionTypeNotSupportedError");
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;
1234
1327
  }
1235
1328
  };
1236
- __publicField(TransactionTypeNotSupportedError, "nodeMessage", /transaction type not valid/);
1237
- var TipAboveFeeCapError = class extends BaseError {
1329
+ var TransactionNotFoundError = class extends BaseError {
1238
1330
  constructor({
1239
- cause,
1240
- maxPriorityFeePerGas,
1241
- maxFeePerGas
1242
- } = {}) {
1331
+ blockHash,
1332
+ blockNumber,
1333
+ blockTag,
1334
+ hash: hash2,
1335
+ index
1336
+ }) {
1337
+ let identifier = "Transaction";
1338
+ if (blockTag && index !== void 0)
1339
+ identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
1340
+ if (blockHash && index !== void 0)
1341
+ identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
1342
+ if (blockNumber && index !== void 0)
1343
+ identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
1344
+ if (hash2)
1345
+ identifier = `Transaction with hash "${hash2}"`;
1346
+ super(`${identifier} could not be found.`);
1347
+ __publicField(this, "name", "TransactionNotFoundError");
1348
+ }
1349
+ };
1350
+ var TransactionReceiptNotFoundError = class extends BaseError {
1351
+ constructor({ hash: hash2 }) {
1243
1352
  super(
1244
- [
1245
- `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1246
- ].join("\n"),
1247
- {
1248
- cause
1249
- }
1353
+ `Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
1250
1354
  );
1251
- __publicField(this, "name", "TipAboveFeeCapError");
1355
+ __publicField(this, "name", "TransactionReceiptNotFoundError");
1252
1356
  }
1253
1357
  };
1254
- __publicField(TipAboveFeeCapError, "nodeMessage", /max priority fee per gas higher than max fee per gas|tip higher than fee cap/);
1255
- var UnknownNodeError = class extends BaseError {
1256
- constructor({ cause }) {
1257
- super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _21 => _21.message])}`, {
1258
- cause
1259
- });
1260
- __publicField(this, "name", "UnknownNodeError");
1358
+ var WaitForTransactionReceiptTimeoutError = class extends BaseError {
1359
+ constructor({ hash: hash2 }) {
1360
+ super(
1361
+ `Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
1362
+ );
1363
+ __publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
1261
1364
  }
1262
1365
  };
1263
1366
 
1264
- // src/errors/request.ts
1265
- var RequestError = class extends BaseError {
1266
- constructor(err, {
1367
+ // src/errors/contract.ts
1368
+ var CallExecutionError = class extends BaseError {
1369
+ constructor(cause, {
1370
+ account: account_,
1267
1371
  docsPath: docsPath6,
1268
- metaMessages,
1269
- shortMessage
1372
+ chain,
1373
+ data,
1374
+ gas,
1375
+ gasPrice,
1376
+ maxFeePerGas,
1377
+ maxPriorityFeePerGas,
1378
+ nonce,
1379
+ to,
1380
+ value
1270
1381
  }) {
1271
- super(shortMessage, {
1272
- cause: err,
1273
- docsPath: docsPath6,
1274
- metaMessages
1382
+ const account = account_ ? parseAccount(account_) : void 0;
1383
+ const prettyArgs = prettyPrint({
1384
+ from: _optionalChain([account, 'optionalAccess', _18 => _18.address]),
1385
+ to,
1386
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _19 => _19.nativeCurrency, 'access', _20 => _20.symbol]) || "ETH"}`,
1387
+ data,
1388
+ gas,
1389
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1390
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1391
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1392
+ nonce
1275
1393
  });
1276
- this.name = err.name;
1277
- }
1278
- };
1279
- var RpcRequestError = class extends RequestError {
1280
- constructor(err, { docsPath: docsPath6, shortMessage }) {
1281
- super(err, { docsPath: docsPath6, metaMessages: err.metaMessages, shortMessage });
1282
- __publicField(this, "code");
1283
- this.code = err.code;
1284
- this.name = err.name;
1394
+ super(cause.shortMessage, {
1395
+ cause,
1396
+ docsPath: docsPath6,
1397
+ metaMessages: [
1398
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1399
+ "Raw Call Arguments:",
1400
+ prettyArgs
1401
+ ].filter(Boolean)
1402
+ });
1403
+ __publicField(this, "cause");
1404
+ __publicField(this, "name", "CallExecutionError");
1405
+ this.cause = cause;
1285
1406
  }
1286
1407
  };
1287
- var ParseRpcError = class extends RpcRequestError {
1288
- constructor(err) {
1289
- super(err, {
1290
- shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
1408
+ var ContractFunctionExecutionError = class extends BaseError {
1409
+ constructor(cause, {
1410
+ abi,
1411
+ args,
1412
+ contractAddress,
1413
+ docsPath: docsPath6,
1414
+ functionName,
1415
+ sender
1416
+ }) {
1417
+ const abiItem = getAbiItem({ abi, args, name: functionName });
1418
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
1419
+ abiItem,
1420
+ args,
1421
+ includeFunctionName: false,
1422
+ includeName: false
1423
+ }) : void 0;
1424
+ const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
1425
+ const prettyArgs = prettyPrint({
1426
+ address: contractAddress && getContractAddress(contractAddress),
1427
+ function: functionWithParams,
1428
+ args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _21 => _21.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
1429
+ sender
1291
1430
  });
1292
- __publicField(this, "name", "ParseRpcError");
1293
- __publicField(this, "code", -32700);
1431
+ super(
1432
+ cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
1433
+ {
1434
+ cause,
1435
+ docsPath: docsPath6,
1436
+ metaMessages: [
1437
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1438
+ "Contract Call:",
1439
+ prettyArgs
1440
+ ].filter(Boolean)
1441
+ }
1442
+ );
1443
+ __publicField(this, "abi");
1444
+ __publicField(this, "args");
1445
+ __publicField(this, "cause");
1446
+ __publicField(this, "contractAddress");
1447
+ __publicField(this, "formattedArgs");
1448
+ __publicField(this, "functionName");
1449
+ __publicField(this, "sender");
1450
+ __publicField(this, "name", "ContractFunctionExecutionError");
1451
+ this.abi = abi;
1452
+ this.args = args;
1453
+ this.cause = cause;
1454
+ this.contractAddress = contractAddress;
1455
+ this.functionName = functionName;
1456
+ this.sender = sender;
1294
1457
  }
1295
1458
  };
1296
- var InvalidRequestRpcError = class extends RpcRequestError {
1297
- constructor(err) {
1298
- super(err, { shortMessage: "JSON is not a valid request object." });
1299
- __publicField(this, "name", "InvalidRequestRpcError");
1300
- __publicField(this, "code", -32600);
1459
+ var ContractFunctionRevertedError = class extends BaseError {
1460
+ constructor({
1461
+ abi,
1462
+ data,
1463
+ functionName,
1464
+ message
1465
+ }) {
1466
+ let decodedData = void 0;
1467
+ let metaMessages;
1468
+ let reason;
1469
+ if (data && data !== "0x") {
1470
+ decodedData = decodeErrorResult({ abi, data });
1471
+ const { abiItem, errorName, args: errorArgs } = decodedData;
1472
+ if (errorName === "Error") {
1473
+ reason = errorArgs[0];
1474
+ } else if (errorName === "Panic") {
1475
+ const [firstArg] = errorArgs;
1476
+ reason = panicReasons[firstArg];
1477
+ } else if (errorArgs) {
1478
+ const errorWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
1479
+ const formattedArgs = abiItem ? formatAbiItemWithArgs({
1480
+ abiItem,
1481
+ args: errorArgs,
1482
+ includeFunctionName: false,
1483
+ includeName: false
1484
+ }) : void 0;
1485
+ metaMessages = [
1486
+ errorWithParams ? `Error: ${errorWithParams}` : "",
1487
+ formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _22 => _22.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
1488
+ ];
1489
+ }
1490
+ } else if (message)
1491
+ reason = message;
1492
+ super(
1493
+ reason ? [
1494
+ `The contract function "${functionName}" reverted with the following reason:`,
1495
+ reason
1496
+ ].join("\n") : `The contract function "${functionName}" reverted.`,
1497
+ {
1498
+ metaMessages
1499
+ }
1500
+ );
1501
+ __publicField(this, "name", "ContractFunctionRevertedError");
1502
+ __publicField(this, "data");
1503
+ __publicField(this, "reason");
1504
+ this.reason = reason;
1505
+ this.data = decodedData;
1301
1506
  }
1302
1507
  };
1303
- var MethodNotFoundRpcError = class extends RpcRequestError {
1304
- constructor(err) {
1305
- super(err, {
1306
- shortMessage: "The method does not exist / is not available."
1508
+ var ContractFunctionZeroDataError = class extends BaseError {
1509
+ constructor({ functionName }) {
1510
+ super(`The contract function "${functionName}" returned no data ("0x").`, {
1511
+ metaMessages: [
1512
+ "This could be due to any of the following:",
1513
+ ` - The contract does not have the function "${functionName}",`,
1514
+ " - The parameters passed to the contract function may be invalid, or",
1515
+ " - The address is not a contract."
1516
+ ]
1307
1517
  });
1308
- __publicField(this, "name", "MethodNotFoundRpcError");
1309
- __publicField(this, "code", -32601);
1518
+ __publicField(this, "name", "ContractFunctionZeroDataError");
1310
1519
  }
1311
1520
  };
1312
- var InvalidParamsRpcError = class extends RpcRequestError {
1313
- constructor(err) {
1314
- super(err, {
1315
- shortMessage: [
1316
- "Invalid parameters were provided to the RPC method.",
1317
- "Double check you have provided the correct parameters."
1318
- ].join("\n")
1319
- });
1320
- __publicField(this, "name", "InvalidParamsRpcError");
1321
- __publicField(this, "code", -32602);
1521
+ var RawContractError = class extends BaseError {
1522
+ constructor({ data, message }) {
1523
+ super(message || "");
1524
+ __publicField(this, "code", 3);
1525
+ __publicField(this, "name", "RawContractError");
1526
+ __publicField(this, "data");
1527
+ this.data = data;
1322
1528
  }
1323
1529
  };
1324
- var InternalRpcError = class extends RpcRequestError {
1325
- constructor(err) {
1326
- super(err, { shortMessage: "An internal error was received." });
1327
- __publicField(this, "name", "InternalRpcError");
1328
- __publicField(this, "code", -32603);
1530
+
1531
+ // src/errors/data.ts
1532
+ var SizeExceedsPaddingSizeError = class extends BaseError {
1533
+ constructor({
1534
+ size: size2,
1535
+ targetSize,
1536
+ type
1537
+ }) {
1538
+ super(
1539
+ `${type.charAt(0).toUpperCase()}${type.slice(1).toLowerCase()} size (${size2}) exceeds padding size (${targetSize}).`
1540
+ );
1541
+ __publicField(this, "name", "SizeExceedsPaddingSizeError");
1329
1542
  }
1330
1543
  };
1331
- var InvalidInputRpcError = class extends RpcRequestError {
1332
- constructor(err) {
1333
- super(err, {
1334
- shortMessage: [
1335
- "Missing or invalid parameters.",
1336
- "Double check you have provided the correct parameters."
1337
- ].join("\n")
1338
- });
1339
- __publicField(this, "name", "InvalidInputRpcError");
1340
- __publicField(this, "code", -32e3);
1544
+
1545
+ // src/errors/encoding.ts
1546
+ var DataLengthTooLongError = class extends BaseError {
1547
+ constructor({ consumed, length }) {
1548
+ super(
1549
+ `Consumed bytes (${consumed}) is shorter than data length (${length - 1}).`
1550
+ );
1551
+ __publicField(this, "name", "DataLengthTooLongError");
1341
1552
  }
1342
1553
  };
1343
- var ResourceNotFoundRpcError = class extends RpcRequestError {
1344
- constructor(err) {
1345
- super(err, { shortMessage: "Requested resource not found." });
1346
- __publicField(this, "name", "ResourceNotFoundRpcError");
1347
- __publicField(this, "code", -32001);
1554
+ var DataLengthTooShortError = class extends BaseError {
1555
+ constructor({ length, dataLength }) {
1556
+ super(
1557
+ `Data length (${dataLength - 1}) is shorter than prefix length (${length - 1}).`
1558
+ );
1559
+ __publicField(this, "name", "DataLengthTooShortError");
1348
1560
  }
1349
1561
  };
1350
- var ResourceUnavailableRpcError = class extends RpcRequestError {
1351
- constructor(err) {
1352
- super(err, { shortMessage: "Requested resource not available." });
1353
- __publicField(this, "name", "ResourceUnavailableRpcError");
1354
- __publicField(this, "code", -32002);
1562
+ var IntegerOutOfRangeError = class extends BaseError {
1563
+ constructor({
1564
+ max,
1565
+ min,
1566
+ signed,
1567
+ size: size2,
1568
+ value
1569
+ }) {
1570
+ super(
1571
+ `Number "${value}" is not in safe ${size2 ? `${size2 * 8}-bit ${signed ? "signed" : "unsigned"} ` : ""}integer range ${max ? `(${min} to ${max})` : `(above ${min})`}`
1572
+ );
1573
+ __publicField(this, "name", "IntegerOutOfRangeError");
1355
1574
  }
1356
1575
  };
1357
- var TransactionRejectedRpcError = class extends RpcRequestError {
1358
- constructor(err) {
1359
- super(err, { shortMessage: "Transaction creation failed." });
1360
- __publicField(this, "name", "TransactionRejectedRpcError");
1361
- __publicField(this, "code", -32003);
1576
+ var InvalidBytesBooleanError = class extends BaseError {
1577
+ constructor(bytes) {
1578
+ super(
1579
+ `Bytes value "${bytes}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`
1580
+ );
1581
+ __publicField(this, "name", "InvalidBytesBooleanError");
1362
1582
  }
1363
1583
  };
1364
- var MethodNotSupportedRpcError = class extends RpcRequestError {
1365
- constructor(err) {
1366
- super(err, { shortMessage: "Method is not implemented." });
1367
- __publicField(this, "name", "MethodNotSupportedRpcError");
1368
- __publicField(this, "code", -32004);
1584
+ var InvalidHexBooleanError = class extends BaseError {
1585
+ constructor(hex) {
1586
+ super(
1587
+ `Hex value "${hex}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`
1588
+ );
1589
+ __publicField(this, "name", "InvalidHexBooleanError");
1369
1590
  }
1370
1591
  };
1371
- var LimitExceededRpcError = class extends RpcRequestError {
1372
- constructor(err) {
1373
- super(err, { shortMessage: "Request exceeds defined limit." });
1374
- __publicField(this, "name", "LimitExceededRpcError");
1375
- __publicField(this, "code", -32005);
1592
+ var InvalidHexValueError = class extends BaseError {
1593
+ constructor(value) {
1594
+ super(
1595
+ `Hex value "${value}" is an odd length (${value.length}). It must be an even length.`
1596
+ );
1597
+ __publicField(this, "name", "InvalidHexValueError");
1376
1598
  }
1377
1599
  };
1378
- var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1379
- constructor(err) {
1380
- super(err, {
1381
- shortMessage: "Version of JSON-RPC protocol is not supported."
1382
- });
1383
- __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1384
- __publicField(this, "code", -32006);
1600
+ var OffsetOutOfBoundsError = class extends BaseError {
1601
+ constructor({ nextOffset, offset }) {
1602
+ super(
1603
+ `Next offset (${nextOffset}) is greater than previous offset + consumed bytes (${offset})`
1604
+ );
1605
+ __publicField(this, "name", "OffsetOutOfBoundsError");
1385
1606
  }
1386
1607
  };
1387
- var UserRejectedRequestError = class extends RpcRequestError {
1388
- constructor(err) {
1389
- super(err, {
1390
- shortMessage: "User rejected the request."
1608
+
1609
+ // src/errors/estimateGas.ts
1610
+ var EstimateGasExecutionError = class extends BaseError {
1611
+ constructor(cause, {
1612
+ account,
1613
+ docsPath: docsPath6,
1614
+ chain,
1615
+ data,
1616
+ gas,
1617
+ gasPrice,
1618
+ maxFeePerGas,
1619
+ maxPriorityFeePerGas,
1620
+ nonce,
1621
+ to,
1622
+ value
1623
+ }) {
1624
+ const prettyArgs = prettyPrint({
1625
+ from: _optionalChain([account, 'optionalAccess', _23 => _23.address]),
1626
+ to,
1627
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _24 => _24.nativeCurrency, 'access', _25 => _25.symbol]) || "ETH"}`,
1628
+ data,
1629
+ gas,
1630
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1631
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1632
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1633
+ nonce
1391
1634
  });
1392
- __publicField(this, "name", "UserRejectedRequestError");
1393
- __publicField(this, "code", 4001);
1394
- }
1395
- };
1396
- var SwitchChainError = class extends RpcRequestError {
1397
- constructor(err) {
1398
- super(err, {
1399
- shortMessage: "An error occurred when attempting to switch chain."
1635
+ super(cause.shortMessage, {
1636
+ cause,
1637
+ docsPath: docsPath6,
1638
+ metaMessages: [
1639
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1640
+ "Estimate Gas Arguments:",
1641
+ prettyArgs
1642
+ ].filter(Boolean)
1400
1643
  });
1401
- __publicField(this, "name", "SwitchChainError");
1402
- __publicField(this, "code", 4902);
1644
+ __publicField(this, "cause");
1645
+ __publicField(this, "name", "EstimateGasExecutionError");
1646
+ this.cause = cause;
1403
1647
  }
1404
1648
  };
1405
- var UnknownRpcError = class extends RequestError {
1406
- constructor(err) {
1407
- super(err, {
1408
- shortMessage: "An unknown RPC error occurred."
1409
- });
1410
- __publicField(this, "name", "UnknownRpcError");
1649
+
1650
+ // src/errors/log.ts
1651
+ var FilterTypeNotSupportedError = class extends BaseError {
1652
+ constructor(type) {
1653
+ super(`Filter type "${type}" is not supported.`);
1654
+ __publicField(this, "name", "FilterTypeNotSupportedError");
1411
1655
  }
1412
1656
  };
1413
1657
 
1414
- // src/errors/rpc.ts
1415
- var HttpRequestError = class extends BaseError {
1658
+ // src/errors/node.ts
1659
+ var ExecutionRevertedError = class extends BaseError {
1416
1660
  constructor({
1417
- body,
1418
- details,
1419
- headers,
1420
- status,
1421
- url
1422
- }) {
1423
- super("HTTP request failed.", {
1424
- details,
1425
- metaMessages: [
1426
- status && `Status: ${status}`,
1427
- `URL: ${getUrl(url)}`,
1428
- `Request body: ${stringify(body)}`
1429
- ].filter(Boolean)
1430
- });
1431
- __publicField(this, "name", "HttpRequestError");
1432
- __publicField(this, "body");
1433
- __publicField(this, "headers");
1434
- __publicField(this, "status");
1435
- __publicField(this, "url");
1436
- this.body = body;
1437
- this.headers = headers;
1438
- this.status = status;
1439
- this.url = url;
1661
+ cause,
1662
+ message
1663
+ } = {}) {
1664
+ const reason = _optionalChain([message, 'optionalAccess', _26 => _26.replace, 'call', _27 => _27("execution reverted: ", ""), 'optionalAccess', _28 => _28.replace, 'call', _29 => _29("execution reverted", "")]);
1665
+ super(
1666
+ `Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`,
1667
+ {
1668
+ cause
1669
+ }
1670
+ );
1671
+ __publicField(this, "name", "ExecutionRevertedError");
1440
1672
  }
1441
1673
  };
1442
- var WebSocketRequestError = class extends BaseError {
1674
+ __publicField(ExecutionRevertedError, "code", 3);
1675
+ __publicField(ExecutionRevertedError, "nodeMessage", /execution reverted/);
1676
+ var FeeCapTooHighError = class extends BaseError {
1443
1677
  constructor({
1444
- body,
1445
- details,
1446
- url
1447
- }) {
1448
- super("WebSocket request failed.", {
1449
- details,
1450
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1451
- });
1452
- __publicField(this, "name", "WebSocketRequestError");
1678
+ cause,
1679
+ maxFeePerGas
1680
+ } = {}) {
1681
+ super(
1682
+ `The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`,
1683
+ {
1684
+ cause
1685
+ }
1686
+ );
1687
+ __publicField(this, "name", "FeeCapTooHigh");
1453
1688
  }
1454
1689
  };
1455
- var RpcError = class extends BaseError {
1690
+ __publicField(FeeCapTooHighError, "nodeMessage", /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/);
1691
+ var FeeCapTooLowError = class extends BaseError {
1456
1692
  constructor({
1457
- body,
1458
- error,
1459
- url
1460
- }) {
1461
- super("RPC Request failed.", {
1462
- cause: error,
1463
- details: error.message,
1464
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1465
- });
1466
- __publicField(this, "code");
1467
- __publicField(this, "name", "RpcError");
1468
- this.code = error.code;
1693
+ cause,
1694
+ maxFeePerGas
1695
+ } = {}) {
1696
+ super(
1697
+ `The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`,
1698
+ {
1699
+ cause
1700
+ }
1701
+ );
1702
+ __publicField(this, "name", "FeeCapTooLow");
1469
1703
  }
1470
1704
  };
1471
- var TimeoutError = class extends BaseError {
1472
- constructor({
1473
- body,
1474
- url
1475
- }) {
1476
- super("The request took too long to respond.", {
1477
- details: "The request timed out.",
1478
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1479
- });
1480
- __publicField(this, "name", "TimeoutError");
1705
+ __publicField(FeeCapTooLowError, "nodeMessage", /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/);
1706
+ var NonceTooHighError = class extends BaseError {
1707
+ constructor({ cause, nonce } = {}) {
1708
+ super(
1709
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`,
1710
+ { cause }
1711
+ );
1712
+ __publicField(this, "name", "NonceTooHighError");
1481
1713
  }
1482
1714
  };
1483
-
1484
- // src/errors/transport.ts
1485
- var UrlRequiredError = class extends BaseError {
1486
- constructor() {
1715
+ __publicField(NonceTooHighError, "nodeMessage", /nonce too high/);
1716
+ var NonceTooLowError = class extends BaseError {
1717
+ constructor({ cause, nonce } = {}) {
1487
1718
  super(
1488
- "No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
1719
+ [
1720
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
1721
+ "Try increasing the nonce or find the latest nonce with `getTransactionCount`."
1722
+ ].join("\n"),
1723
+ { cause }
1724
+ );
1725
+ __publicField(this, "name", "NonceTooLowError");
1726
+ }
1727
+ };
1728
+ __publicField(NonceTooLowError, "nodeMessage", /nonce too low|transaction already imported/);
1729
+ var NonceMaxValueError = class extends BaseError {
1730
+ constructor({ cause, nonce } = {}) {
1731
+ super(
1732
+ `Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`,
1733
+ { cause }
1734
+ );
1735
+ __publicField(this, "name", "NonceMaxValueError");
1736
+ }
1737
+ };
1738
+ __publicField(NonceMaxValueError, "nodeMessage", /nonce has max value/);
1739
+ var InsufficientFundsError = class extends BaseError {
1740
+ constructor({ cause } = {}) {
1741
+ super(
1742
+ [
1743
+ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1744
+ ].join("\n"),
1489
1745
  {
1490
- docsPath: "/docs/clients/intro"
1746
+ cause,
1747
+ metaMessages: [
1748
+ "This error could arise when the account does not have enough funds to:",
1749
+ " - pay for the total gas fee,",
1750
+ " - pay for the value to send.",
1751
+ " ",
1752
+ "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1753
+ " - `gas` is the amount of gas needed for transaction to execute,",
1754
+ " - `gas fee` is the gas fee,",
1755
+ " - `value` is the amount of ether to send to the recipient."
1756
+ ]
1491
1757
  }
1492
1758
  );
1759
+ __publicField(this, "name", "InsufficientFundsError");
1493
1760
  }
1494
1761
  };
1495
-
1496
- // src/utils/data/concat.ts
1497
- function concat(values) {
1498
- if (typeof values[0] === "string")
1499
- return concatHex(values);
1500
- return concatBytes(values);
1501
- }
1502
- function concatBytes(values) {
1503
- let length = 0;
1504
- for (const arr of values) {
1505
- length += arr.length;
1762
+ __publicField(InsufficientFundsError, "nodeMessage", /insufficient funds/);
1763
+ var IntrinsicGasTooHighError = class extends BaseError {
1764
+ constructor({ cause, gas } = {}) {
1765
+ super(
1766
+ `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`,
1767
+ {
1768
+ cause
1769
+ }
1770
+ );
1771
+ __publicField(this, "name", "IntrinsicGasTooHighError");
1506
1772
  }
1507
- const result = new Uint8Array(length);
1508
- let offset = 0;
1509
- for (const arr of values) {
1510
- result.set(arr, offset);
1511
- offset += arr.length;
1773
+ };
1774
+ __publicField(IntrinsicGasTooHighError, "nodeMessage", /intrinsic gas too high|gas limit reached/);
1775
+ var IntrinsicGasTooLowError = class extends BaseError {
1776
+ constructor({ cause, gas } = {}) {
1777
+ super(
1778
+ `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`,
1779
+ {
1780
+ cause
1781
+ }
1782
+ );
1783
+ __publicField(this, "name", "IntrinsicGasTooLowError");
1512
1784
  }
1513
- return result;
1514
- }
1515
- function concatHex(values) {
1516
- return `0x${values.reduce(
1517
- (acc, x) => acc + x.replace("0x", ""),
1518
- ""
1519
- )}`;
1520
- }
1521
-
1522
- // src/utils/data/isBytes.ts
1523
- function isBytes(value) {
1524
- if (!value)
1525
- return false;
1526
- if (typeof value !== "object")
1527
- return false;
1528
- if (!("BYTES_PER_ELEMENT" in value))
1529
- return false;
1530
- return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
1531
- }
1532
-
1533
- // src/utils/data/isHex.ts
1534
- function isHex(value) {
1535
- if (!value)
1536
- return false;
1537
- if (typeof value !== "string")
1538
- return false;
1539
- return /^0x[0-9a-fA-F]*$/.test(value);
1540
- }
1541
-
1542
- // src/utils/data/pad.ts
1543
- function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
1544
- if (typeof hexOrBytes === "string")
1545
- return padHex(hexOrBytes, { dir, size: size2 });
1546
- return padBytes(hexOrBytes, { dir, size: size2 });
1547
- }
1548
- function padHex(hex_, { dir, size: size2 = 32 } = {}) {
1549
- if (size2 === null)
1550
- return hex_;
1551
- let hex = hex_.replace("0x", "");
1552
- if (hex.length > size2 * 2)
1553
- throw new SizeExceedsPaddingSizeError({
1554
- size: Math.ceil(hex.length / 2),
1555
- targetSize: size2,
1556
- type: "hex"
1785
+ };
1786
+ __publicField(IntrinsicGasTooLowError, "nodeMessage", /intrinsic gas too low/);
1787
+ var TransactionTypeNotSupportedError = class extends BaseError {
1788
+ constructor({ cause }) {
1789
+ super("The transaction type is not supported for this chain.", {
1790
+ cause
1557
1791
  });
1558
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](
1559
- size2 * 2,
1560
- "0"
1561
- )}`;
1562
- }
1563
- function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
1564
- if (size2 === null)
1565
- return bytes;
1566
- if (bytes.length > size2)
1567
- throw new SizeExceedsPaddingSizeError({
1568
- size: bytes.length,
1569
- targetSize: size2,
1570
- type: "bytes"
1792
+ __publicField(this, "name", "TransactionTypeNotSupportedError");
1793
+ }
1794
+ };
1795
+ __publicField(TransactionTypeNotSupportedError, "nodeMessage", /transaction type not valid/);
1796
+ var TipAboveFeeCapError = class extends BaseError {
1797
+ constructor({
1798
+ cause,
1799
+ maxPriorityFeePerGas,
1800
+ maxFeePerGas
1801
+ } = {}) {
1802
+ super(
1803
+ [
1804
+ `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1805
+ ].join("\n"),
1806
+ {
1807
+ cause
1808
+ }
1809
+ );
1810
+ __publicField(this, "name", "TipAboveFeeCapError");
1811
+ }
1812
+ };
1813
+ __publicField(TipAboveFeeCapError, "nodeMessage", /max priority fee per gas higher than max fee per gas|tip higher than fee cap/);
1814
+ var UnknownNodeError = class extends BaseError {
1815
+ constructor({ cause }) {
1816
+ super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _30 => _30.message])}`, {
1817
+ cause
1571
1818
  });
1572
- const paddedBytes = new Uint8Array(size2);
1573
- for (let i = 0; i < size2; i++) {
1574
- const padEnd = dir === "right";
1575
- paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
1819
+ __publicField(this, "name", "UnknownNodeError");
1576
1820
  }
1577
- return paddedBytes;
1578
- }
1821
+ };
1579
1822
 
1580
- // src/utils/data/trim.ts
1581
- function trim(hexOrBytes, { dir = "left" } = {}) {
1582
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
1583
- let sliceLength = 0;
1584
- for (let i = 0; i < data.length - 1; i++) {
1585
- if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
1586
- sliceLength++;
1587
- else
1588
- break;
1823
+ // src/errors/request.ts
1824
+ var RequestError = class extends BaseError {
1825
+ constructor(err, {
1826
+ docsPath: docsPath6,
1827
+ metaMessages,
1828
+ shortMessage
1829
+ }) {
1830
+ super(shortMessage, {
1831
+ cause: err,
1832
+ docsPath: docsPath6,
1833
+ metaMessages
1834
+ });
1835
+ this.name = err.name;
1589
1836
  }
1590
- data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
1591
- if (typeof hexOrBytes === "string") {
1592
- if (data.length === 1 && dir === "right")
1593
- data = `${data}0`;
1594
- return `0x${data}`;
1837
+ };
1838
+ var RpcRequestError = class extends RequestError {
1839
+ constructor(err, { docsPath: docsPath6, shortMessage }) {
1840
+ super(err, { docsPath: docsPath6, metaMessages: err.metaMessages, shortMessage });
1841
+ __publicField(this, "code");
1842
+ this.code = err.code;
1843
+ this.name = err.name;
1595
1844
  }
1596
- return data;
1597
- }
1598
-
1599
- // src/utils/data/size.ts
1600
- function size(value) {
1601
- if (isHex(value))
1602
- return Math.ceil((value.length - 2) / 2);
1603
- return value.length;
1604
- }
1605
-
1606
- // src/utils/data/slice.ts
1607
- function slice(value, start, end) {
1608
- if (isHex(value))
1609
- return sliceHex(value, start, end);
1610
- return sliceBytes(value, start, end);
1611
- }
1612
- function assertStartOffset(value, start) {
1613
- if (typeof start === "number" && start > 0 && start > size(value) - 1)
1614
- throw new Error(
1615
- `Slice starting at offset "${start}" is out-of-bounds (size: ${size(
1616
- value
1617
- )}).`
1618
- );
1619
- }
1620
- function sliceBytes(value, start, end) {
1621
- assertStartOffset(value, start);
1622
- return value.slice(start, end);
1623
- }
1624
- function sliceHex(value_, start, end) {
1625
- assertStartOffset(value_, start);
1626
- const value = value_.replace("0x", "").slice((_nullishCoalesce(start, () => ( 0))) * 2, (_nullishCoalesce(end, () => ( value_.length))) * 2);
1627
- return `0x${value}`;
1628
- }
1629
-
1630
- // src/utils/encoding/toHex.ts
1631
- var hexes = Array.from(
1632
- { length: 256 },
1633
- (_v, i) => i.toString(16).padStart(2, "0")
1634
- );
1635
- function boolToHex(value) {
1636
- return `0x${Number(value)}`;
1637
- }
1638
- function bytesToHex(value) {
1639
- let hex = "";
1640
- for (let i = 0; i < value.length; i++) {
1641
- hex += hexes[value[i]];
1845
+ };
1846
+ var ParseRpcError = class extends RpcRequestError {
1847
+ constructor(err) {
1848
+ super(err, {
1849
+ shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
1850
+ });
1851
+ __publicField(this, "name", "ParseRpcError");
1852
+ __publicField(this, "code", -32700);
1642
1853
  }
1643
- return `0x${hex}`;
1644
- }
1645
- function toHex(value) {
1646
- if (typeof value === "number" || typeof value === "bigint")
1647
- return numberToHex(value);
1648
- if (typeof value === "string") {
1649
- return stringToHex(value);
1854
+ };
1855
+ var InvalidRequestRpcError = class extends RpcRequestError {
1856
+ constructor(err) {
1857
+ super(err, { shortMessage: "JSON is not a valid request object." });
1858
+ __publicField(this, "name", "InvalidRequestRpcError");
1859
+ __publicField(this, "code", -32600);
1650
1860
  }
1651
- if (typeof value === "boolean")
1652
- return boolToHex(value);
1653
- return bytesToHex(value);
1654
- }
1655
- function numberToHex(value_, opts = {}) {
1656
- const { signed, size: size2 } = opts;
1657
- let value = BigInt(value_);
1658
- let maxValue;
1659
- if (size2) {
1660
- if (signed)
1661
- maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
1662
- else
1663
- maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
1664
- } else if (typeof value_ === "number") {
1665
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
1861
+ };
1862
+ var MethodNotFoundRpcError = class extends RpcRequestError {
1863
+ constructor(err) {
1864
+ super(err, {
1865
+ shortMessage: "The method does not exist / is not available."
1866
+ });
1867
+ __publicField(this, "name", "MethodNotFoundRpcError");
1868
+ __publicField(this, "code", -32601);
1666
1869
  }
1667
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
1668
- if (maxValue && value > maxValue || value < minValue) {
1669
- const suffix = typeof value_ === "bigint" ? "n" : "";
1670
- throw new IntegerOutOfRangeError({
1671
- max: maxValue ? `${maxValue}${suffix}` : void 0,
1672
- min: `${minValue}${suffix}`,
1673
- signed,
1674
- size: size2,
1675
- value: `${value_}${suffix}`
1870
+ };
1871
+ var InvalidParamsRpcError = class extends RpcRequestError {
1872
+ constructor(err) {
1873
+ super(err, {
1874
+ shortMessage: [
1875
+ "Invalid parameters were provided to the RPC method.",
1876
+ "Double check you have provided the correct parameters."
1877
+ ].join("\n")
1676
1878
  });
1879
+ __publicField(this, "name", "InvalidParamsRpcError");
1880
+ __publicField(this, "code", -32602);
1677
1881
  }
1678
- const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
1679
- if (size2)
1680
- return pad(hex, { size: size2 });
1681
- return hex;
1682
- }
1683
- var encoder = new TextEncoder();
1684
- function stringToHex(value_) {
1685
- const value = encoder.encode(value_);
1686
- return toHex(value);
1687
- }
1688
-
1689
- // src/utils/encoding/toBytes.ts
1690
- var encoder2 = new TextEncoder();
1691
- function toBytes(value) {
1692
- if (typeof value === "number" || typeof value === "bigint")
1693
- return numberToBytes(value);
1694
- if (typeof value === "boolean")
1695
- return boolToBytes(value);
1696
- if (value.startsWith("0x"))
1697
- return hexToBytes(value);
1698
- return stringToBytes(value);
1699
- }
1700
- function boolToBytes(value) {
1701
- const bytes = new Uint8Array(1);
1702
- bytes[0] = Number(value);
1703
- return bytes;
1704
- }
1705
- function hexToBytes(hex_) {
1706
- let hex = hex_.slice(2);
1707
- if (hex.length % 2)
1708
- hex = `0${hex}`;
1709
- const bytes = new Uint8Array(hex.length / 2);
1710
- for (let index = 0; index < bytes.length; index++) {
1711
- const start = index * 2;
1712
- const hexByte = hex.slice(start, start + 2);
1713
- const byte = Number.parseInt(hexByte, 16);
1714
- if (Number.isNaN(byte) || byte < 0)
1715
- throw new BaseError(`Invalid byte sequence ("${hexByte}" in "${hex}").`);
1716
- bytes[index] = byte;
1882
+ };
1883
+ var InternalRpcError = class extends RpcRequestError {
1884
+ constructor(err) {
1885
+ super(err, { shortMessage: "An internal error was received." });
1886
+ __publicField(this, "name", "InternalRpcError");
1887
+ __publicField(this, "code", -32603);
1717
1888
  }
1718
- return bytes;
1719
- }
1720
- function numberToBytes(value, opts) {
1721
- const hex = numberToHex(value, opts);
1722
- return hexToBytes(hex);
1723
- }
1724
- function stringToBytes(value) {
1725
- return encoder2.encode(value);
1726
- }
1727
-
1728
- // src/utils/encoding/toRlp.ts
1729
- function toRlp(hexOrBytes, to_) {
1730
- const to = to_ || "hex";
1731
- return format(bytesToRlp(parse(hexOrBytes)), to);
1732
- }
1733
- function parse(hexOrBytes) {
1734
- if (Array.isArray(hexOrBytes))
1735
- return hexOrBytes.map(parse);
1736
- return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
1737
- }
1738
- function format(bytes, type = "bytes") {
1739
- return type === "hex" ? bytesToHex(bytes) : bytes;
1740
- }
1741
- function bytesToRlp(bytes) {
1742
- if (Array.isArray(bytes)) {
1743
- const encoded = concat(bytes.map(bytesToRlp));
1744
- return new Uint8Array([...encodeLength(encoded.length, 192), ...encoded]);
1889
+ };
1890
+ var InvalidInputRpcError = class extends RpcRequestError {
1891
+ constructor(err) {
1892
+ super(err, {
1893
+ shortMessage: [
1894
+ "Missing or invalid parameters.",
1895
+ "Double check you have provided the correct parameters."
1896
+ ].join("\n")
1897
+ });
1898
+ __publicField(this, "name", "InvalidInputRpcError");
1899
+ __publicField(this, "code", -32e3);
1745
1900
  }
1746
- if (bytes.length === 1 && bytes[0] < 128)
1747
- return bytes;
1748
- return new Uint8Array([...encodeLength(bytes.length, 128), ...bytes]);
1749
- }
1750
- function encodeLength(length, offset) {
1751
- if (length < 56)
1752
- return [offset + length];
1753
- return [toBytes(length).length + offset + 55, ...toBytes(length)];
1754
- }
1755
-
1756
- // src/utils/encoding/fromHex.ts
1757
- function fromHex(hex, to) {
1758
- if (to === "number")
1759
- return hexToNumber(hex);
1760
- if (to === "bigint")
1761
- return hexToBigInt(hex);
1762
- if (to === "string")
1763
- return hexToString(hex);
1764
- if (to === "boolean")
1765
- return hexToBool(hex);
1766
- return hexToBytes(hex);
1767
- }
1768
- function hexToBigInt(hex, opts = {}) {
1769
- const { signed } = opts;
1770
- const value = BigInt(hex);
1771
- if (!signed)
1772
- return value;
1773
- const size2 = (hex.length - 2) / 2;
1774
- const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
1775
- if (value <= max)
1776
- return value;
1777
- return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
1778
- }
1779
- function hexToBool(hex) {
1780
- if (trim(hex) === "0x0")
1781
- return false;
1782
- if (trim(hex) === "0x1")
1783
- return true;
1784
- throw new InvalidHexBooleanError(hex);
1785
- }
1786
- function hexToNumber(hex, opts = {}) {
1787
- return Number(hexToBigInt(hex, opts));
1788
- }
1789
- function hexToString(hex) {
1790
- const bytes = hexToBytes(hex);
1791
- return new TextDecoder().decode(bytes);
1792
- }
1793
-
1794
- // src/utils/encoding/fromBytes.ts
1795
- function fromBytes(bytes, to) {
1796
- if (to === "number")
1797
- return bytesToNumber(bytes);
1798
- if (to === "bigint")
1799
- return bytesToBigint(bytes);
1800
- if (to === "boolean")
1801
- return bytesToBool(bytes);
1802
- if (to === "string")
1803
- return bytesToString(bytes);
1804
- return bytesToHex(bytes);
1805
- }
1806
- function bytesToBigint(bytes) {
1807
- const hex = bytesToHex(bytes);
1808
- return hexToBigInt(hex);
1809
- }
1810
- function bytesToBool(bytes) {
1811
- if (bytes.length > 1 || bytes[0] > 1)
1812
- throw new InvalidBytesBooleanError(bytes);
1813
- return Boolean(bytes[0]);
1814
- }
1815
- function bytesToNumber(bytes) {
1816
- const hex = bytesToHex(bytes);
1817
- return hexToNumber(hex);
1818
- }
1819
- function bytesToString(bytes) {
1820
- return new TextDecoder().decode(bytes);
1821
- }
1822
-
1823
- // src/utils/encoding/fromRlp.ts
1824
- function fromRlp(value, to) {
1825
- const bytes = parse2(value);
1826
- const [data, consumed] = rlpToBytes(bytes);
1827
- if (consumed < bytes.length)
1828
- throw new DataLengthTooLongError({
1829
- consumed,
1830
- length: bytes.length
1901
+ };
1902
+ var ResourceNotFoundRpcError = class extends RpcRequestError {
1903
+ constructor(err) {
1904
+ super(err, { shortMessage: "Requested resource not found." });
1905
+ __publicField(this, "name", "ResourceNotFoundRpcError");
1906
+ __publicField(this, "code", -32001);
1907
+ }
1908
+ };
1909
+ var ResourceUnavailableRpcError = class extends RpcRequestError {
1910
+ constructor(err) {
1911
+ super(err, { shortMessage: "Requested resource not available." });
1912
+ __publicField(this, "name", "ResourceUnavailableRpcError");
1913
+ __publicField(this, "code", -32002);
1914
+ }
1915
+ };
1916
+ var TransactionRejectedRpcError = class extends RpcRequestError {
1917
+ constructor(err) {
1918
+ super(err, { shortMessage: "Transaction creation failed." });
1919
+ __publicField(this, "name", "TransactionRejectedRpcError");
1920
+ __publicField(this, "code", -32003);
1921
+ }
1922
+ };
1923
+ var MethodNotSupportedRpcError = class extends RpcRequestError {
1924
+ constructor(err) {
1925
+ super(err, { shortMessage: "Method is not implemented." });
1926
+ __publicField(this, "name", "MethodNotSupportedRpcError");
1927
+ __publicField(this, "code", -32004);
1928
+ }
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);
1935
+ }
1936
+ };
1937
+ var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1938
+ constructor(err) {
1939
+ super(err, {
1940
+ shortMessage: "Version of JSON-RPC protocol is not supported."
1831
1941
  });
1832
- return format2(data, to);
1833
- }
1834
- function parse2(value) {
1835
- if (typeof value === "string") {
1836
- if (value.length > 3 && value.length % 2 !== 0)
1837
- throw new InvalidHexValueError(value);
1838
- return hexToBytes(value);
1942
+ __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1943
+ __publicField(this, "code", -32006);
1839
1944
  }
1840
- return value;
1841
- }
1842
- function format2(bytes, to) {
1843
- if (Array.isArray(bytes))
1844
- return bytes.map((b) => format2(b, to));
1845
- return to === "hex" ? trim(bytesToHex(bytes)) : bytes;
1846
- }
1847
- function rlpToBytes(bytes, offset = 0) {
1848
- if (bytes.length === 0)
1849
- return [new Uint8Array([]), 0];
1850
- const prefix = bytes[offset];
1851
- if (prefix <= 127)
1852
- return [new Uint8Array([bytes[offset]]), 1];
1853
- if (prefix <= 183) {
1854
- const length2 = prefix - 128;
1855
- const offset_ = offset + 1;
1856
- if (offset_ + length2 > bytes.length)
1857
- throw new DataLengthTooShortError({
1858
- length: offset_ + length2,
1859
- dataLength: bytes.length
1860
- });
1861
- return [bytes.slice(offset_, offset_ + length2), 1 + length2];
1945
+ };
1946
+ var UserRejectedRequestError = class extends RpcRequestError {
1947
+ constructor(err) {
1948
+ super(err, {
1949
+ shortMessage: "User rejected the request."
1950
+ });
1951
+ __publicField(this, "name", "UserRejectedRequestError");
1952
+ __publicField(this, "code", 4001);
1862
1953
  }
1863
- if (prefix <= 191) {
1864
- const lengthOfLength2 = prefix - 183;
1865
- const offset_ = offset + 1;
1866
- const length2 = bytesToNumber(bytes.slice(offset_, offset_ + lengthOfLength2));
1867
- if (offset_ + lengthOfLength2 + length2 > bytes.length)
1868
- throw new DataLengthTooShortError({
1869
- length: lengthOfLength2 + length2,
1870
- dataLength: bytes.length - lengthOfLength2
1871
- });
1872
- return [
1873
- bytes.slice(offset_ + lengthOfLength2, offset_ + lengthOfLength2 + length2),
1874
- 1 + lengthOfLength2 + length2
1875
- ];
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);
1876
1962
  }
1877
- let lengthOfLength = 0;
1878
- let length = prefix - 192;
1879
- if (prefix > 247) {
1880
- lengthOfLength = prefix - 247;
1881
- length = bytesToNumber(bytes.slice(offset + 1, offset + 1 + lengthOfLength));
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");
1970
+ }
1971
+ };
1972
+
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)
1989
+ });
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;
1999
+ }
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");
2012
+ }
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;
1882
2028
  }
1883
- let nextOffset = offset + 1 + lengthOfLength;
1884
- if (nextOffset > bytes.length)
1885
- throw new DataLengthTooShortError({
1886
- length: nextOffset,
1887
- dataLength: bytes.length
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)}`]
1888
2038
  });
1889
- let consumed = 1 + lengthOfLength + length;
1890
- let result = [];
1891
- while (nextOffset < offset + consumed) {
1892
- const decoded = rlpToBytes(bytes, nextOffset);
1893
- result.push(decoded[0]);
1894
- nextOffset += decoded[1];
1895
- if (nextOffset > offset + consumed)
1896
- throw new OffsetOutOfBoundsError({
1897
- nextOffset,
1898
- offset: offset + consumed
1899
- });
2039
+ __publicField(this, "name", "TimeoutError");
1900
2040
  }
1901
- return [result, consumed];
1902
- }
1903
-
1904
- // src/utils/contract/extractFunctionParts.ts
1905
- var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1906
- function extractFunctionParts(def) {
1907
- const parts = def.match(paramsRegex);
1908
- const type = _optionalChain([parts, 'optionalAccess', _22 => _22[2]]) || void 0;
1909
- const name = _optionalChain([parts, 'optionalAccess', _23 => _23[3]]);
1910
- const params = _optionalChain([parts, 'optionalAccess', _24 => _24[5]]) || void 0;
1911
- return { type, name, params };
1912
- }
1913
- function extractFunctionName(def) {
1914
- return extractFunctionParts(def).name;
1915
- }
1916
- function extractFunctionParams(def) {
1917
- const params = extractFunctionParts(def).params;
1918
- const splitParams = _optionalChain([params, 'optionalAccess', _25 => _25.split, 'call', _26 => _26(","), 'access', _27 => _27.map, 'call', _28 => _28((x) => x.trim().split(" "))]);
1919
- return _optionalChain([splitParams, 'optionalAccess', _29 => _29.map, 'call', _30 => _30((param) => ({
1920
- type: param[0],
1921
- name: param[1] === "indexed" ? param[2] : param[1],
1922
- ...param[1] === "indexed" ? { indexed: true } : {}
1923
- }))]);
1924
- }
1925
- function extractFunctionType(def) {
1926
- return extractFunctionParts(def).type;
1927
- }
1928
-
1929
- // src/utils/hash/keccak256.ts
1930
- var _sha3 = require('@noble/hashes/sha3');
1931
- function keccak256(value, to_) {
1932
- const to = to_ || "hex";
1933
- const bytes = _sha3.keccak_256.call(void 0, isHex(value) ? toBytes(value) : value);
1934
- if (to === "bytes")
1935
- return bytes;
1936
- return toHex(bytes);
1937
- }
1938
-
1939
- // src/utils/hash/hashFunction.ts
1940
- var hash = (value) => keccak256(toBytes(value));
1941
- function hashFunction(def) {
1942
- const name = extractFunctionName(def);
1943
- const params = extractFunctionParams(def);
1944
- if (!params || params.length === 0)
1945
- return hash(def.replace(/ /g, ""));
1946
- return hash(`${name}(${params.map(({ type }) => type).join(",")})`);
1947
- }
1948
-
1949
- // src/utils/hash/getEventSelector.ts
1950
- var getEventSelector = (event) => hashFunction(event);
1951
-
1952
- // src/utils/hash/getFunctionSelector.ts
1953
- var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
1954
-
1955
- // src/utils/address/isAddress.ts
1956
- var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1957
- function isAddress(address) {
1958
- return addressRegex.test(address);
1959
- }
2041
+ };
1960
2042
 
1961
- // src/utils/address/getAddress.ts
1962
- function checksumAddress(address_) {
1963
- const hexAddress = address_.substring(2).toLowerCase();
1964
- const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1965
- let address = hexAddress.split("");
1966
- for (let i = 0; i < 40; i += 2) {
1967
- if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1968
- address[i] = address[i].toUpperCase();
1969
- }
1970
- if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1971
- address[i + 1] = address[i + 1].toUpperCase();
1972
- }
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
+ );
1973
2052
  }
1974
- return `0x${address.join("")}`;
1975
- }
1976
- function getAddress(address) {
1977
- if (!isAddress(address))
1978
- throw new InvalidAddressError({ address });
1979
- return checksumAddress(address);
1980
- }
1981
-
1982
- // src/utils/address/getContractAddress.ts
1983
- function getContractAddress2(opts) {
1984
- if (opts.opcode === "CREATE2")
1985
- return getCreate2Address(opts);
1986
- return getCreateAddress(opts);
1987
- }
1988
- function getCreateAddress(opts) {
1989
- const from = toBytes(getAddress(opts.from));
1990
- let nonce = toBytes(opts.nonce);
1991
- if (nonce[0] === 0)
1992
- nonce = new Uint8Array([]);
1993
- return getAddress(
1994
- `0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
1995
- );
1996
- }
1997
- function getCreate2Address(opts) {
1998
- const from = toBytes(getAddress(opts.from));
1999
- const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
2000
- size: 32
2001
- });
2002
- const bytecodeHash = toBytes(
2003
- keccak256(
2004
- isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
2005
- )
2006
- );
2007
- return getAddress(
2008
- slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
2009
- );
2010
- }
2011
-
2012
- // src/utils/address/isAddressEqual.ts
2013
- function isAddressEqual(a, b) {
2014
- if (!isAddress(a))
2015
- throw new InvalidAddressError({ address: a });
2016
- if (!isAddress(b))
2017
- throw new InvalidAddressError({ address: b });
2018
- return a.toLowerCase() === b.toLowerCase();
2019
- }
2053
+ };
2020
2054
 
2021
2055
  // src/utils/abi/encodeAbiParameters.ts
2022
2056
  function encodeAbiParameters(params, values) {
@@ -2859,32 +2893,6 @@ function formatAbiItemWithArgs({
2859
2893
  ).join(", ")})`;
2860
2894
  }
2861
2895
 
2862
- // src/utils/account.ts
2863
- function getAccount(source) {
2864
- if (typeof source === "string") {
2865
- if (!isAddress(source))
2866
- throw new InvalidAddressError({ address: source });
2867
- return {
2868
- address: source,
2869
- type: "json-rpc"
2870
- };
2871
- }
2872
- if (!isAddress(source.address))
2873
- throw new InvalidAddressError({ address: source.address });
2874
- return {
2875
- address: source.address,
2876
- signMessage: source.signMessage,
2877
- signTransaction: source.signTransaction,
2878
- signTypedData: source.signTypedData,
2879
- type: "local"
2880
- };
2881
- }
2882
- function parseAccount(account) {
2883
- if (typeof account === "string")
2884
- return { address: account, type: "json-rpc" };
2885
- return account;
2886
- }
2887
-
2888
2896
  // src/utils/promise/withCache.ts
2889
2897
  var promiseCache = /* @__PURE__ */ new Map();
2890
2898
  var responseCache = /* @__PURE__ */ new Map();
@@ -3549,13 +3557,59 @@ ${messageBytes.length}`
3549
3557
  return keccak256(concat([prefixBytes, messageBytes]), to_);
3550
3558
  }
3551
3559
 
3560
+ // src/utils/typedData.ts
3561
+ function validateTypedData({
3562
+ domain,
3563
+ message,
3564
+ primaryType,
3565
+ types: types_
3566
+ }) {
3567
+ const types = types_;
3568
+ const validateData = (struct, value_) => {
3569
+ for (const param of struct) {
3570
+ const { name, type: type_ } = param;
3571
+ const type = type_;
3572
+ const value = value_[name];
3573
+ const integerMatch = type.match(integerRegex);
3574
+ if (integerMatch && (typeof value === "number" || typeof value === "bigint")) {
3575
+ const [_type, base, size_] = integerMatch;
3576
+ numberToHex(value, {
3577
+ signed: base === "int",
3578
+ size: parseInt(size_) / 8
3579
+ });
3580
+ }
3581
+ if (type === "address" && typeof value === "string" && !isAddress(value))
3582
+ throw new InvalidAddressError({ address: value });
3583
+ const bytesMatch = type.match(bytesRegex);
3584
+ if (bytesMatch) {
3585
+ const [_type, size_] = bytesMatch;
3586
+ if (size_ && size(value) !== parseInt(size_))
3587
+ throw new BytesSizeMismatchError({
3588
+ expectedSize: parseInt(size_),
3589
+ givenSize: size(value)
3590
+ });
3591
+ }
3592
+ const struct2 = types[type];
3593
+ if (struct2)
3594
+ validateData(struct2, value);
3595
+ }
3596
+ };
3597
+ if (types["EIP712Domain"] && domain)
3598
+ validateData(types["EIP712Domain"], domain);
3599
+ if (primaryType !== "EIP712Domain") {
3600
+ const type = types[primaryType];
3601
+ validateData(type, message);
3602
+ }
3603
+ }
3604
+
3552
3605
  // src/utils/signature/hashTypedData.ts
3553
3606
  function hashTypedData({
3554
- domain,
3607
+ domain: domain_,
3555
3608
  message,
3556
3609
  primaryType,
3557
3610
  types: types_
3558
3611
  }) {
3612
+ const domain = typeof domain_ === "undefined" ? {} : domain_;
3559
3613
  const types = {
3560
3614
  EIP712Domain: [
3561
3615
  _optionalChain([domain, 'optionalAccess', _87 => _87.name]) && { name: "name", type: "string" },
@@ -3569,6 +3623,12 @@ function hashTypedData({
3569
3623
  ].filter(Boolean),
3570
3624
  ...types_
3571
3625
  };
3626
+ validateTypedData({
3627
+ domain,
3628
+ message,
3629
+ primaryType,
3630
+ types
3631
+ });
3572
3632
  let parts = ["0x1901"];
3573
3633
  if (domain)
3574
3634
  parts.push(
@@ -3707,16 +3767,16 @@ function encodeField({
3707
3767
  }
3708
3768
 
3709
3769
  // src/utils/signature/recoverAddress.ts
3710
- async function recoverAddress({
3770
+ var _secp256k1 = require('@noble/secp256k1');
3771
+ function recoverAddress({
3711
3772
  hash: hash2,
3712
3773
  signature
3713
3774
  }) {
3714
3775
  const signatureHex = isHex(signature) ? signature : toHex(signature);
3715
3776
  const hashHex = isHex(hash2) ? hash2 : toHex(hash2);
3716
3777
  const v = hexToNumber(`0x${signatureHex.slice(130)}`);
3717
- const { recoverPublicKey } = await Promise.resolve().then(() => require("@noble/secp256k1"));
3718
3778
  const publicKey = toHex(
3719
- recoverPublicKey(
3779
+ _secp256k1.recoverPublicKey.call(void 0,
3720
3780
  hashHex.substring(2),
3721
3781
  signatureHex.substring(2, 130),
3722
3782
  v - 27
@@ -3727,7 +3787,7 @@ async function recoverAddress({
3727
3787
  }
3728
3788
 
3729
3789
  // src/utils/signature/recoverMessageAddress.ts
3730
- async function recoverMessageAddress({
3790
+ function recoverMessageAddress({
3731
3791
  message,
3732
3792
  signature
3733
3793
  }) {
@@ -3735,7 +3795,7 @@ async function recoverMessageAddress({
3735
3795
  }
3736
3796
 
3737
3797
  // src/utils/signature/recoverTypedDataAddress.ts
3738
- async function recoverTypedDataAddress({
3798
+ function recoverTypedDataAddress({
3739
3799
  domain,
3740
3800
  message,
3741
3801
  primaryType,
@@ -3754,19 +3814,19 @@ async function recoverTypedDataAddress({
3754
3814
  }
3755
3815
 
3756
3816
  // src/utils/signature/verifyMessage.ts
3757
- async function verifyMessage({
3817
+ function verifyMessage({
3758
3818
  address,
3759
3819
  message,
3760
3820
  signature
3761
3821
  }) {
3762
3822
  return isAddressEqual(
3763
3823
  getAddress(address),
3764
- await recoverMessageAddress({ message, signature })
3824
+ recoverMessageAddress({ message, signature })
3765
3825
  );
3766
3826
  }
3767
3827
 
3768
3828
  // src/utils/signature/verifyTypedData.ts
3769
- async function verifyTypedData({
3829
+ function verifyTypedData({
3770
3830
  address,
3771
3831
  domain,
3772
3832
  message,
@@ -3776,7 +3836,7 @@ async function verifyTypedData({
3776
3836
  }) {
3777
3837
  return isAddressEqual(
3778
3838
  getAddress(address),
3779
- await recoverTypedDataAddress({
3839
+ recoverTypedDataAddress({
3780
3840
  domain,
3781
3841
  message,
3782
3842
  primaryType,
@@ -5365,7 +5425,7 @@ async function sendTransaction(client, args) {
5365
5425
  }
5366
5426
 
5367
5427
  // src/actions/wallet/signMessage.ts
5368
- async function signMessage(client, {
5428
+ async function signMessage2(client, {
5369
5429
  account: account_ = client.account,
5370
5430
  data,
5371
5431
  message
@@ -5377,7 +5437,7 @@ async function signMessage(client, {
5377
5437
  const account = parseAccount(account_);
5378
5438
  const message_ = message || data;
5379
5439
  if (account.type === "local")
5380
- return account.signMessage(message_);
5440
+ return account.signMessage({ message: message_ });
5381
5441
  return client.request({
5382
5442
  method: "personal_sign",
5383
5443
  params: [toHex(message_), account.address]
@@ -5432,47 +5492,6 @@ async function signTypedData(client, {
5432
5492
  params: [account.address, typedData]
5433
5493
  });
5434
5494
  }
5435
- function validateTypedData({
5436
- domain,
5437
- message,
5438
- primaryType,
5439
- types: types_
5440
- }) {
5441
- const types = types_;
5442
- const validateData = (struct, value_) => {
5443
- for (const param of struct) {
5444
- const { name, type: type_ } = param;
5445
- const type2 = type_;
5446
- const value = value_[name];
5447
- const integerMatch = type2.match(integerRegex);
5448
- if (integerMatch && (typeof value === "number" || typeof value === "bigint")) {
5449
- const [_type, base, size_] = integerMatch;
5450
- numberToHex(value, {
5451
- signed: base === "int",
5452
- size: parseInt(size_) / 8
5453
- });
5454
- }
5455
- if (type2 === "address" && typeof value === "string" && !isAddress(value))
5456
- throw new InvalidAddressError({ address: value });
5457
- const bytesMatch = type2.match(bytesRegex);
5458
- if (bytesMatch) {
5459
- const [_type, size_] = bytesMatch;
5460
- if (size_ && size(value) !== parseInt(size_))
5461
- throw new BytesSizeMismatchError({
5462
- expectedSize: parseInt(size_),
5463
- givenSize: size(value)
5464
- });
5465
- }
5466
- const struct2 = types[type2];
5467
- if (struct2)
5468
- validateData(struct2, value);
5469
- }
5470
- };
5471
- if (types["EIP712Domain"] && domain)
5472
- validateData(types["EIP712Domain"], domain);
5473
- const type = types[primaryType];
5474
- validateData(type, message);
5475
- }
5476
5495
 
5477
5496
  // src/actions/wallet/switchChain.ts
5478
5497
  async function switchChain(client, { id: id2 }) {
@@ -5890,5 +5909,6 @@ function parseEther(ether, unit = "wei") {
5890
5909
 
5891
5910
 
5892
5911
 
5893
- 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.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.getAccount = getAccount; 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.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;
5894
- //# sourceMappingURL=chunk-22BDIC7J.js.map
5912
+
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