viem 0.0.1-alpha.29 → 0.0.1-alpha.30
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.
- package/dist/{chain-4d46a747.d.ts → chain-00b37e4e.d.ts} +19 -19
- package/dist/{chain-c7c44165.d.ts → chain-38182d92.d.ts} +1 -1
- package/dist/chains.d.ts +3 -3
- package/dist/chains.js +46 -46
- package/dist/chains.mjs +1 -1
- package/dist/{chunk-Q67VUTW3.mjs → chunk-23UHN6UC.mjs} +3 -3
- package/dist/{chunk-Q67VUTW3.mjs.map → chunk-23UHN6UC.mjs.map} +0 -0
- package/dist/{chunk-RR4MGS6O.mjs → chunk-25AJVKAT.mjs} +502 -93
- package/dist/chunk-25AJVKAT.mjs.map +1 -0
- package/dist/{chunk-S252SZEL.mjs → chunk-AO7KQBK3.mjs} +2 -2
- package/dist/{chunk-S252SZEL.mjs.map → chunk-AO7KQBK3.mjs.map} +0 -0
- package/dist/{chunk-OJ7H3CQF.js → chunk-BHMSFL4W.js} +14 -14
- package/dist/{chunk-OJ7H3CQF.js.map → chunk-BHMSFL4W.js.map} +0 -0
- package/dist/{chunk-EYORBAD4.js → chunk-EAD66IDC.js} +521 -112
- package/dist/chunk-EAD66IDC.js.map +1 -0
- package/dist/{chunk-TQC7KZ24.mjs → chunk-EYRMK2SV.mjs} +107 -89
- package/dist/chunk-EYRMK2SV.mjs.map +1 -0
- package/dist/{chunk-HPUQL3IM.mjs → chunk-IP3NSE7H.mjs} +49 -44
- package/dist/chunk-IP3NSE7H.mjs.map +1 -0
- package/dist/{chunk-SEIPUKZE.js → chunk-NPFW67BV.js} +22 -22
- package/dist/{chunk-SEIPUKZE.js.map → chunk-NPFW67BV.js.map} +0 -0
- package/dist/{chunk-CKYH337I.js → chunk-VOK5ALIT.js} +56 -51
- package/dist/chunk-VOK5ALIT.js.map +1 -0
- package/dist/{chunk-4VQKZYE2.js → chunk-ZX4U6QKQ.js} +167 -149
- package/dist/chunk-ZX4U6QKQ.js.map +1 -0
- package/dist/contract.d.ts +7 -9
- package/dist/contract.js +4 -4
- package/dist/contract.mjs +3 -3
- package/dist/{createClient-5d5c14d6.d.ts → createClient-5258d590.d.ts} +2 -2
- package/dist/{createPublicClient-2b4afeac.d.ts → createPublicClient-99be385b.d.ts} +94 -73
- package/dist/{eip1193-f09a55af.d.ts → eip1193-fcdeee04.d.ts} +1 -1
- package/dist/ens.d.ts +5 -7
- package/dist/ens.js +4 -4
- package/dist/ens.mjs +3 -3
- package/dist/{formatAbiItem-d231fef2.d.ts → formatAbiItem-50cb39d8.d.ts} +1 -1
- package/dist/{getAbiItem-0e085959.d.ts → getAbiItem-6d4f64d2.d.ts} +2 -2
- package/dist/index.d.ts +35 -42
- package/dist/index.js +126 -90
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +43 -7
- package/dist/index.mjs.map +1 -1
- package/dist/{parseGwei-4d0b0d73.d.ts → parseGwei-e299cf13.d.ts} +229 -67
- package/dist/public.d.ts +6 -8
- package/dist/public.js +3 -3
- package/dist/public.mjs +2 -2
- package/dist/{test-b9208949.d.ts → test-79ec416c.d.ts} +3 -3
- package/dist/test.d.ts +5 -5
- package/dist/test.js +3 -3
- package/dist/test.mjs +2 -2
- package/dist/utils/index.d.ts +33 -9
- package/dist/utils/index.js +14 -2
- package/dist/utils/index.mjs +13 -1
- package/dist/{wallet-9b1c6905.d.ts → wallet-cf5c8351.d.ts} +17 -6
- package/dist/wallet.d.ts +4 -5
- package/dist/wallet.js +3 -3
- package/dist/wallet.mjs +2 -2
- package/dist/window.d.ts +2 -2
- package/package.json +1 -1
- package/dist/chunk-4VQKZYE2.js.map +0 -1
- package/dist/chunk-CKYH337I.js.map +0 -1
- package/dist/chunk-EYORBAD4.js.map +0 -1
- package/dist/chunk-HPUQL3IM.mjs.map +0 -1
- package/dist/chunk-RR4MGS6O.mjs.map +0 -1
- package/dist/chunk-TQC7KZ24.mjs.map +0 -1
- package/dist/transactionReceipt-84fc92e1.d.ts +0 -26
- package/dist/transactionRequest-44c539b4.d.ts +0 -15
@@ -9,7 +9,7 @@ var __publicField = (obj, key, value) => {
|
|
9
9
|
var package_default = {
|
10
10
|
name: "viem",
|
11
11
|
description: "TypeScript Interface for Ethereum",
|
12
|
-
version: "0.0.1-alpha.
|
12
|
+
version: "0.0.1-alpha.30",
|
13
13
|
scripts: {
|
14
14
|
anvil: "source .env && anvil --fork-url $VITE_ANVIL_FORK_URL --fork-block-number $VITE_ANVIL_BLOCK_NUMBER --block-time $VITE_ANVIL_BLOCK_TIME",
|
15
15
|
bench: "vitest bench --no-threads",
|
@@ -568,7 +568,133 @@ var solidityPanic = {
|
|
568
568
|
type: "error"
|
569
569
|
};
|
570
570
|
|
571
|
+
// src/errors/transaction.ts
|
572
|
+
function prettyPrint(args) {
|
573
|
+
const entries = Object.entries(args).map(([key, value]) => {
|
574
|
+
if (value === void 0 || value === false)
|
575
|
+
return null;
|
576
|
+
return [key, value];
|
577
|
+
}).filter(Boolean);
|
578
|
+
const maxLength = entries.reduce((acc, [key]) => Math.max(acc, key.length), 0);
|
579
|
+
return entries.map(([key, value]) => ` ${`${key}:`.padEnd(maxLength + 1)} ${value}`).join("\n");
|
580
|
+
}
|
581
|
+
var TransactionExecutionError = class extends BaseError {
|
582
|
+
constructor(cause, {
|
583
|
+
docsPath: docsPath5,
|
584
|
+
from,
|
585
|
+
chain,
|
586
|
+
data,
|
587
|
+
gas,
|
588
|
+
gasPrice,
|
589
|
+
maxFeePerGas,
|
590
|
+
maxPriorityFeePerGas,
|
591
|
+
nonce,
|
592
|
+
to,
|
593
|
+
value
|
594
|
+
}) {
|
595
|
+
const prettyArgs = prettyPrint({
|
596
|
+
from,
|
597
|
+
to,
|
598
|
+
value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _4 => _4.nativeCurrency, 'access', _5 => _5.symbol]) || "ETH"}`,
|
599
|
+
data,
|
600
|
+
gas,
|
601
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
|
602
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
|
603
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
|
604
|
+
nonce
|
605
|
+
});
|
606
|
+
super(cause.shortMessage, {
|
607
|
+
cause,
|
608
|
+
docsPath: docsPath5,
|
609
|
+
metaMessages: [
|
610
|
+
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
611
|
+
"Request Arguments:",
|
612
|
+
prettyArgs
|
613
|
+
].filter(Boolean)
|
614
|
+
});
|
615
|
+
__publicField(this, "cause");
|
616
|
+
__publicField(this, "name", "TransactionExecutionError");
|
617
|
+
this.cause = cause;
|
618
|
+
}
|
619
|
+
};
|
620
|
+
var TransactionNotFoundError = class extends BaseError {
|
621
|
+
constructor({
|
622
|
+
blockHash,
|
623
|
+
blockNumber,
|
624
|
+
blockTag,
|
625
|
+
hash: hash2,
|
626
|
+
index
|
627
|
+
}) {
|
628
|
+
let identifier = "Transaction";
|
629
|
+
if (blockTag && index !== void 0)
|
630
|
+
identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
|
631
|
+
if (blockHash && index !== void 0)
|
632
|
+
identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
|
633
|
+
if (blockNumber && index !== void 0)
|
634
|
+
identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
|
635
|
+
if (hash2)
|
636
|
+
identifier = `Transaction with hash "${hash2}"`;
|
637
|
+
super(`${identifier} could not be found.`);
|
638
|
+
__publicField(this, "name", "TransactionNotFoundError");
|
639
|
+
}
|
640
|
+
};
|
641
|
+
var TransactionReceiptNotFoundError = class extends BaseError {
|
642
|
+
constructor({ hash: hash2 }) {
|
643
|
+
super(
|
644
|
+
`Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
|
645
|
+
);
|
646
|
+
__publicField(this, "name", "TransactionReceiptNotFoundError");
|
647
|
+
}
|
648
|
+
};
|
649
|
+
var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
650
|
+
constructor({ hash: hash2 }) {
|
651
|
+
super(
|
652
|
+
`Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
|
653
|
+
);
|
654
|
+
__publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
|
655
|
+
}
|
656
|
+
};
|
657
|
+
|
571
658
|
// src/errors/contract.ts
|
659
|
+
var CallExecutionError = class extends BaseError {
|
660
|
+
constructor(cause, {
|
661
|
+
docsPath: docsPath5,
|
662
|
+
from,
|
663
|
+
chain,
|
664
|
+
data,
|
665
|
+
gas,
|
666
|
+
gasPrice,
|
667
|
+
maxFeePerGas,
|
668
|
+
maxPriorityFeePerGas,
|
669
|
+
nonce,
|
670
|
+
to,
|
671
|
+
value
|
672
|
+
}) {
|
673
|
+
const prettyArgs = prettyPrint({
|
674
|
+
from,
|
675
|
+
to,
|
676
|
+
value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _6 => _6.nativeCurrency, 'access', _7 => _7.symbol]) || "ETH"}`,
|
677
|
+
data,
|
678
|
+
gas,
|
679
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
|
680
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
|
681
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
|
682
|
+
nonce
|
683
|
+
});
|
684
|
+
super(cause.shortMessage, {
|
685
|
+
cause,
|
686
|
+
docsPath: docsPath5,
|
687
|
+
metaMessages: [
|
688
|
+
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
689
|
+
"Raw Call Arguments:",
|
690
|
+
prettyArgs
|
691
|
+
].filter(Boolean)
|
692
|
+
});
|
693
|
+
__publicField(this, "cause");
|
694
|
+
__publicField(this, "name", "CallExecutionError");
|
695
|
+
this.cause = cause;
|
696
|
+
}
|
697
|
+
};
|
572
698
|
var ContractFunctionExecutionError = class extends BaseError {
|
573
699
|
constructor(cause, {
|
574
700
|
abi,
|
@@ -586,6 +712,12 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
586
712
|
includeName: false
|
587
713
|
}) : void 0;
|
588
714
|
const functionWithParams = abiItem ? formatAbiItem(abiItem, { includeName: true }) : void 0;
|
715
|
+
const prettyArgs = prettyPrint({
|
716
|
+
address: contractAddress && getContractAddress(contractAddress),
|
717
|
+
function: functionWithParams,
|
718
|
+
args: formattedArgs && formattedArgs !== "()" && `${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _8 => _8.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
|
719
|
+
sender
|
720
|
+
});
|
589
721
|
super(
|
590
722
|
cause.shortMessage || `An unknown error occurred while executing the contract function "${functionName}".`,
|
591
723
|
{
|
@@ -593,10 +725,8 @@ var ContractFunctionExecutionError = class extends BaseError {
|
|
593
725
|
docsPath: docsPath5,
|
594
726
|
metaMessages: [
|
595
727
|
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
596
|
-
|
597
|
-
|
598
|
-
formattedArgs && formattedArgs !== "()" && `Arguments: ${[...Array(_nullishCoalesce(_optionalChain([functionName, 'optionalAccess', _4 => _4.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}`,
|
599
|
-
sender && `Sender: ${sender}`
|
728
|
+
"Contract Call:",
|
729
|
+
prettyArgs
|
600
730
|
].filter(Boolean)
|
601
731
|
}
|
602
732
|
);
|
@@ -643,8 +773,8 @@ var ContractFunctionRevertedError = class extends BaseError {
|
|
643
773
|
includeName: false
|
644
774
|
}) : void 0;
|
645
775
|
metaMessages = [
|
646
|
-
errorWithParams ? `Error:
|
647
|
-
formattedArgs && formattedArgs !== "()" ? `
|
776
|
+
errorWithParams ? `Error: ${errorWithParams}` : "",
|
777
|
+
formattedArgs && formattedArgs !== "()" ? ` ${[...Array(_nullishCoalesce(_optionalChain([errorName, 'optionalAccess', _9 => _9.length]), () => ( 0))).keys()].map(() => " ").join("")}${formattedArgs}` : ""
|
648
778
|
];
|
649
779
|
}
|
650
780
|
} else if (message)
|
@@ -670,9 +800,9 @@ var ContractFunctionZeroDataError = class extends BaseError {
|
|
670
800
|
super(`The contract function "${functionName}" returned no data ("0x").`, {
|
671
801
|
metaMessages: [
|
672
802
|
"This could be due to any of the following:",
|
673
|
-
|
674
|
-
"- The parameters passed to the contract function may be invalid, or",
|
675
|
-
"- The address is not a contract."
|
803
|
+
` - The contract does not have the function "${functionName}",`,
|
804
|
+
" - The parameters passed to the contract function may be invalid, or",
|
805
|
+
" - The address is not a contract."
|
676
806
|
]
|
677
807
|
});
|
678
808
|
__publicField(this, "name", "ContractFunctionZeroDataError");
|
@@ -752,6 +882,47 @@ var OffsetOutOfBoundsError = class extends BaseError {
|
|
752
882
|
}
|
753
883
|
};
|
754
884
|
|
885
|
+
// src/errors/estimateGas.ts
|
886
|
+
var EstimateGasExecutionError = class extends BaseError {
|
887
|
+
constructor(cause, {
|
888
|
+
docsPath: docsPath5,
|
889
|
+
from,
|
890
|
+
chain,
|
891
|
+
data,
|
892
|
+
gas,
|
893
|
+
gasPrice,
|
894
|
+
maxFeePerGas,
|
895
|
+
maxPriorityFeePerGas,
|
896
|
+
nonce,
|
897
|
+
to,
|
898
|
+
value
|
899
|
+
}) {
|
900
|
+
const prettyArgs = prettyPrint({
|
901
|
+
from,
|
902
|
+
to,
|
903
|
+
value: typeof value !== "undefined" && `${formatEther(value)} ${_optionalChain([chain, 'optionalAccess', _10 => _10.nativeCurrency, 'access', _11 => _11.symbol]) || "ETH"}`,
|
904
|
+
data,
|
905
|
+
gas,
|
906
|
+
gasPrice: typeof gasPrice !== "undefined" && `${formatGwei(gasPrice)} gwei`,
|
907
|
+
maxFeePerGas: typeof maxFeePerGas !== "undefined" && `${formatGwei(maxFeePerGas)} gwei`,
|
908
|
+
maxPriorityFeePerGas: typeof maxPriorityFeePerGas !== "undefined" && `${formatGwei(maxPriorityFeePerGas)} gwei`,
|
909
|
+
nonce
|
910
|
+
});
|
911
|
+
super(cause.shortMessage, {
|
912
|
+
cause,
|
913
|
+
docsPath: docsPath5,
|
914
|
+
metaMessages: [
|
915
|
+
...cause.metaMessages ? [...cause.metaMessages, " "] : [],
|
916
|
+
"Estimate Gas Arguments:",
|
917
|
+
prettyArgs
|
918
|
+
].filter(Boolean)
|
919
|
+
});
|
920
|
+
__publicField(this, "cause");
|
921
|
+
__publicField(this, "name", "EstimateGasExecutionError");
|
922
|
+
this.cause = cause;
|
923
|
+
}
|
924
|
+
};
|
925
|
+
|
755
926
|
// src/errors/log.ts
|
756
927
|
var FilterTypeNotSupportedError = class extends BaseError {
|
757
928
|
constructor(type) {
|
@@ -760,6 +931,171 @@ var FilterTypeNotSupportedError = class extends BaseError {
|
|
760
931
|
}
|
761
932
|
};
|
762
933
|
|
934
|
+
// src/errors/node.ts
|
935
|
+
var ExecutionRevertedError = class extends BaseError {
|
936
|
+
constructor({
|
937
|
+
cause,
|
938
|
+
message
|
939
|
+
} = {}) {
|
940
|
+
const reason = _optionalChain([message, 'optionalAccess', _12 => _12.replace, 'call', _13 => _13("execution reverted: ", ""), 'optionalAccess', _14 => _14.replace, 'call', _15 => _15("execution reverted", "")]);
|
941
|
+
super(
|
942
|
+
`Execution reverted ${reason ? `with reason: ${reason}` : "for an unknown reason"}.`,
|
943
|
+
{
|
944
|
+
cause
|
945
|
+
}
|
946
|
+
);
|
947
|
+
__publicField(this, "name", "ExecutionRevertedError");
|
948
|
+
}
|
949
|
+
};
|
950
|
+
__publicField(ExecutionRevertedError, "code", 3);
|
951
|
+
__publicField(ExecutionRevertedError, "nodeMessage", /execution reverted/);
|
952
|
+
var FeeCapTooHighError = class extends BaseError {
|
953
|
+
constructor({
|
954
|
+
cause,
|
955
|
+
maxFeePerGas
|
956
|
+
} = {}) {
|
957
|
+
super(
|
958
|
+
`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`,
|
959
|
+
{
|
960
|
+
cause
|
961
|
+
}
|
962
|
+
);
|
963
|
+
__publicField(this, "name", "FeeCapTooHigh");
|
964
|
+
}
|
965
|
+
};
|
966
|
+
__publicField(FeeCapTooHighError, "nodeMessage", /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/);
|
967
|
+
var FeeCapTooLowError = class extends BaseError {
|
968
|
+
constructor({
|
969
|
+
cause,
|
970
|
+
maxFeePerGas
|
971
|
+
} = {}) {
|
972
|
+
super(
|
973
|
+
`The fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)}` : ""} gwei) cannot be lower than the block base fee.`,
|
974
|
+
{
|
975
|
+
cause
|
976
|
+
}
|
977
|
+
);
|
978
|
+
__publicField(this, "name", "FeeCapTooLow");
|
979
|
+
}
|
980
|
+
};
|
981
|
+
__publicField(FeeCapTooLowError, "nodeMessage", /max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/);
|
982
|
+
var NonceTooHighError = class extends BaseError {
|
983
|
+
constructor({ cause, nonce } = {}) {
|
984
|
+
super(
|
985
|
+
`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is higher than the next one expected.`,
|
986
|
+
{ cause }
|
987
|
+
);
|
988
|
+
__publicField(this, "name", "NonceTooHighError");
|
989
|
+
}
|
990
|
+
};
|
991
|
+
__publicField(NonceTooHighError, "nodeMessage", /nonce too high/);
|
992
|
+
var NonceTooLowError = class extends BaseError {
|
993
|
+
constructor({ cause, nonce } = {}) {
|
994
|
+
super(
|
995
|
+
[
|
996
|
+
`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}is lower than the current nonce of the account.`,
|
997
|
+
"Try increasing the nonce or find the latest nonce with `getTransactionCount`."
|
998
|
+
].join("\n"),
|
999
|
+
{ cause }
|
1000
|
+
);
|
1001
|
+
__publicField(this, "name", "NonceTooLowError");
|
1002
|
+
}
|
1003
|
+
};
|
1004
|
+
__publicField(NonceTooLowError, "nodeMessage", /nonce too low|transaction already imported/);
|
1005
|
+
var NonceMaxValueError = class extends BaseError {
|
1006
|
+
constructor({ cause, nonce } = {}) {
|
1007
|
+
super(
|
1008
|
+
`Nonce provided for the transaction ${nonce ? `(${nonce}) ` : ""}exceeds the maximum allowed nonce.`,
|
1009
|
+
{ cause }
|
1010
|
+
);
|
1011
|
+
__publicField(this, "name", "NonceMaxValueError");
|
1012
|
+
}
|
1013
|
+
};
|
1014
|
+
__publicField(NonceMaxValueError, "nodeMessage", /nonce has max value/);
|
1015
|
+
var InsufficientFundsError = class extends BaseError {
|
1016
|
+
constructor({ cause } = {}) {
|
1017
|
+
super(
|
1018
|
+
[
|
1019
|
+
"The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account."
|
1020
|
+
].join("\n"),
|
1021
|
+
{
|
1022
|
+
cause,
|
1023
|
+
metaMessages: [
|
1024
|
+
"This error could arise when the account does not have enough funds to:",
|
1025
|
+
" - pay for the total gas fee,",
|
1026
|
+
" - pay for the value to send.",
|
1027
|
+
" ",
|
1028
|
+
"The cost of the transaction is calculated as `gas * gas fee + value`, where:",
|
1029
|
+
" - `gas` is the amount of gas needed for transaction to execute,",
|
1030
|
+
" - `gas fee` is the gas fee,",
|
1031
|
+
" - `value` is the amount of ether to send to the recipient."
|
1032
|
+
]
|
1033
|
+
}
|
1034
|
+
);
|
1035
|
+
__publicField(this, "name", "InsufficientFundsError");
|
1036
|
+
}
|
1037
|
+
};
|
1038
|
+
__publicField(InsufficientFundsError, "nodeMessage", /insufficient funds/);
|
1039
|
+
var IntrinsicGasTooHighError = class extends BaseError {
|
1040
|
+
constructor({ cause, gas } = {}) {
|
1041
|
+
super(
|
1042
|
+
`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction exceeds the limit allowed for the block.`,
|
1043
|
+
{
|
1044
|
+
cause
|
1045
|
+
}
|
1046
|
+
);
|
1047
|
+
__publicField(this, "name", "IntrinsicGasTooHighError");
|
1048
|
+
}
|
1049
|
+
};
|
1050
|
+
__publicField(IntrinsicGasTooHighError, "nodeMessage", /intrinsic gas too high|gas limit reached/);
|
1051
|
+
var IntrinsicGasTooLowError = class extends BaseError {
|
1052
|
+
constructor({ cause, gas } = {}) {
|
1053
|
+
super(
|
1054
|
+
`The amount of gas ${gas ? `(${gas}) ` : ""}provided for the transaction is too low.`,
|
1055
|
+
{
|
1056
|
+
cause
|
1057
|
+
}
|
1058
|
+
);
|
1059
|
+
__publicField(this, "name", "IntrinsicGasTooLowError");
|
1060
|
+
}
|
1061
|
+
};
|
1062
|
+
__publicField(IntrinsicGasTooLowError, "nodeMessage", /intrinsic gas too low/);
|
1063
|
+
var TransactionTypeNotSupportedError = class extends BaseError {
|
1064
|
+
constructor({ cause }) {
|
1065
|
+
super("The transaction type is not supported for this chain.", {
|
1066
|
+
cause
|
1067
|
+
});
|
1068
|
+
__publicField(this, "name", "TransactionTypeNotSupportedError");
|
1069
|
+
}
|
1070
|
+
};
|
1071
|
+
__publicField(TransactionTypeNotSupportedError, "nodeMessage", /transaction type not valid/);
|
1072
|
+
var TipAboveFeeCapError = class extends BaseError {
|
1073
|
+
constructor({
|
1074
|
+
cause,
|
1075
|
+
maxPriorityFeePerGas,
|
1076
|
+
maxFeePerGas
|
1077
|
+
} = {}) {
|
1078
|
+
super(
|
1079
|
+
[
|
1080
|
+
`The provided tip (\`maxPriorityFeePerGas\`${maxPriorityFeePerGas ? ` = ${formatGwei(maxPriorityFeePerGas)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${maxFeePerGas ? ` = ${formatGwei(maxFeePerGas)} gwei` : ""}).`
|
1081
|
+
].join("\n"),
|
1082
|
+
{
|
1083
|
+
cause
|
1084
|
+
}
|
1085
|
+
);
|
1086
|
+
__publicField(this, "name", "TipAboveFeeCapError");
|
1087
|
+
}
|
1088
|
+
};
|
1089
|
+
__publicField(TipAboveFeeCapError, "nodeMessage", /max priority fee per gas higher than max fee per gas|tip higher than fee cap/);
|
1090
|
+
var UnknownNodeError = class extends BaseError {
|
1091
|
+
constructor({ cause }) {
|
1092
|
+
super(`An error occurred while executing: ${_optionalChain([cause, 'optionalAccess', _16 => _16.message])}`, {
|
1093
|
+
cause
|
1094
|
+
});
|
1095
|
+
__publicField(this, "name", "UnknownNodeError");
|
1096
|
+
}
|
1097
|
+
};
|
1098
|
+
|
763
1099
|
// src/errors/request.ts
|
764
1100
|
var RequestError = class extends BaseError {
|
765
1101
|
constructor(err, {
|
@@ -962,51 +1298,6 @@ var TimeoutError = class extends BaseError {
|
|
962
1298
|
}
|
963
1299
|
};
|
964
1300
|
|
965
|
-
// src/errors/transaction.ts
|
966
|
-
var InvalidGasArgumentsError = class extends BaseError {
|
967
|
-
constructor() {
|
968
|
-
super("`maxFeePerGas` cannot be less than `maxPriorityFeePerGas`");
|
969
|
-
__publicField(this, "name", "InvalidGasArgumentsError");
|
970
|
-
}
|
971
|
-
};
|
972
|
-
var TransactionNotFoundError = class extends BaseError {
|
973
|
-
constructor({
|
974
|
-
blockHash,
|
975
|
-
blockNumber,
|
976
|
-
blockTag,
|
977
|
-
hash: hash2,
|
978
|
-
index
|
979
|
-
}) {
|
980
|
-
let identifier = "Transaction";
|
981
|
-
if (blockTag && index !== void 0)
|
982
|
-
identifier = `Transaction at block time "${blockTag}" at index "${index}"`;
|
983
|
-
if (blockHash && index !== void 0)
|
984
|
-
identifier = `Transaction at block hash "${blockHash}" at index "${index}"`;
|
985
|
-
if (blockNumber && index !== void 0)
|
986
|
-
identifier = `Transaction at block number "${blockNumber}" at index "${index}"`;
|
987
|
-
if (hash2)
|
988
|
-
identifier = `Transaction with hash "${hash2}"`;
|
989
|
-
super(`${identifier} could not be found.`);
|
990
|
-
__publicField(this, "name", "TransactionNotFoundError");
|
991
|
-
}
|
992
|
-
};
|
993
|
-
var TransactionReceiptNotFoundError = class extends BaseError {
|
994
|
-
constructor({ hash: hash2 }) {
|
995
|
-
super(
|
996
|
-
`Transaction receipt with hash "${hash2}" could not be found. The Transaction may not be processed on a block yet.`
|
997
|
-
);
|
998
|
-
__publicField(this, "name", "TransactionReceiptNotFoundError");
|
999
|
-
}
|
1000
|
-
};
|
1001
|
-
var WaitForTransactionReceiptTimeoutError = class extends BaseError {
|
1002
|
-
constructor({ hash: hash2 }) {
|
1003
|
-
super(
|
1004
|
-
`Timed out while waiting for transaction with hash "${hash2}" to be confirmed.`
|
1005
|
-
);
|
1006
|
-
__publicField(this, "name", "WaitForTransactionReceiptTimeoutError");
|
1007
|
-
}
|
1008
|
-
};
|
1009
|
-
|
1010
1301
|
// src/errors/transport.ts
|
1011
1302
|
var UrlRequiredError = class extends BaseError {
|
1012
1303
|
constructor() {
|
@@ -1425,9 +1716,9 @@ function rlpToBytes(bytes, offset = 0) {
|
|
1425
1716
|
var paramsRegex = /((function|event)\s)?(.*)(\((.*)\))/;
|
1426
1717
|
function extractFunctionParts(def) {
|
1427
1718
|
const parts = def.match(paramsRegex);
|
1428
|
-
const type = _optionalChain([parts, 'optionalAccess',
|
1429
|
-
const name = _optionalChain([parts, 'optionalAccess',
|
1430
|
-
const params = _optionalChain([parts, 'optionalAccess',
|
1719
|
+
const type = _optionalChain([parts, 'optionalAccess', _17 => _17[2]]) || void 0;
|
1720
|
+
const name = _optionalChain([parts, 'optionalAccess', _18 => _18[3]]);
|
1721
|
+
const params = _optionalChain([parts, 'optionalAccess', _19 => _19[5]]) || void 0;
|
1431
1722
|
return { type, name, params };
|
1432
1723
|
}
|
1433
1724
|
function extractFunctionName(def) {
|
@@ -1435,8 +1726,8 @@ function extractFunctionName(def) {
|
|
1435
1726
|
}
|
1436
1727
|
function extractFunctionParams(def) {
|
1437
1728
|
const params = extractFunctionParts(def).params;
|
1438
|
-
const splitParams = _optionalChain([params, 'optionalAccess',
|
1439
|
-
return _optionalChain([splitParams, 'optionalAccess',
|
1729
|
+
const splitParams = _optionalChain([params, 'optionalAccess', _20 => _20.split, 'call', _21 => _21(","), 'access', _22 => _22.map, 'call', _23 => _23((x) => x.trim().split(" "))]);
|
1730
|
+
return _optionalChain([splitParams, 'optionalAccess', _24 => _24.map, 'call', _25 => _25((param) => ({
|
1440
1731
|
type: param[0],
|
1441
1732
|
name: param[1] === "indexed" ? param[2] : param[1],
|
1442
1733
|
...param[1] === "indexed" ? { indexed: true } : {}
|
@@ -1446,38 +1737,6 @@ function extractFunctionType(def) {
|
|
1446
1737
|
return extractFunctionParts(def).type;
|
1447
1738
|
}
|
1448
1739
|
|
1449
|
-
// src/utils/contract/getContractError.ts
|
1450
|
-
var EXECUTION_REVERTED_ERROR_CODE = 3;
|
1451
|
-
function getContractError(err, {
|
1452
|
-
abi,
|
1453
|
-
address,
|
1454
|
-
args,
|
1455
|
-
docsPath: docsPath5,
|
1456
|
-
functionName,
|
1457
|
-
sender
|
1458
|
-
}) {
|
1459
|
-
const { code, data, message } = err instanceof RawContractError ? err : err.cause || {};
|
1460
|
-
let cause = err;
|
1461
|
-
if (err instanceof AbiDecodingZeroDataError) {
|
1462
|
-
cause = new ContractFunctionZeroDataError({ functionName });
|
1463
|
-
} else if (code === EXECUTION_REVERTED_ERROR_CODE && (data || message)) {
|
1464
|
-
cause = new ContractFunctionRevertedError({
|
1465
|
-
abi,
|
1466
|
-
data,
|
1467
|
-
functionName,
|
1468
|
-
message
|
1469
|
-
});
|
1470
|
-
}
|
1471
|
-
return new ContractFunctionExecutionError(cause, {
|
1472
|
-
abi,
|
1473
|
-
args,
|
1474
|
-
contractAddress: address,
|
1475
|
-
docsPath: docsPath5,
|
1476
|
-
functionName,
|
1477
|
-
sender
|
1478
|
-
});
|
1479
|
-
}
|
1480
|
-
|
1481
1740
|
// src/utils/hash/keccak256.ts
|
1482
1741
|
var _sha3 = require('@noble/hashes/sha3');
|
1483
1742
|
function keccak256(value, to_) {
|
@@ -1851,7 +2110,7 @@ function decodeArray(data, {
|
|
1851
2110
|
}
|
1852
2111
|
if (hasDynamicChild(param)) {
|
1853
2112
|
const arrayComponents = getArrayComponents(param.type);
|
1854
|
-
const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess',
|
2113
|
+
const dynamicChild = !_optionalChain([arrayComponents, 'optionalAccess', _26 => _26[0]]);
|
1855
2114
|
let consumed2 = 0;
|
1856
2115
|
let value2 = [];
|
1857
2116
|
for (let i = 0; i < length; ++i) {
|
@@ -1923,7 +2182,7 @@ function decodeTuple(data, { param, position }) {
|
|
1923
2182
|
position: consumed
|
1924
2183
|
});
|
1925
2184
|
consumed += decodedChild.consumed;
|
1926
|
-
value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess',
|
2185
|
+
value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _27 => _27.name])] = decodedChild.value;
|
1927
2186
|
}
|
1928
2187
|
return { consumed: 32, value };
|
1929
2188
|
}
|
@@ -1935,7 +2194,7 @@ function decodeTuple(data, { param, position }) {
|
|
1935
2194
|
position: position + consumed
|
1936
2195
|
});
|
1937
2196
|
consumed += decodedChild.consumed;
|
1938
|
-
value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess',
|
2197
|
+
value[hasUnnamedChild ? i : _optionalChain([component, 'optionalAccess', _28 => _28.name])] = decodedChild.value;
|
1939
2198
|
}
|
1940
2199
|
return { consumed, value };
|
1941
2200
|
}
|
@@ -1948,7 +2207,7 @@ function hasDynamicChild(param) {
|
|
1948
2207
|
if (type.endsWith("[]"))
|
1949
2208
|
return true;
|
1950
2209
|
if (type === "tuple")
|
1951
|
-
return _optionalChain([param, 'access',
|
2210
|
+
return _optionalChain([param, 'access', _29 => _29.components, 'optionalAccess', _30 => _30.some, 'call', _31 => _31(hasDynamicChild)]);
|
1952
2211
|
const arrayComponents = getArrayComponents(param.type);
|
1953
2212
|
if (arrayComponents && hasDynamicChild({ ...param, type: arrayComponents[1] }))
|
1954
2213
|
return true;
|
@@ -2014,7 +2273,7 @@ function decodeEventLog({
|
|
2014
2273
|
docsPath: "/docs/contract/decodeEventLog"
|
2015
2274
|
});
|
2016
2275
|
const { name, inputs } = abiItem;
|
2017
|
-
const isUnnamed = _optionalChain([inputs, 'optionalAccess',
|
2276
|
+
const isUnnamed = _optionalChain([inputs, 'optionalAccess', _32 => _32.some, 'call', _33 => _33((x) => !("name" in x && x.name))]);
|
2018
2277
|
let args = isUnnamed ? [] : {};
|
2019
2278
|
for (let i = 0; i < inputs.length; i++) {
|
2020
2279
|
const param = inputs[i];
|
@@ -2224,8 +2483,8 @@ function encodeEventTopics({ abi, eventName, args }) {
|
|
2224
2483
|
const signature = getEventSignature(definition);
|
2225
2484
|
let topics = [];
|
2226
2485
|
if (args && "inputs" in abiItem) {
|
2227
|
-
const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access',
|
2228
|
-
topics = _nullishCoalesce(_optionalChain([abiItem, 'access',
|
2486
|
+
const args_ = Array.isArray(args) ? args : _nullishCoalesce(_optionalChain([abiItem, 'access', _34 => _34.inputs, 'optionalAccess', _35 => _35.map, 'call', _36 => _36((x) => args[x.name])]), () => ( []));
|
2487
|
+
topics = _nullishCoalesce(_optionalChain([abiItem, 'access', _37 => _37.inputs, 'optionalAccess', _38 => _38.filter, 'call', _39 => _39((param) => "indexed" in param && param.indexed), 'access', _40 => _40.map, 'call', _41 => _41(
|
2229
2488
|
(param, i) => Array.isArray(args_[i]) ? args_[i].map(
|
2230
2489
|
(_, j) => encodeArg({ param, value: args_[i][j] })
|
2231
2490
|
) : args_[i] ? encodeArg({ param, value: args_[i] }) : null
|
@@ -2397,7 +2656,7 @@ function withTimeout(fn, {
|
|
2397
2656
|
}
|
2398
2657
|
}, timeout);
|
2399
2658
|
}
|
2400
|
-
resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess',
|
2659
|
+
resolve(await fn({ signal: _optionalChain([controller, 'optionalAccess', _42 => _42.signal]) }));
|
2401
2660
|
} catch (err) {
|
2402
2661
|
if (err.name === "AbortError")
|
2403
2662
|
reject(errorInstance);
|
@@ -2459,8 +2718,8 @@ function buildRequest(request, {
|
|
2459
2718
|
{
|
2460
2719
|
delay: ({ count, error }) => {
|
2461
2720
|
if (error && error instanceof HttpRequestError) {
|
2462
|
-
const retryAfter = _optionalChain([error, 'optionalAccess',
|
2463
|
-
if (_optionalChain([retryAfter, 'optionalAccess',
|
2721
|
+
const retryAfter = _optionalChain([error, 'optionalAccess', _43 => _43.headers, 'optionalAccess', _44 => _44.get, 'call', _45 => _45("Retry-After")]);
|
2722
|
+
if (_optionalChain([retryAfter, 'optionalAccess', _46 => _46.match, 'call', _47 => _47(/\d/)]))
|
2464
2723
|
return parseInt(retryAfter) * 1e3;
|
2465
2724
|
}
|
2466
2725
|
return ~~(1 << count) * retryDelay;
|
@@ -2495,7 +2754,7 @@ function defineFormatter({
|
|
2495
2754
|
}
|
2496
2755
|
return {
|
2497
2756
|
...formatted,
|
2498
|
-
..._optionalChain([formatOverride, 'optionalCall',
|
2757
|
+
..._optionalChain([formatOverride, 'optionalCall', _48 => _48(data)])
|
2499
2758
|
};
|
2500
2759
|
};
|
2501
2760
|
}
|
@@ -2535,7 +2794,7 @@ var defineTransaction = defineFormatter({ format: formatTransaction });
|
|
2535
2794
|
|
2536
2795
|
// src/utils/formatters/block.ts
|
2537
2796
|
function formatBlock(block) {
|
2538
|
-
const transactions = _optionalChain([block, 'access',
|
2797
|
+
const transactions = _optionalChain([block, 'access', _49 => _49.transactions, 'optionalAccess', _50 => _50.map, 'call', _51 => _51((transaction) => {
|
2539
2798
|
if (typeof transaction === "string")
|
2540
2799
|
return transaction;
|
2541
2800
|
return formatTransaction(transaction);
|
@@ -2561,7 +2820,7 @@ function extract(value, { formatter }) {
|
|
2561
2820
|
return {};
|
2562
2821
|
const keys = Object.keys(formatter({}));
|
2563
2822
|
return keys.reduce((data, key) => {
|
2564
|
-
if (_optionalChain([value, 'optionalAccess',
|
2823
|
+
if (_optionalChain([value, 'optionalAccess', _52 => _52.hasOwnProperty, 'call', _53 => _53(key)])) {
|
2565
2824
|
;
|
2566
2825
|
data[key] = value[key];
|
2567
2826
|
}
|
@@ -2575,7 +2834,7 @@ function formatFeeHistory(feeHistory) {
|
|
2575
2834
|
baseFeePerGas: feeHistory.baseFeePerGas.map((value) => BigInt(value)),
|
2576
2835
|
gasUsedRatio: feeHistory.gasUsedRatio,
|
2577
2836
|
oldestBlock: BigInt(feeHistory.oldestBlock),
|
2578
|
-
reward: _optionalChain([feeHistory, 'access',
|
2837
|
+
reward: _optionalChain([feeHistory, 'access', _54 => _54.reward, 'optionalAccess', _55 => _55.map, 'call', _56 => _56(
|
2579
2838
|
(reward) => reward.map((value) => BigInt(value))
|
2580
2839
|
)])
|
2581
2840
|
};
|
@@ -2630,6 +2889,135 @@ var defineTransactionRequest = defineFormatter({
|
|
2630
2889
|
format: formatTransactionRequest
|
2631
2890
|
});
|
2632
2891
|
|
2892
|
+
// src/utils/errors/assertRequest.ts
|
2893
|
+
function assertRequest(args) {
|
2894
|
+
const { maxFeePerGas, maxPriorityFeePerGas } = args;
|
2895
|
+
if (maxFeePerGas && maxFeePerGas > 2n ** 256n - 1n)
|
2896
|
+
throw new FeeCapTooHighError({ maxFeePerGas });
|
2897
|
+
if (maxPriorityFeePerGas && maxFeePerGas && maxPriorityFeePerGas > maxFeePerGas)
|
2898
|
+
throw new TipAboveFeeCapError({ maxFeePerGas, maxPriorityFeePerGas });
|
2899
|
+
}
|
2900
|
+
|
2901
|
+
// src/utils/errors/getNodeError.ts
|
2902
|
+
function containsNodeError(err) {
|
2903
|
+
return err instanceof TransactionRejectedRpcError || err instanceof InvalidInputRpcError || err instanceof RpcError && err.code === ExecutionRevertedError.code;
|
2904
|
+
}
|
2905
|
+
function getNodeError(err, args = {}) {
|
2906
|
+
const message = err.details.toLowerCase();
|
2907
|
+
if (FeeCapTooHighError.nodeMessage.test(message))
|
2908
|
+
return new FeeCapTooHighError({
|
2909
|
+
cause: err,
|
2910
|
+
maxFeePerGas: _optionalChain([args, 'optionalAccess', _57 => _57.maxFeePerGas])
|
2911
|
+
});
|
2912
|
+
else if (FeeCapTooLowError.nodeMessage.test(message))
|
2913
|
+
return new FeeCapTooLowError({
|
2914
|
+
cause: err,
|
2915
|
+
maxFeePerGas: _optionalChain([args, 'optionalAccess', _58 => _58.maxFeePerGas])
|
2916
|
+
});
|
2917
|
+
else if (NonceTooHighError.nodeMessage.test(message))
|
2918
|
+
return new NonceTooHighError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _59 => _59.nonce]) });
|
2919
|
+
else if (NonceTooLowError.nodeMessage.test(message))
|
2920
|
+
return new NonceTooLowError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _60 => _60.nonce]) });
|
2921
|
+
else if (NonceMaxValueError.nodeMessage.test(message))
|
2922
|
+
return new NonceMaxValueError({ cause: err, nonce: _optionalChain([args, 'optionalAccess', _61 => _61.nonce]) });
|
2923
|
+
else if (InsufficientFundsError.nodeMessage.test(message))
|
2924
|
+
return new InsufficientFundsError({ cause: err });
|
2925
|
+
else if (IntrinsicGasTooHighError.nodeMessage.test(message))
|
2926
|
+
return new IntrinsicGasTooHighError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _62 => _62.gas]) });
|
2927
|
+
else if (IntrinsicGasTooLowError.nodeMessage.test(message))
|
2928
|
+
return new IntrinsicGasTooLowError({ cause: err, gas: _optionalChain([args, 'optionalAccess', _63 => _63.gas]) });
|
2929
|
+
else if (TransactionTypeNotSupportedError.nodeMessage.test(message))
|
2930
|
+
return new TransactionTypeNotSupportedError({ cause: err });
|
2931
|
+
else if (TipAboveFeeCapError.nodeMessage.test(message))
|
2932
|
+
return new TipAboveFeeCapError({
|
2933
|
+
cause: err,
|
2934
|
+
maxFeePerGas: _optionalChain([args, 'optionalAccess', _64 => _64.maxFeePerGas]),
|
2935
|
+
maxPriorityFeePerGas: _optionalChain([args, 'optionalAccess', _65 => _65.maxPriorityFeePerGas])
|
2936
|
+
});
|
2937
|
+
else if (message.match(ExecutionRevertedError.nodeMessage) || "code" in err.cause && _optionalChain([err, 'access', _66 => _66.cause, 'optionalAccess', _67 => _67.code]) === ExecutionRevertedError.code)
|
2938
|
+
return new ExecutionRevertedError({
|
2939
|
+
cause: err,
|
2940
|
+
message: err.cause.details
|
2941
|
+
});
|
2942
|
+
return new UnknownNodeError({
|
2943
|
+
cause: err.cause.cause
|
2944
|
+
});
|
2945
|
+
}
|
2946
|
+
|
2947
|
+
// src/utils/errors/getCallError.ts
|
2948
|
+
function getCallError(err, {
|
2949
|
+
docsPath: docsPath5,
|
2950
|
+
...args
|
2951
|
+
}) {
|
2952
|
+
let cause = err;
|
2953
|
+
if (containsNodeError(err))
|
2954
|
+
cause = getNodeError(err, args);
|
2955
|
+
return new CallExecutionError(cause, {
|
2956
|
+
docsPath: docsPath5,
|
2957
|
+
...args
|
2958
|
+
});
|
2959
|
+
}
|
2960
|
+
|
2961
|
+
// src/utils/errors/getContractError.ts
|
2962
|
+
var EXECUTION_REVERTED_ERROR_CODE = 3;
|
2963
|
+
function getContractError(err, {
|
2964
|
+
abi,
|
2965
|
+
address,
|
2966
|
+
args,
|
2967
|
+
docsPath: docsPath5,
|
2968
|
+
functionName,
|
2969
|
+
sender
|
2970
|
+
}) {
|
2971
|
+
const { code, data, message } = err instanceof RawContractError ? err : err instanceof CallExecutionError || err instanceof EstimateGasExecutionError ? _optionalChain([err, 'access', _68 => _68.cause, 'optionalAccess', _69 => _69.cause, 'optionalAccess', _70 => _70.cause]) || {} : err.cause || {};
|
2972
|
+
let cause = err;
|
2973
|
+
if (err instanceof AbiDecodingZeroDataError) {
|
2974
|
+
cause = new ContractFunctionZeroDataError({ functionName });
|
2975
|
+
} else if (code === EXECUTION_REVERTED_ERROR_CODE && (data || message)) {
|
2976
|
+
cause = new ContractFunctionRevertedError({
|
2977
|
+
abi,
|
2978
|
+
data,
|
2979
|
+
functionName,
|
2980
|
+
message
|
2981
|
+
});
|
2982
|
+
}
|
2983
|
+
return new ContractFunctionExecutionError(cause, {
|
2984
|
+
abi,
|
2985
|
+
args,
|
2986
|
+
contractAddress: address,
|
2987
|
+
docsPath: docsPath5,
|
2988
|
+
functionName,
|
2989
|
+
sender
|
2990
|
+
});
|
2991
|
+
}
|
2992
|
+
|
2993
|
+
// src/utils/errors/getEstimateGasError.ts
|
2994
|
+
function getEstimateGasError(err, {
|
2995
|
+
docsPath: docsPath5,
|
2996
|
+
...args
|
2997
|
+
}) {
|
2998
|
+
let cause = err;
|
2999
|
+
if (containsNodeError(err))
|
3000
|
+
cause = getNodeError(err, args);
|
3001
|
+
return new EstimateGasExecutionError(cause, {
|
3002
|
+
docsPath: docsPath5,
|
3003
|
+
...args
|
3004
|
+
});
|
3005
|
+
}
|
3006
|
+
|
3007
|
+
// src/utils/errors/getTransactionError.ts
|
3008
|
+
function getTransactionError(err, {
|
3009
|
+
docsPath: docsPath5,
|
3010
|
+
...args
|
3011
|
+
}) {
|
3012
|
+
let cause = err;
|
3013
|
+
if (containsNodeError(err))
|
3014
|
+
cause = getNodeError(err, args);
|
3015
|
+
return new TransactionExecutionError(cause, {
|
3016
|
+
docsPath: docsPath5,
|
3017
|
+
...args
|
3018
|
+
});
|
3019
|
+
}
|
3020
|
+
|
2633
3021
|
// src/utils/rpc.ts
|
2634
3022
|
var _isomorphicws = require('isomorphic-ws'); var _isomorphicws2 = _interopRequireDefault(_isomorphicws);
|
2635
3023
|
|
@@ -2667,7 +3055,7 @@ async function http(url, {
|
|
2667
3055
|
}
|
2668
3056
|
);
|
2669
3057
|
let data;
|
2670
|
-
if (_optionalChain([response, 'access',
|
3058
|
+
if (_optionalChain([response, 'access', _71 => _71.headers, 'access', _72 => _72.get, 'call', _73 => _73("Content-Type"), 'optionalAccess', _74 => _74.startsWith, 'call', _75 => _75("application/json")])) {
|
2671
3059
|
data = await response.json();
|
2672
3060
|
} else {
|
2673
3061
|
data = await response.text();
|
@@ -2759,15 +3147,15 @@ function webSocket(socket, {
|
|
2759
3147
|
if (typeof message.id === "number" && id_ !== message.id)
|
2760
3148
|
return;
|
2761
3149
|
if (message.error) {
|
2762
|
-
_optionalChain([onError, 'optionalCall',
|
3150
|
+
_optionalChain([onError, 'optionalCall', _76 => _76(new RpcError({ body, error: message.error, url: socket.url }))]);
|
2763
3151
|
} else {
|
2764
|
-
_optionalChain([onData, 'optionalCall',
|
3152
|
+
_optionalChain([onData, 'optionalCall', _77 => _77(message)]);
|
2765
3153
|
}
|
2766
3154
|
if (body.method === "eth_subscribe" && typeof message.result === "string") {
|
2767
3155
|
socket.subscriptions.set(message.result, callback);
|
2768
3156
|
}
|
2769
3157
|
if (body.method === "eth_unsubscribe") {
|
2770
|
-
socket.subscriptions.delete(_optionalChain([body, 'access',
|
3158
|
+
socket.subscriptions.delete(_optionalChain([body, 'access', _78 => _78.params, 'optionalAccess', _79 => _79[0]]));
|
2771
3159
|
}
|
2772
3160
|
};
|
2773
3161
|
socket.requests.set(id_, callback);
|
@@ -3023,5 +3411,26 @@ function parseGwei(ether, unit = "wei") {
|
|
3023
3411
|
|
3024
3412
|
|
3025
3413
|
|
3026
|
-
|
3027
|
-
|
3414
|
+
|
3415
|
+
|
3416
|
+
|
3417
|
+
|
3418
|
+
|
3419
|
+
|
3420
|
+
|
3421
|
+
|
3422
|
+
|
3423
|
+
|
3424
|
+
|
3425
|
+
|
3426
|
+
|
3427
|
+
|
3428
|
+
|
3429
|
+
|
3430
|
+
|
3431
|
+
|
3432
|
+
|
3433
|
+
|
3434
|
+
|
3435
|
+
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.AbiEventSignatureNotFoundError = AbiEventSignatureNotFoundError; exports.AbiEventNotFoundError = AbiEventNotFoundError; exports.AbiFunctionNotFoundError = AbiFunctionNotFoundError; exports.AbiFunctionOutputsNotFoundError = AbiFunctionOutputsNotFoundError; exports.AbiFunctionSignatureNotFoundError = AbiFunctionSignatureNotFoundError; exports.InvalidAbiEncodingTypeError = InvalidAbiEncodingTypeError; exports.InvalidAbiDecodingTypeError = InvalidAbiDecodingTypeError; exports.InvalidArrayError = InvalidArrayError; exports.InvalidDefinitionTypeError = InvalidDefinitionTypeError; exports.InvalidAddressError = InvalidAddressError; exports.BlockNotFoundError = BlockNotFoundError; exports.ChainDoesNotSupportContract = ChainDoesNotSupportContract; exports.multicall3Abi = multicall3Abi; exports.panicReasons = panicReasons; 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.UnknownRpcError = UnknownRpcError; exports.HttpRequestError = HttpRequestError; exports.WebSocketRequestError = WebSocketRequestError; exports.RpcError = RpcError; exports.TimeoutError = TimeoutError; exports.UrlRequiredError = UrlRequiredError; exports.concat = concat; 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.boolToBytes = boolToBytes; exports.toBytes = toBytes; 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.getEventSignature = getEventSignature; exports.getFunctionSignature = getFunctionSignature; exports.isAddress = isAddress; exports.checksumAddress = checksumAddress; exports.getAddress = getAddress; exports.getContractAddress = getContractAddress2; exports.getCreateAddress = getCreateAddress; exports.getCreate2Address = getCreate2Address; exports.isAddressEqual = isAddressEqual; exports.encodeAbi = encodeAbi; exports.decodeAbi = decodeAbi; 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.formatAbiItemWithArgs = formatAbiItemWithArgs; exports.getCache = getCache; exports.withCache = withCache; exports.wait = wait; exports.isDeterministicError = isDeterministicError; exports.buildRequest = buildRequest; exports.defineChain = defineChain; exports.format = format3; exports.defineFormatter = defineFormatter; exports.transactionType = transactionType; exports.formatTransaction = formatTransaction; exports.defineTransaction = defineTransaction; exports.formatBlock = formatBlock; exports.defineBlock = defineBlock; exports.extract = extract; exports.formatFeeHistory = formatFeeHistory; exports.formatLog = formatLog; exports.formatTransactionReceipt = formatTransactionReceipt; exports.defineTransactionReceipt = defineTransactionReceipt; exports.formatTransactionRequest = formatTransactionRequest; exports.defineTransactionRequest = defineTransactionRequest; exports.assertRequest = assertRequest; 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.etherUnits = etherUnits; exports.gweiUnits = gweiUnits; exports.weiUnits = weiUnits; exports.formatUnit = formatUnit; exports.formatEther = formatEther; exports.formatGwei = formatGwei; exports.parseUnit = parseUnit; exports.parseEther = parseEther; exports.parseGwei = parseGwei;
|
3436
|
+
//# sourceMappingURL=chunk-EAD66IDC.js.map
|