viem 0.2.0-canary.20230316T042447 → 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 (59) 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-1b53ef88.d.ts → chain-75b0942e.d.ts} +53 -48
  5. package/dist/{chain-ec8c485d.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-A5BRAPQQ.js → chunk-FHJTO6BQ.js} +1480 -1162
  10. package/dist/chunk-FHJTO6BQ.js.map +1 -0
  11. package/dist/{chunk-PLALZ2GD.mjs → chunk-IXGTN6B7.mjs} +2 -2
  12. package/dist/chunk-IXGTN6B7.mjs.map +1 -0
  13. package/dist/{chunk-GZ67J32T.js → chunk-K66BKQUH.js} +19 -19
  14. package/dist/{chunk-GZ67J32T.js.map → chunk-K66BKQUH.js.map} +1 -1
  15. package/dist/{chunk-ISLCPEI2.mjs → chunk-PB263D6W.mjs} +1768 -1450
  16. package/dist/chunk-PB263D6W.mjs.map +1 -0
  17. package/dist/contract.d.ts +8 -7
  18. package/dist/contract.js +2 -2
  19. package/dist/contract.mjs +1 -1
  20. package/dist/{createClient-a28317a9.d.ts → createClient-f87255c1.d.ts} +6 -6
  21. package/dist/{createPublicClient-75540130.d.ts → createPublicClient-62c74ebc.d.ts} +160 -206
  22. package/dist/{eip1193-4f4e240c.d.ts → eip1193-ae706fd8.d.ts} +1 -1
  23. package/dist/{encodeFunctionResult-1f324375.d.ts → encodeFunctionResult-4792a6a3.d.ts} +1 -1
  24. package/dist/{encodePacked-d5d5264a.d.ts → encodePacked-3fcdd54b.d.ts} +1 -1
  25. package/dist/ens.d.ts +5 -4
  26. package/dist/ens.js +3 -3
  27. package/dist/ens.mjs +2 -2
  28. package/dist/ethers.d.ts +4 -6
  29. package/dist/ethers.js +5 -5
  30. package/dist/ethers.js.map +1 -1
  31. package/dist/ethers.mjs +5 -5
  32. package/dist/ethers.mjs.map +1 -1
  33. package/dist/{formatAbiItem-15e8817d.d.ts → formatAbiItem-765ebc53.d.ts} +1 -1
  34. package/dist/{getAbiItem-3e809ff9.d.ts → getAbiItem-693e6e1b.d.ts} +1 -1
  35. package/dist/index.d.ts +14 -13
  36. package/dist/index.js +99 -91
  37. package/dist/index.js.map +1 -1
  38. package/dist/index.mjs +13 -5
  39. package/dist/index.mjs.map +1 -1
  40. package/dist/{parseGwei-6fff7cbe.d.ts → parseGwei-7efc43fc.d.ts} +46 -10
  41. package/dist/public.d.ts +5 -4
  42. package/dist/public.js +2 -2
  43. package/dist/public.mjs +1 -1
  44. package/dist/{test-2bd23d7e.d.ts → test-98c0b642.d.ts} +33 -32
  45. package/dist/test.d.ts +10 -10
  46. package/dist/test.js +2 -2
  47. package/dist/test.mjs +1 -1
  48. package/dist/typedData-0514bb3c.d.ts +76 -0
  49. package/dist/utils/index.d.ts +28 -18
  50. package/dist/utils/index.js +8 -2
  51. package/dist/utils/index.mjs +11 -5
  52. package/dist/wallet.d.ts +5 -4
  53. package/dist/wallet.js +2 -2
  54. package/dist/wallet.mjs +1 -1
  55. package/dist/window.d.ts +2 -2
  56. package/package.json +3 -1
  57. package/dist/chunk-A5BRAPQQ.js.map +0 -1
  58. package/dist/chunk-ISLCPEI2.mjs.map +0 -1
  59. package/dist/chunk-PLALZ2GD.mjs.map +0 -1
@@ -20,7 +20,7 @@ var _abitype = require('abitype');
20
20
  var package_default = {
21
21
  name: "viem",
22
22
  description: "TypeScript Interface for Ethereum",
23
- version: "0.1.20",
23
+ version: "0.1.21",
24
24
  scripts: {
25
25
  anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
26
26
  bench: "vitest bench --no-threads",
@@ -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",
@@ -218,7 +220,9 @@ var BaseError = class extends Error {
218
220
  shortMessage || "An error occurred.",
219
221
  "",
220
222
  ...args.metaMessages ? [...args.metaMessages, ""] : [],
221
- ...docsPath6 ? [`Docs: https://viem.sh${docsPath6}.html`] : [],
223
+ ...docsPath6 ? [
224
+ `Docs: https://viem.sh${docsPath6}.html${args.docsSlug ? `#${args.docsSlug}` : ""}`
225
+ ] : [],
222
226
  ...details ? [`Details: ${details}`] : [],
223
227
  `Version: ${getVersion()}`
224
228
  ].join("\n");
@@ -519,6 +523,23 @@ var UnsupportedPackedAbiType = class extends BaseError {
519
523
  }
520
524
  };
521
525
 
526
+ // src/errors/account.ts
527
+ var AccountNotFoundError = class extends BaseError {
528
+ constructor({ docsPath: docsPath6 } = {}) {
529
+ super(
530
+ [
531
+ "Could not find an Account to execute with this Action.",
532
+ "Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the WalletClient."
533
+ ].join("\n"),
534
+ {
535
+ docsPath: docsPath6,
536
+ docsSlug: "account"
537
+ }
538
+ );
539
+ __publicField(this, "name", "AccountNotFoundError");
540
+ }
541
+ };
542
+
522
543
  // src/errors/address.ts
523
544
  var InvalidAddressError = class extends BaseError {
524
545
  constructor({ address }) {
@@ -583,239 +604,808 @@ var ChainMismatchError = class extends BaseError {
583
604
  __publicField(this, "name", "ChainMismatchError");
584
605
  }
585
606
  };
586
-
587
- // src/constants/abis.ts
588
- var multicall3Abi = [
589
- {
590
- inputs: [
591
- {
592
- components: [
593
- {
594
- name: "target",
595
- type: "address"
596
- },
597
- {
598
- name: "allowFailure",
599
- type: "bool"
600
- },
601
- {
602
- name: "callData",
603
- type: "bytes"
604
- }
605
- ],
606
- name: "calls",
607
- type: "tuple[]"
608
- }
609
- ],
610
- name: "aggregate3",
611
- outputs: [
612
- {
613
- components: [
614
- {
615
- name: "success",
616
- type: "bool"
617
- },
618
- {
619
- name: "returnData",
620
- type: "bytes"
621
- }
622
- ],
623
- name: "returnData",
624
- type: "tuple[]"
625
- }
626
- ],
627
- stateMutability: "view",
628
- type: "function"
629
- }
630
- ];
631
-
632
- // src/constants/solidity.ts
633
- var panicReasons = {
634
- 1: "An `assert` condition failed.",
635
- 17: "Arithmic operation resulted in underflow or overflow.",
636
- 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
637
- 33: "Attempted to convert to an invalid type.",
638
- 34: "Attempted to access a storage byte array that is incorrectly encoded.",
639
- 49: "Performed `.pop()` on an empty array",
640
- 50: "Array index is out of bounds.",
641
- 65: "Allocated too much memory or created an array which is too large.",
642
- 81: "Attempted to call a zero-initialized variable of internal function type."
643
- };
644
- var solidityError = {
645
- inputs: [
646
- {
647
- name: "message",
648
- type: "string"
649
- }
650
- ],
651
- name: "Error",
652
- type: "error"
653
- };
654
- var solidityPanic = {
655
- inputs: [
656
- {
657
- name: "reason",
658
- type: "uint256"
659
- }
660
- ],
661
- name: "Panic",
662
- type: "error"
663
- };
664
-
665
- // src/constants/unit.ts
666
- var etherUnits = {
667
- gwei: 9,
668
- wei: 18
669
- };
670
- var gweiUnits = {
671
- ether: -9,
672
- wei: 9
673
- };
674
- var weiUnits = {
675
- ether: -18,
676
- gwei: -9
677
- };
678
-
679
- // src/errors/transaction.ts
680
- function prettyPrint(args) {
681
- const entries = Object.entries(args).map(([key, value]) => {
682
- if (value === void 0 || value === false)
683
- return null;
684
- return [key, value];
685
- }).filter(Boolean);
686
- const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
687
- return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
688
- }
689
- var FeeConflictError = class extends BaseError {
607
+ var ChainNotFoundError = class extends BaseError {
690
608
  constructor() {
691
609
  super(
692
610
  [
693
- "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
694
- "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
611
+ "No chain was provided to the request.",
612
+ "Please provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient."
695
613
  ].join("\n")
696
614
  );
697
- __publicField(this, "name", "FeeConflictError");
698
- }
699
- };
700
- var TransactionExecutionError = class extends BaseError {
701
- constructor(cause, {
702
- account,
703
- docsPath: docsPath6,
704
- chain,
705
- data,
706
- gas,
707
- gasPrice,
708
- maxFeePerGas,
709
- maxPriorityFeePerGas,
710
- nonce,
711
- to,
712
- value
713
- }) {
714
- const prettyArgs = prettyPrint({
715
- chain: chain && `${_optionalChain([chain, 'optionalAccess', _4 => _4.name])} (id: ${_optionalChain([chain, 'optionalAccess', _5 => _5.id])})`,
716
- from: account.address,
717
- to,
718
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _6 => _6.nativeCurrency, 'access', _7 => _7.symbol]) || "ETH"}`,
719
- data,
720
- gas,
721
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
722
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
723
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
724
- nonce
725
- });
726
- super(cause.shortMessage, {
727
- cause,
728
- docsPath: docsPath6,
729
- metaMessages: [
730
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
731
- "Request Arguments:",
732
- prettyArgs
733
- ].filter(Boolean)
734
- });
735
- __publicField(this, "cause");
736
- __publicField(this, "name", "TransactionExecutionError");
737
- this.cause = cause;
738
- }
739
- };
740
- var TransactionNotFoundError = class extends BaseError {
741
- constructor({
742
- blockHash,
743
- blockNumber,
744
- blockTag,
745
- hash: hash2,
746
- index
747
- }) {
748
- let identifier = "Transaction";
749
- if (blockTag && index !== void 0)
750
- identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
751
- if (blockHash && index !== void 0)
752
- identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
753
- if (blockNumber && index !== void 0)
754
- identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
755
- if (hash2)
756
- identifier = `Transaction with hash "${hash2}"`;
757
- super(`${identifier} could not be found.`);
758
- __publicField(this, "name", "TransactionNotFoundError");
615
+ __publicField(this, "name", "ChainNotFoundError");
759
616
  }
760
617
  };
761
- var TransactionReceiptNotFoundError = class extends BaseError {
762
- constructor({ hash: hash2 }) {
763
- super(
764
- `Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
765
- );
766
- __publicField(this, "name", "TransactionReceiptNotFoundError");
618
+
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;
767
639
  }
768
- };
769
- var WaitForTransactionReceiptTimeoutError = class extends BaseError {
770
- constructor({ hash: hash2 }) {
771
- super(
772
- `Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
773
- );
774
- __publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
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;
775
645
  }
776
- };
646
+ return result;
647
+ }
648
+ function concatHex(values) {
649
+ return `0x${values.reduce(
650
+ (acc, x) => acc + x.replace("0x", ""),
651
+ ""
652
+ )}`;
653
+ }
777
654
 
778
- // src/errors/contract.ts
779
- var CallExecutionError = class extends BaseError {
780
- constructor(cause, {
781
- account,
782
- docsPath: docsPath6,
783
- chain,
784
- data,
785
- gas,
786
- gasPrice,
787
- maxFeePerGas,
788
- maxPriorityFeePerGas,
789
- nonce,
790
- to,
791
- value
792
- }) {
793
- const prettyArgs = prettyPrint({
794
- from: _optionalChain([account, 'optionalAccess', _8 => _8.address]),
795
- to,
796
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _9 => _9.nativeCurrency, 'access', _10 => _10.symbol]) || "ETH"}`,
797
- data,
798
- gas,
799
- gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
800
- maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
801
- maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
802
- nonce
803
- });
804
- super(cause.shortMessage, {
805
- cause,
806
- docsPath: docsPath6,
807
- metaMessages: [
808
- ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
809
- "Raw Call Arguments:",
810
- prettyArgs
811
- ].filter(Boolean)
812
- });
813
- __publicField(this, "cause");
814
- __publicField(this, "name", "CallExecutionError");
815
- this.cause = cause;
816
- }
817
- };
818
- var ContractFunctionExecutionError = class extends BaseError {
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
+ }
665
+
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
+ }
674
+
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 });
680
+ }
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"
690
+ });
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"
704
+ });
705
+ const paddedBytes = new Uint8Array(size2);
706
+ for (let i = 0; i < size2; i++) {
707
+ const padEnd = dir === "right";
708
+ paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
709
+ }
710
+ return paddedBytes;
711
+ }
712
+
713
+ // src/utils/data/trim.ts
714
+ function trim(hexOrBytes, { dir = "left" } = {}) {
715
+ let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
716
+ let sliceLength = 0;
717
+ for (let i = 0; i < data.length - 1; i++) {
718
+ if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
719
+ sliceLength++;
720
+ else
721
+ break;
722
+ }
723
+ data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
724
+ if (typeof hexOrBytes === "string") {
725
+ if (data.length === 1 && dir === "right")
726
+ data = `${data}0`;
727
+ return `0x${data}`;
728
+ }
729
+ return data;
730
+ }
731
+
732
+ // src/utils/data/size.ts
733
+ function size(value) {
734
+ if (isHex(value))
735
+ return Math.ceil((value.length - 2) / 2);
736
+ return value.length;
737
+ }
738
+
739
+ // src/utils/data/slice.ts
740
+ function slice(value, start, end) {
741
+ if (isHex(value))
742
+ return sliceHex(value, start, end);
743
+ return sliceBytes(value, start, end);
744
+ }
745
+ function assertStartOffset(value, start) {
746
+ if (typeof start === "number" && start > 0 && start > size(value) - 1)
747
+ throw new Error(
748
+ `Slice starting at offset "${start}" is out-of-bounds (size: ${size(
749
+ value
750
+ )}).`
751
+ );
752
+ }
753
+ function sliceBytes(value, start, end) {
754
+ assertStartOffset(value, start);
755
+ return value.slice(start, end);
756
+ }
757
+ function sliceHex(value_, start, end) {
758
+ assertStartOffset(value_, start);
759
+ const value = value_.replace("0x", "").slice((_nullishCoalesce(start, () => ( 0))) * 2, (_nullishCoalesce(end, () => ( value_.length))) * 2);
760
+ return `0x${value}`;
761
+ }
762
+
763
+ // src/utils/encoding/toHex.ts
764
+ var hexes = Array.from(
765
+ { length: 256 },
766
+ (_v, i) => i.toString(16).padStart(2, "0")
767
+ );
768
+ function boolToHex(value) {
769
+ return `0x${Number(value)}`;
770
+ }
771
+ function bytesToHex(value) {
772
+ let hex = "";
773
+ for (let i = 0; i < value.length; i++) {
774
+ hex += hexes[value[i]];
775
+ }
776
+ return `0x${hex}`;
777
+ }
778
+ function toHex(value) {
779
+ if (typeof value === "number" || typeof value === "bigint")
780
+ return numberToHex(value);
781
+ if (typeof value === "string") {
782
+ return stringToHex(value);
783
+ }
784
+ if (typeof value === "boolean")
785
+ return boolToHex(value);
786
+ return bytesToHex(value);
787
+ }
788
+ function numberToHex(value_, opts = {}) {
789
+ const { signed, size: size2 } = opts;
790
+ let value = BigInt(value_);
791
+ let maxValue;
792
+ if (size2) {
793
+ if (signed)
794
+ maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
795
+ else
796
+ maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
797
+ } else if (typeof value_ === "number") {
798
+ maxValue = BigInt(Number.MAX_SAFE_INTEGER);
799
+ }
800
+ const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
801
+ if (maxValue && value > maxValue || value < minValue) {
802
+ const suffix = typeof value_ === "bigint" ? "n" : "";
803
+ throw new IntegerOutOfRangeError({
804
+ max: maxValue ? `${maxValue}${suffix}` : void 0,
805
+ min: `${minValue}${suffix}`,
806
+ signed,
807
+ size: size2,
808
+ value: `${value_}${suffix}`
809
+ });
810
+ }
811
+ const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
812
+ if (size2)
813
+ return pad(hex, { size: size2 });
814
+ return hex;
815
+ }
816
+ var encoder = new TextEncoder();
817
+ function stringToHex(value_) {
818
+ const value = encoder.encode(value_);
819
+ return toHex(value);
820
+ }
821
+
822
+ // src/utils/encoding/toBytes.ts
823
+ var encoder2 = new TextEncoder();
824
+ function toBytes(value) {
825
+ if (typeof value === "number" || typeof value === "bigint")
826
+ return numberToBytes(value);
827
+ if (typeof value === "boolean")
828
+ return boolToBytes(value);
829
+ if (value.startsWith("0x"))
830
+ return hexToBytes(value);
831
+ return stringToBytes(value);
832
+ }
833
+ function boolToBytes(value) {
834
+ const bytes = new Uint8Array(1);
835
+ bytes[0] = Number(value);
836
+ return bytes;
837
+ }
838
+ function hexToBytes(hex_) {
839
+ let hex = hex_.slice(2);
840
+ if (hex.length % 2)
841
+ hex = `0${hex}`;
842
+ const bytes = new Uint8Array(hex.length / 2);
843
+ for (let index = 0; index < bytes.length; index++) {
844
+ const start = index * 2;
845
+ const hexByte = hex.slice(start, start + 2);
846
+ const byte = Number.parseInt(hexByte, 16);
847
+ if (Number.isNaN(byte) || byte < 0)
848
+ throw new BaseError(`Invalid byte sequence ("${hexByte}" in "${hex}").`);
849
+ bytes[index] = byte;
850
+ }
851
+ return bytes;
852
+ }
853
+ function numberToBytes(value, opts) {
854
+ const hex = numberToHex(value, opts);
855
+ return hexToBytes(hex);
856
+ }
857
+ function stringToBytes(value) {
858
+ return encoder2.encode(value);
859
+ }
860
+
861
+ // src/utils/encoding/toRlp.ts
862
+ function toRlp(hexOrBytes, to_) {
863
+ const to = to_ || "hex";
864
+ return format(bytesToRlp(parse(hexOrBytes)), to);
865
+ }
866
+ function parse(hexOrBytes) {
867
+ if (Array.isArray(hexOrBytes))
868
+ return hexOrBytes.map(parse);
869
+ return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
870
+ }
871
+ function format(bytes, type = "bytes") {
872
+ return type === "hex" ? bytesToHex(bytes) : bytes;
873
+ }
874
+ function bytesToRlp(bytes) {
875
+ if (Array.isArray(bytes)) {
876
+ const encoded = concat(bytes.map(bytesToRlp));
877
+ return new Uint8Array([...encodeLength(encoded.length, 192), ...encoded]);
878
+ }
879
+ if (bytes.length === 1 && bytes[0] < 128)
880
+ return bytes;
881
+ return new Uint8Array([...encodeLength(bytes.length, 128), ...bytes]);
882
+ }
883
+ function encodeLength(length, offset) {
884
+ if (length < 56)
885
+ return [offset + length];
886
+ return [toBytes(length).length + offset + 55, ...toBytes(length)];
887
+ }
888
+
889
+ // src/utils/encoding/fromHex.ts
890
+ function fromHex(hex, to) {
891
+ if (to === "number")
892
+ return hexToNumber(hex);
893
+ if (to === "bigint")
894
+ return hexToBigInt(hex);
895
+ if (to === "string")
896
+ return hexToString(hex);
897
+ if (to === "boolean")
898
+ return hexToBool(hex);
899
+ return hexToBytes(hex);
900
+ }
901
+ function hexToBigInt(hex, opts = {}) {
902
+ const { signed } = opts;
903
+ const value = BigInt(hex);
904
+ if (!signed)
905
+ return value;
906
+ const size2 = (hex.length - 2) / 2;
907
+ const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
908
+ if (value <= max)
909
+ return value;
910
+ return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
911
+ }
912
+ function hexToBool(hex) {
913
+ if (trim(hex) === "0x0")
914
+ return false;
915
+ if (trim(hex) === "0x1")
916
+ return true;
917
+ throw new InvalidHexBooleanError(hex);
918
+ }
919
+ function hexToNumber(hex, opts = {}) {
920
+ return Number(hexToBigInt(hex, opts));
921
+ }
922
+ function hexToString(hex) {
923
+ const bytes = hexToBytes(hex);
924
+ return new TextDecoder().decode(bytes);
925
+ }
926
+
927
+ // src/utils/encoding/fromBytes.ts
928
+ function fromBytes(bytes, to) {
929
+ if (to === "number")
930
+ return bytesToNumber(bytes);
931
+ if (to === "bigint")
932
+ return bytesToBigint(bytes);
933
+ if (to === "boolean")
934
+ return bytesToBool(bytes);
935
+ if (to === "string")
936
+ return bytesToString(bytes);
937
+ return bytesToHex(bytes);
938
+ }
939
+ function bytesToBigint(bytes) {
940
+ const hex = bytesToHex(bytes);
941
+ return hexToBigInt(hex);
942
+ }
943
+ function bytesToBool(bytes) {
944
+ if (bytes.length > 1 || bytes[0] > 1)
945
+ throw new InvalidBytesBooleanError(bytes);
946
+ return Boolean(bytes[0]);
947
+ }
948
+ function bytesToNumber(bytes) {
949
+ const hex = bytesToHex(bytes);
950
+ return hexToNumber(hex);
951
+ }
952
+ function bytesToString(bytes) {
953
+ return new TextDecoder().decode(bytes);
954
+ }
955
+
956
+ // src/utils/encoding/fromRlp.ts
957
+ function fromRlp(value, to) {
958
+ const bytes = parse2(value);
959
+ const [data, consumed] = rlpToBytes(bytes);
960
+ if (consumed < bytes.length)
961
+ throw new DataLengthTooLongError({
962
+ consumed,
963
+ length: bytes.length
964
+ });
965
+ return format2(data, to);
966
+ }
967
+ function parse2(value) {
968
+ if (typeof value === "string") {
969
+ if (value.length > 3 && value.length % 2 !== 0)
970
+ throw new InvalidHexValueError(value);
971
+ return hexToBytes(value);
972
+ }
973
+ return value;
974
+ }
975
+ function format2(bytes, to) {
976
+ if (Array.isArray(bytes))
977
+ return bytes.map((b) => format2(b, to));
978
+ return to === "hex" ? trim(bytesToHex(bytes)) : bytes;
979
+ }
980
+ function rlpToBytes(bytes, offset = 0) {
981
+ if (bytes.length === 0)
982
+ return [new Uint8Array([]), 0];
983
+ const prefix = bytes[offset];
984
+ if (prefix <= 127)
985
+ return [new Uint8Array([bytes[offset]]), 1];
986
+ if (prefix <= 183) {
987
+ const length2 = prefix - 128;
988
+ const offset_ = offset + 1;
989
+ if (offset_ + length2 > bytes.length)
990
+ throw new DataLengthTooShortError({
991
+ length: offset_ + length2,
992
+ dataLength: bytes.length
993
+ });
994
+ return [bytes.slice(offset_, offset_ + length2), 1 + length2];
995
+ }
996
+ if (prefix <= 191) {
997
+ const lengthOfLength2 = prefix - 183;
998
+ const offset_ = offset + 1;
999
+ const length2 = bytesToNumber(bytes.slice(offset_, offset_ + lengthOfLength2));
1000
+ if (offset_ + lengthOfLength2 + length2 > bytes.length)
1001
+ throw new DataLengthTooShortError({
1002
+ length: lengthOfLength2 + length2,
1003
+ dataLength: bytes.length - lengthOfLength2
1004
+ });
1005
+ return [
1006
+ bytes.slice(offset_ + lengthOfLength2, offset_ + lengthOfLength2 + length2),
1007
+ 1 + lengthOfLength2 + length2
1008
+ ];
1009
+ }
1010
+ let lengthOfLength = 0;
1011
+ let length = prefix - 192;
1012
+ if (prefix > 247) {
1013
+ lengthOfLength = prefix - 247;
1014
+ length = bytesToNumber(bytes.slice(offset + 1, offset + 1 + lengthOfLength));
1015
+ }
1016
+ let nextOffset = offset + 1 + lengthOfLength;
1017
+ if (nextOffset > bytes.length)
1018
+ throw new DataLengthTooShortError({
1019
+ length: nextOffset,
1020
+ dataLength: bytes.length
1021
+ });
1022
+ let consumed = 1 + lengthOfLength + length;
1023
+ let result = [];
1024
+ while (nextOffset < offset + consumed) {
1025
+ const decoded = rlpToBytes(bytes, nextOffset);
1026
+ result.push(decoded[0]);
1027
+ nextOffset += decoded[1];
1028
+ if (nextOffset > offset + consumed)
1029
+ throw new OffsetOutOfBoundsError({
1030
+ nextOffset,
1031
+ offset: offset + consumed
1032
+ });
1033
+ }
1034
+ return [result, consumed];
1035
+ }
1036
+
1037
+ // src/utils/contract/extractFunctionParts.ts
1038
+ var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1039
+ function extractFunctionParts(def) {
1040
+ const parts = def.match(paramsRegex);
1041
+ const type = _optionalChain([parts, 'optionalAccess', _4 => _4[2]]) || void 0;
1042
+ const name = _optionalChain([parts, 'optionalAccess', _5 => _5[3]]);
1043
+ const params = _optionalChain([parts, 'optionalAccess', _6 => _6[5]]) || void 0;
1044
+ return { type, name, params };
1045
+ }
1046
+ function extractFunctionName(def) {
1047
+ return extractFunctionParts(def).name;
1048
+ }
1049
+ function extractFunctionParams(def) {
1050
+ const params = extractFunctionParts(def).params;
1051
+ const splitParams = _optionalChain([params, 'optionalAccess', _7 => _7.split, 'call', _8 => _8(","), 'access', _9 => _9.map, 'call', _10 => _10((x) => x.trim().split(" "))]);
1052
+ return _optionalChain([splitParams, 'optionalAccess', _11 => _11.map, 'call', _12 => _12((param) => ({
1053
+ type: param[0],
1054
+ name: param[1] === "indexed" ? param[2] : param[1],
1055
+ ...param[1] === "indexed" ? { indexed: true } : {}
1056
+ }))]);
1057
+ }
1058
+ function extractFunctionType(def) {
1059
+ return extractFunctionParts(def).type;
1060
+ }
1061
+
1062
+ // src/utils/hash/keccak256.ts
1063
+ var _sha3 = require('@noble/hashes/sha3');
1064
+ function keccak256(value, to_) {
1065
+ const to = to_ || "hex";
1066
+ const bytes = _sha3.keccak_256.call(void 0, isHex(value) ? toBytes(value) : value);
1067
+ if (to === "bytes")
1068
+ return bytes;
1069
+ return toHex(bytes);
1070
+ }
1071
+
1072
+ // src/utils/hash/hashFunction.ts
1073
+ var hash = (value) => keccak256(toBytes(value));
1074
+ function hashFunction(def) {
1075
+ const name = extractFunctionName(def);
1076
+ const params = extractFunctionParams(def);
1077
+ if (!params || params.length === 0)
1078
+ return hash(def.replace(/ /g, ""));
1079
+ return hash(`${name}(${params.map(({ type }) => type).join(",")})`);
1080
+ }
1081
+
1082
+ // src/utils/hash/getEventSelector.ts
1083
+ var getEventSelector = (event) => hashFunction(event);
1084
+
1085
+ // src/utils/hash/getFunctionSelector.ts
1086
+ var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
1087
+
1088
+ // src/utils/address/isAddress.ts
1089
+ var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1090
+ function isAddress(address) {
1091
+ return addressRegex.test(address);
1092
+ }
1093
+
1094
+ // src/utils/address/getAddress.ts
1095
+ function checksumAddress(address_) {
1096
+ const hexAddress = address_.substring(2).toLowerCase();
1097
+ const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1098
+ let address = hexAddress.split("");
1099
+ for (let i = 0; i < 40; i += 2) {
1100
+ if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1101
+ address[i] = address[i].toUpperCase();
1102
+ }
1103
+ if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1104
+ address[i + 1] = address[i + 1].toUpperCase();
1105
+ }
1106
+ }
1107
+ return `0x${address.join("")}`;
1108
+ }
1109
+ function getAddress(address) {
1110
+ if (!isAddress(address))
1111
+ throw new InvalidAddressError({ address });
1112
+ return checksumAddress(address);
1113
+ }
1114
+
1115
+ // src/utils/address/getContractAddress.ts
1116
+ function getContractAddress2(opts) {
1117
+ if (opts.opcode === "CREATE2")
1118
+ return getCreate2Address(opts);
1119
+ return getCreateAddress(opts);
1120
+ }
1121
+ function getCreateAddress(opts) {
1122
+ const from = toBytes(getAddress(opts.from));
1123
+ let nonce = toBytes(opts.nonce);
1124
+ if (nonce[0] === 0)
1125
+ nonce = new Uint8Array([]);
1126
+ return getAddress(
1127
+ `0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
1128
+ );
1129
+ }
1130
+ function getCreate2Address(opts) {
1131
+ const from = toBytes(getAddress(opts.from));
1132
+ const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
1133
+ size: 32
1134
+ });
1135
+ const bytecodeHash = toBytes(
1136
+ keccak256(
1137
+ isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
1138
+ )
1139
+ );
1140
+ return getAddress(
1141
+ slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
1142
+ );
1143
+ }
1144
+
1145
+ // src/utils/address/isAddressEqual.ts
1146
+ function isAddressEqual(a, b) {
1147
+ if (!isAddress(a))
1148
+ throw new InvalidAddressError({ address: a });
1149
+ if (!isAddress(b))
1150
+ throw new InvalidAddressError({ address: b });
1151
+ return a.toLowerCase() === b.toLowerCase();
1152
+ }
1153
+
1154
+ // src/accounts/toAccount.ts
1155
+ function toAccount(source) {
1156
+ if (typeof source === "string") {
1157
+ if (!isAddress(source))
1158
+ throw new InvalidAddressError({ address: source });
1159
+ return {
1160
+ address: source,
1161
+ type: "json-rpc"
1162
+ };
1163
+ }
1164
+ if (!isAddress(source.address))
1165
+ throw new InvalidAddressError({ address: source.address });
1166
+ return {
1167
+ address: source.address,
1168
+ signMessage: source.signMessage,
1169
+ signTransaction: source.signTransaction,
1170
+ signTypedData: source.signTypedData,
1171
+ source: "custom",
1172
+ type: "local"
1173
+ };
1174
+ }
1175
+
1176
+ // src/constants/abis.ts
1177
+ var multicall3Abi = [
1178
+ {
1179
+ inputs: [
1180
+ {
1181
+ components: [
1182
+ {
1183
+ name: "target",
1184
+ type: "address"
1185
+ },
1186
+ {
1187
+ name: "allowFailure",
1188
+ type: "bool"
1189
+ },
1190
+ {
1191
+ name: "callData",
1192
+ type: "bytes"
1193
+ }
1194
+ ],
1195
+ name: "calls",
1196
+ type: "tuple[]"
1197
+ }
1198
+ ],
1199
+ name: "aggregate3",
1200
+ outputs: [
1201
+ {
1202
+ components: [
1203
+ {
1204
+ name: "success",
1205
+ type: "bool"
1206
+ },
1207
+ {
1208
+ name: "returnData",
1209
+ type: "bytes"
1210
+ }
1211
+ ],
1212
+ name: "returnData",
1213
+ type: "tuple[]"
1214
+ }
1215
+ ],
1216
+ stateMutability: "view",
1217
+ type: "function"
1218
+ }
1219
+ ];
1220
+
1221
+ // src/constants/solidity.ts
1222
+ var panicReasons = {
1223
+ 1: "An `assert` condition failed.",
1224
+ 17: "Arithmic operation resulted in underflow or overflow.",
1225
+ 18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
1226
+ 33: "Attempted to convert to an invalid type.",
1227
+ 34: "Attempted to access a storage byte array that is incorrectly encoded.",
1228
+ 49: "Performed `.pop()` on an empty array",
1229
+ 50: "Array index is out of bounds.",
1230
+ 65: "Allocated too much memory or created an array which is too large.",
1231
+ 81: "Attempted to call a zero-initialized variable of internal function type."
1232
+ };
1233
+ var solidityError = {
1234
+ inputs: [
1235
+ {
1236
+ name: "message",
1237
+ type: "string"
1238
+ }
1239
+ ],
1240
+ name: "Error",
1241
+ type: "error"
1242
+ };
1243
+ var solidityPanic = {
1244
+ inputs: [
1245
+ {
1246
+ name: "reason",
1247
+ type: "uint256"
1248
+ }
1249
+ ],
1250
+ name: "Panic",
1251
+ type: "error"
1252
+ };
1253
+
1254
+ // src/constants/unit.ts
1255
+ var etherUnits = {
1256
+ gwei: 9,
1257
+ wei: 18
1258
+ };
1259
+ var gweiUnits = {
1260
+ ether: -9,
1261
+ wei: 9
1262
+ };
1263
+ var weiUnits = {
1264
+ ether: -18,
1265
+ gwei: -9
1266
+ };
1267
+
1268
+ // src/errors/transaction.ts
1269
+ function prettyPrint(args) {
1270
+ const entries = Object.entries(args).map(([key, value]) => {
1271
+ if (value === void 0 || value === false)
1272
+ return null;
1273
+ return [key, value];
1274
+ }).filter(Boolean);
1275
+ const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
1276
+ return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
1277
+ }
1278
+ var FeeConflictError = class extends BaseError {
1279
+ constructor() {
1280
+ super(
1281
+ [
1282
+ "Cannot specify both a `gasPrice` and a `maxFeePerGas`/`maxPriorityFeePerGas`.",
1283
+ "Use `maxFeePerGas`/`maxPriorityFeePerGas` for EIP-1559 compatible networks, and `gasPrice` for others."
1284
+ ].join("\n")
1285
+ );
1286
+ __publicField(this, "name", "FeeConflictError");
1287
+ }
1288
+ };
1289
+ var TransactionExecutionError = class extends BaseError {
1290
+ constructor(cause, {
1291
+ account,
1292
+ docsPath: docsPath6,
1293
+ chain,
1294
+ data,
1295
+ gas,
1296
+ gasPrice,
1297
+ maxFeePerGas,
1298
+ maxPriorityFeePerGas,
1299
+ nonce,
1300
+ to,
1301
+ value
1302
+ }) {
1303
+ const prettyArgs = prettyPrint({
1304
+ chain: chain && `${_optionalChain([chain, 'optionalAccess', _13 => _13.name])} (id: ${_optionalChain([chain, 'optionalAccess', _14 => _14.id])})`,
1305
+ from: _optionalChain([account, 'optionalAccess', _15 => _15.address]),
1306
+ to,
1307
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _16 => _16.nativeCurrency, 'access', _17 => _17.symbol]) || "ETH"}`,
1308
+ data,
1309
+ gas,
1310
+ gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
1311
+ maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
1312
+ maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
1313
+ nonce
1314
+ });
1315
+ super(cause.shortMessage, {
1316
+ cause,
1317
+ docsPath: docsPath6,
1318
+ metaMessages: [
1319
+ ...cause.metaMessages ? [...cause.metaMessages, " "] : [],
1320
+ "Request Arguments:",
1321
+ prettyArgs
1322
+ ].filter(Boolean)
1323
+ });
1324
+ __publicField(this, "cause");
1325
+ __publicField(this, "name", "TransactionExecutionError");
1326
+ this.cause = cause;
1327
+ }
1328
+ };
1329
+ var TransactionNotFoundError = class extends BaseError {
1330
+ constructor({
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 }) {
1352
+ super(
1353
+ `Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
1354
+ );
1355
+ __publicField(this, "name", "TransactionReceiptNotFoundError");
1356
+ }
1357
+ };
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");
1364
+ }
1365
+ };
1366
+
1367
+ // src/errors/contract.ts
1368
+ var CallExecutionError = class extends BaseError {
1369
+ constructor(cause, {
1370
+ account: account_,
1371
+ docsPath: docsPath6,
1372
+ chain,
1373
+ data,
1374
+ gas,
1375
+ gasPrice,
1376
+ maxFeePerGas,
1377
+ maxPriorityFeePerGas,
1378
+ nonce,
1379
+ to,
1380
+ value
1381
+ }) {
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
1393
+ });
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;
1406
+ }
1407
+ };
1408
+ var ContractFunctionExecutionError = class extends BaseError {
819
1409
  constructor(cause, {
820
1410
  abi,
821
1411
  args,
@@ -835,7 +1425,7 @@ var ContractFunctionExecutionError = class extends BaseError {
835
1425
  const prettyArgs = prettyPrint({
836
1426
  address: contractAddress && getContractAddress(contractAddress),
837
1427
  function: functionWithParams,
838
- args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _11 => _11.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
1428
+ args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _21 => _21.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
839
1429
  sender
840
1430
  });
841
1431
  super(
@@ -894,7 +1484,7 @@ var ContractFunctionRevertedError = class extends BaseError {
894
1484
  }) : void 0;
895
1485
  metaMessages = [
896
1486
  errorWithParams ? `Error: ${errorWithParams}` : "",
897
- formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _12 => _12.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
1487
+ formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _22 => _22.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
898
1488
  ];
899
1489
  }
900
1490
  } else if (message)
@@ -1032,9 +1622,9 @@ var EstimateGasExecutionError = class extends BaseError {
1032
1622
  value
1033
1623
  }) {
1034
1624
  const prettyArgs = prettyPrint({
1035
- from: account.address,
1625
+ from: _optionalChain([account, 'optionalAccess', _23 => _23.address]),
1036
1626
  to,
1037
- value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _13 => _13.nativeCurrency, 'access', _14 => _14.symbol]) || "ETH"}`,
1627
+ value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _24 => _24.nativeCurrency, 'access', _25 => _25.symbol]) || "ETH"}`,
1038
1628
  data,
1039
1629
  gas,
1040
1630
  gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
@@ -1071,7 +1661,7 @@ var ExecutionRevertedError = class extends BaseError {
1071
1661
  cause,
1072
1662
  message
1073
1663
  } = {}) {
1074
- const reason = _optionalChain([message, 'optionalAccess', _15 => _15.replace, 'call', _16 => _16("execution reverted: ", ""), 'optionalAccess', _17 => _17.replace, 'call', _18 => _18("execution reverted", "")]);
1664
+ const reason = _optionalChain([message, 'optionalAccess', _26 => _26.replace, 'call', _27 => _27("execution reverted: ", ""), 'optionalAccess', _28 => _28.replace, 'call', _29 => _29("execution reverted", "")]);
1075
1665
  super(
1076
1666
  `Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`,
1077
1667
  {
@@ -1150,842 +1740,317 @@ var InsufficientFundsError = class extends BaseError {
1150
1740
  constructor({ cause } = {}) {
1151
1741
  super(
1152
1742
  [
1153
- "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1154
- ].join("\n"),
1155
- {
1156
- cause,
1157
- metaMessages: [
1158
- "This error could arise when the account does not have enough funds to:",
1159
- " - pay for the total gas fee,",
1160
- " - pay for the value to send.",
1161
- " ",
1162
- "The cost of the transaction is calculated as `gas * gas fee + value`, where:",
1163
- " - `gas` is the amount of gas needed for transaction to execute,",
1164
- " - `gas fee` is the gas fee,",
1165
- " - `value` is the amount of ether to send to the recipient."
1166
- ]
1167
- }
1168
- );
1169
- __publicField(this, "name", "InsufficientFundsError");
1170
- }
1171
- };
1172
- __publicField(InsufficientFundsError, "nodeMessage", /insufficient funds/);
1173
- var IntrinsicGasTooHighError = class extends BaseError {
1174
- constructor({ cause, gas } = {}) {
1175
- super(
1176
- `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`,
1177
- {
1178
- cause
1179
- }
1180
- );
1181
- __publicField(this, "name", "IntrinsicGasTooHighError");
1182
- }
1183
- };
1184
- __publicField(IntrinsicGasTooHighError, "nodeMessage", /intrinsic gas too high|gas limit reached/);
1185
- var IntrinsicGasTooLowError = class extends BaseError {
1186
- constructor({ cause, gas } = {}) {
1187
- super(
1188
- `The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`,
1189
- {
1190
- cause
1191
- }
1192
- );
1193
- __publicField(this, "name", "IntrinsicGasTooLowError");
1194
- }
1195
- };
1196
- __publicField(IntrinsicGasTooLowError, "nodeMessage", /intrinsic gas too low/);
1197
- var TransactionTypeNotSupportedError = class extends BaseError {
1198
- constructor({ cause }) {
1199
- super("The transaction type is not supported for this chain.", {
1200
- cause
1201
- });
1202
- __publicField(this, "name", "TransactionTypeNotSupportedError");
1203
- }
1204
- };
1205
- __publicField(TransactionTypeNotSupportedError, "nodeMessage", /transaction type not valid/);
1206
- var TipAboveFeeCapError = class extends BaseError {
1207
- constructor({
1208
- cause,
1209
- maxPriorityFeePerGas,
1210
- maxFeePerGas
1211
- } = {}) {
1212
- super(
1213
- [
1214
- `The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
1215
- ].join("\n"),
1216
- {
1217
- cause
1218
- }
1219
- );
1220
- __publicField(this, "name", "TipAboveFeeCapError");
1221
- }
1222
- };
1223
- __publicField(TipAboveFeeCapError, "nodeMessage", /max priority fee per gas higher than max fee per gas|tip higher than fee cap/);
1224
- var UnknownNodeError = class extends BaseError {
1225
- constructor({ cause }) {
1226
- super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _19 => _19.message])}`, {
1227
- cause
1228
- });
1229
- __publicField(this, "name", "UnknownNodeError");
1230
- }
1231
- };
1232
-
1233
- // src/errors/request.ts
1234
- var RequestError = class extends BaseError {
1235
- constructor(err, {
1236
- docsPath: docsPath6,
1237
- metaMessages,
1238
- shortMessage
1239
- }) {
1240
- super(shortMessage, {
1241
- cause: err,
1242
- docsPath: docsPath6,
1243
- metaMessages
1244
- });
1245
- this.name = err.name;
1246
- }
1247
- };
1248
- var RpcRequestError = class extends RequestError {
1249
- constructor(err, { docsPath: docsPath6, shortMessage }) {
1250
- super(err, { docsPath: docsPath6, metaMessages: err.metaMessages, shortMessage });
1251
- __publicField(this, "code");
1252
- this.code = err.code;
1253
- this.name = err.name;
1254
- }
1255
- };
1256
- var ParseRpcError = class extends RpcRequestError {
1257
- constructor(err) {
1258
- super(err, {
1259
- shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
1260
- });
1261
- __publicField(this, "name", "ParseRpcError");
1262
- __publicField(this, "code", -32700);
1263
- }
1264
- };
1265
- var InvalidRequestRpcError = class extends RpcRequestError {
1266
- constructor(err) {
1267
- super(err, { shortMessage: "JSON is not a valid request object." });
1268
- __publicField(this, "name", "InvalidRequestRpcError");
1269
- __publicField(this, "code", -32600);
1270
- }
1271
- };
1272
- var MethodNotFoundRpcError = class extends RpcRequestError {
1273
- constructor(err) {
1274
- super(err, {
1275
- shortMessage: "The method does not exist / is not available."
1276
- });
1277
- __publicField(this, "name", "MethodNotFoundRpcError");
1278
- __publicField(this, "code", -32601);
1279
- }
1280
- };
1281
- var InvalidParamsRpcError = class extends RpcRequestError {
1282
- constructor(err) {
1283
- super(err, {
1284
- shortMessage: [
1285
- "Invalid parameters were provided to the RPC method.",
1286
- "Double check you have provided the correct parameters."
1287
- ].join("\n")
1288
- });
1289
- __publicField(this, "name", "InvalidParamsRpcError");
1290
- __publicField(this, "code", -32602);
1291
- }
1292
- };
1293
- var InternalRpcError = class extends RpcRequestError {
1294
- constructor(err) {
1295
- super(err, { shortMessage: "An internal error was received." });
1296
- __publicField(this, "name", "InternalRpcError");
1297
- __publicField(this, "code", -32603);
1298
- }
1299
- };
1300
- var InvalidInputRpcError = class extends RpcRequestError {
1301
- constructor(err) {
1302
- super(err, {
1303
- shortMessage: [
1304
- "Missing or invalid parameters.",
1305
- "Double check you have provided the correct parameters."
1306
- ].join("\n")
1307
- });
1308
- __publicField(this, "name", "InvalidInputRpcError");
1309
- __publicField(this, "code", -32e3);
1310
- }
1311
- };
1312
- var ResourceNotFoundRpcError = class extends RpcRequestError {
1313
- constructor(err) {
1314
- super(err, { shortMessage: "Requested resource not found." });
1315
- __publicField(this, "name", "ResourceNotFoundRpcError");
1316
- __publicField(this, "code", -32001);
1317
- }
1318
- };
1319
- var ResourceUnavailableRpcError = class extends RpcRequestError {
1320
- constructor(err) {
1321
- super(err, { shortMessage: "Requested resource not available." });
1322
- __publicField(this, "name", "ResourceUnavailableRpcError");
1323
- __publicField(this, "code", -32002);
1324
- }
1325
- };
1326
- var TransactionRejectedRpcError = class extends RpcRequestError {
1327
- constructor(err) {
1328
- super(err, { shortMessage: "Transaction creation failed." });
1329
- __publicField(this, "name", "TransactionRejectedRpcError");
1330
- __publicField(this, "code", -32003);
1331
- }
1332
- };
1333
- var MethodNotSupportedRpcError = class extends RpcRequestError {
1334
- constructor(err) {
1335
- super(err, { shortMessage: "Method is not implemented." });
1336
- __publicField(this, "name", "MethodNotSupportedRpcError");
1337
- __publicField(this, "code", -32004);
1338
- }
1339
- };
1340
- var LimitExceededRpcError = class extends RpcRequestError {
1341
- constructor(err) {
1342
- super(err, { shortMessage: "Request exceeds defined limit." });
1343
- __publicField(this, "name", "LimitExceededRpcError");
1344
- __publicField(this, "code", -32005);
1345
- }
1346
- };
1347
- var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1348
- constructor(err) {
1349
- super(err, {
1350
- shortMessage: "Version of JSON-RPC protocol is not supported."
1351
- });
1352
- __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1353
- __publicField(this, "code", -32006);
1354
- }
1355
- };
1356
- var UserRejectedRequestError = class extends RpcRequestError {
1357
- constructor(err) {
1358
- super(err, {
1359
- shortMessage: "User rejected the request."
1360
- });
1361
- __publicField(this, "name", "UserRejectedRequestError");
1362
- __publicField(this, "code", 4001);
1363
- }
1364
- };
1365
- var SwitchChainError = class extends RpcRequestError {
1366
- constructor(err) {
1367
- super(err, {
1368
- shortMessage: "An error occurred when attempting to switch chain."
1369
- });
1370
- __publicField(this, "name", "SwitchChainError");
1371
- __publicField(this, "code", 4902);
1372
- }
1373
- };
1374
- var UnknownRpcError = class extends RequestError {
1375
- constructor(err) {
1376
- super(err, {
1377
- shortMessage: "An unknown RPC error occurred."
1378
- });
1379
- __publicField(this, "name", "UnknownRpcError");
1380
- }
1381
- };
1382
-
1383
- // src/errors/rpc.ts
1384
- var HttpRequestError = class extends BaseError {
1385
- constructor({
1386
- body,
1387
- details,
1388
- headers,
1389
- status,
1390
- url
1391
- }) {
1392
- super("HTTP request failed.", {
1393
- details,
1394
- metaMessages: [
1395
- status && `Status: ${status}`,
1396
- `URL: ${getUrl(url)}`,
1397
- `Request body: ${stringify(body)}`
1398
- ].filter(Boolean)
1399
- });
1400
- __publicField(this, "name", "HttpRequestError");
1401
- __publicField(this, "body");
1402
- __publicField(this, "headers");
1403
- __publicField(this, "status");
1404
- __publicField(this, "url");
1405
- this.body = body;
1406
- this.headers = headers;
1407
- this.status = status;
1408
- this.url = url;
1743
+ "The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
1744
+ ].join("\n"),
1745
+ {
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
+ ]
1757
+ }
1758
+ );
1759
+ __publicField(this, "name", "InsufficientFundsError");
1409
1760
  }
1410
1761
  };
1411
- var WebSocketRequestError = class extends BaseError {
1412
- constructor({
1413
- body,
1414
- details,
1415
- url
1416
- }) {
1417
- super("WebSocket request failed.", {
1418
- details,
1419
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1420
- });
1421
- __publicField(this, "name", "WebSocketRequestError");
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");
1422
1772
  }
1423
1773
  };
1424
- var RpcError = class extends BaseError {
1425
- constructor({
1426
- body,
1427
- error,
1428
- url
1429
- }) {
1430
- super("RPC Request failed.", {
1431
- cause: error,
1432
- details: error.message,
1433
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
1434
- });
1435
- __publicField(this, "code");
1436
- __publicField(this, "name", "RpcError");
1437
- this.code = error.code;
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");
1438
1784
  }
1439
1785
  };
1440
- var TimeoutError = class extends BaseError {
1441
- constructor({
1442
- body,
1443
- url
1444
- }) {
1445
- super("The request took too long to respond.", {
1446
- details: "The request timed out.",
1447
- metaMessages: [`URL: ${getUrl(url)}`, `Request body: ${stringify(body)}`]
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
1448
1791
  });
1449
- __publicField(this, "name", "TimeoutError");
1792
+ __publicField(this, "name", "TransactionTypeNotSupportedError");
1450
1793
  }
1451
1794
  };
1452
-
1453
- // src/errors/transport.ts
1454
- var UrlRequiredError = class extends BaseError {
1455
- constructor() {
1795
+ __publicField(TransactionTypeNotSupportedError, "nodeMessage", /transaction type not valid/);
1796
+ var TipAboveFeeCapError = class extends BaseError {
1797
+ constructor({
1798
+ cause,
1799
+ maxPriorityFeePerGas,
1800
+ maxFeePerGas
1801
+ } = {}) {
1456
1802
  super(
1457
- "No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",
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"),
1458
1806
  {
1459
- docsPath: "/docs/clients/intro"
1807
+ cause
1460
1808
  }
1461
1809
  );
1810
+ __publicField(this, "name", "TipAboveFeeCapError");
1462
1811
  }
1463
1812
  };
1464
-
1465
- // src/utils/data/concat.ts
1466
- function concat(values) {
1467
- if (typeof values[0] === "string")
1468
- return concatHex(values);
1469
- return concatBytes(values);
1470
- }
1471
- function concatBytes(values) {
1472
- let length = 0;
1473
- for (const arr of values) {
1474
- length += arr.length;
1475
- }
1476
- const result = new Uint8Array(length);
1477
- let offset = 0;
1478
- for (const arr of values) {
1479
- result.set(arr, offset);
1480
- offset += arr.length;
1481
- }
1482
- return result;
1483
- }
1484
- function concatHex(values) {
1485
- return `0x${values.reduce(
1486
- (acc, x) => acc + x.replace("0x", ""),
1487
- ""
1488
- )}`;
1489
- }
1490
-
1491
- // src/utils/data/isBytes.ts
1492
- function isBytes(value) {
1493
- if (!value)
1494
- return false;
1495
- if (typeof value !== "object")
1496
- return false;
1497
- if (!("BYTES_PER_ELEMENT" in value))
1498
- return false;
1499
- return value.BYTES_PER_ELEMENT === 1 && value.constructor.name === "Uint8Array";
1500
- }
1501
-
1502
- // src/utils/data/isHex.ts
1503
- function isHex(value) {
1504
- if (!value)
1505
- return false;
1506
- if (typeof value !== "string")
1507
- return false;
1508
- return /^0x[0-9a-fA-F]*$/.test(value);
1509
- }
1510
-
1511
- // src/utils/data/pad.ts
1512
- function pad(hexOrBytes, { dir, size: size2 = 32 } = {}) {
1513
- if (typeof hexOrBytes === "string")
1514
- return padHex(hexOrBytes, { dir, size: size2 });
1515
- return padBytes(hexOrBytes, { dir, size: size2 });
1516
- }
1517
- function padHex(hex_, { dir, size: size2 = 32 } = {}) {
1518
- if (size2 === null)
1519
- return hex_;
1520
- let hex = hex_.replace("0x", "");
1521
- if (hex.length > size2 * 2)
1522
- throw new SizeExceedsPaddingSizeError({
1523
- size: Math.ceil(hex.length / 2),
1524
- targetSize: size2,
1525
- type: "hex"
1526
- });
1527
- return `0x${hex[dir === "right" ? "padEnd" : "padStart"](
1528
- size2 * 2,
1529
- "0"
1530
- )}`;
1531
- }
1532
- function padBytes(bytes, { dir, size: size2 = 32 } = {}) {
1533
- if (size2 === null)
1534
- return bytes;
1535
- if (bytes.length > size2)
1536
- throw new SizeExceedsPaddingSizeError({
1537
- size: bytes.length,
1538
- targetSize: size2,
1539
- type: "bytes"
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
1540
1818
  });
1541
- const paddedBytes = new Uint8Array(size2);
1542
- for (let i = 0; i < size2; i++) {
1543
- const padEnd = dir === "right";
1544
- paddedBytes[padEnd ? i : size2 - i - 1] = bytes[padEnd ? i : bytes.length - i - 1];
1545
- }
1546
- return paddedBytes;
1547
- }
1548
-
1549
- // src/utils/data/trim.ts
1550
- function trim(hexOrBytes, { dir = "left" } = {}) {
1551
- let data = typeof hexOrBytes === "string" ? hexOrBytes.replace("0x", "") : hexOrBytes;
1552
- let sliceLength = 0;
1553
- for (let i = 0; i < data.length - 1; i++) {
1554
- if (data[dir === "left" ? i : data.length - i - 1].toString() === "0")
1555
- sliceLength++;
1556
- else
1557
- break;
1558
- }
1559
- data = dir === "left" ? data.slice(sliceLength) : data.slice(0, data.length - sliceLength);
1560
- if (typeof hexOrBytes === "string") {
1561
- if (data.length === 1 && dir === "right")
1562
- data = `${data}0`;
1563
- return `0x${data}`;
1819
+ __publicField(this, "name", "UnknownNodeError");
1564
1820
  }
1565
- return data;
1566
- }
1567
-
1568
- // src/utils/data/size.ts
1569
- function size(value) {
1570
- if (isHex(value))
1571
- return Math.ceil((value.length - 2) / 2);
1572
- return value.length;
1573
- }
1574
-
1575
- // src/utils/data/slice.ts
1576
- function slice(value, start, end) {
1577
- if (isHex(value))
1578
- return sliceHex(value, start, end);
1579
- return sliceBytes(value, start, end);
1580
- }
1581
- function assertStartOffset(value, start) {
1582
- if (typeof start === "number" && start > 0 && start > size(value) - 1)
1583
- throw new Error(
1584
- `Slice starting at offset "${start}" is out-of-bounds (size: ${size(
1585
- value
1586
- )}).`
1587
- );
1588
- }
1589
- function sliceBytes(value, start, end) {
1590
- assertStartOffset(value, start);
1591
- return value.slice(start, end);
1592
- }
1593
- function sliceHex(value_, start, end) {
1594
- assertStartOffset(value_, start);
1595
- const value = value_.replace("0x", "").slice((_nullishCoalesce(start, () => ( 0))) * 2, (_nullishCoalesce(end, () => ( value_.length))) * 2);
1596
- return `0x${value}`;
1597
- }
1821
+ };
1598
1822
 
1599
- // src/utils/encoding/toHex.ts
1600
- var hexes = Array.from(
1601
- { length: 256 },
1602
- (_v, i) => i.toString(16).padStart(2, "0")
1603
- );
1604
- function boolToHex(value) {
1605
- return `0x${Number(value)}`;
1606
- }
1607
- function bytesToHex(value) {
1608
- let hex = "";
1609
- for (let i = 0; i < value.length; i++) {
1610
- hex += hexes[value[i]];
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;
1611
1836
  }
1612
- return `0x${hex}`;
1613
- }
1614
- function toHex(value) {
1615
- if (typeof value === "number" || typeof value === "bigint")
1616
- return numberToHex(value);
1617
- if (typeof value === "string") {
1618
- return stringToHex(value);
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;
1619
1844
  }
1620
- if (typeof value === "boolean")
1621
- return boolToHex(value);
1622
- return bytesToHex(value);
1623
- }
1624
- function numberToHex(value_, opts = {}) {
1625
- const { signed, size: size2 } = opts;
1626
- let value = BigInt(value_);
1627
- let maxValue;
1628
- if (size2) {
1629
- if (signed)
1630
- maxValue = (1n << BigInt(size2) * 8n - 1n) - 1n;
1631
- else
1632
- maxValue = 2n ** (BigInt(size2) * 8n) - 1n;
1633
- } else if (typeof value_ === "number") {
1634
- maxValue = BigInt(Number.MAX_SAFE_INTEGER);
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);
1635
1853
  }
1636
- const minValue = typeof maxValue === "bigint" && signed ? -maxValue - 1n : 0;
1637
- if (maxValue && value > maxValue || value < minValue) {
1638
- const suffix = typeof value_ === "bigint" ? "n" : "";
1639
- throw new IntegerOutOfRangeError({
1640
- max: maxValue ? `${maxValue}${suffix}` : void 0,
1641
- min: `${minValue}${suffix}`,
1642
- signed,
1643
- size: size2,
1644
- value: `${value_}${suffix}`
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);
1860
+ }
1861
+ };
1862
+ var MethodNotFoundRpcError = class extends RpcRequestError {
1863
+ constructor(err) {
1864
+ super(err, {
1865
+ shortMessage: "The method does not exist / is not available."
1645
1866
  });
1867
+ __publicField(this, "name", "MethodNotFoundRpcError");
1868
+ __publicField(this, "code", -32601);
1646
1869
  }
1647
- const hex = `0x${(signed && value < 0 ? (1n << BigInt(size2 * 8)) + BigInt(value) : value).toString(16)}`;
1648
- if (size2)
1649
- return pad(hex, { size: size2 });
1650
- return hex;
1651
- }
1652
- var encoder = new TextEncoder();
1653
- function stringToHex(value_) {
1654
- const value = encoder.encode(value_);
1655
- return toHex(value);
1656
- }
1657
-
1658
- // src/utils/encoding/toBytes.ts
1659
- var encoder2 = new TextEncoder();
1660
- function toBytes(value) {
1661
- if (typeof value === "number" || typeof value === "bigint")
1662
- return numberToBytes(value);
1663
- if (typeof value === "boolean")
1664
- return boolToBytes(value);
1665
- if (value.startsWith("0x"))
1666
- return hexToBytes(value);
1667
- return stringToBytes(value);
1668
- }
1669
- function boolToBytes(value) {
1670
- const bytes = new Uint8Array(1);
1671
- bytes[0] = Number(value);
1672
- return bytes;
1673
- }
1674
- function hexToBytes(hex_) {
1675
- let hex = hex_.slice(2);
1676
- if (hex.length % 2)
1677
- hex = `0${hex}`;
1678
- const bytes = new Uint8Array(hex.length / 2);
1679
- for (let index = 0; index < bytes.length; index++) {
1680
- const start = index * 2;
1681
- const hexByte = hex.slice(start, start + 2);
1682
- const byte = Number.parseInt(hexByte, 16);
1683
- if (Number.isNaN(byte) || byte < 0)
1684
- throw new BaseError(`Invalid byte sequence ("${hexByte}" in "${hex}").`);
1685
- bytes[index] = byte;
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")
1878
+ });
1879
+ __publicField(this, "name", "InvalidParamsRpcError");
1880
+ __publicField(this, "code", -32602);
1686
1881
  }
1687
- return bytes;
1688
- }
1689
- function numberToBytes(value, opts) {
1690
- const hex = numberToHex(value, opts);
1691
- return hexToBytes(hex);
1692
- }
1693
- function stringToBytes(value) {
1694
- return encoder2.encode(value);
1695
- }
1696
-
1697
- // src/utils/encoding/toRlp.ts
1698
- function toRlp(hexOrBytes, to_) {
1699
- const to = to_ || "hex";
1700
- return format(bytesToRlp(parse(hexOrBytes)), to);
1701
- }
1702
- function parse(hexOrBytes) {
1703
- if (Array.isArray(hexOrBytes))
1704
- return hexOrBytes.map(parse);
1705
- return typeof hexOrBytes === "string" ? toBytes(hexOrBytes) : hexOrBytes;
1706
- }
1707
- function format(bytes, type = "bytes") {
1708
- return type === "hex" ? bytesToHex(bytes) : bytes;
1709
- }
1710
- function bytesToRlp(bytes) {
1711
- if (Array.isArray(bytes)) {
1712
- const encoded = concat(bytes.map(bytesToRlp));
1713
- return new Uint8Array([...encodeLength(encoded.length, 192), ...encoded]);
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);
1714
1888
  }
1715
- if (bytes.length === 1 && bytes[0] < 128)
1716
- return bytes;
1717
- return new Uint8Array([...encodeLength(bytes.length, 128), ...bytes]);
1718
- }
1719
- function encodeLength(length, offset) {
1720
- if (length < 56)
1721
- return [offset + length];
1722
- return [toBytes(length).length + offset + 55, ...toBytes(length)];
1723
- }
1724
-
1725
- // src/utils/encoding/fromHex.ts
1726
- function fromHex(hex, to) {
1727
- if (to === "number")
1728
- return hexToNumber(hex);
1729
- if (to === "bigint")
1730
- return hexToBigInt(hex);
1731
- if (to === "string")
1732
- return hexToString(hex);
1733
- if (to === "boolean")
1734
- return hexToBool(hex);
1735
- return hexToBytes(hex);
1736
- }
1737
- function hexToBigInt(hex, opts = {}) {
1738
- const { signed } = opts;
1739
- const value = BigInt(hex);
1740
- if (!signed)
1741
- return value;
1742
- const size2 = (hex.length - 2) / 2;
1743
- const max = (1n << BigInt(size2) * 8n - 1n) - 1n;
1744
- if (value <= max)
1745
- return value;
1746
- return value - BigInt(`0x${"f".padStart(size2 * 2, "f")}`) - 1n;
1747
- }
1748
- function hexToBool(hex) {
1749
- if (trim(hex) === "0x0")
1750
- return false;
1751
- if (trim(hex) === "0x1")
1752
- return true;
1753
- throw new InvalidHexBooleanError(hex);
1754
- }
1755
- function hexToNumber(hex, opts = {}) {
1756
- return Number(hexToBigInt(hex, opts));
1757
- }
1758
- function hexToString(hex) {
1759
- const bytes = hexToBytes(hex);
1760
- return new TextDecoder().decode(bytes);
1761
- }
1762
-
1763
- // src/utils/encoding/fromBytes.ts
1764
- function fromBytes(bytes, to) {
1765
- if (to === "number")
1766
- return bytesToNumber(bytes);
1767
- if (to === "bigint")
1768
- return bytesToBigint(bytes);
1769
- if (to === "boolean")
1770
- return bytesToBool(bytes);
1771
- if (to === "string")
1772
- return bytesToString(bytes);
1773
- return bytesToHex(bytes);
1774
- }
1775
- function bytesToBigint(bytes) {
1776
- const hex = bytesToHex(bytes);
1777
- return hexToBigInt(hex);
1778
- }
1779
- function bytesToBool(bytes) {
1780
- if (bytes.length > 1 || bytes[0] > 1)
1781
- throw new InvalidBytesBooleanError(bytes);
1782
- return Boolean(bytes[0]);
1783
- }
1784
- function bytesToNumber(bytes) {
1785
- const hex = bytesToHex(bytes);
1786
- return hexToNumber(hex);
1787
- }
1788
- function bytesToString(bytes) {
1789
- return new TextDecoder().decode(bytes);
1790
- }
1791
-
1792
- // src/utils/encoding/fromRlp.ts
1793
- function fromRlp(value, to) {
1794
- const bytes = parse2(value);
1795
- const [data, consumed] = rlpToBytes(bytes);
1796
- if (consumed < bytes.length)
1797
- throw new DataLengthTooLongError({
1798
- consumed,
1799
- length: bytes.length
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")
1800
1897
  });
1801
- return format2(data, to);
1802
- }
1803
- function parse2(value) {
1804
- if (typeof value === "string") {
1805
- if (value.length > 3 && value.length % 2 !== 0)
1806
- throw new InvalidHexValueError(value);
1807
- return hexToBytes(value);
1898
+ __publicField(this, "name", "InvalidInputRpcError");
1899
+ __publicField(this, "code", -32e3);
1900
+ }
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);
1808
1914
  }
1809
- return value;
1810
- }
1811
- function format2(bytes, to) {
1812
- if (Array.isArray(bytes))
1813
- return bytes.map((b) => format2(b, to));
1814
- return to === "hex" ? trim(bytesToHex(bytes)) : bytes;
1815
- }
1816
- function rlpToBytes(bytes, offset = 0) {
1817
- if (bytes.length === 0)
1818
- return [new Uint8Array([]), 0];
1819
- const prefix = bytes[offset];
1820
- if (prefix <= 127)
1821
- return [new Uint8Array([bytes[offset]]), 1];
1822
- if (prefix <= 183) {
1823
- const length2 = prefix - 128;
1824
- const offset_ = offset + 1;
1825
- if (offset_ + length2 > bytes.length)
1826
- throw new DataLengthTooShortError({
1827
- length: offset_ + length2,
1828
- dataLength: bytes.length
1829
- });
1830
- return [bytes.slice(offset_, offset_ + length2), 1 + length2];
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);
1831
1921
  }
1832
- if (prefix <= 191) {
1833
- const lengthOfLength2 = prefix - 183;
1834
- const offset_ = offset + 1;
1835
- const length2 = bytesToNumber(bytes.slice(offset_, offset_ + lengthOfLength2));
1836
- if (offset_ + lengthOfLength2 + length2 > bytes.length)
1837
- throw new DataLengthTooShortError({
1838
- length: lengthOfLength2 + length2,
1839
- dataLength: bytes.length - lengthOfLength2
1840
- });
1841
- return [
1842
- bytes.slice(offset_ + lengthOfLength2, offset_ + lengthOfLength2 + length2),
1843
- 1 + lengthOfLength2 + length2
1844
- ];
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);
1845
1928
  }
1846
- let lengthOfLength = 0;
1847
- let length = prefix - 192;
1848
- if (prefix > 247) {
1849
- lengthOfLength = prefix - 247;
1850
- length = bytesToNumber(bytes.slice(offset + 1, offset + 1 + lengthOfLength));
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);
1851
1935
  }
1852
- let nextOffset = offset + 1 + lengthOfLength;
1853
- if (nextOffset > bytes.length)
1854
- throw new DataLengthTooShortError({
1855
- length: nextOffset,
1856
- dataLength: bytes.length
1936
+ };
1937
+ var JsonRpcVersionUnsupportedError = class extends RpcRequestError {
1938
+ constructor(err) {
1939
+ super(err, {
1940
+ shortMessage: "Version of JSON-RPC protocol is not supported."
1857
1941
  });
1858
- let consumed = 1 + lengthOfLength + length;
1859
- let result = [];
1860
- while (nextOffset < offset + consumed) {
1861
- const decoded = rlpToBytes(bytes, nextOffset);
1862
- result.push(decoded[0]);
1863
- nextOffset += decoded[1];
1864
- if (nextOffset > offset + consumed)
1865
- throw new OffsetOutOfBoundsError({
1866
- nextOffset,
1867
- offset: offset + consumed
1868
- });
1942
+ __publicField(this, "name", "JsonRpcVersionUnsupportedError");
1943
+ __publicField(this, "code", -32006);
1869
1944
  }
1870
- return [result, consumed];
1871
- }
1872
-
1873
- // src/utils/contract/extractFunctionParts.ts
1874
- var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
1875
- function extractFunctionParts(def) {
1876
- const parts = def.match(paramsRegex);
1877
- const type = _optionalChain([parts, 'optionalAccess', _20 => _20[2]]) || void 0;
1878
- const name = _optionalChain([parts, 'optionalAccess', _21 => _21[3]]);
1879
- const params = _optionalChain([parts, 'optionalAccess', _22 => _22[5]]) || void 0;
1880
- return { type, name, params };
1881
- }
1882
- function extractFunctionName(def) {
1883
- return extractFunctionParts(def).name;
1884
- }
1885
- function extractFunctionParams(def) {
1886
- const params = extractFunctionParts(def).params;
1887
- const splitParams = _optionalChain([params, 'optionalAccess', _23 => _23.split, 'call', _24 => _24(","), 'access', _25 => _25.map, 'call', _26 => _26((x) => x.trim().split(" "))]);
1888
- return _optionalChain([splitParams, 'optionalAccess', _27 => _27.map, 'call', _28 => _28((param) => ({
1889
- type: param[0],
1890
- name: param[1] === "indexed" ? param[2] : param[1],
1891
- ...param[1] === "indexed" ? { indexed: true } : {}
1892
- }))]);
1893
- }
1894
- function extractFunctionType(def) {
1895
- return extractFunctionParts(def).type;
1896
- }
1897
-
1898
- // src/utils/hash/keccak256.ts
1899
- var _sha3 = require('@noble/hashes/sha3');
1900
- function keccak256(value, to_) {
1901
- const to = to_ || "hex";
1902
- const bytes = _sha3.keccak_256.call(void 0, isHex(value) ? toBytes(value) : value);
1903
- if (to === "bytes")
1904
- return bytes;
1905
- return toHex(bytes);
1906
- }
1907
-
1908
- // src/utils/hash/hashFunction.ts
1909
- var hash = (value) => keccak256(toBytes(value));
1910
- function hashFunction(def) {
1911
- const name = extractFunctionName(def);
1912
- const params = extractFunctionParams(def);
1913
- if (!params || params.length === 0)
1914
- return hash(def.replace(/ /g, ""));
1915
- return hash(`${name}(${params.map(({ type }) => type).join(",")})`);
1916
- }
1917
-
1918
- // src/utils/hash/getEventSelector.ts
1919
- var getEventSelector = (event) => hashFunction(event);
1920
-
1921
- // src/utils/hash/getFunctionSelector.ts
1922
- var getFunctionSelector = (fn) => slice(hashFunction(fn), 0, 4);
1923
-
1924
- // src/utils/address/isAddress.ts
1925
- var addressRegex = /^0x[a-fA-F0-9]{40}$/;
1926
- function isAddress(address) {
1927
- return addressRegex.test(address);
1928
- }
1929
-
1930
- // src/utils/address/getAddress.ts
1931
- function checksumAddress(address_) {
1932
- const hexAddress = address_.substring(2).toLowerCase();
1933
- const hash2 = keccak256(stringToBytes(hexAddress), "bytes");
1934
- let address = hexAddress.split("");
1935
- for (let i = 0; i < 40; i += 2) {
1936
- if (hash2[i >> 1] >> 4 >= 8 && address[i]) {
1937
- address[i] = address[i].toUpperCase();
1938
- }
1939
- if ((hash2[i >> 1] & 15) >= 8 && address[i + 1]) {
1940
- address[i + 1] = address[i + 1].toUpperCase();
1941
- }
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);
1942
1953
  }
1943
- return `0x${address.join("")}`;
1944
- }
1945
- function getAddress(address) {
1946
- if (!isAddress(address))
1947
- throw new InvalidAddressError({ address });
1948
- return checksumAddress(address);
1949
- }
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);
1962
+ }
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
+ };
1950
1972
 
1951
- // src/utils/address/getContractAddress.ts
1952
- function getContractAddress2(opts) {
1953
- if (opts.opcode === "CREATE2")
1954
- return getCreate2Address(opts);
1955
- return getCreateAddress(opts);
1956
- }
1957
- function getCreateAddress(opts) {
1958
- const from = toBytes(getAddress(opts.from));
1959
- let nonce = toBytes(opts.nonce);
1960
- if (nonce[0] === 0)
1961
- nonce = new Uint8Array([]);
1962
- return getAddress(
1963
- `0x${keccak256(toRlp([from, nonce], "bytes")).slice(26)}`
1964
- );
1965
- }
1966
- function getCreate2Address(opts) {
1967
- const from = toBytes(getAddress(opts.from));
1968
- const salt = pad(isBytes(opts.salt) ? opts.salt : toBytes(opts.salt), {
1969
- size: 32
1970
- });
1971
- const bytecodeHash = toBytes(
1972
- keccak256(
1973
- isBytes(opts.bytecode) ? opts.bytecode : toBytes(opts.bytecode)
1974
- )
1975
- );
1976
- return getAddress(
1977
- slice(keccak256(concat([toBytes("0xff"), from, salt, bytecodeHash])), 12)
1978
- );
1979
- }
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;
2028
+ }
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)}`]
2038
+ });
2039
+ __publicField(this, "name", "TimeoutError");
2040
+ }
2041
+ };
1980
2042
 
1981
- // src/utils/address/isAddressEqual.ts
1982
- function isAddressEqual(a, b) {
1983
- if (!isAddress(a))
1984
- throw new InvalidAddressError({ address: a });
1985
- if (!isAddress(b))
1986
- throw new InvalidAddressError({ address: b });
1987
- return a.toLowerCase() === b.toLowerCase();
1988
- }
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
+ );
2052
+ }
2053
+ };
1989
2054
 
1990
2055
  // src/utils/abi/encodeAbiParameters.ts
1991
2056
  function encodeAbiParameters(params, values) {
@@ -2287,7 +2352,7 @@ function decodeArray(data, {
2287
2352
  }
2288
2353
  if (hasDynamicChild(param)) {
2289
2354
  const arrayComponents = getArrayComponents(param.type);
2290
- const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _29 => _29[0]]);
2355
+ const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _31 => _31[0]]);
2291
2356
  let consumed2 = 0;
2292
2357
  let value2 = [];
2293
2358
  for (let i = 0; i < length; ++i) {
@@ -2363,7 +2428,7 @@ function decodeTuple(data, { param, position }) {
2363
2428
  position: consumed
2364
2429
  });
2365
2430
  consumed += decodedChild.consumed;
2366
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _30 => _30.name])] = decodedChild.value;
2431
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _32 => _32.name])] = decodedChild.value;
2367
2432
  }
2368
2433
  return { consumed: 32, value };
2369
2434
  }
@@ -2375,7 +2440,7 @@ function decodeTuple(data, { param, position }) {
2375
2440
  position: position + consumed
2376
2441
  });
2377
2442
  consumed += decodedChild.consumed;
2378
- value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _31 => _31.name])] = decodedChild.value;
2443
+ value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _33 => _33.name])] = decodedChild.value;
2379
2444
  }
2380
2445
  return { consumed, value };
2381
2446
  }
@@ -2388,7 +2453,7 @@ function hasDynamicChild(param) {
2388
2453
  if (type.endsWith("[]"))
2389
2454
  return true;
2390
2455
  if (type === "tuple")
2391
- return _optionalChain([param, 'access', _32 => _32.components, 'optionalAccess', _33 => _33.some, 'call', _34 => _34(hasDynamicChild)]);
2456
+ return _optionalChain([param, 'access', _34 => _34.components, 'optionalAccess', _35 => _35.some, 'call', _36 => _36(hasDynamicChild)]);
2392
2457
  const arrayComponents = getArrayComponents(param.type);
2393
2458
  if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
2394
2459
  return true;
@@ -2459,7 +2524,7 @@ function decodeEventLog({
2459
2524
  docsPath
2460
2525
  });
2461
2526
  const { name, inputs } = abiItem;
2462
- const isUnnamed = _optionalChain([inputs, 'optionalAccess', _35 => _35.some, 'call', _36 => _36((x) => !("name" in x && x.name))]);
2527
+ const isUnnamed = _optionalChain([inputs, 'optionalAccess', _37 => _37.some, 'call', _38 => _38((x) => !("name" in x && x.name))]);
2463
2528
  let args = isUnnamed ? [] : {};
2464
2529
  if (argTopics.length > 0) {
2465
2530
  const indexedInputs = inputs.filter((x) => "indexed" in x && x.indexed);
@@ -2680,8 +2745,8 @@ function encodeEventTopics({ abi, eventName, args }) {
2680
2745
  const signature = getEventSelector(definition);
2681
2746
  let topics = [];
2682
2747
  if (args && "inputs" in abiItem) {
2683
- const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _37 => _37.inputs, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((x) => args[x.name])]), () => ( []));
2684
- topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _40 => _40.inputs, 'optionalAccess', _41 => _41.filter, 'call', _42 => _42((param) => "indexed" in param && param.indexed), 'access', _43 => _43.map, 'call', _44 => _44(
2748
+ const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _39 => _39.inputs, 'optionalAccess', _40 => _40.map, 'call', _41 => _41((x) => args[x.name])]), () => ( []));
2749
+ topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _42 => _42.inputs, 'optionalAccess', _43 => _43.filter, 'call', _44 => _44((param) => "indexed" in param && param.indexed), 'access', _45 => _45.map, 'call', _46 => _46(
2685
2750
  (param, i) => Array.isArray(args_[i]) ? args_[i].map(
2686
2751
  (_, j) => encodeArg({ param, value: args_[i][j] })
2687
2752
  ) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
@@ -2828,21 +2893,6 @@ function formatAbiItemWithArgs({
2828
2893
  ).join(", ")})`;
2829
2894
  }
2830
2895
 
2831
- // src/utils/account.ts
2832
- function getAccount(account) {
2833
- if (typeof account === "string") {
2834
- if (!isAddress(account))
2835
- throw new InvalidAddressError({ address: account });
2836
- return { address: account, type: "json-rpc" };
2837
- }
2838
- if (!isAddress(account.address))
2839
- throw new InvalidAddressError({ address: account.address });
2840
- return {
2841
- ...account,
2842
- type: "local"
2843
- };
2844
- }
2845
-
2846
2896
  // src/utils/promise/withCache.ts
2847
2897
  var promiseCache = /* @__PURE__ */ new Map();
2848
2898
  var responseCache = /* @__PURE__ */ new Map();
@@ -2938,7 +2988,7 @@ function withTimeout(fn, {
2938
2988
  }
2939
2989
  }, timeout);
2940
2990
  }
2941
- resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _45 => _45.signal]) }));
2991
+ resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _47 => _47.signal]) }));
2942
2992
  } catch (err) {
2943
2993
  if (err.name === "AbortError")
2944
2994
  reject(errorInstance);
@@ -3004,8 +3054,8 @@ function buildRequest(request, {
3004
3054
  {
3005
3055
  delay: ({ count, error }) => {
3006
3056
  if (error && error instanceof HttpRequestError) {
3007
- const retryAfter = _optionalChain([error, 'optionalAccess', _46 => _46.headers, 'optionalAccess', _47 => _47.get, 'call', _48 => _48("Retry-After")]);
3008
- if (_optionalChain([retryAfter, 'optionalAccess', _49 => _49.match, 'call', _50 => _50(/\d/)]))
3057
+ const retryAfter = _optionalChain([error, 'optionalAccess', _48 => _48.headers, 'optionalAccess', _49 => _49.get, 'call', _50 => _50("Retry-After")]);
3058
+ if (_optionalChain([retryAfter, 'optionalAccess', _51 => _51.match, 'call', _52 => _52(/\d/)]))
3009
3059
  return parseInt(retryAfter) * 1e3;
3010
3060
  }
3011
3061
  return ~~(1 << count) * retryDelay;
@@ -3025,7 +3075,7 @@ function getChainContractAddress({
3025
3075
  chain,
3026
3076
  contract: name
3027
3077
  }) {
3028
- const contract = _optionalChain([chain, 'optionalAccess', _51 => _51.contracts, 'optionalAccess', _52 => _52[name]]);
3078
+ const contract = _optionalChain([chain, 'optionalAccess', _53 => _53.contracts, 'optionalAccess', _54 => _54[name]]);
3029
3079
  if (!contract)
3030
3080
  throw new ChainDoesNotSupportContract({
3031
3081
  chain,
@@ -3062,7 +3112,7 @@ function defineFormatter({
3062
3112
  }
3063
3113
  return {
3064
3114
  ...formatted,
3065
- ..._optionalChain([formatOverride, 'optionalCall', _53 => _53(data)])
3115
+ ..._optionalChain([formatOverride, 'optionalCall', _55 => _55(data)])
3066
3116
  };
3067
3117
  };
3068
3118
  }
@@ -3105,7 +3155,7 @@ var defineTransaction = defineFormatter({ format: formatTransaction });
3105
3155
 
3106
3156
  // src/utils/formatters/block.ts
3107
3157
  function formatBlock(block) {
3108
- const transactions = _optionalChain([block, 'access', _54 => _54.transactions, 'optionalAccess', _55 => _55.map, 'call', _56 => _56((transaction) => {
3158
+ const transactions = _optionalChain([block, 'access', _56 => _56.transactions, 'optionalAccess', _57 => _57.map, 'call', _58 => _58((transaction) => {
3109
3159
  if (typeof transaction === "string")
3110
3160
  return transaction;
3111
3161
  return formatTransaction(transaction);
@@ -3134,7 +3184,7 @@ function extract(value, { formatter }) {
3134
3184
  return {};
3135
3185
  const keys = Object.keys(formatter({}));
3136
3186
  return keys.reduce((data, key) => {
3137
- if (_optionalChain([value, 'optionalAccess', _57 => _57.hasOwnProperty, 'call', _58 => _58(key)])) {
3187
+ if (_optionalChain([value, 'optionalAccess', _59 => _59.hasOwnProperty, 'call', _60 => _60(key)])) {
3138
3188
  ;
3139
3189
  data[key] = value[key];
3140
3190
  }
@@ -3148,7 +3198,7 @@ function formatFeeHistory(feeHistory) {
3148
3198
  baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
3149
3199
  gasUsedRatio: feeHistory.gasUsedRatio,
3150
3200
  oldestBlock: BigInt(feeHistory.oldestBlock),
3151
- reward: _optionalChain([feeHistory, 'access', _59 => _59.reward, 'optionalAccess', _60 => _60.map, 'call', _61 => _61(
3201
+ reward: _optionalChain([feeHistory, 'access', _61 => _61.reward, 'optionalAccess', _62 => _62.map, 'call', _63 => _63(
3152
3202
  (reward) => reward.map((value) => BigInt(value))
3153
3203
  )])
3154
3204
  };
@@ -3216,34 +3266,34 @@ function getNodeError(err, args) {
3216
3266
  if (FeeCapTooHighError.nodeMessage.test(message))
3217
3267
  return new FeeCapTooHighError({
3218
3268
  cause: err,
3219
- maxFeePerGas: _optionalChain([args, 'optionalAccess', _62 => _62.maxFeePerGas])
3269
+ maxFeePerGas: _optionalChain([args, 'optionalAccess', _64 => _64.maxFeePerGas])
3220
3270
  });
3221
3271
  else if (FeeCapTooLowError.nodeMessage.test(message))
3222
3272
  return new FeeCapTooLowError({
3223
3273
  cause: err,
3224
- maxFeePerGas: _optionalChain([args, 'optionalAccess', _63 => _63.maxFeePerGas])
3274
+ maxFeePerGas: _optionalChain([args, 'optionalAccess', _65 => _65.maxFeePerGas])
3225
3275
  });
3226
3276
  else if (NonceTooHighError.nodeMessage.test(message))
3227
- return new NonceTooHighError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _64 => _64.nonce]) });
3277
+ return new NonceTooHighError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _66 => _66.nonce]) });
3228
3278
  else if (NonceTooLowError.nodeMessage.test(message))
3229
- return new NonceTooLowError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _65 => _65.nonce]) });
3279
+ return new NonceTooLowError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _67 => _67.nonce]) });
3230
3280
  else if (NonceMaxValueError.nodeMessage.test(message))
3231
- return new NonceMaxValueError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _66 => _66.nonce]) });
3281
+ return new NonceMaxValueError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _68 => _68.nonce]) });
3232
3282
  else if (InsufficientFundsError.nodeMessage.test(message))
3233
3283
  return new InsufficientFundsError({ cause: err });
3234
3284
  else if (IntrinsicGasTooHighError.nodeMessage.test(message))
3235
- return new IntrinsicGasTooHighError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _67 => _67.gas]) });
3285
+ return new IntrinsicGasTooHighError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _69 => _69.gas]) });
3236
3286
  else if (IntrinsicGasTooLowError.nodeMessage.test(message))
3237
- return new IntrinsicGasTooLowError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _68 => _68.gas]) });
3287
+ return new IntrinsicGasTooLowError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _70 => _70.gas]) });
3238
3288
  else if (TransactionTypeNotSupportedError.nodeMessage.test(message))
3239
3289
  return new TransactionTypeNotSupportedError({ cause: err });
3240
3290
  else if (TipAboveFeeCapError.nodeMessage.test(message))
3241
3291
  return new TipAboveFeeCapError({
3242
3292
  cause: err,
3243
- maxFeePerGas: _optionalChain([args, 'optionalAccess', _69 => _69.maxFeePerGas]),
3244
- maxPriorityFeePerGas: _optionalChain([args, 'optionalAccess', _70 => _70.maxPriorityFeePerGas])
3293
+ maxFeePerGas: _optionalChain([args, 'optionalAccess', _71 => _71.maxFeePerGas]),
3294
+ maxPriorityFeePerGas: _optionalChain([args, 'optionalAccess', _72 => _72.maxPriorityFeePerGas])
3245
3295
  });
3246
- else if (message.match(ExecutionRevertedError.nodeMessage) || "code" in err.cause && _optionalChain([err, 'access', _71 => _71.cause, 'optionalAccess', _72 => _72.code]) === ExecutionRevertedError.code)
3296
+ else if (message.match(ExecutionRevertedError.nodeMessage) || "code" in err.cause && _optionalChain([err, 'access', _73 => _73.cause, 'optionalAccess', _74 => _74.code]) === ExecutionRevertedError.code)
3247
3297
  return new ExecutionRevertedError({
3248
3298
  cause: err,
3249
3299
  message: err.cause.details
@@ -3277,7 +3327,7 @@ function getContractError(err, {
3277
3327
  functionName,
3278
3328
  sender
3279
3329
  }) {
3280
- const { code, data, message } = err instanceof RawContractError ? err : err instanceof CallExecutionError || err instanceof EstimateGasExecutionError ? _optionalChain([err, 'access', _73 => _73.cause, 'optionalAccess', _74 => _74.cause, 'optionalAccess', _75 => _75.cause]) || {} : err.cause || {};
3330
+ const { code, data, message } = err instanceof RawContractError ? err : err instanceof CallExecutionError || err instanceof EstimateGasExecutionError ? _optionalChain([err, 'access', _75 => _75.cause, 'optionalAccess', _76 => _76.cause, 'optionalAccess', _77 => _77.cause]) || {} : err.cause || {};
3281
3331
  let cause = err;
3282
3332
  if (err instanceof AbiDecodingZeroDataError) {
3283
3333
  cause = new ContractFunctionZeroDataError({ functionName });
@@ -3366,7 +3416,7 @@ async function http(url, { body, fetchOptions = {}, timeout = 1e4 }) {
3366
3416
  }
3367
3417
  );
3368
3418
  let data;
3369
- if (_optionalChain([response, 'access', _76 => _76.headers, 'access', _77 => _77.get, 'call', _78 => _78("Content-Type"), 'optionalAccess', _79 => _79.startsWith, 'call', _80 => _80("application/json")])) {
3419
+ if (_optionalChain([response, 'access', _78 => _78.headers, 'access', _79 => _79.get, 'call', _80 => _80("Content-Type"), 'optionalAccess', _81 => _81.startsWith, 'call', _82 => _82("application/json")])) {
3370
3420
  data = await response.json();
3371
3421
  } else {
3372
3422
  data = await response.text();
@@ -3458,15 +3508,15 @@ function webSocket(socket, {
3458
3508
  if (typeof message.id === "number" && id_ !== message.id)
3459
3509
  return;
3460
3510
  if (message.error) {
3461
- _optionalChain([onError, 'optionalCall', _81 => _81(new RpcError({ body, error: message.error, url: socket.url }))]);
3511
+ _optionalChain([onError, 'optionalCall', _83 => _83(new RpcError({ body, error: message.error, url: socket.url }))]);
3462
3512
  } else {
3463
- _optionalChain([onData, 'optionalCall', _82 => _82(message)]);
3513
+ _optionalChain([onData, 'optionalCall', _84 => _84(message)]);
3464
3514
  }
3465
3515
  if (body.method === "eth_subscribe" && typeof message.result === "string") {
3466
3516
  socket.subscriptions.set(message.result, callback);
3467
3517
  }
3468
3518
  if (body.method === "eth_unsubscribe") {
3469
- socket.subscriptions.delete(_optionalChain([body, 'access', _83 => _83.params, 'optionalAccess', _84 => _84[0]]));
3519
+ socket.subscriptions.delete(_optionalChain([body, 'access', _85 => _85.params, 'optionalAccess', _86 => _86[0]]));
3470
3520
  }
3471
3521
  };
3472
3522
  socket.requests.set(id_, callback);
@@ -3507,6 +3557,215 @@ ${messageBytes.length}`
3507
3557
  return keccak256(concat([prefixBytes, messageBytes]), to_);
3508
3558
  }
3509
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
+
3605
+ // src/utils/signature/hashTypedData.ts
3606
+ function hashTypedData({
3607
+ domain: domain_,
3608
+ message,
3609
+ primaryType,
3610
+ types: types_
3611
+ }) {
3612
+ const domain = typeof domain_ === "undefined" ? {} : domain_;
3613
+ const types = {
3614
+ EIP712Domain: [
3615
+ _optionalChain([domain, 'optionalAccess', _87 => _87.name]) && { name: "name", type: "string" },
3616
+ _optionalChain([domain, 'optionalAccess', _88 => _88.version]) && { name: "version", type: "string" },
3617
+ _optionalChain([domain, 'optionalAccess', _89 => _89.chainId]) && { name: "chainId", type: "uint256" },
3618
+ _optionalChain([domain, 'optionalAccess', _90 => _90.verifyingContract]) && {
3619
+ name: "verifyingContract",
3620
+ type: "address"
3621
+ },
3622
+ _optionalChain([domain, 'optionalAccess', _91 => _91.salt]) && { name: "salt", type: "bytes32" }
3623
+ ].filter(Boolean),
3624
+ ...types_
3625
+ };
3626
+ validateTypedData({
3627
+ domain,
3628
+ message,
3629
+ primaryType,
3630
+ types
3631
+ });
3632
+ let parts = ["0x1901"];
3633
+ if (domain)
3634
+ parts.push(
3635
+ hashDomain({
3636
+ domain,
3637
+ types
3638
+ })
3639
+ );
3640
+ if (primaryType !== "EIP712Domain") {
3641
+ parts.push(
3642
+ hashStruct({
3643
+ data: message,
3644
+ primaryType,
3645
+ types
3646
+ })
3647
+ );
3648
+ }
3649
+ return keccak256(concat(parts));
3650
+ }
3651
+ function hashDomain({
3652
+ domain,
3653
+ types
3654
+ }) {
3655
+ return hashStruct({
3656
+ data: domain,
3657
+ primaryType: "EIP712Domain",
3658
+ types
3659
+ });
3660
+ }
3661
+ function hashStruct({
3662
+ data,
3663
+ primaryType,
3664
+ types
3665
+ }) {
3666
+ const encoded = encodeData({
3667
+ data,
3668
+ primaryType,
3669
+ types
3670
+ });
3671
+ return keccak256(encoded);
3672
+ }
3673
+ function encodeData({
3674
+ data,
3675
+ primaryType,
3676
+ types
3677
+ }) {
3678
+ let encodedTypes = [{ type: "bytes32" }];
3679
+ const encodedValues = [hashType({ primaryType, types })];
3680
+ for (const field of types[primaryType]) {
3681
+ const [type, value] = encodeField({
3682
+ types,
3683
+ name: field.name,
3684
+ type: field.type,
3685
+ value: data[field.name]
3686
+ });
3687
+ encodedTypes.push(type);
3688
+ encodedValues.push(value);
3689
+ }
3690
+ return encodeAbiParameters(encodedTypes, encodedValues);
3691
+ }
3692
+ function hashType({
3693
+ primaryType,
3694
+ types
3695
+ }) {
3696
+ const encodedHashType = toHex(encodeType({ primaryType, types }));
3697
+ return keccak256(encodedHashType);
3698
+ }
3699
+ function encodeType({
3700
+ primaryType,
3701
+ types
3702
+ }) {
3703
+ let result = "";
3704
+ const unsortedDeps = findTypeDependencies({ primaryType, types });
3705
+ unsortedDeps.delete(primaryType);
3706
+ const deps = [primaryType, ...Array.from(unsortedDeps).sort()];
3707
+ for (const type of deps) {
3708
+ result += `${type}(${types[type].map(({ name, type: t }) => `${t} ${name}`).join(",")})`;
3709
+ }
3710
+ return result;
3711
+ }
3712
+ function findTypeDependencies({
3713
+ primaryType: primaryType_,
3714
+ types
3715
+ }, results = /* @__PURE__ */ new Set()) {
3716
+ const match = primaryType_.match(/^\w*/u);
3717
+ const primaryType = _optionalChain([match, 'optionalAccess', _92 => _92[0]]);
3718
+ if (results.has(primaryType) || types[primaryType] === void 0) {
3719
+ return results;
3720
+ }
3721
+ results.add(primaryType);
3722
+ for (const field of types[primaryType]) {
3723
+ findTypeDependencies({ primaryType: field.type, types }, results);
3724
+ }
3725
+ return results;
3726
+ }
3727
+ function encodeField({
3728
+ types,
3729
+ name,
3730
+ type,
3731
+ value
3732
+ }) {
3733
+ if (types[type] !== void 0) {
3734
+ return [
3735
+ { type: "bytes32" },
3736
+ keccak256(encodeData({ data: value, primaryType: type, types }))
3737
+ ];
3738
+ }
3739
+ if (type === "bytes") {
3740
+ const prepend = value.length % 2 ? "0" : "";
3741
+ value = `0x${prepend + value.slice(2)}`;
3742
+ return [{ type: "bytes32" }, keccak256(value)];
3743
+ }
3744
+ if (type === "string")
3745
+ return [{ type: "bytes32" }, keccak256(toHex(value))];
3746
+ if (type.lastIndexOf("]") === type.length - 1) {
3747
+ const parsedType = type.slice(0, type.lastIndexOf("["));
3748
+ const typeValuePairs = value.map(
3749
+ (item) => encodeField({
3750
+ name,
3751
+ type: parsedType,
3752
+ types,
3753
+ value: item
3754
+ })
3755
+ );
3756
+ return [
3757
+ { type: "bytes32" },
3758
+ keccak256(
3759
+ encodeAbiParameters(
3760
+ typeValuePairs.map(([t]) => t),
3761
+ typeValuePairs.map(([, v]) => v)
3762
+ )
3763
+ )
3764
+ ];
3765
+ }
3766
+ return [{ type }, value];
3767
+ }
3768
+
3510
3769
  // src/utils/signature/recoverAddress.ts
3511
3770
  var _secp256k1 = require('@noble/secp256k1');
3512
3771
  function recoverAddress({
@@ -3535,6 +3794,25 @@ function recoverMessageAddress({
3535
3794
  return recoverAddress({ hash: hashMessage(message), signature });
3536
3795
  }
3537
3796
 
3797
+ // src/utils/signature/recoverTypedDataAddress.ts
3798
+ function recoverTypedDataAddress({
3799
+ domain,
3800
+ message,
3801
+ primaryType,
3802
+ signature,
3803
+ types
3804
+ }) {
3805
+ return recoverAddress({
3806
+ hash: hashTypedData({
3807
+ domain,
3808
+ message,
3809
+ primaryType,
3810
+ types
3811
+ }),
3812
+ signature
3813
+ });
3814
+ }
3815
+
3538
3816
  // src/utils/signature/verifyMessage.ts
3539
3817
  function verifyMessage({
3540
3818
  address,
@@ -3547,9 +3825,37 @@ function verifyMessage({
3547
3825
  );
3548
3826
  }
3549
3827
 
3828
+ // src/utils/signature/verifyTypedData.ts
3829
+ function verifyTypedData({
3830
+ address,
3831
+ domain,
3832
+ message,
3833
+ primaryType,
3834
+ signature,
3835
+ types
3836
+ }) {
3837
+ return isAddressEqual(
3838
+ getAddress(address),
3839
+ recoverTypedDataAddress({
3840
+ domain,
3841
+ message,
3842
+ primaryType,
3843
+ signature,
3844
+ types
3845
+ })
3846
+ );
3847
+ }
3848
+
3550
3849
  // src/utils/transaction/assertRequest.ts
3551
3850
  function assertRequest(args) {
3552
- const { account, gasPrice, maxFeePerGas, maxPriorityFeePerGas, to } = args;
3851
+ const {
3852
+ account: account_,
3853
+ gasPrice,
3854
+ maxFeePerGas,
3855
+ maxPriorityFeePerGas,
3856
+ to
3857
+ } = args;
3858
+ const account = account_ ? parseAccount(account_) : void 0;
3553
3859
  if (account && !isAddress(account.address))
3554
3860
  throw new InvalidAddressError({ address: account.address });
3555
3861
  if (to && !isAddress(to))
@@ -3565,7 +3871,7 @@ function assertRequest(args) {
3565
3871
  // src/actions/public/call.ts
3566
3872
  async function call(client, args) {
3567
3873
  const {
3568
- account,
3874
+ account: account_,
3569
3875
  blockNumber,
3570
3876
  blockTag = "latest",
3571
3877
  accessList,
@@ -3579,13 +3885,14 @@ async function call(client, args) {
3579
3885
  value,
3580
3886
  ...rest
3581
3887
  } = args;
3888
+ const account = account_ ? parseAccount(account_) : void 0;
3582
3889
  try {
3583
3890
  assertRequest(args);
3584
3891
  const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
3585
- const formatter = _optionalChain([client, 'access', _85 => _85.chain, 'optionalAccess', _86 => _86.formatters, 'optionalAccess', _87 => _87.transactionRequest]);
3892
+ const formatter = _optionalChain([client, 'access', _93 => _93.chain, 'optionalAccess', _94 => _94.formatters, 'optionalAccess', _95 => _95.transactionRequest]);
3586
3893
  const request_ = format3(
3587
3894
  {
3588
- from: _optionalChain([account, 'optionalAccess', _88 => _88.address]),
3895
+ from: _optionalChain([account, 'optionalAccess', _96 => _96.address]),
3589
3896
  accessList,
3590
3897
  data,
3591
3898
  gas,
@@ -3612,6 +3919,7 @@ async function call(client, args) {
3612
3919
  } catch (err) {
3613
3920
  throw getCallError(err, {
3614
3921
  ...args,
3922
+ account,
3615
3923
  chain: client.chain
3616
3924
  });
3617
3925
  }
@@ -3625,6 +3933,7 @@ async function simulateContract(client, {
3625
3933
  functionName,
3626
3934
  ...callRequest
3627
3935
  }) {
3936
+ const account = callRequest.account ? parseAccount(callRequest.account) : void 0;
3628
3937
  const calldata = encodeFunctionData({
3629
3938
  abi,
3630
3939
  args,
@@ -3659,7 +3968,7 @@ async function simulateContract(client, {
3659
3968
  args,
3660
3969
  docsPath: "/docs/contract/simulateContract",
3661
3970
  functionName,
3662
- sender: _optionalChain([callRequest, 'access', _89 => _89.account, 'optionalAccess', _90 => _90.address])
3971
+ sender: _optionalChain([account, 'optionalAccess', _97 => _97.address])
3663
3972
  });
3664
3973
  }
3665
3974
  }
@@ -3751,9 +4060,13 @@ async function createContractEventFilter(client, {
3751
4060
 
3752
4061
  // src/actions/public/estimateGas.ts
3753
4062
  async function estimateGas(client, args) {
4063
+ if (!args.account)
4064
+ throw new AccountNotFoundError({
4065
+ docsPath: "/docs/actions/public/estimateGas"
4066
+ });
4067
+ const account = parseAccount(args.account);
3754
4068
  try {
3755
4069
  const {
3756
- account,
3757
4070
  accessList,
3758
4071
  blockNumber,
3759
4072
  blockTag = "latest",
@@ -3766,10 +4079,10 @@ async function estimateGas(client, args) {
3766
4079
  to,
3767
4080
  value,
3768
4081
  ...rest
3769
- } = args.account.type === "local" ? await prepareRequest(client, args) : args;
4082
+ } = account.type === "local" ? await prepareRequest(client, args) : args;
3770
4083
  const blockNumberHex = blockNumber ? numberToHex(blockNumber) : void 0;
3771
4084
  assertRequest(args);
3772
- const formatter = _optionalChain([client, 'access', _91 => _91.chain, 'optionalAccess', _92 => _92.formatters, 'optionalAccess', _93 => _93.transactionRequest]);
4085
+ const formatter = _optionalChain([client, 'access', _98 => _98.chain, 'optionalAccess', _99 => _99.formatters, 'optionalAccess', _100 => _100.transactionRequest]);
3773
4086
  const request = format3(
3774
4087
  {
3775
4088
  from: account.address,
@@ -3797,6 +4110,7 @@ async function estimateGas(client, args) {
3797
4110
  } catch (err) {
3798
4111
  throw getEstimateGasError(err, {
3799
4112
  ...args,
4113
+ account,
3800
4114
  chain: client.chain
3801
4115
  });
3802
4116
  }
@@ -3810,6 +4124,7 @@ async function estimateContractGas(client, {
3810
4124
  functionName,
3811
4125
  ...request
3812
4126
  }) {
4127
+ const account = parseAccount(request.account);
3813
4128
  const data = encodeFunctionData({
3814
4129
  abi,
3815
4130
  args,
@@ -3829,7 +4144,7 @@ async function estimateContractGas(client, {
3829
4144
  args,
3830
4145
  docsPath: "/docs/contract/simulateContract",
3831
4146
  functionName,
3832
- sender: _optionalChain([request, 'access', _94 => _94.account, 'optionalAccess', _95 => _95.address])
4147
+ sender: _optionalChain([account, 'optionalAccess', _101 => _101.address])
3833
4148
  });
3834
4149
  }
3835
4150
  }
@@ -3867,7 +4182,7 @@ async function getBlock(client, {
3867
4182
  if (!block)
3868
4183
  throw new BlockNotFoundError({ blockHash, blockNumber });
3869
4184
  return format3(block, {
3870
- formatter: _optionalChain([client, 'access', _96 => _96.chain, 'optionalAccess', _97 => _97.formatters, 'optionalAccess', _98 => _98.block]) || formatBlock
4185
+ formatter: _optionalChain([client, 'access', _102 => _102.chain, 'optionalAccess', _103 => _103.formatters, 'optionalAccess', _104 => _104.block]) || formatBlock
3871
4186
  });
3872
4187
  }
3873
4188
 
@@ -4079,7 +4394,7 @@ async function getTransaction(client, {
4079
4394
  index
4080
4395
  });
4081
4396
  return format3(transaction, {
4082
- formatter: _optionalChain([client, 'access', _99 => _99.chain, 'optionalAccess', _100 => _100.formatters, 'optionalAccess', _101 => _101.transaction]) || formatTransaction
4397
+ formatter: _optionalChain([client, 'access', _105 => _105.chain, 'optionalAccess', _106 => _106.formatters, 'optionalAccess', _107 => _107.transaction]) || formatTransaction
4083
4398
  });
4084
4399
  }
4085
4400
 
@@ -4089,7 +4404,7 @@ async function getTransactionConfirmations(client, { hash: hash2, transactionRec
4089
4404
  getBlockNumber(client),
4090
4405
  hash2 ? getTransaction(client, { hash: hash2 }) : void 0
4091
4406
  ]);
4092
- const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess', _102 => _102.blockNumber]) || _optionalChain([transaction, 'optionalAccess', _103 => _103.blockNumber]);
4407
+ const transactionBlockNumber = _optionalChain([transactionReceipt, 'optionalAccess', _108 => _108.blockNumber]) || _optionalChain([transaction, 'optionalAccess', _109 => _109.blockNumber]);
4093
4408
  if (!transactionBlockNumber)
4094
4409
  return 0n;
4095
4410
  return blockNumber - transactionBlockNumber + 1n;
@@ -4113,7 +4428,7 @@ async function getTransactionReceipt(client, { hash: hash2 }) {
4113
4428
  if (!receipt)
4114
4429
  throw new TransactionReceiptNotFoundError({ hash: hash2 });
4115
4430
  return format3(receipt, {
4116
- formatter: _optionalChain([client, 'access', _104 => _104.chain, 'optionalAccess', _105 => _105.formatters, 'optionalAccess', _106 => _106.transactionReceipt]) || formatTransactionReceipt
4431
+ formatter: _optionalChain([client, 'access', _110 => _110.chain, 'optionalAccess', _111 => _111.formatters, 'optionalAccess', _112 => _112.transactionReceipt]) || formatTransactionReceipt
4117
4432
  });
4118
4433
  }
4119
4434
 
@@ -4282,7 +4597,7 @@ function observe(observerId, callbacks, fn) {
4282
4597
  const listeners2 = getListeners();
4283
4598
  if (listeners2.length === 0)
4284
4599
  return;
4285
- listeners2.forEach((listener) => _optionalChain([listener, 'access', _107 => _107.fns, 'access', _108 => _108[key], 'optionalCall', _109 => _109(...args)]));
4600
+ listeners2.forEach((listener) => _optionalChain([listener, 'access', _113 => _113.fns, 'access', _114 => _114[key], 'optionalCall', _115 => _115(...args)]));
4286
4601
  };
4287
4602
  }
4288
4603
  const cleanup = fn(emit);
@@ -4363,7 +4678,7 @@ async function waitForTransactionReceipt(client, {
4363
4678
  reason = "cancelled";
4364
4679
  }
4365
4680
  done(() => {
4366
- _optionalChain([emit, 'access', _110 => _110.onReplaced, 'optionalCall', _111 => _111({
4681
+ _optionalChain([emit, 'access', _116 => _116.onReplaced, 'optionalCall', _117 => _117({
4367
4682
  reason,
4368
4683
  replacedTransaction,
4369
4684
  transaction: replacementTransaction,
@@ -4391,7 +4706,7 @@ function poll(fn, { emitOnBegin, initialWaitTime, interval }) {
4391
4706
  let data;
4392
4707
  if (emitOnBegin)
4393
4708
  data = await fn({ unpoll: unwatch });
4394
- const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _112 => _112(data)]), async () => ( interval));
4709
+ const initialWait = await _asyncNullishCoalesce(await _optionalChain([initialWaitTime, 'optionalCall', _118 => _118(data)]), async () => ( interval));
4395
4710
  await wait(initialWait);
4396
4711
  const poll2 = async () => {
4397
4712
  if (!active)
@@ -4444,7 +4759,7 @@ function watchBlockNumber(client, {
4444
4759
  prevBlockNumber = blockNumber;
4445
4760
  }
4446
4761
  } catch (err) {
4447
- _optionalChain([emit, 'access', _113 => _113.onError, 'optionalCall', _114 => _114(err)]);
4762
+ _optionalChain([emit, 'access', _119 => _119.onError, 'optionalCall', _120 => _120(err)]);
4448
4763
  }
4449
4764
  },
4450
4765
  {
@@ -4484,11 +4799,11 @@ function watchBlocks(client, {
4484
4799
  blockTag,
4485
4800
  includeTransactions
4486
4801
  });
4487
- if (block.number && _optionalChain([prevBlock, 'optionalAccess', _115 => _115.number])) {
4802
+ if (block.number && _optionalChain([prevBlock, 'optionalAccess', _121 => _121.number])) {
4488
4803
  if (block.number === prevBlock.number)
4489
4804
  return;
4490
4805
  if (block.number - prevBlock.number > 1 && emitMissed) {
4491
- for (let i = _optionalChain([prevBlock, 'optionalAccess', _116 => _116.number]) + 1n; i < block.number; i++) {
4806
+ for (let i = _optionalChain([prevBlock, 'optionalAccess', _122 => _122.number]) + 1n; i < block.number; i++) {
4492
4807
  const block2 = await getBlock(client, {
4493
4808
  blockNumber: i,
4494
4809
  includeTransactions
@@ -4500,8 +4815,8 @@ function watchBlocks(client, {
4500
4815
  }
4501
4816
  if (
4502
4817
  // If no previous block exists, emit.
4503
- !_optionalChain([prevBlock, 'optionalAccess', _117 => _117.number]) || // If the block tag is "pending" with no block number, emit.
4504
- blockTag === "pending" && !_optionalChain([block, 'optionalAccess', _118 => _118.number]) || // If the next block number is greater than the previous block number, emit.
4818
+ !_optionalChain([prevBlock, 'optionalAccess', _123 => _123.number]) || // If the block tag is "pending" with no block number, emit.
4819
+ blockTag === "pending" && !_optionalChain([block, 'optionalAccess', _124 => _124.number]) || // If the next block number is greater than the previous block number, emit.
4505
4820
  // We don't want to emit blocks in the past.
4506
4821
  block.number && block.number > prevBlock.number
4507
4822
  ) {
@@ -4509,7 +4824,7 @@ function watchBlocks(client, {
4509
4824
  prevBlock = block;
4510
4825
  }
4511
4826
  } catch (err) {
4512
- _optionalChain([emit, 'access', _119 => _119.onError, 'optionalCall', _120 => _120(err)]);
4827
+ _optionalChain([emit, 'access', _125 => _125.onError, 'optionalCall', _126 => _126(err)]);
4513
4828
  }
4514
4829
  },
4515
4830
  {
@@ -4588,7 +4903,7 @@ function watchContractEvent(client, {
4588
4903
  else
4589
4904
  logs.forEach((log) => emit.onLogs([log]));
4590
4905
  } catch (err) {
4591
- _optionalChain([emit, 'access', _121 => _121.onError, 'optionalCall', _122 => _122(err)]);
4906
+ _optionalChain([emit, 'access', _127 => _127.onError, 'optionalCall', _128 => _128(err)]);
4592
4907
  }
4593
4908
  },
4594
4909
  {
@@ -4667,7 +4982,7 @@ function watchEvent(client, {
4667
4982
  else
4668
4983
  logs.forEach((log) => emit.onLogs([log]));
4669
4984
  } catch (err) {
4670
- _optionalChain([emit, 'access', _123 => _123.onError, 'optionalCall', _124 => _124(err)]);
4985
+ _optionalChain([emit, 'access', _129 => _129.onError, 'optionalCall', _130 => _130(err)]);
4671
4986
  }
4672
4987
  },
4673
4988
  {
@@ -4718,7 +5033,7 @@ function watchPendingTransactions(client, {
4718
5033
  else
4719
5034
  hashes.forEach((hash2) => emit.onTransactions([hash2]));
4720
5035
  } catch (err) {
4721
- _optionalChain([emit, 'access', _125 => _125.onError, 'optionalCall', _126 => _126(err)]);
5036
+ _optionalChain([emit, 'access', _131 => _131.onError, 'optionalCall', _132 => _132(err)]);
4722
5037
  }
4723
5038
  },
4724
5039
  {
@@ -4980,7 +5295,12 @@ async function addChain(client, { chain }) {
4980
5295
  }
4981
5296
 
4982
5297
  // src/actions/wallet/deployContract.ts
4983
- function deployContract(walletClient, { abi, args, bytecode, ...request }) {
5298
+ function deployContract(walletClient, {
5299
+ abi,
5300
+ args,
5301
+ bytecode,
5302
+ ...request
5303
+ }) {
4984
5304
  const calldata = encodeDeployData({
4985
5305
  abi,
4986
5306
  args,
@@ -5021,10 +5341,9 @@ async function requestPermissions(client, permissions) {
5021
5341
  // src/actions/wallet/sendTransaction.ts
5022
5342
  async function sendTransaction(client, args) {
5023
5343
  const {
5024
- account,
5344
+ account: account_ = client.account,
5025
5345
  chain = client.chain,
5026
5346
  accessList,
5027
- assertChain = true,
5028
5347
  data,
5029
5348
  gas,
5030
5349
  gasPrice,
@@ -5035,13 +5354,20 @@ async function sendTransaction(client, args) {
5035
5354
  value,
5036
5355
  ...rest
5037
5356
  } = args;
5357
+ if (!account_)
5358
+ throw new AccountNotFoundError({
5359
+ docsPath: "/docs/actions/wallet/sendTransaction"
5360
+ });
5361
+ const account = parseAccount(account_);
5038
5362
  try {
5039
5363
  assertRequest(args);
5040
- const currentChainId = await getChainId(client);
5041
- if (assertChain && chain && currentChainId !== _optionalChain([chain, 'optionalAccess', _127 => _127.id]))
5042
- throw new ChainMismatchError({ chain, currentChainId });
5364
+ const chainId = await getChainId(client);
5365
+ if (chain !== null && chainId !== _optionalChain([chain, 'optionalAccess', _133 => _133.id])) {
5366
+ if (!chain)
5367
+ throw new ChainNotFoundError();
5368
+ throw new ChainMismatchError({ chain, currentChainId: chainId });
5369
+ }
5043
5370
  if (account.type === "local") {
5044
- const chainId = _nullishCoalesce(_optionalChain([chain, 'optionalAccess', _128 => _128.id]), () => ( currentChainId));
5045
5371
  const request2 = await prepareRequest(client, {
5046
5372
  account,
5047
5373
  accessList,
@@ -5065,7 +5391,7 @@ async function sendTransaction(client, args) {
5065
5391
  params: [signedRequest]
5066
5392
  });
5067
5393
  }
5068
- const formatter = _optionalChain([chain, 'optionalAccess', _129 => _129.formatters, 'optionalAccess', _130 => _130.transactionRequest]);
5394
+ const formatter = _optionalChain([chain, 'optionalAccess', _134 => _134.formatters, 'optionalAccess', _135 => _135.transactionRequest]);
5069
5395
  const request = format3(
5070
5396
  {
5071
5397
  accessList,
@@ -5090,15 +5416,28 @@ async function sendTransaction(client, args) {
5090
5416
  params: [request]
5091
5417
  });
5092
5418
  } catch (err) {
5093
- throw getTransactionError(err, args);
5419
+ throw getTransactionError(err, {
5420
+ ...args,
5421
+ account,
5422
+ chain: args.chain || void 0
5423
+ });
5094
5424
  }
5095
5425
  }
5096
5426
 
5097
5427
  // src/actions/wallet/signMessage.ts
5098
- async function signMessage(client, { account, data, message }) {
5428
+ async function signMessage2(client, {
5429
+ account: account_ = client.account,
5430
+ data,
5431
+ message
5432
+ }) {
5433
+ if (!account_)
5434
+ throw new AccountNotFoundError({
5435
+ docsPath: "/docs/actions/wallet/signMessage"
5436
+ });
5437
+ const account = parseAccount(account_);
5099
5438
  const message_ = message || data;
5100
5439
  if (account.type === "local")
5101
- return account.signMessage(message_);
5440
+ return account.signMessage({ message: message_ });
5102
5441
  return client.request({
5103
5442
  method: "personal_sign",
5104
5443
  params: [toHex(message_), account.address]
@@ -5107,22 +5446,27 @@ async function signMessage(client, { account, data, message }) {
5107
5446
 
5108
5447
  // src/actions/wallet/signTypedData.ts
5109
5448
  async function signTypedData(client, {
5110
- account,
5449
+ account: account_ = client.account,
5111
5450
  domain,
5112
5451
  message,
5113
5452
  primaryType,
5114
5453
  types: types_
5115
5454
  }) {
5455
+ if (!account_)
5456
+ throw new AccountNotFoundError({
5457
+ docsPath: "/docs/actions/wallet/signTypedData"
5458
+ });
5459
+ const account = parseAccount(account_);
5116
5460
  const types = {
5117
5461
  EIP712Domain: [
5118
- _optionalChain([domain, 'optionalAccess', _131 => _131.name]) && { name: "name", type: "string" },
5119
- _optionalChain([domain, 'optionalAccess', _132 => _132.version]) && { name: "version", type: "string" },
5120
- _optionalChain([domain, 'optionalAccess', _133 => _133.chainId]) && { name: "chainId", type: "uint256" },
5121
- _optionalChain([domain, 'optionalAccess', _134 => _134.verifyingContract]) && {
5462
+ _optionalChain([domain, 'optionalAccess', _136 => _136.name]) && { name: "name", type: "string" },
5463
+ _optionalChain([domain, 'optionalAccess', _137 => _137.version]) && { name: "version", type: "string" },
5464
+ _optionalChain([domain, 'optionalAccess', _138 => _138.chainId]) && { name: "chainId", type: "uint256" },
5465
+ _optionalChain([domain, 'optionalAccess', _139 => _139.verifyingContract]) && {
5122
5466
  name: "verifyingContract",
5123
5467
  type: "address"
5124
5468
  },
5125
- _optionalChain([domain, 'optionalAccess', _135 => _135.salt]) && { name: "salt", type: "bytes32" }
5469
+ _optionalChain([domain, 'optionalAccess', _140 => _140.salt]) && { name: "salt", type: "bytes32" }
5126
5470
  ].filter(Boolean),
5127
5471
  ...types_
5128
5472
  };
@@ -5148,47 +5492,6 @@ async function signTypedData(client, {
5148
5492
  params: [account.address, typedData]
5149
5493
  });
5150
5494
  }
5151
- function validateTypedData({
5152
- domain,
5153
- message,
5154
- primaryType,
5155
- types: types_
5156
- }) {
5157
- const types = types_;
5158
- const validateData = (struct, value_) => {
5159
- for (const param of struct) {
5160
- const { name, type: type_ } = param;
5161
- const type2 = type_;
5162
- const value = value_[name];
5163
- const integerMatch = type2.match(integerRegex);
5164
- if (integerMatch && (typeof value === "number" || typeof value === "bigint")) {
5165
- const [_type, base, size_] = integerMatch;
5166
- numberToHex(value, {
5167
- signed: base === "int",
5168
- size: parseInt(size_) / 8
5169
- });
5170
- }
5171
- if (type2 === "address" && typeof value === "string" && !isAddress(value))
5172
- throw new InvalidAddressError({ address: value });
5173
- const bytesMatch = type2.match(bytesRegex);
5174
- if (bytesMatch) {
5175
- const [_type, size_] = bytesMatch;
5176
- if (size_ && size(value) !== parseInt(size_))
5177
- throw new BytesSizeMismatchError({
5178
- expectedSize: parseInt(size_),
5179
- givenSize: size(value)
5180
- });
5181
- }
5182
- const struct2 = types[type2];
5183
- if (struct2)
5184
- validateData(struct2, value);
5185
- }
5186
- };
5187
- if (types["EIP712Domain"] && domain)
5188
- validateData(types["EIP712Domain"], domain);
5189
- const type = types[primaryType];
5190
- validateData(type, message);
5191
- }
5192
5495
 
5193
5496
  // src/actions/wallet/switchChain.ts
5194
5497
  async function switchChain(client, { id: id2 }) {
@@ -5262,7 +5565,17 @@ function parseGwei(ether, unit = "wei") {
5262
5565
  // src/utils/transaction/prepareRequest.ts
5263
5566
  var defaultTip = parseGwei("1.5");
5264
5567
  async function prepareRequest(client, args) {
5265
- const { account, gas, gasPrice, maxFeePerGas, maxPriorityFeePerGas, nonce } = args;
5568
+ const {
5569
+ account: account_,
5570
+ gas,
5571
+ gasPrice,
5572
+ maxFeePerGas,
5573
+ maxPriorityFeePerGas,
5574
+ nonce
5575
+ } = args;
5576
+ if (!account_)
5577
+ throw new AccountNotFoundError();
5578
+ const account = parseAccount(account_);
5266
5579
  const block = await getBlock(client, { blockTag: "latest" });
5267
5580
  const request = { ...args, from: account.address };
5268
5581
  if (typeof nonce === "undefined")
@@ -5592,5 +5905,10 @@ function parseEther(ether, unit = "wei") {
5592
5905
 
5593
5906
 
5594
5907
 
5595
- 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.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.recoverAddress = recoverAddress; exports.recoverMessageAddress = recoverMessageAddress; exports.verifyMessage = verifyMessage; 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;
5596
- //# sourceMappingURL=chunk-A5BRAPQQ.js.map
5908
+
5909
+
5910
+
5911
+
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