@pufferfinance/puffer-sdk 1.8.1 → 1.9.1
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/api/puffer-client-helpers.cjs +1 -1
- package/dist/api/puffer-client-helpers.cjs.map +1 -1
- package/dist/api/puffer-client-helpers.js +82 -81
- package/dist/api/puffer-client-helpers.js.map +1 -1
- package/dist/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.cjs.map +1 -1
- package/dist/api/puffer-client.d.ts +3 -0
- package/dist/api/puffer-client.js +56 -49
- package/dist/api/puffer-client.js.map +1 -1
- package/dist/ccip-BO_b9tFc.cjs +2 -0
- package/dist/ccip-BO_b9tFc.cjs.map +1 -0
- package/dist/ccip-DLDO0_x2.js +148 -0
- package/dist/ccip-DLDO0_x2.js.map +1 -0
- package/dist/chains/constants.cjs +1 -1
- package/dist/chains/constants.js +1 -1
- package/dist/constants-BjRNQpT2.js +1997 -0
- package/dist/constants-BjRNQpT2.js.map +1 -0
- package/dist/constants-DA2xUb9r.cjs +9 -0
- package/dist/constants-DA2xUb9r.cjs.map +1 -0
- package/dist/contracts/abis/holesky/PufferDepositor.cjs.map +1 -1
- package/dist/contracts/abis/holesky/PufferDepositor.js.map +1 -1
- package/dist/contracts/abis/holesky/PufferVaultV2.cjs.map +1 -1
- package/dist/contracts/abis/holesky/PufferVaultV2.js.map +1 -1
- package/dist/contracts/abis/l1-reward-manager-abis.cjs +1 -1
- package/dist/contracts/abis/l1-reward-manager-abis.cjs.map +1 -1
- package/dist/contracts/abis/l1-reward-manager-abis.js +1 -1
- package/dist/contracts/abis/l2-reward-manager-abis.cjs +1 -1
- package/dist/contracts/abis/l2-reward-manager-abis.cjs.map +1 -1
- package/dist/contracts/abis/l2-reward-manager-abis.js +1 -1
- package/dist/contracts/abis/mainnet/Accountant.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/Accountant.js.map +1 -1
- package/dist/contracts/abis/mainnet/AtomicQueue.cjs +2 -0
- package/dist/contracts/abis/mainnet/AtomicQueue.cjs.map +1 -0
- package/dist/contracts/abis/mainnet/AtomicQueue.d.ts +328 -0
- package/dist/contracts/abis/mainnet/AtomicQueue.js +237 -0
- package/dist/contracts/abis/mainnet/AtomicQueue.js.map +1 -0
- package/dist/contracts/abis/mainnet/BoringVault.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/BoringVault.js.map +1 -1
- package/dist/contracts/abis/mainnet/ERC20Permit.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/ERC20Permit.js.map +1 -1
- package/dist/contracts/abis/mainnet/L1RewardManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/L1RewardManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/L2RewardManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/L2RewardManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufLocker.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufLocker.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferDepositor.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferDepositor.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferL2Depositor.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferL2Depositor.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferVaultV2.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferVaultV2.js.map +1 -1
- package/dist/contracts/abis/mainnet/PufferWithdrawalManager.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/PufferWithdrawalManager.js.map +1 -1
- package/dist/contracts/abis/mainnet/Teller.cjs.map +1 -1
- package/dist/contracts/abis/mainnet/Teller.js.map +1 -1
- package/dist/contracts/abis/nucleus-accountant-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-accountant-abis.cjs.map +1 -1
- package/dist/contracts/abis/nucleus-accountant-abis.js +1 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs +2 -0
- package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs.map +1 -0
- package/dist/contracts/abis/nucleus-atomic-queue-abis.d.ts +332 -0
- package/dist/contracts/abis/nucleus-atomic-queue-abis.js +9 -0
- package/dist/contracts/abis/nucleus-atomic-queue-abis.js.map +1 -0
- package/dist/contracts/abis/nucleus-boring-vault-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-boring-vault-abis.cjs.map +1 -1
- package/dist/contracts/abis/nucleus-boring-vault-abis.js +1 -1
- package/dist/contracts/abis/nucleus-teller-abis.cjs +1 -1
- package/dist/contracts/abis/nucleus-teller-abis.cjs.map +1 -1
- package/dist/contracts/abis/nucleus-teller-abis.js +1 -1
- package/dist/contracts/abis/puf-locker-abis.cjs +1 -1
- package/dist/contracts/abis/puf-locker-abis.cjs.map +1 -1
- package/dist/contracts/abis/puf-locker-abis.js +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.cjs.map +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.js +1 -1
- package/dist/contracts/abis/puffer-depositor-abis.js.map +1 -1
- package/dist/contracts/abis/puffer-vault-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-vault-abis.cjs.map +1 -1
- package/dist/contracts/abis/puffer-vault-abis.js +1 -1
- package/dist/contracts/abis/puffer-vault-abis.js.map +1 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs +1 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.cjs.map +1 -1
- package/dist/contracts/abis/puffer-withdrawal-manager-abis.js +1 -1
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.cjs.map +1 -1
- package/dist/contracts/addresses.d.ts +14 -0
- package/dist/contracts/addresses.js +3 -2
- package/dist/contracts/addresses.js.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.cjs.map +1 -1
- package/dist/contracts/handlers/erc20-permit-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/erc20-permit-handler.js +3 -3
- package/dist/contracts/handlers/erc20-permit-handler.js.map +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/l1-reward-manager-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/l1-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/l1-reward-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/l2-reward-manager-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/l2-reward-manager-handler.js +2 -2
- package/dist/contracts/handlers/l2-reward-manager-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/nucleus-accountant-handler.js +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs +2 -0
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -0
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +14923 -0
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +89 -0
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -0
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/nucleus-teller-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs +1 -1
- package/dist/contracts/handlers/puf-locker-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puf-locker-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/puf-locker-handler.js +2 -2
- package/dist/contracts/handlers/puf-locker-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-depositor-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/puffer-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-l2-depositor-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js +2 -2
- package/dist/contracts/handlers/puffer-l2-depositor-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-vault-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/puffer-vault-handler.js +2 -2
- package/dist/contracts/handlers/puffer-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.cjs.map +1 -1
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js +2 -2
- package/dist/contracts/handlers/puffer-withdrawal-manager-handler.js.map +1 -1
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.cjs.map +1 -1
- package/dist/contracts/tokens.js +1 -1
- package/dist/contracts/tokens.js.map +1 -1
- package/dist/createWalletClient-BuLYysrp.cjs +4 -0
- package/dist/createWalletClient-BuLYysrp.cjs.map +1 -0
- package/dist/createWalletClient-DNcW-ENe.js +2028 -0
- package/dist/createWalletClient-DNcW-ENe.js.map +1 -0
- package/dist/errors/base-error.cjs.map +1 -1
- package/dist/errors/base-error.js.map +1 -1
- package/dist/{getContract-MrPLx6gp.cjs → getContract-3QbyfZBF.cjs} +2 -2
- package/dist/getContract-3QbyfZBF.cjs.map +1 -0
- package/dist/{getContract-B3Spz0SO.js → getContract-CezEyDf-.js} +2 -2
- package/dist/{getContract-MrPLx6gp.cjs.map → getContract-CezEyDf-.js.map} +1 -1
- package/dist/main.cjs +1 -1
- package/dist/main.js +1 -1
- package/dist/secp256k1-3OC5y4qp.js +1579 -0
- package/dist/secp256k1-3OC5y4qp.js.map +1 -0
- package/dist/secp256k1-bcahnPX9.cjs +2 -0
- package/dist/secp256k1-bcahnPX9.cjs.map +1 -0
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/dist/writeContract-ChuHpJLC.js +3799 -0
- package/dist/writeContract-ChuHpJLC.js.map +1 -0
- package/dist/writeContract-D97dSJQe.cjs +32 -0
- package/dist/writeContract-D97dSJQe.cjs.map +1 -0
- package/package.json +13 -13
- package/dist/ccip-D4klNwCt.js +0 -159
- package/dist/ccip-D4klNwCt.js.map +0 -1
- package/dist/ccip-DLDqFodf.cjs +0 -2
- package/dist/ccip-DLDqFodf.cjs.map +0 -1
- package/dist/constants-BvU-JhfL.cjs +0 -9
- package/dist/constants-BvU-JhfL.cjs.map +0 -1
- package/dist/constants-rWWWhxR_.js +0 -2099
- package/dist/constants-rWWWhxR_.js.map +0 -1
- package/dist/createWalletClient-Bmopj8MM.cjs +0 -4
- package/dist/createWalletClient-Bmopj8MM.cjs.map +0 -1
- package/dist/createWalletClient-DKcpswHR.js +0 -2007
- package/dist/createWalletClient-DKcpswHR.js.map +0 -1
- package/dist/getContract-B3Spz0SO.js.map +0 -1
- package/dist/secp256k1-BLbXMlpX.js +0 -1172
- package/dist/secp256k1-BLbXMlpX.js.map +0 -1
- package/dist/secp256k1-CFnFaJ0H.cjs +0 -2
- package/dist/secp256k1-CFnFaJ0H.cjs.map +0 -1
- package/dist/writeContract-BBHpAss8.cjs +0 -32
- package/dist/writeContract-BBHpAss8.cjs.map +0 -1
- package/dist/writeContract-RluxM31W.js +0 -3833
- package/dist/writeContract-RluxM31W.js.map +0 -1
|
@@ -0,0 +1,3799 @@
|
|
|
1
|
+
import { B as h, j as D, k as ie, t as qe, n as v, c as ee, g as H, I as te, p as K, z as In, A as jn, s as Nn, D as le, i as je, m as Ue, E as he, b as Y, v as fe, e as Ve, F as On, h as ge, o as Jt, G as zn, y as Yt, H as Gn, J as Ze, K as Xt, M as J, d as At, N as Dn, O as de, P as Ne, Q as Ft, R as Mt, S as St, U as Ct, X as Tt, Y as kt, Z as Bt, _ as Rt, $ as Oe, a0 as we, a1 as It, a2 as _n, a3 as Ln, a4 as Hn, a5 as qn, a6 as Un, a7 as Vn, a8 as Zn, a9 as Wn, aa as Kn, f as pe, ab as ze, ac as Qt, ad as Jn, ae as Yn, af as Xn, L as Qn } from "./constants-BjRNQpT2.js";
|
|
2
|
+
const er = "1.0.7";
|
|
3
|
+
class C extends Error {
|
|
4
|
+
constructor(t, n = {}) {
|
|
5
|
+
var o;
|
|
6
|
+
const r = n.cause instanceof C ? n.cause.details : (o = n.cause) != null && o.message ? n.cause.message : n.details, s = n.cause instanceof C && n.cause.docsPath || n.docsPath, a = [
|
|
7
|
+
t || "An error occurred.",
|
|
8
|
+
"",
|
|
9
|
+
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
10
|
+
...s ? [`Docs: https://abitype.dev${s}`] : [],
|
|
11
|
+
...r ? [`Details: ${r}`] : [],
|
|
12
|
+
`Version: abitype@${er}`
|
|
13
|
+
].join(`
|
|
14
|
+
`);
|
|
15
|
+
super(a), Object.defineProperty(this, "details", {
|
|
16
|
+
enumerable: !0,
|
|
17
|
+
configurable: !0,
|
|
18
|
+
writable: !0,
|
|
19
|
+
value: void 0
|
|
20
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
21
|
+
enumerable: !0,
|
|
22
|
+
configurable: !0,
|
|
23
|
+
writable: !0,
|
|
24
|
+
value: void 0
|
|
25
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
26
|
+
enumerable: !0,
|
|
27
|
+
configurable: !0,
|
|
28
|
+
writable: !0,
|
|
29
|
+
value: void 0
|
|
30
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
31
|
+
enumerable: !0,
|
|
32
|
+
configurable: !0,
|
|
33
|
+
writable: !0,
|
|
34
|
+
value: void 0
|
|
35
|
+
}), Object.defineProperty(this, "name", {
|
|
36
|
+
enumerable: !0,
|
|
37
|
+
configurable: !0,
|
|
38
|
+
writable: !0,
|
|
39
|
+
value: "AbiTypeError"
|
|
40
|
+
}), n.cause && (this.cause = n.cause), this.details = r, this.docsPath = s, this.metaMessages = n.metaMessages, this.shortMessage = t;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function V(e, t) {
|
|
44
|
+
const n = e.exec(t);
|
|
45
|
+
return n == null ? void 0 : n.groups;
|
|
46
|
+
}
|
|
47
|
+
const en = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, tn = /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/, nn = /^\(.+?\).*?$/, jt = /^tuple(?<array>(\[(\d*)\])*)$/;
|
|
48
|
+
function Ge(e) {
|
|
49
|
+
let t = e.type;
|
|
50
|
+
if (jt.test(e.type) && "components" in e) {
|
|
51
|
+
t = "(";
|
|
52
|
+
const n = e.components.length;
|
|
53
|
+
for (let s = 0; s < n; s++) {
|
|
54
|
+
const a = e.components[s];
|
|
55
|
+
t += Ge(a), s < n - 1 && (t += ", ");
|
|
56
|
+
}
|
|
57
|
+
const r = V(jt, e.type);
|
|
58
|
+
return t += `)${(r == null ? void 0 : r.array) ?? ""}`, Ge({
|
|
59
|
+
...e,
|
|
60
|
+
type: t
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return "indexed" in e && e.indexed && (t = `${t} indexed`), e.name ? `${t} ${e.name}` : t;
|
|
64
|
+
}
|
|
65
|
+
function se(e) {
|
|
66
|
+
let t = "";
|
|
67
|
+
const n = e.length;
|
|
68
|
+
for (let r = 0; r < n; r++) {
|
|
69
|
+
const s = e[r];
|
|
70
|
+
t += Ge(s), r !== n - 1 && (t += ", ");
|
|
71
|
+
}
|
|
72
|
+
return t;
|
|
73
|
+
}
|
|
74
|
+
function tr(e) {
|
|
75
|
+
var t;
|
|
76
|
+
return e.type === "function" ? `function ${e.name}(${se(e.inputs)})${e.stateMutability && e.stateMutability !== "nonpayable" ? ` ${e.stateMutability}` : ""}${(t = e.outputs) != null && t.length ? ` returns (${se(e.outputs)})` : ""}` : e.type === "event" ? `event ${e.name}(${se(e.inputs)})` : e.type === "error" ? `error ${e.name}(${se(e.inputs)})` : e.type === "constructor" ? `constructor(${se(e.inputs)})${e.stateMutability === "payable" ? " payable" : ""}` : e.type === "fallback" ? `fallback() external${e.stateMutability === "payable" ? " payable" : ""}` : "receive() external payable";
|
|
77
|
+
}
|
|
78
|
+
const rn = /^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
79
|
+
function nr(e) {
|
|
80
|
+
return rn.test(e);
|
|
81
|
+
}
|
|
82
|
+
function rr(e) {
|
|
83
|
+
return V(rn, e);
|
|
84
|
+
}
|
|
85
|
+
const sn = /^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;
|
|
86
|
+
function sr(e) {
|
|
87
|
+
return sn.test(e);
|
|
88
|
+
}
|
|
89
|
+
function or(e) {
|
|
90
|
+
return V(sn, e);
|
|
91
|
+
}
|
|
92
|
+
const on = /^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;
|
|
93
|
+
function ar(e) {
|
|
94
|
+
return on.test(e);
|
|
95
|
+
}
|
|
96
|
+
function ir(e) {
|
|
97
|
+
return V(on, e);
|
|
98
|
+
}
|
|
99
|
+
const an = /^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;
|
|
100
|
+
function cn(e) {
|
|
101
|
+
return an.test(e);
|
|
102
|
+
}
|
|
103
|
+
function cr(e) {
|
|
104
|
+
return V(an, e);
|
|
105
|
+
}
|
|
106
|
+
const un = /^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;
|
|
107
|
+
function ur(e) {
|
|
108
|
+
return un.test(e);
|
|
109
|
+
}
|
|
110
|
+
function dr(e) {
|
|
111
|
+
return V(un, e);
|
|
112
|
+
}
|
|
113
|
+
const lr = /^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;
|
|
114
|
+
function fr(e) {
|
|
115
|
+
return lr.test(e);
|
|
116
|
+
}
|
|
117
|
+
const pr = /^receive\(\) external payable$/;
|
|
118
|
+
function yr(e) {
|
|
119
|
+
return pr.test(e);
|
|
120
|
+
}
|
|
121
|
+
const br = /* @__PURE__ */ new Set(["indexed"]), De = /* @__PURE__ */ new Set([
|
|
122
|
+
"calldata",
|
|
123
|
+
"memory",
|
|
124
|
+
"storage"
|
|
125
|
+
]);
|
|
126
|
+
class mr extends C {
|
|
127
|
+
constructor({ type: t }) {
|
|
128
|
+
super("Unknown type.", {
|
|
129
|
+
metaMessages: [
|
|
130
|
+
`Type "${t}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`
|
|
131
|
+
]
|
|
132
|
+
}), Object.defineProperty(this, "name", {
|
|
133
|
+
enumerable: !0,
|
|
134
|
+
configurable: !0,
|
|
135
|
+
writable: !0,
|
|
136
|
+
value: "UnknownTypeError"
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
class hr extends C {
|
|
141
|
+
constructor({ type: t }) {
|
|
142
|
+
super("Unknown type.", {
|
|
143
|
+
metaMessages: [`Type "${t}" is not a valid ABI type.`]
|
|
144
|
+
}), Object.defineProperty(this, "name", {
|
|
145
|
+
enumerable: !0,
|
|
146
|
+
configurable: !0,
|
|
147
|
+
writable: !0,
|
|
148
|
+
value: "UnknownSolidityTypeError"
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
class gr extends C {
|
|
153
|
+
constructor({ param: t }) {
|
|
154
|
+
super("Invalid ABI parameter.", {
|
|
155
|
+
details: t
|
|
156
|
+
}), Object.defineProperty(this, "name", {
|
|
157
|
+
enumerable: !0,
|
|
158
|
+
configurable: !0,
|
|
159
|
+
writable: !0,
|
|
160
|
+
value: "InvalidParameterError"
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
class wr extends C {
|
|
165
|
+
constructor({ param: t, name: n }) {
|
|
166
|
+
super("Invalid ABI parameter.", {
|
|
167
|
+
details: t,
|
|
168
|
+
metaMessages: [
|
|
169
|
+
`"${n}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`
|
|
170
|
+
]
|
|
171
|
+
}), Object.defineProperty(this, "name", {
|
|
172
|
+
enumerable: !0,
|
|
173
|
+
configurable: !0,
|
|
174
|
+
writable: !0,
|
|
175
|
+
value: "SolidityProtectedKeywordError"
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
class vr extends C {
|
|
180
|
+
constructor({ param: t, type: n, modifier: r }) {
|
|
181
|
+
super("Invalid ABI parameter.", {
|
|
182
|
+
details: t,
|
|
183
|
+
metaMessages: [
|
|
184
|
+
`Modifier "${r}" not allowed${n ? ` in "${n}" type` : ""}.`
|
|
185
|
+
]
|
|
186
|
+
}), Object.defineProperty(this, "name", {
|
|
187
|
+
enumerable: !0,
|
|
188
|
+
configurable: !0,
|
|
189
|
+
writable: !0,
|
|
190
|
+
value: "InvalidModifierError"
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
class xr extends C {
|
|
195
|
+
constructor({ param: t, type: n, modifier: r }) {
|
|
196
|
+
super("Invalid ABI parameter.", {
|
|
197
|
+
details: t,
|
|
198
|
+
metaMessages: [
|
|
199
|
+
`Modifier "${r}" not allowed${n ? ` in "${n}" type` : ""}.`,
|
|
200
|
+
`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`
|
|
201
|
+
]
|
|
202
|
+
}), Object.defineProperty(this, "name", {
|
|
203
|
+
enumerable: !0,
|
|
204
|
+
configurable: !0,
|
|
205
|
+
writable: !0,
|
|
206
|
+
value: "InvalidFunctionModifierError"
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
class Pr extends C {
|
|
211
|
+
constructor({ abiParameter: t }) {
|
|
212
|
+
super("Invalid ABI parameter.", {
|
|
213
|
+
details: JSON.stringify(t, null, 2),
|
|
214
|
+
metaMessages: ["ABI parameter type is invalid."]
|
|
215
|
+
}), Object.defineProperty(this, "name", {
|
|
216
|
+
enumerable: !0,
|
|
217
|
+
configurable: !0,
|
|
218
|
+
writable: !0,
|
|
219
|
+
value: "InvalidAbiTypeParameterError"
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
class oe extends C {
|
|
224
|
+
constructor({ signature: t, type: n }) {
|
|
225
|
+
super(`Invalid ${n} signature.`, {
|
|
226
|
+
details: t
|
|
227
|
+
}), Object.defineProperty(this, "name", {
|
|
228
|
+
enumerable: !0,
|
|
229
|
+
configurable: !0,
|
|
230
|
+
writable: !0,
|
|
231
|
+
value: "InvalidSignatureError"
|
|
232
|
+
});
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
class Er extends C {
|
|
236
|
+
constructor({ signature: t }) {
|
|
237
|
+
super("Unknown signature.", {
|
|
238
|
+
details: t
|
|
239
|
+
}), Object.defineProperty(this, "name", {
|
|
240
|
+
enumerable: !0,
|
|
241
|
+
configurable: !0,
|
|
242
|
+
writable: !0,
|
|
243
|
+
value: "UnknownSignatureError"
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
class $r extends C {
|
|
248
|
+
constructor({ signature: t }) {
|
|
249
|
+
super("Invalid struct signature.", {
|
|
250
|
+
details: t,
|
|
251
|
+
metaMessages: ["No properties exist."]
|
|
252
|
+
}), Object.defineProperty(this, "name", {
|
|
253
|
+
enumerable: !0,
|
|
254
|
+
configurable: !0,
|
|
255
|
+
writable: !0,
|
|
256
|
+
value: "InvalidStructSignatureError"
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
class Ar extends C {
|
|
261
|
+
constructor({ type: t }) {
|
|
262
|
+
super("Circular reference detected.", {
|
|
263
|
+
metaMessages: [`Struct "${t}" is a circular reference.`]
|
|
264
|
+
}), Object.defineProperty(this, "name", {
|
|
265
|
+
enumerable: !0,
|
|
266
|
+
configurable: !0,
|
|
267
|
+
writable: !0,
|
|
268
|
+
value: "CircularReferenceError"
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
class Fr extends C {
|
|
273
|
+
constructor({ current: t, depth: n }) {
|
|
274
|
+
super("Unbalanced parentheses.", {
|
|
275
|
+
metaMessages: [
|
|
276
|
+
`"${t.trim()}" has too many ${n > 0 ? "opening" : "closing"} parentheses.`
|
|
277
|
+
],
|
|
278
|
+
details: `Depth "${n}"`
|
|
279
|
+
}), Object.defineProperty(this, "name", {
|
|
280
|
+
enumerable: !0,
|
|
281
|
+
configurable: !0,
|
|
282
|
+
writable: !0,
|
|
283
|
+
value: "InvalidParenthesisError"
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
function Mr(e, t, n) {
|
|
288
|
+
let r = "";
|
|
289
|
+
if (n)
|
|
290
|
+
for (const s of Object.entries(n)) {
|
|
291
|
+
if (!s)
|
|
292
|
+
continue;
|
|
293
|
+
let a = "";
|
|
294
|
+
for (const o of s[1])
|
|
295
|
+
a += `[${o.type}${o.name ? `:${o.name}` : ""}]`;
|
|
296
|
+
r += `(${s[0]}{${a}})`;
|
|
297
|
+
}
|
|
298
|
+
return t ? `${t}:${e}${r}` : e;
|
|
299
|
+
}
|
|
300
|
+
const Se = /* @__PURE__ */ new Map([
|
|
301
|
+
// Unnamed
|
|
302
|
+
["address", { type: "address" }],
|
|
303
|
+
["bool", { type: "bool" }],
|
|
304
|
+
["bytes", { type: "bytes" }],
|
|
305
|
+
["bytes32", { type: "bytes32" }],
|
|
306
|
+
["int", { type: "int256" }],
|
|
307
|
+
["int256", { type: "int256" }],
|
|
308
|
+
["string", { type: "string" }],
|
|
309
|
+
["uint", { type: "uint256" }],
|
|
310
|
+
["uint8", { type: "uint8" }],
|
|
311
|
+
["uint16", { type: "uint16" }],
|
|
312
|
+
["uint24", { type: "uint24" }],
|
|
313
|
+
["uint32", { type: "uint32" }],
|
|
314
|
+
["uint64", { type: "uint64" }],
|
|
315
|
+
["uint96", { type: "uint96" }],
|
|
316
|
+
["uint112", { type: "uint112" }],
|
|
317
|
+
["uint160", { type: "uint160" }],
|
|
318
|
+
["uint192", { type: "uint192" }],
|
|
319
|
+
["uint256", { type: "uint256" }],
|
|
320
|
+
// Named
|
|
321
|
+
["address owner", { type: "address", name: "owner" }],
|
|
322
|
+
["address to", { type: "address", name: "to" }],
|
|
323
|
+
["bool approved", { type: "bool", name: "approved" }],
|
|
324
|
+
["bytes _data", { type: "bytes", name: "_data" }],
|
|
325
|
+
["bytes data", { type: "bytes", name: "data" }],
|
|
326
|
+
["bytes signature", { type: "bytes", name: "signature" }],
|
|
327
|
+
["bytes32 hash", { type: "bytes32", name: "hash" }],
|
|
328
|
+
["bytes32 r", { type: "bytes32", name: "r" }],
|
|
329
|
+
["bytes32 root", { type: "bytes32", name: "root" }],
|
|
330
|
+
["bytes32 s", { type: "bytes32", name: "s" }],
|
|
331
|
+
["string name", { type: "string", name: "name" }],
|
|
332
|
+
["string symbol", { type: "string", name: "symbol" }],
|
|
333
|
+
["string tokenURI", { type: "string", name: "tokenURI" }],
|
|
334
|
+
["uint tokenId", { type: "uint256", name: "tokenId" }],
|
|
335
|
+
["uint8 v", { type: "uint8", name: "v" }],
|
|
336
|
+
["uint256 balance", { type: "uint256", name: "balance" }],
|
|
337
|
+
["uint256 tokenId", { type: "uint256", name: "tokenId" }],
|
|
338
|
+
["uint256 value", { type: "uint256", name: "value" }],
|
|
339
|
+
// Indexed
|
|
340
|
+
[
|
|
341
|
+
"event:address indexed from",
|
|
342
|
+
{ type: "address", name: "from", indexed: !0 }
|
|
343
|
+
],
|
|
344
|
+
["event:address indexed to", { type: "address", name: "to", indexed: !0 }],
|
|
345
|
+
[
|
|
346
|
+
"event:uint indexed tokenId",
|
|
347
|
+
{ type: "uint256", name: "tokenId", indexed: !0 }
|
|
348
|
+
],
|
|
349
|
+
[
|
|
350
|
+
"event:uint256 indexed tokenId",
|
|
351
|
+
{ type: "uint256", name: "tokenId", indexed: !0 }
|
|
352
|
+
]
|
|
353
|
+
]);
|
|
354
|
+
function Sr(e, t = {}) {
|
|
355
|
+
if (ar(e)) {
|
|
356
|
+
const n = ir(e);
|
|
357
|
+
if (!n)
|
|
358
|
+
throw new oe({ signature: e, type: "function" });
|
|
359
|
+
const r = G(n.parameters), s = [], a = r.length;
|
|
360
|
+
for (let i = 0; i < a; i++)
|
|
361
|
+
s.push(W(r[i], {
|
|
362
|
+
modifiers: De,
|
|
363
|
+
structs: t,
|
|
364
|
+
type: "function"
|
|
365
|
+
}));
|
|
366
|
+
const o = [];
|
|
367
|
+
if (n.returns) {
|
|
368
|
+
const i = G(n.returns), c = i.length;
|
|
369
|
+
for (let u = 0; u < c; u++)
|
|
370
|
+
o.push(W(i[u], {
|
|
371
|
+
modifiers: De,
|
|
372
|
+
structs: t,
|
|
373
|
+
type: "function"
|
|
374
|
+
}));
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
name: n.name,
|
|
378
|
+
type: "function",
|
|
379
|
+
stateMutability: n.stateMutability ?? "nonpayable",
|
|
380
|
+
inputs: s,
|
|
381
|
+
outputs: o
|
|
382
|
+
};
|
|
383
|
+
}
|
|
384
|
+
if (sr(e)) {
|
|
385
|
+
const n = or(e);
|
|
386
|
+
if (!n)
|
|
387
|
+
throw new oe({ signature: e, type: "event" });
|
|
388
|
+
const r = G(n.parameters), s = [], a = r.length;
|
|
389
|
+
for (let o = 0; o < a; o++)
|
|
390
|
+
s.push(W(r[o], {
|
|
391
|
+
modifiers: br,
|
|
392
|
+
structs: t,
|
|
393
|
+
type: "event"
|
|
394
|
+
}));
|
|
395
|
+
return { name: n.name, type: "event", inputs: s };
|
|
396
|
+
}
|
|
397
|
+
if (nr(e)) {
|
|
398
|
+
const n = rr(e);
|
|
399
|
+
if (!n)
|
|
400
|
+
throw new oe({ signature: e, type: "error" });
|
|
401
|
+
const r = G(n.parameters), s = [], a = r.length;
|
|
402
|
+
for (let o = 0; o < a; o++)
|
|
403
|
+
s.push(W(r[o], { structs: t, type: "error" }));
|
|
404
|
+
return { name: n.name, type: "error", inputs: s };
|
|
405
|
+
}
|
|
406
|
+
if (ur(e)) {
|
|
407
|
+
const n = dr(e);
|
|
408
|
+
if (!n)
|
|
409
|
+
throw new oe({ signature: e, type: "constructor" });
|
|
410
|
+
const r = G(n.parameters), s = [], a = r.length;
|
|
411
|
+
for (let o = 0; o < a; o++)
|
|
412
|
+
s.push(W(r[o], { structs: t, type: "constructor" }));
|
|
413
|
+
return {
|
|
414
|
+
type: "constructor",
|
|
415
|
+
stateMutability: n.stateMutability ?? "nonpayable",
|
|
416
|
+
inputs: s
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
if (fr(e))
|
|
420
|
+
return { type: "fallback" };
|
|
421
|
+
if (yr(e))
|
|
422
|
+
return {
|
|
423
|
+
type: "receive",
|
|
424
|
+
stateMutability: "payable"
|
|
425
|
+
};
|
|
426
|
+
throw new Er({ signature: e });
|
|
427
|
+
}
|
|
428
|
+
const Cr = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, Tr = /^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/, kr = /^u?int$/;
|
|
429
|
+
function W(e, t) {
|
|
430
|
+
var l, f;
|
|
431
|
+
const n = Mr(e, t == null ? void 0 : t.type, t == null ? void 0 : t.structs);
|
|
432
|
+
if (Se.has(n))
|
|
433
|
+
return Se.get(n);
|
|
434
|
+
const r = nn.test(e), s = V(r ? Tr : Cr, e);
|
|
435
|
+
if (!s)
|
|
436
|
+
throw new gr({ param: e });
|
|
437
|
+
if (s.name && Rr(s.name))
|
|
438
|
+
throw new wr({ param: e, name: s.name });
|
|
439
|
+
const a = s.name ? { name: s.name } : {}, o = s.modifier === "indexed" ? { indexed: !0 } : {}, i = (t == null ? void 0 : t.structs) ?? {};
|
|
440
|
+
let c, u = {};
|
|
441
|
+
if (r) {
|
|
442
|
+
c = "tuple";
|
|
443
|
+
const y = G(s.type), p = [], b = y.length;
|
|
444
|
+
for (let m = 0; m < b; m++)
|
|
445
|
+
p.push(W(y[m], { structs: i }));
|
|
446
|
+
u = { components: p };
|
|
447
|
+
} else if (s.type in i)
|
|
448
|
+
c = "tuple", u = { components: i[s.type] };
|
|
449
|
+
else if (kr.test(s.type))
|
|
450
|
+
c = `${s.type}256`;
|
|
451
|
+
else if (c = s.type, (t == null ? void 0 : t.type) !== "struct" && !dn(c))
|
|
452
|
+
throw new hr({ type: c });
|
|
453
|
+
if (s.modifier) {
|
|
454
|
+
if (!((f = (l = t == null ? void 0 : t.modifiers) == null ? void 0 : l.has) != null && f.call(l, s.modifier)))
|
|
455
|
+
throw new vr({
|
|
456
|
+
param: e,
|
|
457
|
+
type: t == null ? void 0 : t.type,
|
|
458
|
+
modifier: s.modifier
|
|
459
|
+
});
|
|
460
|
+
if (De.has(s.modifier) && !Ir(c, !!s.array))
|
|
461
|
+
throw new xr({
|
|
462
|
+
param: e,
|
|
463
|
+
type: t == null ? void 0 : t.type,
|
|
464
|
+
modifier: s.modifier
|
|
465
|
+
});
|
|
466
|
+
}
|
|
467
|
+
const d = {
|
|
468
|
+
type: `${c}${s.array ?? ""}`,
|
|
469
|
+
...a,
|
|
470
|
+
...o,
|
|
471
|
+
...u
|
|
472
|
+
};
|
|
473
|
+
return Se.set(n, d), d;
|
|
474
|
+
}
|
|
475
|
+
function G(e, t = [], n = "", r = 0) {
|
|
476
|
+
const s = e.trim().length;
|
|
477
|
+
for (let a = 0; a < s; a++) {
|
|
478
|
+
const o = e[a], i = e.slice(a + 1);
|
|
479
|
+
switch (o) {
|
|
480
|
+
case ",":
|
|
481
|
+
return r === 0 ? G(i, [...t, n.trim()]) : G(i, t, `${n}${o}`, r);
|
|
482
|
+
case "(":
|
|
483
|
+
return G(i, t, `${n}${o}`, r + 1);
|
|
484
|
+
case ")":
|
|
485
|
+
return G(i, t, `${n}${o}`, r - 1);
|
|
486
|
+
default:
|
|
487
|
+
return G(i, t, `${n}${o}`, r);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (n === "")
|
|
491
|
+
return t;
|
|
492
|
+
if (r !== 0)
|
|
493
|
+
throw new Fr({ current: n, depth: r });
|
|
494
|
+
return t.push(n.trim()), t;
|
|
495
|
+
}
|
|
496
|
+
function dn(e) {
|
|
497
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || en.test(e) || tn.test(e);
|
|
498
|
+
}
|
|
499
|
+
const Br = /^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/;
|
|
500
|
+
function Rr(e) {
|
|
501
|
+
return e === "address" || e === "bool" || e === "function" || e === "string" || e === "tuple" || en.test(e) || tn.test(e) || Br.test(e);
|
|
502
|
+
}
|
|
503
|
+
function Ir(e, t) {
|
|
504
|
+
return t || e === "bytes" || e === "string" || e === "tuple";
|
|
505
|
+
}
|
|
506
|
+
function jr(e) {
|
|
507
|
+
const t = {}, n = e.length;
|
|
508
|
+
for (let o = 0; o < n; o++) {
|
|
509
|
+
const i = e[o];
|
|
510
|
+
if (!cn(i))
|
|
511
|
+
continue;
|
|
512
|
+
const c = cr(i);
|
|
513
|
+
if (!c)
|
|
514
|
+
throw new oe({ signature: i, type: "struct" });
|
|
515
|
+
const u = c.properties.split(";"), d = [], l = u.length;
|
|
516
|
+
for (let f = 0; f < l; f++) {
|
|
517
|
+
const p = u[f].trim();
|
|
518
|
+
if (!p)
|
|
519
|
+
continue;
|
|
520
|
+
const b = W(p, {
|
|
521
|
+
type: "struct"
|
|
522
|
+
});
|
|
523
|
+
d.push(b);
|
|
524
|
+
}
|
|
525
|
+
if (!d.length)
|
|
526
|
+
throw new $r({ signature: i });
|
|
527
|
+
t[c.name] = d;
|
|
528
|
+
}
|
|
529
|
+
const r = {}, s = Object.entries(t), a = s.length;
|
|
530
|
+
for (let o = 0; o < a; o++) {
|
|
531
|
+
const [i, c] = s[o];
|
|
532
|
+
r[i] = ln(c, t);
|
|
533
|
+
}
|
|
534
|
+
return r;
|
|
535
|
+
}
|
|
536
|
+
const Nr = /^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/;
|
|
537
|
+
function ln(e, t, n = /* @__PURE__ */ new Set()) {
|
|
538
|
+
const r = [], s = e.length;
|
|
539
|
+
for (let a = 0; a < s; a++) {
|
|
540
|
+
const o = e[a];
|
|
541
|
+
if (nn.test(o.type))
|
|
542
|
+
r.push(o);
|
|
543
|
+
else {
|
|
544
|
+
const c = V(Nr, o.type);
|
|
545
|
+
if (!(c != null && c.type))
|
|
546
|
+
throw new Pr({ abiParameter: o });
|
|
547
|
+
const { array: u, type: d } = c;
|
|
548
|
+
if (d in t) {
|
|
549
|
+
if (n.has(d))
|
|
550
|
+
throw new Ar({ type: d });
|
|
551
|
+
r.push({
|
|
552
|
+
...o,
|
|
553
|
+
type: `tuple${u ?? ""}`,
|
|
554
|
+
components: ln(t[d] ?? [], t, /* @__PURE__ */ new Set([...n, d]))
|
|
555
|
+
});
|
|
556
|
+
} else if (dn(d))
|
|
557
|
+
r.push(o);
|
|
558
|
+
else
|
|
559
|
+
throw new mr({ type: d });
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
return r;
|
|
563
|
+
}
|
|
564
|
+
function fn(e) {
|
|
565
|
+
const t = jr(e), n = [], r = e.length;
|
|
566
|
+
for (let s = 0; s < r; s++) {
|
|
567
|
+
const a = e[s];
|
|
568
|
+
cn(a) || n.push(Sr(a, t));
|
|
569
|
+
}
|
|
570
|
+
return n;
|
|
571
|
+
}
|
|
572
|
+
function A(e, t, n) {
|
|
573
|
+
const r = e[t.name];
|
|
574
|
+
if (typeof r == "function")
|
|
575
|
+
return r;
|
|
576
|
+
const s = e[n];
|
|
577
|
+
return typeof s == "function" ? s : (a) => t(e, a);
|
|
578
|
+
}
|
|
579
|
+
function q(e, { includeName: t = !1 } = {}) {
|
|
580
|
+
if (e.type !== "function" && e.type !== "event" && e.type !== "error")
|
|
581
|
+
throw new Wr(e.type);
|
|
582
|
+
return `${e.name}(${ve(e.inputs, { includeName: t })})`;
|
|
583
|
+
}
|
|
584
|
+
function ve(e, { includeName: t = !1 } = {}) {
|
|
585
|
+
return e ? e.map((n) => Or(n, { includeName: t })).join(t ? ", " : ",") : "";
|
|
586
|
+
}
|
|
587
|
+
function Or(e, { includeName: t }) {
|
|
588
|
+
return e.type.startsWith("tuple") ? `(${ve(e.components, { includeName: t })})${e.type.slice(5)}` : e.type + (t && e.name ? ` ${e.name}` : "");
|
|
589
|
+
}
|
|
590
|
+
class zr extends h {
|
|
591
|
+
constructor({ docsPath: t }) {
|
|
592
|
+
super([
|
|
593
|
+
"A constructor was not found on the ABI.",
|
|
594
|
+
"Make sure you are using the correct ABI and that the constructor exists on it."
|
|
595
|
+
].join(`
|
|
596
|
+
`), {
|
|
597
|
+
docsPath: t,
|
|
598
|
+
name: "AbiConstructorNotFoundError"
|
|
599
|
+
});
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
class Nt extends h {
|
|
603
|
+
constructor({ docsPath: t }) {
|
|
604
|
+
super([
|
|
605
|
+
"Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.",
|
|
606
|
+
"Make sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists."
|
|
607
|
+
].join(`
|
|
608
|
+
`), {
|
|
609
|
+
docsPath: t,
|
|
610
|
+
name: "AbiConstructorParamsNotFoundError"
|
|
611
|
+
});
|
|
612
|
+
}
|
|
613
|
+
}
|
|
614
|
+
class pn extends h {
|
|
615
|
+
constructor({ data: t, params: n, size: r }) {
|
|
616
|
+
super([`Data size of ${r} bytes is too small for given parameters.`].join(`
|
|
617
|
+
`), {
|
|
618
|
+
metaMessages: [
|
|
619
|
+
`Params: (${ve(n, { includeName: !0 })})`,
|
|
620
|
+
`Data: ${t} (${r} bytes)`
|
|
621
|
+
],
|
|
622
|
+
name: "AbiDecodingDataSizeTooSmallError"
|
|
623
|
+
}), Object.defineProperty(this, "data", {
|
|
624
|
+
enumerable: !0,
|
|
625
|
+
configurable: !0,
|
|
626
|
+
writable: !0,
|
|
627
|
+
value: void 0
|
|
628
|
+
}), Object.defineProperty(this, "params", {
|
|
629
|
+
enumerable: !0,
|
|
630
|
+
configurable: !0,
|
|
631
|
+
writable: !0,
|
|
632
|
+
value: void 0
|
|
633
|
+
}), Object.defineProperty(this, "size", {
|
|
634
|
+
enumerable: !0,
|
|
635
|
+
configurable: !0,
|
|
636
|
+
writable: !0,
|
|
637
|
+
value: void 0
|
|
638
|
+
}), this.data = t, this.params = n, this.size = r;
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
class We extends h {
|
|
642
|
+
constructor() {
|
|
643
|
+
super('Cannot decode zero data ("0x") with ABI parameters.', {
|
|
644
|
+
name: "AbiDecodingZeroDataError"
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
class Gr extends h {
|
|
649
|
+
constructor({ expectedLength: t, givenLength: n, type: r }) {
|
|
650
|
+
super([
|
|
651
|
+
`ABI encoding array length mismatch for type ${r}.`,
|
|
652
|
+
`Expected length: ${t}`,
|
|
653
|
+
`Given length: ${n}`
|
|
654
|
+
].join(`
|
|
655
|
+
`), { name: "AbiEncodingArrayLengthMismatchError" });
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
class Dr extends h {
|
|
659
|
+
constructor({ expectedSize: t, value: n }) {
|
|
660
|
+
super(`Size of bytes "${n}" (bytes${D(n)}) does not match expected size (bytes${t}).`, { name: "AbiEncodingBytesSizeMismatchError" });
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
class _r extends h {
|
|
664
|
+
constructor({ expectedLength: t, givenLength: n }) {
|
|
665
|
+
super([
|
|
666
|
+
"ABI encoding params/values length mismatch.",
|
|
667
|
+
`Expected length (params): ${t}`,
|
|
668
|
+
`Given length (values): ${n}`
|
|
669
|
+
].join(`
|
|
670
|
+
`), { name: "AbiEncodingLengthMismatchError" });
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
class yn extends h {
|
|
674
|
+
constructor(t, { docsPath: n }) {
|
|
675
|
+
super([
|
|
676
|
+
`Encoded error signature "${t}" not found on ABI.`,
|
|
677
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
678
|
+
`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${t}.`
|
|
679
|
+
].join(`
|
|
680
|
+
`), {
|
|
681
|
+
docsPath: n,
|
|
682
|
+
name: "AbiErrorSignatureNotFoundError"
|
|
683
|
+
}), Object.defineProperty(this, "signature", {
|
|
684
|
+
enumerable: !0,
|
|
685
|
+
configurable: !0,
|
|
686
|
+
writable: !0,
|
|
687
|
+
value: void 0
|
|
688
|
+
}), this.signature = t;
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
class Lr extends h {
|
|
692
|
+
constructor({ docsPath: t }) {
|
|
693
|
+
super("Cannot extract event signature from empty topics.", {
|
|
694
|
+
docsPath: t,
|
|
695
|
+
name: "AbiEventSignatureEmptyTopicsError"
|
|
696
|
+
});
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
class bn extends h {
|
|
700
|
+
constructor(t, { docsPath: n }) {
|
|
701
|
+
super([
|
|
702
|
+
`Encoded event signature "${t}" not found on ABI.`,
|
|
703
|
+
"Make sure you are using the correct ABI and that the event exists on it.",
|
|
704
|
+
`You can look up the signature here: https://openchain.xyz/signatures?query=${t}.`
|
|
705
|
+
].join(`
|
|
706
|
+
`), {
|
|
707
|
+
docsPath: n,
|
|
708
|
+
name: "AbiEventSignatureNotFoundError"
|
|
709
|
+
});
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
class Ot extends h {
|
|
713
|
+
constructor(t, { docsPath: n } = {}) {
|
|
714
|
+
super([
|
|
715
|
+
`Event ${t ? `"${t}" ` : ""}not found on ABI.`,
|
|
716
|
+
"Make sure you are using the correct ABI and that the event exists on it."
|
|
717
|
+
].join(`
|
|
718
|
+
`), {
|
|
719
|
+
docsPath: n,
|
|
720
|
+
name: "AbiEventNotFoundError"
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
}
|
|
724
|
+
class ye extends h {
|
|
725
|
+
constructor(t, { docsPath: n } = {}) {
|
|
726
|
+
super([
|
|
727
|
+
`Function ${t ? `"${t}" ` : ""}not found on ABI.`,
|
|
728
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
729
|
+
].join(`
|
|
730
|
+
`), {
|
|
731
|
+
docsPath: n,
|
|
732
|
+
name: "AbiFunctionNotFoundError"
|
|
733
|
+
});
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
class Hr extends h {
|
|
737
|
+
constructor(t, { docsPath: n }) {
|
|
738
|
+
super([
|
|
739
|
+
`Function "${t}" does not contain any \`outputs\` on ABI.`,
|
|
740
|
+
"Cannot decode function result without knowing what the parameter types are.",
|
|
741
|
+
"Make sure you are using the correct ABI and that the function exists on it."
|
|
742
|
+
].join(`
|
|
743
|
+
`), {
|
|
744
|
+
docsPath: n,
|
|
745
|
+
name: "AbiFunctionOutputsNotFoundError"
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
class qr extends h {
|
|
750
|
+
constructor(t, n) {
|
|
751
|
+
super("Found ambiguous types in overloaded ABI items.", {
|
|
752
|
+
metaMessages: [
|
|
753
|
+
`\`${t.type}\` in \`${q(t.abiItem)}\`, and`,
|
|
754
|
+
`\`${n.type}\` in \`${q(n.abiItem)}\``,
|
|
755
|
+
"",
|
|
756
|
+
"These types encode differently and cannot be distinguished at runtime.",
|
|
757
|
+
"Remove one of the ambiguous items in the ABI."
|
|
758
|
+
],
|
|
759
|
+
name: "AbiItemAmbiguityError"
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
}
|
|
763
|
+
class ko extends h {
|
|
764
|
+
constructor({ expectedSize: t, givenSize: n }) {
|
|
765
|
+
super(`Expected bytes${t}, got bytes${n}.`, {
|
|
766
|
+
name: "BytesSizeMismatchError"
|
|
767
|
+
});
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
class be extends h {
|
|
771
|
+
constructor({ abiItem: t, data: n, params: r, size: s }) {
|
|
772
|
+
super([
|
|
773
|
+
`Data size of ${s} bytes is too small for non-indexed event parameters.`
|
|
774
|
+
].join(`
|
|
775
|
+
`), {
|
|
776
|
+
metaMessages: [
|
|
777
|
+
`Params: (${ve(r, { includeName: !0 })})`,
|
|
778
|
+
`Data: ${n} (${s} bytes)`
|
|
779
|
+
],
|
|
780
|
+
name: "DecodeLogDataMismatch"
|
|
781
|
+
}), Object.defineProperty(this, "abiItem", {
|
|
782
|
+
enumerable: !0,
|
|
783
|
+
configurable: !0,
|
|
784
|
+
writable: !0,
|
|
785
|
+
value: void 0
|
|
786
|
+
}), Object.defineProperty(this, "data", {
|
|
787
|
+
enumerable: !0,
|
|
788
|
+
configurable: !0,
|
|
789
|
+
writable: !0,
|
|
790
|
+
value: void 0
|
|
791
|
+
}), Object.defineProperty(this, "params", {
|
|
792
|
+
enumerable: !0,
|
|
793
|
+
configurable: !0,
|
|
794
|
+
writable: !0,
|
|
795
|
+
value: void 0
|
|
796
|
+
}), Object.defineProperty(this, "size", {
|
|
797
|
+
enumerable: !0,
|
|
798
|
+
configurable: !0,
|
|
799
|
+
writable: !0,
|
|
800
|
+
value: void 0
|
|
801
|
+
}), this.abiItem = t, this.data = n, this.params = r, this.size = s;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
class Ke extends h {
|
|
805
|
+
constructor({ abiItem: t, param: n }) {
|
|
806
|
+
super([
|
|
807
|
+
`Expected a topic for indexed event parameter${n.name ? ` "${n.name}"` : ""} on event "${q(t, { includeName: !0 })}".`
|
|
808
|
+
].join(`
|
|
809
|
+
`), { name: "DecodeLogTopicsMismatch" }), Object.defineProperty(this, "abiItem", {
|
|
810
|
+
enumerable: !0,
|
|
811
|
+
configurable: !0,
|
|
812
|
+
writable: !0,
|
|
813
|
+
value: void 0
|
|
814
|
+
}), this.abiItem = t;
|
|
815
|
+
}
|
|
816
|
+
}
|
|
817
|
+
class Ur extends h {
|
|
818
|
+
constructor(t, { docsPath: n }) {
|
|
819
|
+
super([
|
|
820
|
+
`Type "${t}" is not a valid encoding type.`,
|
|
821
|
+
"Please provide a valid ABI type."
|
|
822
|
+
].join(`
|
|
823
|
+
`), { docsPath: n, name: "InvalidAbiEncodingType" });
|
|
824
|
+
}
|
|
825
|
+
}
|
|
826
|
+
class Vr extends h {
|
|
827
|
+
constructor(t, { docsPath: n }) {
|
|
828
|
+
super([
|
|
829
|
+
`Type "${t}" is not a valid decoding type.`,
|
|
830
|
+
"Please provide a valid ABI type."
|
|
831
|
+
].join(`
|
|
832
|
+
`), { docsPath: n, name: "InvalidAbiDecodingType" });
|
|
833
|
+
}
|
|
834
|
+
}
|
|
835
|
+
class Zr extends h {
|
|
836
|
+
constructor(t) {
|
|
837
|
+
super([`Value "${t}" is not a valid array.`].join(`
|
|
838
|
+
`), {
|
|
839
|
+
name: "InvalidArrayError"
|
|
840
|
+
});
|
|
841
|
+
}
|
|
842
|
+
}
|
|
843
|
+
class Wr extends h {
|
|
844
|
+
constructor(t) {
|
|
845
|
+
super([
|
|
846
|
+
`"${t}" is not a valid definition type.`,
|
|
847
|
+
'Valid types: "function", "event", "error"'
|
|
848
|
+
].join(`
|
|
849
|
+
`), { name: "InvalidDefinitionTypeError" });
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
class Kr extends h {
|
|
853
|
+
constructor(t) {
|
|
854
|
+
super(`Filter type "${t}" is not supported.`, {
|
|
855
|
+
name: "FilterTypeNotSupportedError"
|
|
856
|
+
});
|
|
857
|
+
}
|
|
858
|
+
}
|
|
859
|
+
const Jr = (e) => ie(qe(e));
|
|
860
|
+
function Yr(e) {
|
|
861
|
+
return Jr(e);
|
|
862
|
+
}
|
|
863
|
+
function Xr(e) {
|
|
864
|
+
let t = !0, n = "", r = 0, s = "", a = !1;
|
|
865
|
+
for (let o = 0; o < e.length; o++) {
|
|
866
|
+
const i = e[o];
|
|
867
|
+
if (["(", ")", ","].includes(i) && (t = !0), i === "(" && r++, i === ")" && r--, !!t) {
|
|
868
|
+
if (r === 0) {
|
|
869
|
+
if (i === " " && ["event", "function", ""].includes(s))
|
|
870
|
+
s = "";
|
|
871
|
+
else if (s += i, i === ")") {
|
|
872
|
+
a = !0;
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
continue;
|
|
876
|
+
}
|
|
877
|
+
if (i === " ") {
|
|
878
|
+
e[o - 1] !== "," && n !== "," && n !== ",(" && (n = "", t = !1);
|
|
879
|
+
continue;
|
|
880
|
+
}
|
|
881
|
+
s += i, n += i;
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
if (!a)
|
|
885
|
+
throw new h("Unable to normalize signature.");
|
|
886
|
+
return s;
|
|
887
|
+
}
|
|
888
|
+
const Qr = (e) => {
|
|
889
|
+
const t = typeof e == "string" ? e : tr(e);
|
|
890
|
+
return Xr(t);
|
|
891
|
+
};
|
|
892
|
+
function mn(e) {
|
|
893
|
+
return Yr(Qr(e));
|
|
894
|
+
}
|
|
895
|
+
const xe = mn, Bo = /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/, es = /^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;
|
|
896
|
+
function Je(e, t) {
|
|
897
|
+
if (e.length !== t.length)
|
|
898
|
+
throw new _r({
|
|
899
|
+
expectedLength: e.length,
|
|
900
|
+
givenLength: t.length
|
|
901
|
+
});
|
|
902
|
+
const n = ts({
|
|
903
|
+
params: e,
|
|
904
|
+
values: t
|
|
905
|
+
}), r = Xe(n);
|
|
906
|
+
return r.length === 0 ? "0x" : r;
|
|
907
|
+
}
|
|
908
|
+
function ts({ params: e, values: t }) {
|
|
909
|
+
const n = [];
|
|
910
|
+
for (let r = 0; r < e.length; r++)
|
|
911
|
+
n.push(Ye({ param: e[r], value: t[r] }));
|
|
912
|
+
return n;
|
|
913
|
+
}
|
|
914
|
+
function Ye({ param: e, value: t }) {
|
|
915
|
+
const n = Qe(e.type);
|
|
916
|
+
if (n) {
|
|
917
|
+
const [r, s] = n;
|
|
918
|
+
return rs(t, { length: r, param: { ...e, type: s } });
|
|
919
|
+
}
|
|
920
|
+
if (e.type === "tuple")
|
|
921
|
+
return cs(t, {
|
|
922
|
+
param: e
|
|
923
|
+
});
|
|
924
|
+
if (e.type === "address")
|
|
925
|
+
return ns(t);
|
|
926
|
+
if (e.type === "bool")
|
|
927
|
+
return os(t);
|
|
928
|
+
if (e.type.startsWith("uint") || e.type.startsWith("int")) {
|
|
929
|
+
const r = e.type.startsWith("int"), [, , s = "256"] = es.exec(e.type) ?? [];
|
|
930
|
+
return as(t, {
|
|
931
|
+
signed: r,
|
|
932
|
+
size: Number(s)
|
|
933
|
+
});
|
|
934
|
+
}
|
|
935
|
+
if (e.type.startsWith("bytes"))
|
|
936
|
+
return ss(t, { param: e });
|
|
937
|
+
if (e.type === "string")
|
|
938
|
+
return is(t);
|
|
939
|
+
throw new Ur(e.type, {
|
|
940
|
+
docsPath: "/docs/contract/encodeAbiParameters"
|
|
941
|
+
});
|
|
942
|
+
}
|
|
943
|
+
function Xe(e) {
|
|
944
|
+
let t = 0;
|
|
945
|
+
for (let a = 0; a < e.length; a++) {
|
|
946
|
+
const { dynamic: o, encoded: i } = e[a];
|
|
947
|
+
o ? t += 32 : t += D(i);
|
|
948
|
+
}
|
|
949
|
+
const n = [], r = [];
|
|
950
|
+
let s = 0;
|
|
951
|
+
for (let a = 0; a < e.length; a++) {
|
|
952
|
+
const { dynamic: o, encoded: i } = e[a];
|
|
953
|
+
o ? (n.push(v(t + s, { size: 32 })), r.push(i), s += D(i)) : n.push(i);
|
|
954
|
+
}
|
|
955
|
+
return ee([...n, ...r]);
|
|
956
|
+
}
|
|
957
|
+
function ns(e) {
|
|
958
|
+
if (!H(e))
|
|
959
|
+
throw new te({ address: e });
|
|
960
|
+
return { dynamic: !1, encoded: K(e.toLowerCase()) };
|
|
961
|
+
}
|
|
962
|
+
function rs(e, { length: t, param: n }) {
|
|
963
|
+
const r = t === null;
|
|
964
|
+
if (!Array.isArray(e))
|
|
965
|
+
throw new Zr(e);
|
|
966
|
+
if (!r && e.length !== t)
|
|
967
|
+
throw new Gr({
|
|
968
|
+
expectedLength: t,
|
|
969
|
+
givenLength: e.length,
|
|
970
|
+
type: `${n.type}[${t}]`
|
|
971
|
+
});
|
|
972
|
+
let s = !1;
|
|
973
|
+
const a = [];
|
|
974
|
+
for (let o = 0; o < e.length; o++) {
|
|
975
|
+
const i = Ye({ param: n, value: e[o] });
|
|
976
|
+
i.dynamic && (s = !0), a.push(i);
|
|
977
|
+
}
|
|
978
|
+
if (r || s) {
|
|
979
|
+
const o = Xe(a);
|
|
980
|
+
if (r) {
|
|
981
|
+
const i = v(a.length, { size: 32 });
|
|
982
|
+
return {
|
|
983
|
+
dynamic: !0,
|
|
984
|
+
encoded: a.length > 0 ? ee([i, o]) : i
|
|
985
|
+
};
|
|
986
|
+
}
|
|
987
|
+
if (s)
|
|
988
|
+
return { dynamic: !0, encoded: o };
|
|
989
|
+
}
|
|
990
|
+
return {
|
|
991
|
+
dynamic: !1,
|
|
992
|
+
encoded: ee(a.map(({ encoded: o }) => o))
|
|
993
|
+
};
|
|
994
|
+
}
|
|
995
|
+
function ss(e, { param: t }) {
|
|
996
|
+
const [, n] = t.type.split("bytes"), r = D(e);
|
|
997
|
+
if (!n) {
|
|
998
|
+
let s = e;
|
|
999
|
+
return r % 32 !== 0 && (s = K(s, {
|
|
1000
|
+
dir: "right",
|
|
1001
|
+
size: Math.ceil((e.length - 2) / 2 / 32) * 32
|
|
1002
|
+
})), {
|
|
1003
|
+
dynamic: !0,
|
|
1004
|
+
encoded: ee([K(v(r, { size: 32 })), s])
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
if (r !== Number.parseInt(n))
|
|
1008
|
+
throw new Dr({
|
|
1009
|
+
expectedSize: Number.parseInt(n),
|
|
1010
|
+
value: e
|
|
1011
|
+
});
|
|
1012
|
+
return { dynamic: !1, encoded: K(e, { dir: "right" }) };
|
|
1013
|
+
}
|
|
1014
|
+
function os(e) {
|
|
1015
|
+
if (typeof e != "boolean")
|
|
1016
|
+
throw new h(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);
|
|
1017
|
+
return { dynamic: !1, encoded: K(In(e)) };
|
|
1018
|
+
}
|
|
1019
|
+
function as(e, { signed: t, size: n = 256 }) {
|
|
1020
|
+
if (typeof n == "number") {
|
|
1021
|
+
const r = 2n ** (BigInt(n) - (t ? 1n : 0n)) - 1n, s = t ? -r - 1n : 0n;
|
|
1022
|
+
if (e > r || e < s)
|
|
1023
|
+
throw new jn({
|
|
1024
|
+
max: r.toString(),
|
|
1025
|
+
min: s.toString(),
|
|
1026
|
+
signed: t,
|
|
1027
|
+
size: n / 8,
|
|
1028
|
+
value: e.toString()
|
|
1029
|
+
});
|
|
1030
|
+
}
|
|
1031
|
+
return {
|
|
1032
|
+
dynamic: !1,
|
|
1033
|
+
encoded: v(e, {
|
|
1034
|
+
size: 32,
|
|
1035
|
+
signed: t
|
|
1036
|
+
})
|
|
1037
|
+
};
|
|
1038
|
+
}
|
|
1039
|
+
function is(e) {
|
|
1040
|
+
const t = Nn(e), n = Math.ceil(D(t) / 32), r = [];
|
|
1041
|
+
for (let s = 0; s < n; s++)
|
|
1042
|
+
r.push(K(le(t, s * 32, (s + 1) * 32), {
|
|
1043
|
+
dir: "right"
|
|
1044
|
+
}));
|
|
1045
|
+
return {
|
|
1046
|
+
dynamic: !0,
|
|
1047
|
+
encoded: ee([
|
|
1048
|
+
K(v(D(t), { size: 32 })),
|
|
1049
|
+
...r
|
|
1050
|
+
])
|
|
1051
|
+
};
|
|
1052
|
+
}
|
|
1053
|
+
function cs(e, { param: t }) {
|
|
1054
|
+
let n = !1;
|
|
1055
|
+
const r = [];
|
|
1056
|
+
for (let s = 0; s < t.components.length; s++) {
|
|
1057
|
+
const a = t.components[s], o = Array.isArray(e) ? s : a.name, i = Ye({
|
|
1058
|
+
param: a,
|
|
1059
|
+
value: e[o]
|
|
1060
|
+
});
|
|
1061
|
+
r.push(i), i.dynamic && (n = !0);
|
|
1062
|
+
}
|
|
1063
|
+
return {
|
|
1064
|
+
dynamic: n,
|
|
1065
|
+
encoded: n ? Xe(r) : ee(r.map(({ encoded: s }) => s))
|
|
1066
|
+
};
|
|
1067
|
+
}
|
|
1068
|
+
function Qe(e) {
|
|
1069
|
+
const t = e.match(/^(.*)\[(\d+)?\]$/);
|
|
1070
|
+
return t ? (
|
|
1071
|
+
// Return `null` if the array is dynamic.
|
|
1072
|
+
[t[2] ? Number(t[2]) : null, t[1]]
|
|
1073
|
+
) : void 0;
|
|
1074
|
+
}
|
|
1075
|
+
const et = (e) => le(mn(e), 0, 4);
|
|
1076
|
+
function ce(e) {
|
|
1077
|
+
const { abi: t, args: n = [], name: r } = e, s = je(r, { strict: !1 }), a = t.filter((i) => s ? i.type === "function" ? et(i) === r : i.type === "event" ? xe(i) === r : !1 : "name" in i && i.name === r);
|
|
1078
|
+
if (a.length === 0)
|
|
1079
|
+
return;
|
|
1080
|
+
if (a.length === 1)
|
|
1081
|
+
return a[0];
|
|
1082
|
+
let o;
|
|
1083
|
+
for (const i of a) {
|
|
1084
|
+
if (!("inputs" in i))
|
|
1085
|
+
continue;
|
|
1086
|
+
if (!n || n.length === 0) {
|
|
1087
|
+
if (!i.inputs || i.inputs.length === 0)
|
|
1088
|
+
return i;
|
|
1089
|
+
continue;
|
|
1090
|
+
}
|
|
1091
|
+
if (!i.inputs || i.inputs.length === 0 || i.inputs.length !== n.length)
|
|
1092
|
+
continue;
|
|
1093
|
+
if (n.every((u, d) => {
|
|
1094
|
+
const l = "inputs" in i && i.inputs[d];
|
|
1095
|
+
return l ? _e(u, l) : !1;
|
|
1096
|
+
})) {
|
|
1097
|
+
if (o && "inputs" in o && o.inputs) {
|
|
1098
|
+
const u = hn(i.inputs, o.inputs, n);
|
|
1099
|
+
if (u)
|
|
1100
|
+
throw new qr({
|
|
1101
|
+
abiItem: i,
|
|
1102
|
+
type: u[0]
|
|
1103
|
+
}, {
|
|
1104
|
+
abiItem: o,
|
|
1105
|
+
type: u[1]
|
|
1106
|
+
});
|
|
1107
|
+
}
|
|
1108
|
+
o = i;
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
return o || a[0];
|
|
1112
|
+
}
|
|
1113
|
+
function _e(e, t) {
|
|
1114
|
+
const n = typeof e, r = t.type;
|
|
1115
|
+
switch (r) {
|
|
1116
|
+
case "address":
|
|
1117
|
+
return H(e, { strict: !1 });
|
|
1118
|
+
case "bool":
|
|
1119
|
+
return n === "boolean";
|
|
1120
|
+
case "function":
|
|
1121
|
+
return n === "string";
|
|
1122
|
+
case "string":
|
|
1123
|
+
return n === "string";
|
|
1124
|
+
default:
|
|
1125
|
+
return r === "tuple" && "components" in t ? Object.values(t.components).every((s, a) => _e(Object.values(e)[a], s)) : /^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(r) ? n === "number" || n === "bigint" : /^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(r) ? n === "string" || e instanceof Uint8Array : /[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(r) ? Array.isArray(e) && e.every((s) => _e(s, {
|
|
1126
|
+
...t,
|
|
1127
|
+
// Pop off `[]` or `[M]` from end of type
|
|
1128
|
+
type: r.replace(/(\[[0-9]{0,}\])$/, "")
|
|
1129
|
+
})) : !1;
|
|
1130
|
+
}
|
|
1131
|
+
}
|
|
1132
|
+
function hn(e, t, n) {
|
|
1133
|
+
for (const r in e) {
|
|
1134
|
+
const s = e[r], a = t[r];
|
|
1135
|
+
if (s.type === "tuple" && a.type === "tuple" && "components" in s && "components" in a)
|
|
1136
|
+
return hn(s.components, a.components, n[r]);
|
|
1137
|
+
const o = [s.type, a.type];
|
|
1138
|
+
if (o.includes("address") && o.includes("bytes20") ? !0 : o.includes("address") && o.includes("string") ? H(n[r], { strict: !1 }) : o.includes("address") && o.includes("bytes") ? H(n[r], { strict: !1 }) : !1)
|
|
1139
|
+
return o;
|
|
1140
|
+
}
|
|
1141
|
+
}
|
|
1142
|
+
const zt = "/docs/contract/encodeEventTopics";
|
|
1143
|
+
function tt(e) {
|
|
1144
|
+
var c;
|
|
1145
|
+
const { abi: t, eventName: n, args: r } = e;
|
|
1146
|
+
let s = t[0];
|
|
1147
|
+
if (n) {
|
|
1148
|
+
const u = ce({ abi: t, name: n });
|
|
1149
|
+
if (!u)
|
|
1150
|
+
throw new Ot(n, { docsPath: zt });
|
|
1151
|
+
s = u;
|
|
1152
|
+
}
|
|
1153
|
+
if (s.type !== "event")
|
|
1154
|
+
throw new Ot(void 0, { docsPath: zt });
|
|
1155
|
+
const a = q(s), o = xe(a);
|
|
1156
|
+
let i = [];
|
|
1157
|
+
if (r && "inputs" in s) {
|
|
1158
|
+
const u = (c = s.inputs) == null ? void 0 : c.filter((l) => "indexed" in l && l.indexed), d = Array.isArray(r) ? r : Object.values(r).length > 0 ? (u == null ? void 0 : u.map((l) => r[l.name])) ?? [] : [];
|
|
1159
|
+
d.length > 0 && (i = (u == null ? void 0 : u.map((l, f) => Array.isArray(d[f]) ? d[f].map((y, p) => Gt({ param: l, value: d[f][p] })) : d[f] ? Gt({ param: l, value: d[f] }) : null)) ?? []);
|
|
1160
|
+
}
|
|
1161
|
+
return [o, ...i];
|
|
1162
|
+
}
|
|
1163
|
+
function Gt({ param: e, value: t }) {
|
|
1164
|
+
if (e.type === "string" || e.type === "bytes")
|
|
1165
|
+
return ie(qe(t));
|
|
1166
|
+
if (e.type === "tuple" || e.type.match(/^(.*)\[(\d+)?\]$/))
|
|
1167
|
+
throw new Kr(e.type);
|
|
1168
|
+
return Je([e], [t]);
|
|
1169
|
+
}
|
|
1170
|
+
function us(e, { method: t }) {
|
|
1171
|
+
var r, s;
|
|
1172
|
+
const n = {};
|
|
1173
|
+
return e.transport.type === "fallback" && ((s = (r = e.transport).onResponse) == null || s.call(r, ({ method: a, response: o, status: i, transport: c }) => {
|
|
1174
|
+
i === "success" && t === a && (n[o] = c.request);
|
|
1175
|
+
})), (a) => n[a] || e.request;
|
|
1176
|
+
}
|
|
1177
|
+
async function ds(e, t) {
|
|
1178
|
+
const { address: n, abi: r, args: s, eventName: a, fromBlock: o, strict: i, toBlock: c } = t, u = us(e, {
|
|
1179
|
+
method: "eth_newFilter"
|
|
1180
|
+
}), d = a ? tt({
|
|
1181
|
+
abi: r,
|
|
1182
|
+
args: s,
|
|
1183
|
+
eventName: a
|
|
1184
|
+
}) : void 0, l = await e.request({
|
|
1185
|
+
method: "eth_newFilter",
|
|
1186
|
+
params: [
|
|
1187
|
+
{
|
|
1188
|
+
address: n,
|
|
1189
|
+
fromBlock: typeof o == "bigint" ? v(o) : o,
|
|
1190
|
+
toBlock: typeof c == "bigint" ? v(c) : c,
|
|
1191
|
+
topics: d
|
|
1192
|
+
}
|
|
1193
|
+
]
|
|
1194
|
+
});
|
|
1195
|
+
return {
|
|
1196
|
+
abi: r,
|
|
1197
|
+
args: s,
|
|
1198
|
+
eventName: a,
|
|
1199
|
+
id: l,
|
|
1200
|
+
request: u(l),
|
|
1201
|
+
strict: !!i,
|
|
1202
|
+
type: "event"
|
|
1203
|
+
};
|
|
1204
|
+
}
|
|
1205
|
+
function U(e) {
|
|
1206
|
+
return typeof e == "string" ? { address: e, type: "json-rpc" } : e;
|
|
1207
|
+
}
|
|
1208
|
+
const Dt = "/docs/contract/encodeFunctionData";
|
|
1209
|
+
function ls(e) {
|
|
1210
|
+
const { abi: t, args: n, functionName: r } = e;
|
|
1211
|
+
let s = t[0];
|
|
1212
|
+
if (r) {
|
|
1213
|
+
const a = ce({
|
|
1214
|
+
abi: t,
|
|
1215
|
+
args: n,
|
|
1216
|
+
name: r
|
|
1217
|
+
});
|
|
1218
|
+
if (!a)
|
|
1219
|
+
throw new ye(r, { docsPath: Dt });
|
|
1220
|
+
s = a;
|
|
1221
|
+
}
|
|
1222
|
+
if (s.type !== "function")
|
|
1223
|
+
throw new ye(void 0, { docsPath: Dt });
|
|
1224
|
+
return {
|
|
1225
|
+
abi: [s],
|
|
1226
|
+
functionName: et(q(s))
|
|
1227
|
+
};
|
|
1228
|
+
}
|
|
1229
|
+
function ue(e) {
|
|
1230
|
+
const { args: t } = e, { abi: n, functionName: r } = (() => {
|
|
1231
|
+
var i;
|
|
1232
|
+
return e.abi.length === 1 && ((i = e.functionName) != null && i.startsWith("0x")) ? e : ls(e);
|
|
1233
|
+
})(), s = n[0], a = r, o = "inputs" in s && s.inputs ? Je(s.inputs, t ?? []) : void 0;
|
|
1234
|
+
return Ue([a, o ?? "0x"]);
|
|
1235
|
+
}
|
|
1236
|
+
const fs = {
|
|
1237
|
+
1: "An `assert` condition failed.",
|
|
1238
|
+
17: "Arithmetic operation resulted in underflow or overflow.",
|
|
1239
|
+
18: "Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",
|
|
1240
|
+
33: "Attempted to convert to an invalid type.",
|
|
1241
|
+
34: "Attempted to access a storage byte array that is incorrectly encoded.",
|
|
1242
|
+
49: "Performed `.pop()` on an empty array",
|
|
1243
|
+
50: "Array index is out of bounds.",
|
|
1244
|
+
65: "Allocated too much memory or created an array which is too large.",
|
|
1245
|
+
81: "Attempted to call a zero-initialized variable of internal function type."
|
|
1246
|
+
}, ps = {
|
|
1247
|
+
inputs: [
|
|
1248
|
+
{
|
|
1249
|
+
name: "message",
|
|
1250
|
+
type: "string"
|
|
1251
|
+
}
|
|
1252
|
+
],
|
|
1253
|
+
name: "Error",
|
|
1254
|
+
type: "error"
|
|
1255
|
+
}, ys = {
|
|
1256
|
+
inputs: [
|
|
1257
|
+
{
|
|
1258
|
+
name: "reason",
|
|
1259
|
+
type: "uint256"
|
|
1260
|
+
}
|
|
1261
|
+
],
|
|
1262
|
+
name: "Panic",
|
|
1263
|
+
type: "error"
|
|
1264
|
+
};
|
|
1265
|
+
function bs(e, t = {}) {
|
|
1266
|
+
typeof t.size < "u" && he(e, { size: t.size });
|
|
1267
|
+
const n = Y(e, t);
|
|
1268
|
+
return fe(n, t);
|
|
1269
|
+
}
|
|
1270
|
+
function ms(e, t = {}) {
|
|
1271
|
+
let n = e;
|
|
1272
|
+
if (typeof t.size < "u" && (he(n, { size: t.size }), n = Ve(n)), n.length > 1 || n[0] > 1)
|
|
1273
|
+
throw new On(n);
|
|
1274
|
+
return !!n[0];
|
|
1275
|
+
}
|
|
1276
|
+
function L(e, t = {}) {
|
|
1277
|
+
typeof t.size < "u" && he(e, { size: t.size });
|
|
1278
|
+
const n = Y(e, t);
|
|
1279
|
+
return ge(n, t);
|
|
1280
|
+
}
|
|
1281
|
+
function hs(e, t = {}) {
|
|
1282
|
+
let n = e;
|
|
1283
|
+
return typeof t.size < "u" && (he(n, { size: t.size }), n = Ve(n, { dir: "right" })), new TextDecoder().decode(n);
|
|
1284
|
+
}
|
|
1285
|
+
function Pe(e, t) {
|
|
1286
|
+
const n = typeof t == "string" ? Jt(t) : t, r = zn(n);
|
|
1287
|
+
if (D(n) === 0 && e.length > 0)
|
|
1288
|
+
throw new We();
|
|
1289
|
+
if (D(t) && D(t) < 32)
|
|
1290
|
+
throw new pn({
|
|
1291
|
+
data: typeof t == "string" ? t : Y(t),
|
|
1292
|
+
params: e,
|
|
1293
|
+
size: D(t)
|
|
1294
|
+
});
|
|
1295
|
+
let s = 0;
|
|
1296
|
+
const a = [];
|
|
1297
|
+
for (let o = 0; o < e.length; ++o) {
|
|
1298
|
+
const i = e[o];
|
|
1299
|
+
r.setPosition(s);
|
|
1300
|
+
const [c, u] = Q(r, i, {
|
|
1301
|
+
staticPosition: 0
|
|
1302
|
+
});
|
|
1303
|
+
s += u, a.push(c);
|
|
1304
|
+
}
|
|
1305
|
+
return a;
|
|
1306
|
+
}
|
|
1307
|
+
function Q(e, t, { staticPosition: n }) {
|
|
1308
|
+
const r = Qe(t.type);
|
|
1309
|
+
if (r) {
|
|
1310
|
+
const [s, a] = r;
|
|
1311
|
+
return ws(e, { ...t, type: a }, { length: s, staticPosition: n });
|
|
1312
|
+
}
|
|
1313
|
+
if (t.type === "tuple")
|
|
1314
|
+
return Es(e, t, { staticPosition: n });
|
|
1315
|
+
if (t.type === "address")
|
|
1316
|
+
return gs(e);
|
|
1317
|
+
if (t.type === "bool")
|
|
1318
|
+
return vs(e);
|
|
1319
|
+
if (t.type.startsWith("bytes"))
|
|
1320
|
+
return xs(e, t, { staticPosition: n });
|
|
1321
|
+
if (t.type.startsWith("uint") || t.type.startsWith("int"))
|
|
1322
|
+
return Ps(e, t);
|
|
1323
|
+
if (t.type === "string")
|
|
1324
|
+
return $s(e, { staticPosition: n });
|
|
1325
|
+
throw new Vr(t.type, {
|
|
1326
|
+
docsPath: "/docs/contract/decodeAbiParameters"
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
const _t = 32, Le = 32;
|
|
1330
|
+
function gs(e) {
|
|
1331
|
+
const t = e.readBytes(32);
|
|
1332
|
+
return [Yt(Y(Gn(t, -20))), 32];
|
|
1333
|
+
}
|
|
1334
|
+
function ws(e, t, { length: n, staticPosition: r }) {
|
|
1335
|
+
if (!n) {
|
|
1336
|
+
const o = L(e.readBytes(Le)), i = r + o, c = i + _t;
|
|
1337
|
+
e.setPosition(i);
|
|
1338
|
+
const u = L(e.readBytes(_t)), d = ae(t);
|
|
1339
|
+
let l = 0;
|
|
1340
|
+
const f = [];
|
|
1341
|
+
for (let y = 0; y < u; ++y) {
|
|
1342
|
+
e.setPosition(c + (d ? y * 32 : l));
|
|
1343
|
+
const [p, b] = Q(e, t, {
|
|
1344
|
+
staticPosition: c
|
|
1345
|
+
});
|
|
1346
|
+
l += b, f.push(p);
|
|
1347
|
+
}
|
|
1348
|
+
return e.setPosition(r + 32), [f, 32];
|
|
1349
|
+
}
|
|
1350
|
+
if (ae(t)) {
|
|
1351
|
+
const o = L(e.readBytes(Le)), i = r + o, c = [];
|
|
1352
|
+
for (let u = 0; u < n; ++u) {
|
|
1353
|
+
e.setPosition(i + u * 32);
|
|
1354
|
+
const [d] = Q(e, t, {
|
|
1355
|
+
staticPosition: i
|
|
1356
|
+
});
|
|
1357
|
+
c.push(d);
|
|
1358
|
+
}
|
|
1359
|
+
return e.setPosition(r + 32), [c, 32];
|
|
1360
|
+
}
|
|
1361
|
+
let s = 0;
|
|
1362
|
+
const a = [];
|
|
1363
|
+
for (let o = 0; o < n; ++o) {
|
|
1364
|
+
const [i, c] = Q(e, t, {
|
|
1365
|
+
staticPosition: r + s
|
|
1366
|
+
});
|
|
1367
|
+
s += c, a.push(i);
|
|
1368
|
+
}
|
|
1369
|
+
return [a, s];
|
|
1370
|
+
}
|
|
1371
|
+
function vs(e) {
|
|
1372
|
+
return [ms(e.readBytes(32), { size: 32 }), 32];
|
|
1373
|
+
}
|
|
1374
|
+
function xs(e, t, { staticPosition: n }) {
|
|
1375
|
+
const [r, s] = t.type.split("bytes");
|
|
1376
|
+
if (!s) {
|
|
1377
|
+
const o = L(e.readBytes(32));
|
|
1378
|
+
e.setPosition(n + o);
|
|
1379
|
+
const i = L(e.readBytes(32));
|
|
1380
|
+
if (i === 0)
|
|
1381
|
+
return e.setPosition(n + 32), ["0x", 32];
|
|
1382
|
+
const c = e.readBytes(i);
|
|
1383
|
+
return e.setPosition(n + 32), [Y(c), 32];
|
|
1384
|
+
}
|
|
1385
|
+
return [Y(e.readBytes(Number.parseInt(s), 32)), 32];
|
|
1386
|
+
}
|
|
1387
|
+
function Ps(e, t) {
|
|
1388
|
+
const n = t.type.startsWith("int"), r = Number.parseInt(t.type.split("int")[1] || "256"), s = e.readBytes(32);
|
|
1389
|
+
return [
|
|
1390
|
+
r > 48 ? bs(s, { signed: n }) : L(s, { signed: n }),
|
|
1391
|
+
32
|
|
1392
|
+
];
|
|
1393
|
+
}
|
|
1394
|
+
function Es(e, t, { staticPosition: n }) {
|
|
1395
|
+
const r = t.components.length === 0 || t.components.some(({ name: o }) => !o), s = r ? [] : {};
|
|
1396
|
+
let a = 0;
|
|
1397
|
+
if (ae(t)) {
|
|
1398
|
+
const o = L(e.readBytes(Le)), i = n + o;
|
|
1399
|
+
for (let c = 0; c < t.components.length; ++c) {
|
|
1400
|
+
const u = t.components[c];
|
|
1401
|
+
e.setPosition(i + a);
|
|
1402
|
+
const [d, l] = Q(e, u, {
|
|
1403
|
+
staticPosition: i
|
|
1404
|
+
});
|
|
1405
|
+
a += l, s[r ? c : u == null ? void 0 : u.name] = d;
|
|
1406
|
+
}
|
|
1407
|
+
return e.setPosition(n + 32), [s, 32];
|
|
1408
|
+
}
|
|
1409
|
+
for (let o = 0; o < t.components.length; ++o) {
|
|
1410
|
+
const i = t.components[o], [c, u] = Q(e, i, {
|
|
1411
|
+
staticPosition: n
|
|
1412
|
+
});
|
|
1413
|
+
s[r ? o : i == null ? void 0 : i.name] = c, a += u;
|
|
1414
|
+
}
|
|
1415
|
+
return [s, a];
|
|
1416
|
+
}
|
|
1417
|
+
function $s(e, { staticPosition: t }) {
|
|
1418
|
+
const n = L(e.readBytes(32)), r = t + n;
|
|
1419
|
+
e.setPosition(r);
|
|
1420
|
+
const s = L(e.readBytes(32));
|
|
1421
|
+
if (s === 0)
|
|
1422
|
+
return e.setPosition(t + 32), ["", 32];
|
|
1423
|
+
const a = e.readBytes(s, 32), o = hs(Ve(a));
|
|
1424
|
+
return e.setPosition(t + 32), [o, 32];
|
|
1425
|
+
}
|
|
1426
|
+
function ae(e) {
|
|
1427
|
+
var r;
|
|
1428
|
+
const { type: t } = e;
|
|
1429
|
+
if (t === "string" || t === "bytes" || t.endsWith("[]"))
|
|
1430
|
+
return !0;
|
|
1431
|
+
if (t === "tuple")
|
|
1432
|
+
return (r = e.components) == null ? void 0 : r.some(ae);
|
|
1433
|
+
const n = Qe(e.type);
|
|
1434
|
+
return !!(n && ae({ ...e, type: n[1] }));
|
|
1435
|
+
}
|
|
1436
|
+
function As(e) {
|
|
1437
|
+
const { abi: t, data: n } = e, r = le(n, 0, 4);
|
|
1438
|
+
if (r === "0x")
|
|
1439
|
+
throw new We();
|
|
1440
|
+
const a = [...t || [], ps, ys].find((o) => o.type === "error" && r === et(q(o)));
|
|
1441
|
+
if (!a)
|
|
1442
|
+
throw new yn(r, {
|
|
1443
|
+
docsPath: "/docs/contract/decodeErrorResult"
|
|
1444
|
+
});
|
|
1445
|
+
return {
|
|
1446
|
+
abiItem: a,
|
|
1447
|
+
args: "inputs" in a && a.inputs && a.inputs.length > 0 ? Pe(a.inputs, le(n, 4)) : void 0,
|
|
1448
|
+
errorName: a.name
|
|
1449
|
+
};
|
|
1450
|
+
}
|
|
1451
|
+
const ne = (e, t, n) => JSON.stringify(e, (r, s) => typeof s == "bigint" ? s.toString() : s, n);
|
|
1452
|
+
function gn({ abiItem: e, args: t, includeFunctionName: n = !0, includeName: r = !1 }) {
|
|
1453
|
+
if ("name" in e && "inputs" in e && e.inputs)
|
|
1454
|
+
return `${n ? e.name : ""}(${e.inputs.map((s, a) => `${r && s.name ? `${s.name}: ` : ""}${typeof t[a] == "object" ? ne(t[a]) : t[a]}`).join(", ")})`;
|
|
1455
|
+
}
|
|
1456
|
+
class Fs extends h {
|
|
1457
|
+
constructor({ address: t }) {
|
|
1458
|
+
super(`State for account "${t}" is set multiple times.`, {
|
|
1459
|
+
name: "AccountStateConflictError"
|
|
1460
|
+
});
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
class Ms extends h {
|
|
1464
|
+
constructor() {
|
|
1465
|
+
super("state and stateDiff are set on the same account.", {
|
|
1466
|
+
name: "StateAssignmentConflictError"
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
function Lt(e) {
|
|
1471
|
+
return e.reduce((t, { slot: n, value: r }) => `${t} ${n}: ${r}
|
|
1472
|
+
`, "");
|
|
1473
|
+
}
|
|
1474
|
+
function Ss(e) {
|
|
1475
|
+
return e.reduce((t, { address: n, ...r }) => {
|
|
1476
|
+
let s = `${t} ${n}:
|
|
1477
|
+
`;
|
|
1478
|
+
return r.nonce && (s += ` nonce: ${r.nonce}
|
|
1479
|
+
`), r.balance && (s += ` balance: ${r.balance}
|
|
1480
|
+
`), r.code && (s += ` code: ${r.code}
|
|
1481
|
+
`), r.state && (s += ` state:
|
|
1482
|
+
`, s += Lt(r.state)), r.stateDiff && (s += ` stateDiff:
|
|
1483
|
+
`, s += Lt(r.stateDiff)), s;
|
|
1484
|
+
}, ` State Override:
|
|
1485
|
+
`).slice(0, -1);
|
|
1486
|
+
}
|
|
1487
|
+
const Cs = (e) => e, nt = (e) => e;
|
|
1488
|
+
class Ts extends h {
|
|
1489
|
+
constructor(t, { account: n, docsPath: r, chain: s, data: a, gas: o, gasPrice: i, maxFeePerGas: c, maxPriorityFeePerGas: u, nonce: d, to: l, value: f, stateOverride: y }) {
|
|
1490
|
+
var m;
|
|
1491
|
+
const p = n ? U(n) : void 0;
|
|
1492
|
+
let b = Ze({
|
|
1493
|
+
from: p == null ? void 0 : p.address,
|
|
1494
|
+
to: l,
|
|
1495
|
+
value: typeof f < "u" && `${Xt(f)} ${((m = s == null ? void 0 : s.nativeCurrency) == null ? void 0 : m.symbol) || "ETH"}`,
|
|
1496
|
+
data: a,
|
|
1497
|
+
gas: o,
|
|
1498
|
+
gasPrice: typeof i < "u" && `${J(i)} gwei`,
|
|
1499
|
+
maxFeePerGas: typeof c < "u" && `${J(c)} gwei`,
|
|
1500
|
+
maxPriorityFeePerGas: typeof u < "u" && `${J(u)} gwei`,
|
|
1501
|
+
nonce: d
|
|
1502
|
+
});
|
|
1503
|
+
y && (b += `
|
|
1504
|
+
${Ss(y)}`), super(t.shortMessage, {
|
|
1505
|
+
cause: t,
|
|
1506
|
+
docsPath: r,
|
|
1507
|
+
metaMessages: [
|
|
1508
|
+
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
1509
|
+
"Raw Call Arguments:",
|
|
1510
|
+
b
|
|
1511
|
+
].filter(Boolean),
|
|
1512
|
+
name: "CallExecutionError"
|
|
1513
|
+
}), Object.defineProperty(this, "cause", {
|
|
1514
|
+
enumerable: !0,
|
|
1515
|
+
configurable: !0,
|
|
1516
|
+
writable: !0,
|
|
1517
|
+
value: void 0
|
|
1518
|
+
}), this.cause = t;
|
|
1519
|
+
}
|
|
1520
|
+
}
|
|
1521
|
+
class ks extends h {
|
|
1522
|
+
constructor(t, { abi: n, args: r, contractAddress: s, docsPath: a, functionName: o, sender: i }) {
|
|
1523
|
+
const c = ce({ abi: n, args: r, name: o }), u = c ? gn({
|
|
1524
|
+
abiItem: c,
|
|
1525
|
+
args: r,
|
|
1526
|
+
includeFunctionName: !1,
|
|
1527
|
+
includeName: !1
|
|
1528
|
+
}) : void 0, d = c ? q(c, { includeName: !0 }) : void 0, l = Ze({
|
|
1529
|
+
address: s && Cs(s),
|
|
1530
|
+
function: d,
|
|
1531
|
+
args: u && u !== "()" && `${[...Array((o == null ? void 0 : o.length) ?? 0).keys()].map(() => " ").join("")}${u}`,
|
|
1532
|
+
sender: i
|
|
1533
|
+
});
|
|
1534
|
+
super(t.shortMessage || `An unknown error occurred while executing the contract function "${o}".`, {
|
|
1535
|
+
cause: t,
|
|
1536
|
+
docsPath: a,
|
|
1537
|
+
metaMessages: [
|
|
1538
|
+
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
1539
|
+
l && "Contract Call:",
|
|
1540
|
+
l
|
|
1541
|
+
].filter(Boolean),
|
|
1542
|
+
name: "ContractFunctionExecutionError"
|
|
1543
|
+
}), Object.defineProperty(this, "abi", {
|
|
1544
|
+
enumerable: !0,
|
|
1545
|
+
configurable: !0,
|
|
1546
|
+
writable: !0,
|
|
1547
|
+
value: void 0
|
|
1548
|
+
}), Object.defineProperty(this, "args", {
|
|
1549
|
+
enumerable: !0,
|
|
1550
|
+
configurable: !0,
|
|
1551
|
+
writable: !0,
|
|
1552
|
+
value: void 0
|
|
1553
|
+
}), Object.defineProperty(this, "cause", {
|
|
1554
|
+
enumerable: !0,
|
|
1555
|
+
configurable: !0,
|
|
1556
|
+
writable: !0,
|
|
1557
|
+
value: void 0
|
|
1558
|
+
}), Object.defineProperty(this, "contractAddress", {
|
|
1559
|
+
enumerable: !0,
|
|
1560
|
+
configurable: !0,
|
|
1561
|
+
writable: !0,
|
|
1562
|
+
value: void 0
|
|
1563
|
+
}), Object.defineProperty(this, "formattedArgs", {
|
|
1564
|
+
enumerable: !0,
|
|
1565
|
+
configurable: !0,
|
|
1566
|
+
writable: !0,
|
|
1567
|
+
value: void 0
|
|
1568
|
+
}), Object.defineProperty(this, "functionName", {
|
|
1569
|
+
enumerable: !0,
|
|
1570
|
+
configurable: !0,
|
|
1571
|
+
writable: !0,
|
|
1572
|
+
value: void 0
|
|
1573
|
+
}), Object.defineProperty(this, "sender", {
|
|
1574
|
+
enumerable: !0,
|
|
1575
|
+
configurable: !0,
|
|
1576
|
+
writable: !0,
|
|
1577
|
+
value: void 0
|
|
1578
|
+
}), this.abi = n, this.args = r, this.cause = t, this.contractAddress = s, this.functionName = o, this.sender = i;
|
|
1579
|
+
}
|
|
1580
|
+
}
|
|
1581
|
+
class Bs extends h {
|
|
1582
|
+
constructor({ abi: t, data: n, functionName: r, message: s }) {
|
|
1583
|
+
let a, o, i, c;
|
|
1584
|
+
if (n && n !== "0x")
|
|
1585
|
+
try {
|
|
1586
|
+
o = As({ abi: t, data: n });
|
|
1587
|
+
const { abiItem: d, errorName: l, args: f } = o;
|
|
1588
|
+
if (l === "Error")
|
|
1589
|
+
c = f[0];
|
|
1590
|
+
else if (l === "Panic") {
|
|
1591
|
+
const [y] = f;
|
|
1592
|
+
c = fs[y];
|
|
1593
|
+
} else {
|
|
1594
|
+
const y = d ? q(d, { includeName: !0 }) : void 0, p = d && f ? gn({
|
|
1595
|
+
abiItem: d,
|
|
1596
|
+
args: f,
|
|
1597
|
+
includeFunctionName: !1,
|
|
1598
|
+
includeName: !1
|
|
1599
|
+
}) : void 0;
|
|
1600
|
+
i = [
|
|
1601
|
+
y ? `Error: ${y}` : "",
|
|
1602
|
+
p && p !== "()" ? ` ${[...Array((l == null ? void 0 : l.length) ?? 0).keys()].map(() => " ").join("")}${p}` : ""
|
|
1603
|
+
];
|
|
1604
|
+
}
|
|
1605
|
+
} catch (d) {
|
|
1606
|
+
a = d;
|
|
1607
|
+
}
|
|
1608
|
+
else s && (c = s);
|
|
1609
|
+
let u;
|
|
1610
|
+
a instanceof yn && (u = a.signature, i = [
|
|
1611
|
+
`Unable to decode signature "${u}" as it was not found on the provided ABI.`,
|
|
1612
|
+
"Make sure you are using the correct ABI and that the error exists on it.",
|
|
1613
|
+
`You can look up the decoded signature here: https://openchain.xyz/signatures?query=${u}.`
|
|
1614
|
+
]), super(c && c !== "execution reverted" || u ? [
|
|
1615
|
+
`The contract function "${r}" reverted with the following ${u ? "signature" : "reason"}:`,
|
|
1616
|
+
c || u
|
|
1617
|
+
].join(`
|
|
1618
|
+
`) : `The contract function "${r}" reverted.`, {
|
|
1619
|
+
cause: a,
|
|
1620
|
+
metaMessages: i,
|
|
1621
|
+
name: "ContractFunctionRevertedError"
|
|
1622
|
+
}), Object.defineProperty(this, "data", {
|
|
1623
|
+
enumerable: !0,
|
|
1624
|
+
configurable: !0,
|
|
1625
|
+
writable: !0,
|
|
1626
|
+
value: void 0
|
|
1627
|
+
}), Object.defineProperty(this, "reason", {
|
|
1628
|
+
enumerable: !0,
|
|
1629
|
+
configurable: !0,
|
|
1630
|
+
writable: !0,
|
|
1631
|
+
value: void 0
|
|
1632
|
+
}), Object.defineProperty(this, "signature", {
|
|
1633
|
+
enumerable: !0,
|
|
1634
|
+
configurable: !0,
|
|
1635
|
+
writable: !0,
|
|
1636
|
+
value: void 0
|
|
1637
|
+
}), this.data = o, this.reason = c, this.signature = u;
|
|
1638
|
+
}
|
|
1639
|
+
}
|
|
1640
|
+
class Rs extends h {
|
|
1641
|
+
constructor({ functionName: t }) {
|
|
1642
|
+
super(`The contract function "${t}" returned no data ("0x").`, {
|
|
1643
|
+
metaMessages: [
|
|
1644
|
+
"This could be due to any of the following:",
|
|
1645
|
+
` - The contract does not have the function "${t}",`,
|
|
1646
|
+
" - The parameters passed to the contract function may be invalid, or",
|
|
1647
|
+
" - The address is not a contract."
|
|
1648
|
+
],
|
|
1649
|
+
name: "ContractFunctionZeroDataError"
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
class Is extends h {
|
|
1654
|
+
constructor({ factory: t }) {
|
|
1655
|
+
super(`Deployment for counterfactual contract call failed${t ? ` for factory "${t}".` : ""}`, {
|
|
1656
|
+
metaMessages: [
|
|
1657
|
+
"Please ensure:",
|
|
1658
|
+
"- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).",
|
|
1659
|
+
"- The `factoryData` is a valid encoded function call for contract deployment function on the factory."
|
|
1660
|
+
],
|
|
1661
|
+
name: "CounterfactualDeploymentFailedError"
|
|
1662
|
+
});
|
|
1663
|
+
}
|
|
1664
|
+
}
|
|
1665
|
+
class wn extends h {
|
|
1666
|
+
constructor({ data: t, message: n }) {
|
|
1667
|
+
super(n || "", { name: "RawContractError" }), Object.defineProperty(this, "code", {
|
|
1668
|
+
enumerable: !0,
|
|
1669
|
+
configurable: !0,
|
|
1670
|
+
writable: !0,
|
|
1671
|
+
value: 3
|
|
1672
|
+
}), Object.defineProperty(this, "data", {
|
|
1673
|
+
enumerable: !0,
|
|
1674
|
+
configurable: !0,
|
|
1675
|
+
writable: !0,
|
|
1676
|
+
value: void 0
|
|
1677
|
+
}), this.data = t;
|
|
1678
|
+
}
|
|
1679
|
+
}
|
|
1680
|
+
class Ro extends h {
|
|
1681
|
+
constructor({ body: t, cause: n, details: r, headers: s, status: a, url: o }) {
|
|
1682
|
+
super("HTTP request failed.", {
|
|
1683
|
+
cause: n,
|
|
1684
|
+
details: r,
|
|
1685
|
+
metaMessages: [
|
|
1686
|
+
a && `Status: ${a}`,
|
|
1687
|
+
`URL: ${nt(o)}`,
|
|
1688
|
+
t && `Request body: ${ne(t)}`
|
|
1689
|
+
].filter(Boolean),
|
|
1690
|
+
name: "HttpRequestError"
|
|
1691
|
+
}), Object.defineProperty(this, "body", {
|
|
1692
|
+
enumerable: !0,
|
|
1693
|
+
configurable: !0,
|
|
1694
|
+
writable: !0,
|
|
1695
|
+
value: void 0
|
|
1696
|
+
}), Object.defineProperty(this, "headers", {
|
|
1697
|
+
enumerable: !0,
|
|
1698
|
+
configurable: !0,
|
|
1699
|
+
writable: !0,
|
|
1700
|
+
value: void 0
|
|
1701
|
+
}), Object.defineProperty(this, "status", {
|
|
1702
|
+
enumerable: !0,
|
|
1703
|
+
configurable: !0,
|
|
1704
|
+
writable: !0,
|
|
1705
|
+
value: void 0
|
|
1706
|
+
}), Object.defineProperty(this, "url", {
|
|
1707
|
+
enumerable: !0,
|
|
1708
|
+
configurable: !0,
|
|
1709
|
+
writable: !0,
|
|
1710
|
+
value: void 0
|
|
1711
|
+
}), this.body = t, this.headers = s, this.status = a, this.url = o;
|
|
1712
|
+
}
|
|
1713
|
+
}
|
|
1714
|
+
class js extends h {
|
|
1715
|
+
constructor({ body: t, error: n, url: r }) {
|
|
1716
|
+
super("RPC Request failed.", {
|
|
1717
|
+
cause: n,
|
|
1718
|
+
details: n.message,
|
|
1719
|
+
metaMessages: [`URL: ${nt(r)}`, `Request body: ${ne(t)}`],
|
|
1720
|
+
name: "RpcRequestError"
|
|
1721
|
+
}), Object.defineProperty(this, "code", {
|
|
1722
|
+
enumerable: !0,
|
|
1723
|
+
configurable: !0,
|
|
1724
|
+
writable: !0,
|
|
1725
|
+
value: void 0
|
|
1726
|
+
}), this.code = n.code;
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
class Io extends h {
|
|
1730
|
+
constructor({ body: t, url: n }) {
|
|
1731
|
+
super("The request took too long to respond.", {
|
|
1732
|
+
details: "The request timed out.",
|
|
1733
|
+
metaMessages: [`URL: ${nt(n)}`, `Request body: ${ne(t)}`],
|
|
1734
|
+
name: "TimeoutError"
|
|
1735
|
+
});
|
|
1736
|
+
}
|
|
1737
|
+
}
|
|
1738
|
+
const Ns = -1;
|
|
1739
|
+
class B extends h {
|
|
1740
|
+
constructor(t, { code: n, docsPath: r, metaMessages: s, name: a, shortMessage: o }) {
|
|
1741
|
+
super(o, {
|
|
1742
|
+
cause: t,
|
|
1743
|
+
docsPath: r,
|
|
1744
|
+
metaMessages: s || (t == null ? void 0 : t.metaMessages),
|
|
1745
|
+
name: a || "RpcError"
|
|
1746
|
+
}), Object.defineProperty(this, "code", {
|
|
1747
|
+
enumerable: !0,
|
|
1748
|
+
configurable: !0,
|
|
1749
|
+
writable: !0,
|
|
1750
|
+
value: void 0
|
|
1751
|
+
}), this.name = a || t.name, this.code = t instanceof js ? t.code : n ?? Ns;
|
|
1752
|
+
}
|
|
1753
|
+
}
|
|
1754
|
+
class re extends B {
|
|
1755
|
+
constructor(t, n) {
|
|
1756
|
+
super(t, n), Object.defineProperty(this, "data", {
|
|
1757
|
+
enumerable: !0,
|
|
1758
|
+
configurable: !0,
|
|
1759
|
+
writable: !0,
|
|
1760
|
+
value: void 0
|
|
1761
|
+
}), this.data = n.data;
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
class rt extends B {
|
|
1765
|
+
constructor(t) {
|
|
1766
|
+
super(t, {
|
|
1767
|
+
code: rt.code,
|
|
1768
|
+
name: "ParseRpcError",
|
|
1769
|
+
shortMessage: "Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."
|
|
1770
|
+
});
|
|
1771
|
+
}
|
|
1772
|
+
}
|
|
1773
|
+
Object.defineProperty(rt, "code", {
|
|
1774
|
+
enumerable: !0,
|
|
1775
|
+
configurable: !0,
|
|
1776
|
+
writable: !0,
|
|
1777
|
+
value: -32700
|
|
1778
|
+
});
|
|
1779
|
+
class st extends B {
|
|
1780
|
+
constructor(t) {
|
|
1781
|
+
super(t, {
|
|
1782
|
+
code: st.code,
|
|
1783
|
+
name: "InvalidRequestRpcError",
|
|
1784
|
+
shortMessage: "JSON is not a valid request object."
|
|
1785
|
+
});
|
|
1786
|
+
}
|
|
1787
|
+
}
|
|
1788
|
+
Object.defineProperty(st, "code", {
|
|
1789
|
+
enumerable: !0,
|
|
1790
|
+
configurable: !0,
|
|
1791
|
+
writable: !0,
|
|
1792
|
+
value: -32600
|
|
1793
|
+
});
|
|
1794
|
+
class ot extends B {
|
|
1795
|
+
constructor(t, { method: n } = {}) {
|
|
1796
|
+
super(t, {
|
|
1797
|
+
code: ot.code,
|
|
1798
|
+
name: "MethodNotFoundRpcError",
|
|
1799
|
+
shortMessage: `The method${n ? ` "${n}"` : ""} does not exist / is not available.`
|
|
1800
|
+
});
|
|
1801
|
+
}
|
|
1802
|
+
}
|
|
1803
|
+
Object.defineProperty(ot, "code", {
|
|
1804
|
+
enumerable: !0,
|
|
1805
|
+
configurable: !0,
|
|
1806
|
+
writable: !0,
|
|
1807
|
+
value: -32601
|
|
1808
|
+
});
|
|
1809
|
+
class at extends B {
|
|
1810
|
+
constructor(t) {
|
|
1811
|
+
super(t, {
|
|
1812
|
+
code: at.code,
|
|
1813
|
+
name: "InvalidParamsRpcError",
|
|
1814
|
+
shortMessage: [
|
|
1815
|
+
"Invalid parameters were provided to the RPC method.",
|
|
1816
|
+
"Double check you have provided the correct parameters."
|
|
1817
|
+
].join(`
|
|
1818
|
+
`)
|
|
1819
|
+
});
|
|
1820
|
+
}
|
|
1821
|
+
}
|
|
1822
|
+
Object.defineProperty(at, "code", {
|
|
1823
|
+
enumerable: !0,
|
|
1824
|
+
configurable: !0,
|
|
1825
|
+
writable: !0,
|
|
1826
|
+
value: -32602
|
|
1827
|
+
});
|
|
1828
|
+
class Ee extends B {
|
|
1829
|
+
constructor(t) {
|
|
1830
|
+
super(t, {
|
|
1831
|
+
code: Ee.code,
|
|
1832
|
+
name: "InternalRpcError",
|
|
1833
|
+
shortMessage: "An internal error was received."
|
|
1834
|
+
});
|
|
1835
|
+
}
|
|
1836
|
+
}
|
|
1837
|
+
Object.defineProperty(Ee, "code", {
|
|
1838
|
+
enumerable: !0,
|
|
1839
|
+
configurable: !0,
|
|
1840
|
+
writable: !0,
|
|
1841
|
+
value: -32603
|
|
1842
|
+
});
|
|
1843
|
+
class $e extends B {
|
|
1844
|
+
constructor(t) {
|
|
1845
|
+
super(t, {
|
|
1846
|
+
code: $e.code,
|
|
1847
|
+
name: "InvalidInputRpcError",
|
|
1848
|
+
shortMessage: [
|
|
1849
|
+
"Missing or invalid parameters.",
|
|
1850
|
+
"Double check you have provided the correct parameters."
|
|
1851
|
+
].join(`
|
|
1852
|
+
`)
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
}
|
|
1856
|
+
Object.defineProperty($e, "code", {
|
|
1857
|
+
enumerable: !0,
|
|
1858
|
+
configurable: !0,
|
|
1859
|
+
writable: !0,
|
|
1860
|
+
value: -32e3
|
|
1861
|
+
});
|
|
1862
|
+
class it extends B {
|
|
1863
|
+
constructor(t) {
|
|
1864
|
+
super(t, {
|
|
1865
|
+
code: it.code,
|
|
1866
|
+
name: "ResourceNotFoundRpcError",
|
|
1867
|
+
shortMessage: "Requested resource not found."
|
|
1868
|
+
}), Object.defineProperty(this, "name", {
|
|
1869
|
+
enumerable: !0,
|
|
1870
|
+
configurable: !0,
|
|
1871
|
+
writable: !0,
|
|
1872
|
+
value: "ResourceNotFoundRpcError"
|
|
1873
|
+
});
|
|
1874
|
+
}
|
|
1875
|
+
}
|
|
1876
|
+
Object.defineProperty(it, "code", {
|
|
1877
|
+
enumerable: !0,
|
|
1878
|
+
configurable: !0,
|
|
1879
|
+
writable: !0,
|
|
1880
|
+
value: -32001
|
|
1881
|
+
});
|
|
1882
|
+
class ct extends B {
|
|
1883
|
+
constructor(t) {
|
|
1884
|
+
super(t, {
|
|
1885
|
+
code: ct.code,
|
|
1886
|
+
name: "ResourceUnavailableRpcError",
|
|
1887
|
+
shortMessage: "Requested resource not available."
|
|
1888
|
+
});
|
|
1889
|
+
}
|
|
1890
|
+
}
|
|
1891
|
+
Object.defineProperty(ct, "code", {
|
|
1892
|
+
enumerable: !0,
|
|
1893
|
+
configurable: !0,
|
|
1894
|
+
writable: !0,
|
|
1895
|
+
value: -32002
|
|
1896
|
+
});
|
|
1897
|
+
class ut extends B {
|
|
1898
|
+
constructor(t) {
|
|
1899
|
+
super(t, {
|
|
1900
|
+
code: ut.code,
|
|
1901
|
+
name: "TransactionRejectedRpcError",
|
|
1902
|
+
shortMessage: "Transaction creation failed."
|
|
1903
|
+
});
|
|
1904
|
+
}
|
|
1905
|
+
}
|
|
1906
|
+
Object.defineProperty(ut, "code", {
|
|
1907
|
+
enumerable: !0,
|
|
1908
|
+
configurable: !0,
|
|
1909
|
+
writable: !0,
|
|
1910
|
+
value: -32003
|
|
1911
|
+
});
|
|
1912
|
+
class dt extends B {
|
|
1913
|
+
constructor(t, { method: n } = {}) {
|
|
1914
|
+
super(t, {
|
|
1915
|
+
code: dt.code,
|
|
1916
|
+
name: "MethodNotSupportedRpcError",
|
|
1917
|
+
shortMessage: `Method${n ? ` "${n}"` : ""} is not implemented.`
|
|
1918
|
+
});
|
|
1919
|
+
}
|
|
1920
|
+
}
|
|
1921
|
+
Object.defineProperty(dt, "code", {
|
|
1922
|
+
enumerable: !0,
|
|
1923
|
+
configurable: !0,
|
|
1924
|
+
writable: !0,
|
|
1925
|
+
value: -32004
|
|
1926
|
+
});
|
|
1927
|
+
class lt extends B {
|
|
1928
|
+
constructor(t) {
|
|
1929
|
+
super(t, {
|
|
1930
|
+
code: lt.code,
|
|
1931
|
+
name: "LimitExceededRpcError",
|
|
1932
|
+
shortMessage: "Request exceeds defined limit."
|
|
1933
|
+
});
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
Object.defineProperty(lt, "code", {
|
|
1937
|
+
enumerable: !0,
|
|
1938
|
+
configurable: !0,
|
|
1939
|
+
writable: !0,
|
|
1940
|
+
value: -32005
|
|
1941
|
+
});
|
|
1942
|
+
class ft extends B {
|
|
1943
|
+
constructor(t) {
|
|
1944
|
+
super(t, {
|
|
1945
|
+
code: ft.code,
|
|
1946
|
+
name: "JsonRpcVersionUnsupportedError",
|
|
1947
|
+
shortMessage: "Version of JSON-RPC protocol is not supported."
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
Object.defineProperty(ft, "code", {
|
|
1952
|
+
enumerable: !0,
|
|
1953
|
+
configurable: !0,
|
|
1954
|
+
writable: !0,
|
|
1955
|
+
value: -32006
|
|
1956
|
+
});
|
|
1957
|
+
class pt extends re {
|
|
1958
|
+
constructor(t) {
|
|
1959
|
+
super(t, {
|
|
1960
|
+
code: pt.code,
|
|
1961
|
+
name: "UserRejectedRequestError",
|
|
1962
|
+
shortMessage: "User rejected the request."
|
|
1963
|
+
});
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
Object.defineProperty(pt, "code", {
|
|
1967
|
+
enumerable: !0,
|
|
1968
|
+
configurable: !0,
|
|
1969
|
+
writable: !0,
|
|
1970
|
+
value: 4001
|
|
1971
|
+
});
|
|
1972
|
+
class yt extends re {
|
|
1973
|
+
constructor(t) {
|
|
1974
|
+
super(t, {
|
|
1975
|
+
code: yt.code,
|
|
1976
|
+
name: "UnauthorizedProviderError",
|
|
1977
|
+
shortMessage: "The requested method and/or account has not been authorized by the user."
|
|
1978
|
+
});
|
|
1979
|
+
}
|
|
1980
|
+
}
|
|
1981
|
+
Object.defineProperty(yt, "code", {
|
|
1982
|
+
enumerable: !0,
|
|
1983
|
+
configurable: !0,
|
|
1984
|
+
writable: !0,
|
|
1985
|
+
value: 4100
|
|
1986
|
+
});
|
|
1987
|
+
class bt extends re {
|
|
1988
|
+
constructor(t, { method: n } = {}) {
|
|
1989
|
+
super(t, {
|
|
1990
|
+
code: bt.code,
|
|
1991
|
+
name: "UnsupportedProviderMethodError",
|
|
1992
|
+
shortMessage: `The Provider does not support the requested method${n ? ` " ${n}"` : ""}.`
|
|
1993
|
+
});
|
|
1994
|
+
}
|
|
1995
|
+
}
|
|
1996
|
+
Object.defineProperty(bt, "code", {
|
|
1997
|
+
enumerable: !0,
|
|
1998
|
+
configurable: !0,
|
|
1999
|
+
writable: !0,
|
|
2000
|
+
value: 4200
|
|
2001
|
+
});
|
|
2002
|
+
class mt extends re {
|
|
2003
|
+
constructor(t) {
|
|
2004
|
+
super(t, {
|
|
2005
|
+
code: mt.code,
|
|
2006
|
+
name: "ProviderDisconnectedError",
|
|
2007
|
+
shortMessage: "The Provider is disconnected from all chains."
|
|
2008
|
+
});
|
|
2009
|
+
}
|
|
2010
|
+
}
|
|
2011
|
+
Object.defineProperty(mt, "code", {
|
|
2012
|
+
enumerable: !0,
|
|
2013
|
+
configurable: !0,
|
|
2014
|
+
writable: !0,
|
|
2015
|
+
value: 4900
|
|
2016
|
+
});
|
|
2017
|
+
class ht extends re {
|
|
2018
|
+
constructor(t) {
|
|
2019
|
+
super(t, {
|
|
2020
|
+
code: ht.code,
|
|
2021
|
+
name: "ChainDisconnectedError",
|
|
2022
|
+
shortMessage: "The Provider is not connected to the requested chain."
|
|
2023
|
+
});
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
Object.defineProperty(ht, "code", {
|
|
2027
|
+
enumerable: !0,
|
|
2028
|
+
configurable: !0,
|
|
2029
|
+
writable: !0,
|
|
2030
|
+
value: 4901
|
|
2031
|
+
});
|
|
2032
|
+
class gt extends re {
|
|
2033
|
+
constructor(t) {
|
|
2034
|
+
super(t, {
|
|
2035
|
+
code: gt.code,
|
|
2036
|
+
name: "SwitchChainError",
|
|
2037
|
+
shortMessage: "An error occurred when attempting to switch chain."
|
|
2038
|
+
});
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
Object.defineProperty(gt, "code", {
|
|
2042
|
+
enumerable: !0,
|
|
2043
|
+
configurable: !0,
|
|
2044
|
+
writable: !0,
|
|
2045
|
+
value: 4902
|
|
2046
|
+
});
|
|
2047
|
+
class jo extends B {
|
|
2048
|
+
constructor(t) {
|
|
2049
|
+
super(t, {
|
|
2050
|
+
name: "UnknownRpcError",
|
|
2051
|
+
shortMessage: "An unknown RPC error occurred."
|
|
2052
|
+
});
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
const Os = 3;
|
|
2056
|
+
function Ae(e, { abi: t, address: n, args: r, docsPath: s, functionName: a, sender: o }) {
|
|
2057
|
+
const { code: i, data: c, message: u, shortMessage: d } = e instanceof wn ? e : e instanceof h ? e.walk((f) => "data" in f) || e.walk() : {}, l = e instanceof We ? new Rs({ functionName: a }) : [Os, Ee.code].includes(i) && (c || u || d) ? new Bs({
|
|
2058
|
+
abi: t,
|
|
2059
|
+
data: typeof c == "object" ? c.data : c,
|
|
2060
|
+
functionName: a,
|
|
2061
|
+
message: d ?? u
|
|
2062
|
+
}) : e;
|
|
2063
|
+
return new ks(l, {
|
|
2064
|
+
abi: t,
|
|
2065
|
+
args: r,
|
|
2066
|
+
contractAddress: n,
|
|
2067
|
+
docsPath: s,
|
|
2068
|
+
functionName: a,
|
|
2069
|
+
sender: o
|
|
2070
|
+
});
|
|
2071
|
+
}
|
|
2072
|
+
function zs(e) {
|
|
2073
|
+
const t = ie(`0x${e.substring(4)}`).substring(26);
|
|
2074
|
+
return Yt(`0x${t}`);
|
|
2075
|
+
}
|
|
2076
|
+
async function Gs({ hash: e, signature: t }) {
|
|
2077
|
+
const n = je(e) ? e : At(e), { secp256k1: r } = await import("./secp256k1-3OC5y4qp.js");
|
|
2078
|
+
return `0x${(() => {
|
|
2079
|
+
if (typeof t == "object" && "r" in t && "s" in t) {
|
|
2080
|
+
const { r: u, s: d, v: l, yParity: f } = t, y = Number(f ?? l), p = Ht(y);
|
|
2081
|
+
return new r.Signature(fe(u), fe(d)).addRecoveryBit(p);
|
|
2082
|
+
}
|
|
2083
|
+
const o = je(t) ? t : At(t), i = ge(`0x${o.slice(130)}`), c = Ht(i);
|
|
2084
|
+
return r.Signature.fromCompact(o.substring(2, 130)).addRecoveryBit(c);
|
|
2085
|
+
})().recoverPublicKey(n.substring(2)).toHex(!1)}`;
|
|
2086
|
+
}
|
|
2087
|
+
function Ht(e) {
|
|
2088
|
+
if (e === 0 || e === 1)
|
|
2089
|
+
return e;
|
|
2090
|
+
if (e === 27)
|
|
2091
|
+
return 0;
|
|
2092
|
+
if (e === 28)
|
|
2093
|
+
return 1;
|
|
2094
|
+
throw new Error("Invalid yParityOrV value");
|
|
2095
|
+
}
|
|
2096
|
+
async function Ds({ hash: e, signature: t }) {
|
|
2097
|
+
return zs(await Gs({ hash: e, signature: t }));
|
|
2098
|
+
}
|
|
2099
|
+
function _s(e) {
|
|
2100
|
+
const { chainId: t, contractAddress: n, nonce: r, to: s } = e, a = ie(Ue([
|
|
2101
|
+
"0x05",
|
|
2102
|
+
Dn([
|
|
2103
|
+
t ? v(t) : "0x",
|
|
2104
|
+
n,
|
|
2105
|
+
r ? v(r) : "0x"
|
|
2106
|
+
])
|
|
2107
|
+
]));
|
|
2108
|
+
return s === "bytes" ? Jt(a) : a;
|
|
2109
|
+
}
|
|
2110
|
+
async function vn(e) {
|
|
2111
|
+
const { authorization: t, signature: n } = e;
|
|
2112
|
+
return Ds({
|
|
2113
|
+
hash: _s(t),
|
|
2114
|
+
signature: n ?? t
|
|
2115
|
+
});
|
|
2116
|
+
}
|
|
2117
|
+
class Ls extends h {
|
|
2118
|
+
constructor(t, { account: n, docsPath: r, chain: s, data: a, gas: o, gasPrice: i, maxFeePerGas: c, maxPriorityFeePerGas: u, nonce: d, to: l, value: f }) {
|
|
2119
|
+
var p;
|
|
2120
|
+
const y = Ze({
|
|
2121
|
+
from: n == null ? void 0 : n.address,
|
|
2122
|
+
to: l,
|
|
2123
|
+
value: typeof f < "u" && `${Xt(f)} ${((p = s == null ? void 0 : s.nativeCurrency) == null ? void 0 : p.symbol) || "ETH"}`,
|
|
2124
|
+
data: a,
|
|
2125
|
+
gas: o,
|
|
2126
|
+
gasPrice: typeof i < "u" && `${J(i)} gwei`,
|
|
2127
|
+
maxFeePerGas: typeof c < "u" && `${J(c)} gwei`,
|
|
2128
|
+
maxPriorityFeePerGas: typeof u < "u" && `${J(u)} gwei`,
|
|
2129
|
+
nonce: d
|
|
2130
|
+
});
|
|
2131
|
+
super(t.shortMessage, {
|
|
2132
|
+
cause: t,
|
|
2133
|
+
docsPath: r,
|
|
2134
|
+
metaMessages: [
|
|
2135
|
+
...t.metaMessages ? [...t.metaMessages, " "] : [],
|
|
2136
|
+
"Estimate Gas Arguments:",
|
|
2137
|
+
y
|
|
2138
|
+
].filter(Boolean),
|
|
2139
|
+
name: "EstimateGasExecutionError"
|
|
2140
|
+
}), Object.defineProperty(this, "cause", {
|
|
2141
|
+
enumerable: !0,
|
|
2142
|
+
configurable: !0,
|
|
2143
|
+
writable: !0,
|
|
2144
|
+
value: void 0
|
|
2145
|
+
}), this.cause = t;
|
|
2146
|
+
}
|
|
2147
|
+
}
|
|
2148
|
+
function wt(e, t) {
|
|
2149
|
+
const n = (e.details || "").toLowerCase(), r = e instanceof h ? e.walk((s) => (s == null ? void 0 : s.code) === de.code) : e;
|
|
2150
|
+
return r instanceof h ? new de({
|
|
2151
|
+
cause: e,
|
|
2152
|
+
message: r.details
|
|
2153
|
+
}) : de.nodeMessage.test(n) ? new de({
|
|
2154
|
+
cause: e,
|
|
2155
|
+
message: e.details
|
|
2156
|
+
}) : Ne.nodeMessage.test(n) ? new Ne({
|
|
2157
|
+
cause: e,
|
|
2158
|
+
maxFeePerGas: t == null ? void 0 : t.maxFeePerGas
|
|
2159
|
+
}) : Ft.nodeMessage.test(n) ? new Ft({
|
|
2160
|
+
cause: e,
|
|
2161
|
+
maxFeePerGas: t == null ? void 0 : t.maxFeePerGas
|
|
2162
|
+
}) : Mt.nodeMessage.test(n) ? new Mt({ cause: e, nonce: t == null ? void 0 : t.nonce }) : St.nodeMessage.test(n) ? new St({ cause: e, nonce: t == null ? void 0 : t.nonce }) : Ct.nodeMessage.test(n) ? new Ct({ cause: e, nonce: t == null ? void 0 : t.nonce }) : Tt.nodeMessage.test(n) ? new Tt({ cause: e }) : kt.nodeMessage.test(n) ? new kt({ cause: e, gas: t == null ? void 0 : t.gas }) : Bt.nodeMessage.test(n) ? new Bt({ cause: e, gas: t == null ? void 0 : t.gas }) : Rt.nodeMessage.test(n) ? new Rt({ cause: e }) : Oe.nodeMessage.test(n) ? new Oe({
|
|
2163
|
+
cause: e,
|
|
2164
|
+
maxFeePerGas: t == null ? void 0 : t.maxFeePerGas,
|
|
2165
|
+
maxPriorityFeePerGas: t == null ? void 0 : t.maxPriorityFeePerGas
|
|
2166
|
+
}) : new we({
|
|
2167
|
+
cause: e
|
|
2168
|
+
});
|
|
2169
|
+
}
|
|
2170
|
+
function Hs(e, { docsPath: t, ...n }) {
|
|
2171
|
+
const r = (() => {
|
|
2172
|
+
const s = wt(e, n);
|
|
2173
|
+
return s instanceof we ? e : s;
|
|
2174
|
+
})();
|
|
2175
|
+
return new Ls(r, {
|
|
2176
|
+
docsPath: t,
|
|
2177
|
+
...n
|
|
2178
|
+
});
|
|
2179
|
+
}
|
|
2180
|
+
function vt(e, { format: t }) {
|
|
2181
|
+
if (!t)
|
|
2182
|
+
return {};
|
|
2183
|
+
const n = {};
|
|
2184
|
+
function r(a) {
|
|
2185
|
+
const o = Object.keys(a);
|
|
2186
|
+
for (const i of o)
|
|
2187
|
+
i in e && (n[i] = e[i]), a[i] && typeof a[i] == "object" && !Array.isArray(a[i]) && r(a[i]);
|
|
2188
|
+
}
|
|
2189
|
+
const s = t(e || {});
|
|
2190
|
+
return r(s), n;
|
|
2191
|
+
}
|
|
2192
|
+
const qs = {
|
|
2193
|
+
legacy: "0x0",
|
|
2194
|
+
eip2930: "0x1",
|
|
2195
|
+
eip1559: "0x2",
|
|
2196
|
+
eip4844: "0x3",
|
|
2197
|
+
eip7702: "0x4"
|
|
2198
|
+
};
|
|
2199
|
+
function xt(e) {
|
|
2200
|
+
const t = {};
|
|
2201
|
+
return typeof e.authorizationList < "u" && (t.authorizationList = Us(e.authorizationList)), typeof e.accessList < "u" && (t.accessList = e.accessList), typeof e.blobVersionedHashes < "u" && (t.blobVersionedHashes = e.blobVersionedHashes), typeof e.blobs < "u" && (typeof e.blobs[0] != "string" ? t.blobs = e.blobs.map((n) => Y(n)) : t.blobs = e.blobs), typeof e.data < "u" && (t.data = e.data), typeof e.from < "u" && (t.from = e.from), typeof e.gas < "u" && (t.gas = v(e.gas)), typeof e.gasPrice < "u" && (t.gasPrice = v(e.gasPrice)), typeof e.maxFeePerBlobGas < "u" && (t.maxFeePerBlobGas = v(e.maxFeePerBlobGas)), typeof e.maxFeePerGas < "u" && (t.maxFeePerGas = v(e.maxFeePerGas)), typeof e.maxPriorityFeePerGas < "u" && (t.maxPriorityFeePerGas = v(e.maxPriorityFeePerGas)), typeof e.nonce < "u" && (t.nonce = v(e.nonce)), typeof e.to < "u" && (t.to = e.to), typeof e.type < "u" && (t.type = qs[e.type]), typeof e.value < "u" && (t.value = v(e.value)), t;
|
|
2202
|
+
}
|
|
2203
|
+
function Us(e) {
|
|
2204
|
+
return e.map((t) => ({
|
|
2205
|
+
address: t.contractAddress,
|
|
2206
|
+
r: t.r,
|
|
2207
|
+
s: t.s,
|
|
2208
|
+
chainId: v(t.chainId),
|
|
2209
|
+
nonce: v(t.nonce),
|
|
2210
|
+
...typeof t.yParity < "u" ? { yParity: v(t.yParity) } : {},
|
|
2211
|
+
...typeof t.v < "u" && typeof t.yParity > "u" ? { v: v(t.v) } : {}
|
|
2212
|
+
}));
|
|
2213
|
+
}
|
|
2214
|
+
function qt(e) {
|
|
2215
|
+
if (!(!e || e.length === 0))
|
|
2216
|
+
return e.reduce((t, { slot: n, value: r }) => {
|
|
2217
|
+
if (n.length !== 66)
|
|
2218
|
+
throw new It({
|
|
2219
|
+
size: n.length,
|
|
2220
|
+
targetSize: 66,
|
|
2221
|
+
type: "hex"
|
|
2222
|
+
});
|
|
2223
|
+
if (r.length !== 66)
|
|
2224
|
+
throw new It({
|
|
2225
|
+
size: r.length,
|
|
2226
|
+
targetSize: 66,
|
|
2227
|
+
type: "hex"
|
|
2228
|
+
});
|
|
2229
|
+
return t[n] = r, t;
|
|
2230
|
+
}, {});
|
|
2231
|
+
}
|
|
2232
|
+
function Vs(e) {
|
|
2233
|
+
const { balance: t, nonce: n, state: r, stateDiff: s, code: a } = e, o = {};
|
|
2234
|
+
if (a !== void 0 && (o.code = a), t !== void 0 && (o.balance = v(t)), n !== void 0 && (o.nonce = v(n)), r !== void 0 && (o.state = qt(r)), s !== void 0) {
|
|
2235
|
+
if (o.state)
|
|
2236
|
+
throw new Ms();
|
|
2237
|
+
o.stateDiff = qt(s);
|
|
2238
|
+
}
|
|
2239
|
+
return o;
|
|
2240
|
+
}
|
|
2241
|
+
function xn(e) {
|
|
2242
|
+
if (!e)
|
|
2243
|
+
return;
|
|
2244
|
+
const t = {};
|
|
2245
|
+
for (const { address: n, ...r } of e) {
|
|
2246
|
+
if (!H(n, { strict: !1 }))
|
|
2247
|
+
throw new te({ address: n });
|
|
2248
|
+
if (t[n])
|
|
2249
|
+
throw new Fs({ address: n });
|
|
2250
|
+
t[n] = Vs(r);
|
|
2251
|
+
}
|
|
2252
|
+
return t;
|
|
2253
|
+
}
|
|
2254
|
+
function Fe(e) {
|
|
2255
|
+
const { account: t, gasPrice: n, maxFeePerGas: r, maxPriorityFeePerGas: s, to: a } = e, o = t ? U(t) : void 0;
|
|
2256
|
+
if (o && !H(o.address))
|
|
2257
|
+
throw new te({ address: o.address });
|
|
2258
|
+
if (a && !H(a))
|
|
2259
|
+
throw new te({ address: a });
|
|
2260
|
+
if (typeof n < "u" && (typeof r < "u" || typeof s < "u"))
|
|
2261
|
+
throw new _n();
|
|
2262
|
+
if (r && r > Ln)
|
|
2263
|
+
throw new Ne({ maxFeePerGas: r });
|
|
2264
|
+
if (s && r && s > r)
|
|
2265
|
+
throw new Oe({ maxFeePerGas: r, maxPriorityFeePerGas: s });
|
|
2266
|
+
}
|
|
2267
|
+
class Zs extends h {
|
|
2268
|
+
constructor() {
|
|
2269
|
+
super("`baseFeeMultiplier` must be greater than 1.", {
|
|
2270
|
+
name: "BaseFeeScalarError"
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
}
|
|
2274
|
+
class Pt extends h {
|
|
2275
|
+
constructor() {
|
|
2276
|
+
super("Chain does not support EIP-1559 fees.", {
|
|
2277
|
+
name: "Eip1559FeesNotSupportedError"
|
|
2278
|
+
});
|
|
2279
|
+
}
|
|
2280
|
+
}
|
|
2281
|
+
class Ws extends h {
|
|
2282
|
+
constructor({ maxPriorityFeePerGas: t }) {
|
|
2283
|
+
super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${J(t)} gwei).`, { name: "MaxFeePerGasTooLowError" });
|
|
2284
|
+
}
|
|
2285
|
+
}
|
|
2286
|
+
class Ks extends h {
|
|
2287
|
+
constructor({ blockHash: t, blockNumber: n }) {
|
|
2288
|
+
let r = "Block";
|
|
2289
|
+
t && (r = `Block at hash "${t}"`), n && (r = `Block at number "${n}"`), super(`${r} could not be found.`, { name: "BlockNotFoundError" });
|
|
2290
|
+
}
|
|
2291
|
+
}
|
|
2292
|
+
async function me(e, { blockHash: t, blockNumber: n, blockTag: r, includeTransactions: s } = {}) {
|
|
2293
|
+
var d, l, f;
|
|
2294
|
+
const a = r ?? "latest", o = s ?? !1, i = n !== void 0 ? v(n) : void 0;
|
|
2295
|
+
let c = null;
|
|
2296
|
+
if (t ? c = await e.request({
|
|
2297
|
+
method: "eth_getBlockByHash",
|
|
2298
|
+
params: [t, o]
|
|
2299
|
+
}, { dedupe: !0 }) : c = await e.request({
|
|
2300
|
+
method: "eth_getBlockByNumber",
|
|
2301
|
+
params: [i || a, o]
|
|
2302
|
+
}, { dedupe: !!i }), !c)
|
|
2303
|
+
throw new Ks({ blockHash: t, blockNumber: n });
|
|
2304
|
+
return (((f = (l = (d = e.chain) == null ? void 0 : d.formatters) == null ? void 0 : l.block) == null ? void 0 : f.format) || Hn)(c);
|
|
2305
|
+
}
|
|
2306
|
+
async function Pn(e) {
|
|
2307
|
+
const t = await e.request({
|
|
2308
|
+
method: "eth_gasPrice"
|
|
2309
|
+
});
|
|
2310
|
+
return BigInt(t);
|
|
2311
|
+
}
|
|
2312
|
+
async function No(e, t) {
|
|
2313
|
+
return En(e, t);
|
|
2314
|
+
}
|
|
2315
|
+
async function En(e, t) {
|
|
2316
|
+
var a, o;
|
|
2317
|
+
const { block: n, chain: r = e.chain, request: s } = t || {};
|
|
2318
|
+
try {
|
|
2319
|
+
const i = ((a = r == null ? void 0 : r.fees) == null ? void 0 : a.maxPriorityFeePerGas) ?? ((o = r == null ? void 0 : r.fees) == null ? void 0 : o.defaultPriorityFee);
|
|
2320
|
+
if (typeof i == "function") {
|
|
2321
|
+
const u = n || await A(e, me, "getBlock")({}), d = await i({
|
|
2322
|
+
block: u,
|
|
2323
|
+
client: e,
|
|
2324
|
+
request: s
|
|
2325
|
+
});
|
|
2326
|
+
if (d === null)
|
|
2327
|
+
throw new Error();
|
|
2328
|
+
return d;
|
|
2329
|
+
}
|
|
2330
|
+
if (typeof i < "u")
|
|
2331
|
+
return i;
|
|
2332
|
+
const c = await e.request({
|
|
2333
|
+
method: "eth_maxPriorityFeePerGas"
|
|
2334
|
+
});
|
|
2335
|
+
return fe(c);
|
|
2336
|
+
} catch {
|
|
2337
|
+
const [i, c] = await Promise.all([
|
|
2338
|
+
n ? Promise.resolve(n) : A(e, me, "getBlock")({}),
|
|
2339
|
+
A(e, Pn, "getGasPrice")({})
|
|
2340
|
+
]);
|
|
2341
|
+
if (typeof i.baseFeePerGas != "bigint")
|
|
2342
|
+
throw new Pt();
|
|
2343
|
+
const u = c - i.baseFeePerGas;
|
|
2344
|
+
return u < 0n ? 0n : u;
|
|
2345
|
+
}
|
|
2346
|
+
}
|
|
2347
|
+
async function Oo(e, t) {
|
|
2348
|
+
return He(e, t);
|
|
2349
|
+
}
|
|
2350
|
+
async function He(e, t) {
|
|
2351
|
+
var f, y;
|
|
2352
|
+
const { block: n, chain: r = e.chain, request: s, type: a = "eip1559" } = t || {}, o = await (async () => {
|
|
2353
|
+
var p, b;
|
|
2354
|
+
return typeof ((p = r == null ? void 0 : r.fees) == null ? void 0 : p.baseFeeMultiplier) == "function" ? r.fees.baseFeeMultiplier({
|
|
2355
|
+
block: n,
|
|
2356
|
+
client: e,
|
|
2357
|
+
request: s
|
|
2358
|
+
}) : ((b = r == null ? void 0 : r.fees) == null ? void 0 : b.baseFeeMultiplier) ?? 1.2;
|
|
2359
|
+
})();
|
|
2360
|
+
if (o < 1)
|
|
2361
|
+
throw new Zs();
|
|
2362
|
+
const c = 10 ** (((f = o.toString().split(".")[1]) == null ? void 0 : f.length) ?? 0), u = (p) => p * BigInt(Math.ceil(o * c)) / BigInt(c), d = n || await A(e, me, "getBlock")({});
|
|
2363
|
+
if (typeof ((y = r == null ? void 0 : r.fees) == null ? void 0 : y.estimateFeesPerGas) == "function") {
|
|
2364
|
+
const p = await r.fees.estimateFeesPerGas({
|
|
2365
|
+
block: n,
|
|
2366
|
+
client: e,
|
|
2367
|
+
multiply: u,
|
|
2368
|
+
request: s,
|
|
2369
|
+
type: a
|
|
2370
|
+
});
|
|
2371
|
+
if (p !== null)
|
|
2372
|
+
return p;
|
|
2373
|
+
}
|
|
2374
|
+
if (a === "eip1559") {
|
|
2375
|
+
if (typeof d.baseFeePerGas != "bigint")
|
|
2376
|
+
throw new Pt();
|
|
2377
|
+
const p = typeof (s == null ? void 0 : s.maxPriorityFeePerGas) == "bigint" ? s.maxPriorityFeePerGas : await En(e, {
|
|
2378
|
+
block: d,
|
|
2379
|
+
chain: r,
|
|
2380
|
+
request: s
|
|
2381
|
+
}), b = u(d.baseFeePerGas);
|
|
2382
|
+
return {
|
|
2383
|
+
maxFeePerGas: (s == null ? void 0 : s.maxFeePerGas) ?? b + p,
|
|
2384
|
+
maxPriorityFeePerGas: p
|
|
2385
|
+
};
|
|
2386
|
+
}
|
|
2387
|
+
return {
|
|
2388
|
+
gasPrice: (s == null ? void 0 : s.gasPrice) ?? u(await A(e, Pn, "getGasPrice")({}))
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
async function Js(e, { address: t, blockTag: n = "latest", blockNumber: r }) {
|
|
2392
|
+
const s = await e.request({
|
|
2393
|
+
method: "eth_getTransactionCount",
|
|
2394
|
+
params: [t, r ? v(r) : n]
|
|
2395
|
+
}, { dedupe: !!r });
|
|
2396
|
+
return ge(s);
|
|
2397
|
+
}
|
|
2398
|
+
async function $n(e) {
|
|
2399
|
+
const t = await e.request({
|
|
2400
|
+
method: "eth_chainId"
|
|
2401
|
+
}, { dedupe: !0 });
|
|
2402
|
+
return ge(t);
|
|
2403
|
+
}
|
|
2404
|
+
const An = [
|
|
2405
|
+
"blobVersionedHashes",
|
|
2406
|
+
"chainId",
|
|
2407
|
+
"fees",
|
|
2408
|
+
"gas",
|
|
2409
|
+
"nonce",
|
|
2410
|
+
"type"
|
|
2411
|
+
];
|
|
2412
|
+
async function Fn(e, t) {
|
|
2413
|
+
const { account: n = e.account, blobs: r, chain: s, gas: a, kzg: o, nonce: i, nonceManager: c, parameters: u = An, type: d } = t, l = n && U(n), f = { ...t, ...l ? { from: l == null ? void 0 : l.address } : {} };
|
|
2414
|
+
let y;
|
|
2415
|
+
async function p() {
|
|
2416
|
+
return y || (y = await A(e, me, "getBlock")({ blockTag: "latest" }), y);
|
|
2417
|
+
}
|
|
2418
|
+
let b;
|
|
2419
|
+
async function m() {
|
|
2420
|
+
return b || (s ? s.id : typeof t.chainId < "u" ? t.chainId : (b = await A(e, $n, "getChainId")({}), b));
|
|
2421
|
+
}
|
|
2422
|
+
if ((u.includes("blobVersionedHashes") || u.includes("sidecars")) && r && o) {
|
|
2423
|
+
const w = qn({ blobs: r, kzg: o });
|
|
2424
|
+
if (u.includes("blobVersionedHashes")) {
|
|
2425
|
+
const g = Un({
|
|
2426
|
+
commitments: w,
|
|
2427
|
+
to: "hex"
|
|
2428
|
+
});
|
|
2429
|
+
f.blobVersionedHashes = g;
|
|
2430
|
+
}
|
|
2431
|
+
if (u.includes("sidecars")) {
|
|
2432
|
+
const g = Vn({ blobs: r, commitments: w, kzg: o }), x = Zn({
|
|
2433
|
+
blobs: r,
|
|
2434
|
+
commitments: w,
|
|
2435
|
+
proofs: g,
|
|
2436
|
+
to: "hex"
|
|
2437
|
+
});
|
|
2438
|
+
f.sidecars = x;
|
|
2439
|
+
}
|
|
2440
|
+
}
|
|
2441
|
+
if (u.includes("chainId") && (f.chainId = await m()), u.includes("nonce") && typeof i > "u" && l)
|
|
2442
|
+
if (c) {
|
|
2443
|
+
const w = await m();
|
|
2444
|
+
f.nonce = await c.consume({
|
|
2445
|
+
address: l.address,
|
|
2446
|
+
chainId: w,
|
|
2447
|
+
client: e
|
|
2448
|
+
});
|
|
2449
|
+
} else
|
|
2450
|
+
f.nonce = await A(e, Js, "getTransactionCount")({
|
|
2451
|
+
address: l.address,
|
|
2452
|
+
blockTag: "pending"
|
|
2453
|
+
});
|
|
2454
|
+
if ((u.includes("fees") || u.includes("type")) && typeof d > "u")
|
|
2455
|
+
try {
|
|
2456
|
+
f.type = Wn(f);
|
|
2457
|
+
} catch {
|
|
2458
|
+
const w = await p();
|
|
2459
|
+
f.type = typeof (w == null ? void 0 : w.baseFeePerGas) == "bigint" ? "eip1559" : "legacy";
|
|
2460
|
+
}
|
|
2461
|
+
if (u.includes("fees"))
|
|
2462
|
+
if (f.type !== "legacy" && f.type !== "eip2930") {
|
|
2463
|
+
if (typeof f.maxFeePerGas > "u" || typeof f.maxPriorityFeePerGas > "u") {
|
|
2464
|
+
const w = await p(), { maxFeePerGas: g, maxPriorityFeePerGas: x } = await He(e, {
|
|
2465
|
+
block: w,
|
|
2466
|
+
chain: s,
|
|
2467
|
+
request: f
|
|
2468
|
+
});
|
|
2469
|
+
if (typeof t.maxPriorityFeePerGas > "u" && t.maxFeePerGas && t.maxFeePerGas < x)
|
|
2470
|
+
throw new Ws({
|
|
2471
|
+
maxPriorityFeePerGas: x
|
|
2472
|
+
});
|
|
2473
|
+
f.maxPriorityFeePerGas = x, f.maxFeePerGas = g;
|
|
2474
|
+
}
|
|
2475
|
+
} else {
|
|
2476
|
+
if (typeof t.maxFeePerGas < "u" || typeof t.maxPriorityFeePerGas < "u")
|
|
2477
|
+
throw new Pt();
|
|
2478
|
+
const w = await p(), { gasPrice: g } = await He(e, {
|
|
2479
|
+
block: w,
|
|
2480
|
+
chain: s,
|
|
2481
|
+
request: f,
|
|
2482
|
+
type: "legacy"
|
|
2483
|
+
});
|
|
2484
|
+
f.gasPrice = g;
|
|
2485
|
+
}
|
|
2486
|
+
return u.includes("gas") && typeof a > "u" && (f.gas = await A(e, Mn, "estimateGas")({
|
|
2487
|
+
...f,
|
|
2488
|
+
account: l && { address: l.address, type: "json-rpc" }
|
|
2489
|
+
})), Fe(f), delete f.parameters, f;
|
|
2490
|
+
}
|
|
2491
|
+
async function Ys(e, { address: t, blockNumber: n, blockTag: r = "latest" }) {
|
|
2492
|
+
const s = n ? v(n) : void 0, a = await e.request({
|
|
2493
|
+
method: "eth_getBalance",
|
|
2494
|
+
params: [t, s || r]
|
|
2495
|
+
});
|
|
2496
|
+
return BigInt(a);
|
|
2497
|
+
}
|
|
2498
|
+
async function Mn(e, t) {
|
|
2499
|
+
var s, a, o;
|
|
2500
|
+
const { account: n = e.account } = t, r = n ? U(n) : void 0;
|
|
2501
|
+
try {
|
|
2502
|
+
let O = function(k) {
|
|
2503
|
+
const { block: z, request: j, rpcStateOverride: Z } = k;
|
|
2504
|
+
return e.request({
|
|
2505
|
+
method: "eth_estimateGas",
|
|
2506
|
+
params: Z ? [j, z ?? "latest", Z] : z ? [j, z] : [j]
|
|
2507
|
+
});
|
|
2508
|
+
};
|
|
2509
|
+
const { accessList: i, authorizationList: c, blobs: u, blobVersionedHashes: d, blockNumber: l, blockTag: f, data: y, gas: p, gasPrice: b, maxFeePerBlobGas: m, maxFeePerGas: w, maxPriorityFeePerGas: g, nonce: x, value: $, stateOverride: F, ...M } = await Fn(e, {
|
|
2510
|
+
...t,
|
|
2511
|
+
parameters: (
|
|
2512
|
+
// Some RPC Providers do not compute versioned hashes from blobs. We will need
|
|
2513
|
+
// to compute them.
|
|
2514
|
+
(r == null ? void 0 : r.type) === "local" ? void 0 : ["blobVersionedHashes"]
|
|
2515
|
+
)
|
|
2516
|
+
}), P = (l ? v(l) : void 0) || f, E = xn(F), _ = await (async () => {
|
|
2517
|
+
if (M.to)
|
|
2518
|
+
return M.to;
|
|
2519
|
+
if (c && c.length > 0)
|
|
2520
|
+
return await vn({
|
|
2521
|
+
authorization: c[0]
|
|
2522
|
+
}).catch(() => {
|
|
2523
|
+
throw new h("`to` is required. Could not infer from `authorizationList`");
|
|
2524
|
+
});
|
|
2525
|
+
})();
|
|
2526
|
+
Fe(t);
|
|
2527
|
+
const T = (o = (a = (s = e.chain) == null ? void 0 : s.formatters) == null ? void 0 : a.transactionRequest) == null ? void 0 : o.format, S = (T || xt)({
|
|
2528
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
2529
|
+
...vt(M, { format: T }),
|
|
2530
|
+
from: r == null ? void 0 : r.address,
|
|
2531
|
+
accessList: i,
|
|
2532
|
+
authorizationList: c,
|
|
2533
|
+
blobs: u,
|
|
2534
|
+
blobVersionedHashes: d,
|
|
2535
|
+
data: y,
|
|
2536
|
+
gas: p,
|
|
2537
|
+
gasPrice: b,
|
|
2538
|
+
maxFeePerBlobGas: m,
|
|
2539
|
+
maxFeePerGas: w,
|
|
2540
|
+
maxPriorityFeePerGas: g,
|
|
2541
|
+
nonce: x,
|
|
2542
|
+
to: _,
|
|
2543
|
+
value: $
|
|
2544
|
+
});
|
|
2545
|
+
let I = BigInt(await O({ block: P, request: S, rpcStateOverride: E }));
|
|
2546
|
+
if (c) {
|
|
2547
|
+
const k = await Ys(e, { address: S.from }), z = await Promise.all(c.map(async (j) => {
|
|
2548
|
+
const { contractAddress: Z } = j, X = await O({
|
|
2549
|
+
block: P,
|
|
2550
|
+
request: {
|
|
2551
|
+
authorizationList: void 0,
|
|
2552
|
+
data: y,
|
|
2553
|
+
from: r == null ? void 0 : r.address,
|
|
2554
|
+
to: Z,
|
|
2555
|
+
value: v(k)
|
|
2556
|
+
},
|
|
2557
|
+
rpcStateOverride: E
|
|
2558
|
+
}).catch(() => 100000n);
|
|
2559
|
+
return 2n * BigInt(X);
|
|
2560
|
+
}));
|
|
2561
|
+
I += z.reduce((j, Z) => j + Z, 0n);
|
|
2562
|
+
}
|
|
2563
|
+
return I;
|
|
2564
|
+
} catch (i) {
|
|
2565
|
+
throw Hs(i, {
|
|
2566
|
+
...t,
|
|
2567
|
+
account: r,
|
|
2568
|
+
chain: e.chain
|
|
2569
|
+
});
|
|
2570
|
+
}
|
|
2571
|
+
}
|
|
2572
|
+
async function zo(e, t) {
|
|
2573
|
+
const { abi: n, address: r, args: s, functionName: a, dataSuffix: o, ...i } = t, c = ue({
|
|
2574
|
+
abi: n,
|
|
2575
|
+
args: s,
|
|
2576
|
+
functionName: a
|
|
2577
|
+
});
|
|
2578
|
+
try {
|
|
2579
|
+
return await A(e, Mn, "estimateGas")({
|
|
2580
|
+
data: `${c}${o ? o.replace("0x", "") : ""}`,
|
|
2581
|
+
to: r,
|
|
2582
|
+
...i
|
|
2583
|
+
});
|
|
2584
|
+
} catch (u) {
|
|
2585
|
+
const d = i.account ? U(i.account) : void 0;
|
|
2586
|
+
throw Ae(u, {
|
|
2587
|
+
abi: n,
|
|
2588
|
+
address: r,
|
|
2589
|
+
args: s,
|
|
2590
|
+
docsPath: "/docs/contract/estimateContractGas",
|
|
2591
|
+
functionName: a,
|
|
2592
|
+
sender: d == null ? void 0 : d.address
|
|
2593
|
+
});
|
|
2594
|
+
}
|
|
2595
|
+
}
|
|
2596
|
+
function Xs(e, t) {
|
|
2597
|
+
if (!H(e, { strict: !1 }))
|
|
2598
|
+
throw new te({ address: e });
|
|
2599
|
+
if (!H(t, { strict: !1 }))
|
|
2600
|
+
throw new te({ address: t });
|
|
2601
|
+
return e.toLowerCase() === t.toLowerCase();
|
|
2602
|
+
}
|
|
2603
|
+
const Ut = "/docs/contract/decodeEventLog";
|
|
2604
|
+
function Sn(e) {
|
|
2605
|
+
const { abi: t, data: n, strict: r, topics: s } = e, a = r ?? !0, [o, ...i] = s;
|
|
2606
|
+
if (!o)
|
|
2607
|
+
throw new Lr({ docsPath: Ut });
|
|
2608
|
+
const c = t.length === 1 ? t[0] : t.find((b) => b.type === "event" && o === xe(q(b)));
|
|
2609
|
+
if (!(c && "name" in c) || c.type !== "event")
|
|
2610
|
+
throw new bn(o, { docsPath: Ut });
|
|
2611
|
+
const { name: u, inputs: d } = c, l = d == null ? void 0 : d.some((b) => !("name" in b && b.name));
|
|
2612
|
+
let f = l ? [] : {};
|
|
2613
|
+
const y = d.filter((b) => "indexed" in b && b.indexed);
|
|
2614
|
+
for (let b = 0; b < y.length; b++) {
|
|
2615
|
+
const m = y[b], w = i[b];
|
|
2616
|
+
if (!w)
|
|
2617
|
+
throw new Ke({
|
|
2618
|
+
abiItem: c,
|
|
2619
|
+
param: m
|
|
2620
|
+
});
|
|
2621
|
+
f[l ? b : m.name || b] = Qs({ param: m, value: w });
|
|
2622
|
+
}
|
|
2623
|
+
const p = d.filter((b) => !("indexed" in b && b.indexed));
|
|
2624
|
+
if (p.length > 0) {
|
|
2625
|
+
if (n && n !== "0x")
|
|
2626
|
+
try {
|
|
2627
|
+
const b = Pe(p, n);
|
|
2628
|
+
if (b)
|
|
2629
|
+
if (l)
|
|
2630
|
+
f = [...f, ...b];
|
|
2631
|
+
else
|
|
2632
|
+
for (let m = 0; m < p.length; m++)
|
|
2633
|
+
f[p[m].name] = b[m];
|
|
2634
|
+
} catch (b) {
|
|
2635
|
+
if (a)
|
|
2636
|
+
throw b instanceof pn || b instanceof Kn ? new be({
|
|
2637
|
+
abiItem: c,
|
|
2638
|
+
data: n,
|
|
2639
|
+
params: p,
|
|
2640
|
+
size: D(n)
|
|
2641
|
+
}) : b;
|
|
2642
|
+
}
|
|
2643
|
+
else if (a)
|
|
2644
|
+
throw new be({
|
|
2645
|
+
abiItem: c,
|
|
2646
|
+
data: "0x",
|
|
2647
|
+
params: p,
|
|
2648
|
+
size: 0
|
|
2649
|
+
});
|
|
2650
|
+
}
|
|
2651
|
+
return {
|
|
2652
|
+
eventName: u,
|
|
2653
|
+
args: Object.values(f).length > 0 ? f : void 0
|
|
2654
|
+
};
|
|
2655
|
+
}
|
|
2656
|
+
function Qs({ param: e, value: t }) {
|
|
2657
|
+
return e.type === "string" || e.type === "bytes" || e.type === "tuple" || e.type.match(/^(.*)\[(\d+)?\]$/) ? t : (Pe([e], t) || [])[0];
|
|
2658
|
+
}
|
|
2659
|
+
function Cn(e) {
|
|
2660
|
+
const { abi: t, args: n, logs: r, strict: s = !0 } = e, a = (() => {
|
|
2661
|
+
if (e.eventName)
|
|
2662
|
+
return Array.isArray(e.eventName) ? e.eventName : [e.eventName];
|
|
2663
|
+
})();
|
|
2664
|
+
return r.map((o) => {
|
|
2665
|
+
var i;
|
|
2666
|
+
try {
|
|
2667
|
+
const c = t.find((d) => d.type === "event" && o.topics[0] === xe(d));
|
|
2668
|
+
if (!c)
|
|
2669
|
+
return null;
|
|
2670
|
+
const u = Sn({
|
|
2671
|
+
...o,
|
|
2672
|
+
abi: [c],
|
|
2673
|
+
strict: s
|
|
2674
|
+
});
|
|
2675
|
+
return a && !a.includes(u.eventName) || !eo({
|
|
2676
|
+
args: u.args,
|
|
2677
|
+
inputs: c.inputs,
|
|
2678
|
+
matchArgs: n
|
|
2679
|
+
}) ? null : { ...u, ...o };
|
|
2680
|
+
} catch (c) {
|
|
2681
|
+
let u, d;
|
|
2682
|
+
if (c instanceof bn)
|
|
2683
|
+
return null;
|
|
2684
|
+
if (c instanceof be || c instanceof Ke) {
|
|
2685
|
+
if (s)
|
|
2686
|
+
return null;
|
|
2687
|
+
u = c.abiItem.name, d = (i = c.abiItem.inputs) == null ? void 0 : i.some((l) => !("name" in l && l.name));
|
|
2688
|
+
}
|
|
2689
|
+
return { ...o, args: d ? [] : {}, eventName: u };
|
|
2690
|
+
}
|
|
2691
|
+
}).filter(Boolean);
|
|
2692
|
+
}
|
|
2693
|
+
function eo(e) {
|
|
2694
|
+
const { args: t, inputs: n, matchArgs: r } = e;
|
|
2695
|
+
if (!r)
|
|
2696
|
+
return !0;
|
|
2697
|
+
if (!t)
|
|
2698
|
+
return !1;
|
|
2699
|
+
function s(a, o, i) {
|
|
2700
|
+
try {
|
|
2701
|
+
return a.type === "address" ? Xs(o, i) : a.type === "string" || a.type === "bytes" ? ie(qe(o)) === i : o === i;
|
|
2702
|
+
} catch {
|
|
2703
|
+
return !1;
|
|
2704
|
+
}
|
|
2705
|
+
}
|
|
2706
|
+
return Array.isArray(t) && Array.isArray(r) ? r.every((a, o) => {
|
|
2707
|
+
if (a == null)
|
|
2708
|
+
return !0;
|
|
2709
|
+
const i = n[o];
|
|
2710
|
+
return i ? (Array.isArray(a) ? a : [a]).some((u) => s(i, u, t[o])) : !1;
|
|
2711
|
+
}) : typeof t == "object" && !Array.isArray(t) && typeof r == "object" && !Array.isArray(r) ? Object.entries(r).every(([a, o]) => {
|
|
2712
|
+
if (o == null)
|
|
2713
|
+
return !0;
|
|
2714
|
+
const i = n.find((u) => u.name === a);
|
|
2715
|
+
return i ? (Array.isArray(o) ? o : [o]).some((u) => s(i, u, t[a])) : !1;
|
|
2716
|
+
}) : !1;
|
|
2717
|
+
}
|
|
2718
|
+
async function to(e, { address: t, blockHash: n, fromBlock: r, toBlock: s, event: a, events: o, args: i, strict: c } = {}) {
|
|
2719
|
+
const u = c ?? !1, d = o ?? (a ? [a] : void 0);
|
|
2720
|
+
let l = [];
|
|
2721
|
+
d && (l = [d.flatMap((b) => tt({
|
|
2722
|
+
abi: [b],
|
|
2723
|
+
eventName: b.name,
|
|
2724
|
+
args: o ? void 0 : i
|
|
2725
|
+
}))], a && (l = l[0]));
|
|
2726
|
+
let f;
|
|
2727
|
+
n ? f = await e.request({
|
|
2728
|
+
method: "eth_getLogs",
|
|
2729
|
+
params: [{ address: t, topics: l, blockHash: n }]
|
|
2730
|
+
}) : f = await e.request({
|
|
2731
|
+
method: "eth_getLogs",
|
|
2732
|
+
params: [
|
|
2733
|
+
{
|
|
2734
|
+
address: t,
|
|
2735
|
+
topics: l,
|
|
2736
|
+
fromBlock: typeof r == "bigint" ? v(r) : r,
|
|
2737
|
+
toBlock: typeof s == "bigint" ? v(s) : s
|
|
2738
|
+
}
|
|
2739
|
+
]
|
|
2740
|
+
});
|
|
2741
|
+
const y = f.map((p) => pe(p));
|
|
2742
|
+
return d ? Cn({
|
|
2743
|
+
abi: d,
|
|
2744
|
+
args: i,
|
|
2745
|
+
logs: y,
|
|
2746
|
+
strict: u
|
|
2747
|
+
}) : y;
|
|
2748
|
+
}
|
|
2749
|
+
async function no(e, t) {
|
|
2750
|
+
const { abi: n, address: r, args: s, blockHash: a, eventName: o, fromBlock: i, toBlock: c, strict: u } = t, d = o ? ce({ abi: n, name: o }) : void 0, l = d ? void 0 : n.filter((f) => f.type === "event");
|
|
2751
|
+
return A(e, to, "getLogs")({
|
|
2752
|
+
address: r,
|
|
2753
|
+
args: s,
|
|
2754
|
+
blockHash: a,
|
|
2755
|
+
event: d,
|
|
2756
|
+
events: l,
|
|
2757
|
+
fromBlock: i,
|
|
2758
|
+
toBlock: c,
|
|
2759
|
+
strict: u
|
|
2760
|
+
});
|
|
2761
|
+
}
|
|
2762
|
+
const Ce = "/docs/contract/decodeFunctionResult";
|
|
2763
|
+
function Et(e) {
|
|
2764
|
+
const { abi: t, args: n, functionName: r, data: s } = e;
|
|
2765
|
+
let a = t[0];
|
|
2766
|
+
if (r) {
|
|
2767
|
+
const i = ce({ abi: t, args: n, name: r });
|
|
2768
|
+
if (!i)
|
|
2769
|
+
throw new ye(r, { docsPath: Ce });
|
|
2770
|
+
a = i;
|
|
2771
|
+
}
|
|
2772
|
+
if (a.type !== "function")
|
|
2773
|
+
throw new ye(void 0, { docsPath: Ce });
|
|
2774
|
+
if (!a.outputs)
|
|
2775
|
+
throw new Hr(a.name, { docsPath: Ce });
|
|
2776
|
+
const o = Pe(a.outputs, s);
|
|
2777
|
+
if (o && o.length > 1)
|
|
2778
|
+
return o;
|
|
2779
|
+
if (o && o.length === 1)
|
|
2780
|
+
return o[0];
|
|
2781
|
+
}
|
|
2782
|
+
const Vt = [
|
|
2783
|
+
{
|
|
2784
|
+
inputs: [
|
|
2785
|
+
{
|
|
2786
|
+
components: [
|
|
2787
|
+
{
|
|
2788
|
+
name: "target",
|
|
2789
|
+
type: "address"
|
|
2790
|
+
},
|
|
2791
|
+
{
|
|
2792
|
+
name: "allowFailure",
|
|
2793
|
+
type: "bool"
|
|
2794
|
+
},
|
|
2795
|
+
{
|
|
2796
|
+
name: "callData",
|
|
2797
|
+
type: "bytes"
|
|
2798
|
+
}
|
|
2799
|
+
],
|
|
2800
|
+
name: "calls",
|
|
2801
|
+
type: "tuple[]"
|
|
2802
|
+
}
|
|
2803
|
+
],
|
|
2804
|
+
name: "aggregate3",
|
|
2805
|
+
outputs: [
|
|
2806
|
+
{
|
|
2807
|
+
components: [
|
|
2808
|
+
{
|
|
2809
|
+
name: "success",
|
|
2810
|
+
type: "bool"
|
|
2811
|
+
},
|
|
2812
|
+
{
|
|
2813
|
+
name: "returnData",
|
|
2814
|
+
type: "bytes"
|
|
2815
|
+
}
|
|
2816
|
+
],
|
|
2817
|
+
name: "returnData",
|
|
2818
|
+
type: "tuple[]"
|
|
2819
|
+
}
|
|
2820
|
+
],
|
|
2821
|
+
stateMutability: "view",
|
|
2822
|
+
type: "function"
|
|
2823
|
+
}
|
|
2824
|
+
], Tn = [
|
|
2825
|
+
{
|
|
2826
|
+
inputs: [],
|
|
2827
|
+
name: "ResolverNotFound",
|
|
2828
|
+
type: "error"
|
|
2829
|
+
},
|
|
2830
|
+
{
|
|
2831
|
+
inputs: [],
|
|
2832
|
+
name: "ResolverWildcardNotSupported",
|
|
2833
|
+
type: "error"
|
|
2834
|
+
},
|
|
2835
|
+
{
|
|
2836
|
+
inputs: [],
|
|
2837
|
+
name: "ResolverNotContract",
|
|
2838
|
+
type: "error"
|
|
2839
|
+
},
|
|
2840
|
+
{
|
|
2841
|
+
inputs: [
|
|
2842
|
+
{
|
|
2843
|
+
name: "returnData",
|
|
2844
|
+
type: "bytes"
|
|
2845
|
+
}
|
|
2846
|
+
],
|
|
2847
|
+
name: "ResolverError",
|
|
2848
|
+
type: "error"
|
|
2849
|
+
},
|
|
2850
|
+
{
|
|
2851
|
+
inputs: [
|
|
2852
|
+
{
|
|
2853
|
+
components: [
|
|
2854
|
+
{
|
|
2855
|
+
name: "status",
|
|
2856
|
+
type: "uint16"
|
|
2857
|
+
},
|
|
2858
|
+
{
|
|
2859
|
+
name: "message",
|
|
2860
|
+
type: "string"
|
|
2861
|
+
}
|
|
2862
|
+
],
|
|
2863
|
+
name: "errors",
|
|
2864
|
+
type: "tuple[]"
|
|
2865
|
+
}
|
|
2866
|
+
],
|
|
2867
|
+
name: "HttpError",
|
|
2868
|
+
type: "error"
|
|
2869
|
+
}
|
|
2870
|
+
], Go = [
|
|
2871
|
+
...Tn,
|
|
2872
|
+
{
|
|
2873
|
+
name: "resolve",
|
|
2874
|
+
type: "function",
|
|
2875
|
+
stateMutability: "view",
|
|
2876
|
+
inputs: [
|
|
2877
|
+
{ name: "name", type: "bytes" },
|
|
2878
|
+
{ name: "data", type: "bytes" }
|
|
2879
|
+
],
|
|
2880
|
+
outputs: [
|
|
2881
|
+
{ name: "", type: "bytes" },
|
|
2882
|
+
{ name: "address", type: "address" }
|
|
2883
|
+
]
|
|
2884
|
+
},
|
|
2885
|
+
{
|
|
2886
|
+
name: "resolve",
|
|
2887
|
+
type: "function",
|
|
2888
|
+
stateMutability: "view",
|
|
2889
|
+
inputs: [
|
|
2890
|
+
{ name: "name", type: "bytes" },
|
|
2891
|
+
{ name: "data", type: "bytes" },
|
|
2892
|
+
{ name: "gateways", type: "string[]" }
|
|
2893
|
+
],
|
|
2894
|
+
outputs: [
|
|
2895
|
+
{ name: "", type: "bytes" },
|
|
2896
|
+
{ name: "address", type: "address" }
|
|
2897
|
+
]
|
|
2898
|
+
}
|
|
2899
|
+
], Do = [
|
|
2900
|
+
...Tn,
|
|
2901
|
+
{
|
|
2902
|
+
name: "reverse",
|
|
2903
|
+
type: "function",
|
|
2904
|
+
stateMutability: "view",
|
|
2905
|
+
inputs: [{ type: "bytes", name: "reverseName" }],
|
|
2906
|
+
outputs: [
|
|
2907
|
+
{ type: "string", name: "resolvedName" },
|
|
2908
|
+
{ type: "address", name: "resolvedAddress" },
|
|
2909
|
+
{ type: "address", name: "reverseResolver" },
|
|
2910
|
+
{ type: "address", name: "resolver" }
|
|
2911
|
+
]
|
|
2912
|
+
},
|
|
2913
|
+
{
|
|
2914
|
+
name: "reverse",
|
|
2915
|
+
type: "function",
|
|
2916
|
+
stateMutability: "view",
|
|
2917
|
+
inputs: [
|
|
2918
|
+
{ type: "bytes", name: "reverseName" },
|
|
2919
|
+
{ type: "string[]", name: "gateways" }
|
|
2920
|
+
],
|
|
2921
|
+
outputs: [
|
|
2922
|
+
{ type: "string", name: "resolvedName" },
|
|
2923
|
+
{ type: "address", name: "resolvedAddress" },
|
|
2924
|
+
{ type: "address", name: "reverseResolver" },
|
|
2925
|
+
{ type: "address", name: "resolver" }
|
|
2926
|
+
]
|
|
2927
|
+
}
|
|
2928
|
+
], _o = [
|
|
2929
|
+
{
|
|
2930
|
+
name: "text",
|
|
2931
|
+
type: "function",
|
|
2932
|
+
stateMutability: "view",
|
|
2933
|
+
inputs: [
|
|
2934
|
+
{ name: "name", type: "bytes32" },
|
|
2935
|
+
{ name: "key", type: "string" }
|
|
2936
|
+
],
|
|
2937
|
+
outputs: [{ name: "", type: "string" }]
|
|
2938
|
+
}
|
|
2939
|
+
], Lo = [
|
|
2940
|
+
{
|
|
2941
|
+
name: "addr",
|
|
2942
|
+
type: "function",
|
|
2943
|
+
stateMutability: "view",
|
|
2944
|
+
inputs: [{ name: "name", type: "bytes32" }],
|
|
2945
|
+
outputs: [{ name: "", type: "address" }]
|
|
2946
|
+
},
|
|
2947
|
+
{
|
|
2948
|
+
name: "addr",
|
|
2949
|
+
type: "function",
|
|
2950
|
+
stateMutability: "view",
|
|
2951
|
+
inputs: [
|
|
2952
|
+
{ name: "name", type: "bytes32" },
|
|
2953
|
+
{ name: "coinType", type: "uint256" }
|
|
2954
|
+
],
|
|
2955
|
+
outputs: [{ name: "", type: "bytes" }]
|
|
2956
|
+
}
|
|
2957
|
+
], Ho = [
|
|
2958
|
+
{
|
|
2959
|
+
inputs: [
|
|
2960
|
+
{
|
|
2961
|
+
name: "_signer",
|
|
2962
|
+
type: "address"
|
|
2963
|
+
},
|
|
2964
|
+
{
|
|
2965
|
+
name: "_hash",
|
|
2966
|
+
type: "bytes32"
|
|
2967
|
+
},
|
|
2968
|
+
{
|
|
2969
|
+
name: "_signature",
|
|
2970
|
+
type: "bytes"
|
|
2971
|
+
}
|
|
2972
|
+
],
|
|
2973
|
+
stateMutability: "nonpayable",
|
|
2974
|
+
type: "constructor"
|
|
2975
|
+
},
|
|
2976
|
+
{
|
|
2977
|
+
inputs: [
|
|
2978
|
+
{
|
|
2979
|
+
name: "_signer",
|
|
2980
|
+
type: "address"
|
|
2981
|
+
},
|
|
2982
|
+
{
|
|
2983
|
+
name: "_hash",
|
|
2984
|
+
type: "bytes32"
|
|
2985
|
+
},
|
|
2986
|
+
{
|
|
2987
|
+
name: "_signature",
|
|
2988
|
+
type: "bytes"
|
|
2989
|
+
}
|
|
2990
|
+
],
|
|
2991
|
+
outputs: [
|
|
2992
|
+
{
|
|
2993
|
+
type: "bool"
|
|
2994
|
+
}
|
|
2995
|
+
],
|
|
2996
|
+
stateMutability: "nonpayable",
|
|
2997
|
+
type: "function",
|
|
2998
|
+
name: "isValidSig"
|
|
2999
|
+
}
|
|
3000
|
+
], ro = "0x82ad56cb", so = "0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe", oo = "0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe", qo = "0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572", Te = "/docs/contract/encodeDeployData";
|
|
3001
|
+
function kn(e) {
|
|
3002
|
+
const { abi: t, args: n, bytecode: r } = e;
|
|
3003
|
+
if (!n || n.length === 0)
|
|
3004
|
+
return r;
|
|
3005
|
+
const s = t.find((o) => "type" in o && o.type === "constructor");
|
|
3006
|
+
if (!s)
|
|
3007
|
+
throw new zr({ docsPath: Te });
|
|
3008
|
+
if (!("inputs" in s))
|
|
3009
|
+
throw new Nt({ docsPath: Te });
|
|
3010
|
+
if (!s.inputs || s.inputs.length === 0)
|
|
3011
|
+
throw new Nt({ docsPath: Te });
|
|
3012
|
+
const a = Je(s.inputs, n);
|
|
3013
|
+
return Ue([r, a]);
|
|
3014
|
+
}
|
|
3015
|
+
function ao({ blockNumber: e, chain: t, contract: n }) {
|
|
3016
|
+
var s;
|
|
3017
|
+
const r = (s = t == null ? void 0 : t.contracts) == null ? void 0 : s[n];
|
|
3018
|
+
if (!r)
|
|
3019
|
+
throw new ze({
|
|
3020
|
+
chain: t,
|
|
3021
|
+
contract: { name: n }
|
|
3022
|
+
});
|
|
3023
|
+
if (e && r.blockCreated && r.blockCreated > e)
|
|
3024
|
+
throw new ze({
|
|
3025
|
+
blockNumber: e,
|
|
3026
|
+
chain: t,
|
|
3027
|
+
contract: {
|
|
3028
|
+
name: n,
|
|
3029
|
+
blockCreated: r.blockCreated
|
|
3030
|
+
}
|
|
3031
|
+
});
|
|
3032
|
+
return r.address;
|
|
3033
|
+
}
|
|
3034
|
+
function io(e, { docsPath: t, ...n }) {
|
|
3035
|
+
const r = (() => {
|
|
3036
|
+
const s = wt(e, n);
|
|
3037
|
+
return s instanceof we ? e : s;
|
|
3038
|
+
})();
|
|
3039
|
+
return new Ts(r, {
|
|
3040
|
+
docsPath: t,
|
|
3041
|
+
...n
|
|
3042
|
+
});
|
|
3043
|
+
}
|
|
3044
|
+
function co() {
|
|
3045
|
+
let e = () => {
|
|
3046
|
+
}, t = () => {
|
|
3047
|
+
};
|
|
3048
|
+
return { promise: new Promise((r, s) => {
|
|
3049
|
+
e = r, t = s;
|
|
3050
|
+
}), resolve: e, reject: t };
|
|
3051
|
+
}
|
|
3052
|
+
const ke = /* @__PURE__ */ new Map();
|
|
3053
|
+
function uo({ fn: e, id: t, shouldSplitBatch: n, wait: r = 0, sort: s }) {
|
|
3054
|
+
const a = async () => {
|
|
3055
|
+
const d = c();
|
|
3056
|
+
o();
|
|
3057
|
+
const l = d.map(({ args: f }) => f);
|
|
3058
|
+
l.length !== 0 && e(l).then((f) => {
|
|
3059
|
+
s && Array.isArray(f) && f.sort(s);
|
|
3060
|
+
for (let y = 0; y < d.length; y++) {
|
|
3061
|
+
const { resolve: p } = d[y];
|
|
3062
|
+
p == null || p([f[y], f]);
|
|
3063
|
+
}
|
|
3064
|
+
}).catch((f) => {
|
|
3065
|
+
for (let y = 0; y < d.length; y++) {
|
|
3066
|
+
const { reject: p } = d[y];
|
|
3067
|
+
p == null || p(f);
|
|
3068
|
+
}
|
|
3069
|
+
});
|
|
3070
|
+
}, o = () => ke.delete(t), i = () => c().map(({ args: d }) => d), c = () => ke.get(t) || [], u = (d) => ke.set(t, [...c(), d]);
|
|
3071
|
+
return {
|
|
3072
|
+
flush: o,
|
|
3073
|
+
async schedule(d) {
|
|
3074
|
+
const { promise: l, resolve: f, reject: y } = co();
|
|
3075
|
+
return (n == null ? void 0 : n([...i(), d])) && a(), c().length > 0 ? (u({ args: d, resolve: f, reject: y }), l) : (u({ args: d, resolve: f, reject: y }), setTimeout(a, r), l);
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
async function Bn(e, t) {
|
|
3080
|
+
var T, N, S, O;
|
|
3081
|
+
const { account: n = e.account, batch: r = !!((T = e.batch) != null && T.multicall), blockNumber: s, blockTag: a = "latest", accessList: o, blobs: i, code: c, data: u, factory: d, factoryData: l, gas: f, gasPrice: y, maxFeePerBlobGas: p, maxFeePerGas: b, maxPriorityFeePerGas: m, nonce: w, to: g, value: x, stateOverride: $, ...F } = t, M = n ? U(n) : void 0;
|
|
3082
|
+
if (c && (d || l))
|
|
3083
|
+
throw new h("Cannot provide both `code` & `factory`/`factoryData` as parameters.");
|
|
3084
|
+
if (c && g)
|
|
3085
|
+
throw new h("Cannot provide both `code` & `to` as parameters.");
|
|
3086
|
+
const R = c && u, P = d && l && g && u, E = R || P, _ = R ? po({
|
|
3087
|
+
code: c,
|
|
3088
|
+
data: u
|
|
3089
|
+
}) : P ? yo({
|
|
3090
|
+
data: u,
|
|
3091
|
+
factory: d,
|
|
3092
|
+
factoryData: l,
|
|
3093
|
+
to: g
|
|
3094
|
+
}) : u;
|
|
3095
|
+
try {
|
|
3096
|
+
Fe(t);
|
|
3097
|
+
const k = (s ? v(s) : void 0) || a, z = xn($), j = (O = (S = (N = e.chain) == null ? void 0 : N.formatters) == null ? void 0 : S.transactionRequest) == null ? void 0 : O.format, X = (j || xt)({
|
|
3098
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
3099
|
+
...vt(F, { format: j }),
|
|
3100
|
+
from: M == null ? void 0 : M.address,
|
|
3101
|
+
accessList: o,
|
|
3102
|
+
blobs: i,
|
|
3103
|
+
data: _,
|
|
3104
|
+
gas: f,
|
|
3105
|
+
gasPrice: y,
|
|
3106
|
+
maxFeePerBlobGas: p,
|
|
3107
|
+
maxFeePerGas: b,
|
|
3108
|
+
maxPriorityFeePerGas: m,
|
|
3109
|
+
nonce: w,
|
|
3110
|
+
to: E ? void 0 : g,
|
|
3111
|
+
value: x
|
|
3112
|
+
});
|
|
3113
|
+
if (r && lo({ request: X }) && !z)
|
|
3114
|
+
try {
|
|
3115
|
+
return await fo(e, {
|
|
3116
|
+
...X,
|
|
3117
|
+
blockNumber: s,
|
|
3118
|
+
blockTag: a
|
|
3119
|
+
});
|
|
3120
|
+
} catch (Me) {
|
|
3121
|
+
if (!(Me instanceof Qt) && !(Me instanceof ze))
|
|
3122
|
+
throw Me;
|
|
3123
|
+
}
|
|
3124
|
+
const $t = await e.request({
|
|
3125
|
+
method: "eth_call",
|
|
3126
|
+
params: z ? [
|
|
3127
|
+
X,
|
|
3128
|
+
k,
|
|
3129
|
+
z
|
|
3130
|
+
] : [X, k]
|
|
3131
|
+
});
|
|
3132
|
+
return $t === "0x" ? { data: void 0 } : { data: $t };
|
|
3133
|
+
} catch (I) {
|
|
3134
|
+
const k = bo(I), { offchainLookup: z, offchainLookupSignature: j } = await import("./ccip-DLDO0_x2.js");
|
|
3135
|
+
if (e.ccipRead !== !1 && (k == null ? void 0 : k.slice(0, 10)) === j && g)
|
|
3136
|
+
return { data: await z(e, { data: k, to: g }) };
|
|
3137
|
+
throw E && (k == null ? void 0 : k.slice(0, 10)) === "0x101bb98d" ? new Is({ factory: d }) : io(I, {
|
|
3138
|
+
...t,
|
|
3139
|
+
account: M,
|
|
3140
|
+
chain: e.chain
|
|
3141
|
+
});
|
|
3142
|
+
}
|
|
3143
|
+
}
|
|
3144
|
+
function lo({ request: e }) {
|
|
3145
|
+
const { data: t, to: n, ...r } = e;
|
|
3146
|
+
return !(!t || t.startsWith(ro) || !n || Object.values(r).filter((s) => typeof s < "u").length > 0);
|
|
3147
|
+
}
|
|
3148
|
+
async function fo(e, t) {
|
|
3149
|
+
var b;
|
|
3150
|
+
const { batchSize: n = 1024, wait: r = 0 } = typeof ((b = e.batch) == null ? void 0 : b.multicall) == "object" ? e.batch.multicall : {}, { blockNumber: s, blockTag: a = "latest", data: o, multicallAddress: i, to: c } = t;
|
|
3151
|
+
let u = i;
|
|
3152
|
+
if (!u) {
|
|
3153
|
+
if (!e.chain)
|
|
3154
|
+
throw new Qt();
|
|
3155
|
+
u = ao({
|
|
3156
|
+
blockNumber: s,
|
|
3157
|
+
chain: e.chain,
|
|
3158
|
+
contract: "multicall3"
|
|
3159
|
+
});
|
|
3160
|
+
}
|
|
3161
|
+
const l = (s ? v(s) : void 0) || a, { schedule: f } = uo({
|
|
3162
|
+
id: `${e.uid}.${l}`,
|
|
3163
|
+
wait: r,
|
|
3164
|
+
shouldSplitBatch(m) {
|
|
3165
|
+
return m.reduce((g, { data: x }) => g + (x.length - 2), 0) > n * 2;
|
|
3166
|
+
},
|
|
3167
|
+
fn: async (m) => {
|
|
3168
|
+
const w = m.map(($) => ({
|
|
3169
|
+
allowFailure: !0,
|
|
3170
|
+
callData: $.data,
|
|
3171
|
+
target: $.to
|
|
3172
|
+
})), g = ue({
|
|
3173
|
+
abi: Vt,
|
|
3174
|
+
args: [w],
|
|
3175
|
+
functionName: "aggregate3"
|
|
3176
|
+
}), x = await e.request({
|
|
3177
|
+
method: "eth_call",
|
|
3178
|
+
params: [
|
|
3179
|
+
{
|
|
3180
|
+
data: g,
|
|
3181
|
+
to: u
|
|
3182
|
+
},
|
|
3183
|
+
l
|
|
3184
|
+
]
|
|
3185
|
+
});
|
|
3186
|
+
return Et({
|
|
3187
|
+
abi: Vt,
|
|
3188
|
+
args: [w],
|
|
3189
|
+
functionName: "aggregate3",
|
|
3190
|
+
data: x || "0x"
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
}), [{ returnData: y, success: p }] = await f({ data: o, to: c });
|
|
3194
|
+
if (!p)
|
|
3195
|
+
throw new wn({ data: y });
|
|
3196
|
+
return y === "0x" ? { data: void 0 } : { data: y };
|
|
3197
|
+
}
|
|
3198
|
+
function po(e) {
|
|
3199
|
+
const { code: t, data: n } = e;
|
|
3200
|
+
return kn({
|
|
3201
|
+
abi: fn(["constructor(bytes, bytes)"]),
|
|
3202
|
+
bytecode: so,
|
|
3203
|
+
args: [t, n]
|
|
3204
|
+
});
|
|
3205
|
+
}
|
|
3206
|
+
function yo(e) {
|
|
3207
|
+
const { data: t, factory: n, factoryData: r, to: s } = e;
|
|
3208
|
+
return kn({
|
|
3209
|
+
abi: fn(["constructor(address, bytes, address, bytes)"]),
|
|
3210
|
+
bytecode: oo,
|
|
3211
|
+
args: [s, t, n, r]
|
|
3212
|
+
});
|
|
3213
|
+
}
|
|
3214
|
+
function bo(e) {
|
|
3215
|
+
var n;
|
|
3216
|
+
if (!(e instanceof h))
|
|
3217
|
+
return;
|
|
3218
|
+
const t = e.walk();
|
|
3219
|
+
return typeof (t == null ? void 0 : t.data) == "object" ? (n = t.data) == null ? void 0 : n.data : t.data;
|
|
3220
|
+
}
|
|
3221
|
+
async function Uo(e, t) {
|
|
3222
|
+
const { abi: n, address: r, args: s, functionName: a, ...o } = t, i = ue({
|
|
3223
|
+
abi: n,
|
|
3224
|
+
args: s,
|
|
3225
|
+
functionName: a
|
|
3226
|
+
});
|
|
3227
|
+
try {
|
|
3228
|
+
const { data: c } = await A(e, Bn, "call")({
|
|
3229
|
+
...o,
|
|
3230
|
+
data: i,
|
|
3231
|
+
to: r
|
|
3232
|
+
});
|
|
3233
|
+
return Et({
|
|
3234
|
+
abi: n,
|
|
3235
|
+
args: s,
|
|
3236
|
+
functionName: a,
|
|
3237
|
+
data: c || "0x"
|
|
3238
|
+
});
|
|
3239
|
+
} catch (c) {
|
|
3240
|
+
throw Ae(c, {
|
|
3241
|
+
abi: n,
|
|
3242
|
+
address: r,
|
|
3243
|
+
args: s,
|
|
3244
|
+
docsPath: "/docs/contract/readContract",
|
|
3245
|
+
functionName: a
|
|
3246
|
+
});
|
|
3247
|
+
}
|
|
3248
|
+
}
|
|
3249
|
+
async function Vo(e, t) {
|
|
3250
|
+
const { abi: n, address: r, args: s, dataSuffix: a, functionName: o, ...i } = t, c = i.account ? U(i.account) : e.account, u = ue({ abi: n, args: s, functionName: o });
|
|
3251
|
+
try {
|
|
3252
|
+
const { data: d } = await A(e, Bn, "call")({
|
|
3253
|
+
batch: !1,
|
|
3254
|
+
data: `${u}${a ? a.replace("0x", "") : ""}`,
|
|
3255
|
+
to: r,
|
|
3256
|
+
...i,
|
|
3257
|
+
account: c
|
|
3258
|
+
}), l = Et({
|
|
3259
|
+
abi: n,
|
|
3260
|
+
args: s,
|
|
3261
|
+
functionName: o,
|
|
3262
|
+
data: d || "0x"
|
|
3263
|
+
}), f = n.filter((y) => "name" in y && y.name === t.functionName);
|
|
3264
|
+
return {
|
|
3265
|
+
result: l,
|
|
3266
|
+
request: {
|
|
3267
|
+
abi: f,
|
|
3268
|
+
address: r,
|
|
3269
|
+
args: s,
|
|
3270
|
+
dataSuffix: a,
|
|
3271
|
+
functionName: o,
|
|
3272
|
+
...i,
|
|
3273
|
+
account: c
|
|
3274
|
+
}
|
|
3275
|
+
};
|
|
3276
|
+
} catch (d) {
|
|
3277
|
+
throw Ae(d, {
|
|
3278
|
+
abi: n,
|
|
3279
|
+
address: r,
|
|
3280
|
+
args: s,
|
|
3281
|
+
docsPath: "/docs/contract/simulateContract",
|
|
3282
|
+
functionName: o,
|
|
3283
|
+
sender: c == null ? void 0 : c.address
|
|
3284
|
+
});
|
|
3285
|
+
}
|
|
3286
|
+
}
|
|
3287
|
+
const Be = /* @__PURE__ */ new Map(), Zt = /* @__PURE__ */ new Map();
|
|
3288
|
+
let mo = 0;
|
|
3289
|
+
function Wt(e, t, n) {
|
|
3290
|
+
const r = ++mo, s = () => Be.get(e) || [], a = () => {
|
|
3291
|
+
const d = s();
|
|
3292
|
+
Be.set(e, d.filter((l) => l.id !== r));
|
|
3293
|
+
}, o = () => {
|
|
3294
|
+
const d = s();
|
|
3295
|
+
if (!d.some((f) => f.id === r))
|
|
3296
|
+
return;
|
|
3297
|
+
const l = Zt.get(e);
|
|
3298
|
+
d.length === 1 && l && l(), a();
|
|
3299
|
+
}, i = s();
|
|
3300
|
+
if (Be.set(e, [
|
|
3301
|
+
...i,
|
|
3302
|
+
{ id: r, fns: t }
|
|
3303
|
+
]), i && i.length > 0)
|
|
3304
|
+
return o;
|
|
3305
|
+
const c = {};
|
|
3306
|
+
for (const d in t)
|
|
3307
|
+
c[d] = (...l) => {
|
|
3308
|
+
var y, p;
|
|
3309
|
+
const f = s();
|
|
3310
|
+
if (f.length !== 0)
|
|
3311
|
+
for (const b of f)
|
|
3312
|
+
(p = (y = b.fns)[d]) == null || p.call(y, ...l);
|
|
3313
|
+
};
|
|
3314
|
+
const u = n(c);
|
|
3315
|
+
return typeof u == "function" && Zt.set(e, u), o;
|
|
3316
|
+
}
|
|
3317
|
+
async function Kt(e) {
|
|
3318
|
+
return new Promise((t) => setTimeout(t, e));
|
|
3319
|
+
}
|
|
3320
|
+
function ho(e, { emitOnBegin: t, initialWaitTime: n, interval: r }) {
|
|
3321
|
+
let s = !0;
|
|
3322
|
+
const a = () => s = !1;
|
|
3323
|
+
return (async () => {
|
|
3324
|
+
let i;
|
|
3325
|
+
t && (i = await e({ unpoll: a }));
|
|
3326
|
+
const c = await (n == null ? void 0 : n(i)) ?? r;
|
|
3327
|
+
await Kt(c);
|
|
3328
|
+
const u = async () => {
|
|
3329
|
+
s && (await e({ unpoll: a }), await Kt(r), u());
|
|
3330
|
+
};
|
|
3331
|
+
u();
|
|
3332
|
+
})(), a;
|
|
3333
|
+
}
|
|
3334
|
+
const go = /* @__PURE__ */ new Map(), wo = /* @__PURE__ */ new Map();
|
|
3335
|
+
function vo(e) {
|
|
3336
|
+
const t = (s, a) => ({
|
|
3337
|
+
clear: () => a.delete(s),
|
|
3338
|
+
get: () => a.get(s),
|
|
3339
|
+
set: (o) => a.set(s, o)
|
|
3340
|
+
}), n = t(e, go), r = t(e, wo);
|
|
3341
|
+
return {
|
|
3342
|
+
clear: () => {
|
|
3343
|
+
n.clear(), r.clear();
|
|
3344
|
+
},
|
|
3345
|
+
promise: n,
|
|
3346
|
+
response: r
|
|
3347
|
+
};
|
|
3348
|
+
}
|
|
3349
|
+
async function xo(e, { cacheKey: t, cacheTime: n = Number.POSITIVE_INFINITY }) {
|
|
3350
|
+
const r = vo(t), s = r.response.get();
|
|
3351
|
+
if (s && n > 0 && (/* @__PURE__ */ new Date()).getTime() - s.created.getTime() < n)
|
|
3352
|
+
return s.data;
|
|
3353
|
+
let a = r.promise.get();
|
|
3354
|
+
a || (a = e(), r.promise.set(a));
|
|
3355
|
+
try {
|
|
3356
|
+
const o = await a;
|
|
3357
|
+
return r.response.set({ created: /* @__PURE__ */ new Date(), data: o }), o;
|
|
3358
|
+
} finally {
|
|
3359
|
+
r.promise.clear();
|
|
3360
|
+
}
|
|
3361
|
+
}
|
|
3362
|
+
const Po = (e) => `blockNumber.${e}`;
|
|
3363
|
+
async function Eo(e, { cacheTime: t = e.cacheTime } = {}) {
|
|
3364
|
+
const n = await xo(() => e.request({
|
|
3365
|
+
method: "eth_blockNumber"
|
|
3366
|
+
}), { cacheKey: Po(e.uid), cacheTime: t });
|
|
3367
|
+
return BigInt(n);
|
|
3368
|
+
}
|
|
3369
|
+
async function $o(e, { filter: t }) {
|
|
3370
|
+
const n = "strict" in t && t.strict, r = await t.request({
|
|
3371
|
+
method: "eth_getFilterChanges",
|
|
3372
|
+
params: [t.id]
|
|
3373
|
+
});
|
|
3374
|
+
if (typeof r[0] == "string")
|
|
3375
|
+
return r;
|
|
3376
|
+
const s = r.map((a) => pe(a));
|
|
3377
|
+
return !("abi" in t) || !t.abi ? s : Cn({
|
|
3378
|
+
abi: t.abi,
|
|
3379
|
+
logs: s,
|
|
3380
|
+
strict: n
|
|
3381
|
+
});
|
|
3382
|
+
}
|
|
3383
|
+
async function Ao(e, { filter: t }) {
|
|
3384
|
+
return t.request({
|
|
3385
|
+
method: "eth_uninstallFilter",
|
|
3386
|
+
params: [t.id]
|
|
3387
|
+
});
|
|
3388
|
+
}
|
|
3389
|
+
function Zo(e, t) {
|
|
3390
|
+
const { abi: n, address: r, args: s, batch: a = !0, eventName: o, fromBlock: i, onError: c, onLogs: u, poll: d, pollingInterval: l = e.pollingInterval, strict: f } = t;
|
|
3391
|
+
return (typeof d < "u" ? d : typeof i == "bigint" ? !0 : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket")) ? (() => {
|
|
3392
|
+
const m = f ?? !1, w = ne([
|
|
3393
|
+
"watchContractEvent",
|
|
3394
|
+
r,
|
|
3395
|
+
s,
|
|
3396
|
+
a,
|
|
3397
|
+
e.uid,
|
|
3398
|
+
o,
|
|
3399
|
+
l,
|
|
3400
|
+
m,
|
|
3401
|
+
i
|
|
3402
|
+
]);
|
|
3403
|
+
return Wt(w, { onLogs: u, onError: c }, (g) => {
|
|
3404
|
+
let x;
|
|
3405
|
+
i !== void 0 && (x = i - 1n);
|
|
3406
|
+
let $, F = !1;
|
|
3407
|
+
const M = ho(async () => {
|
|
3408
|
+
var R;
|
|
3409
|
+
if (!F) {
|
|
3410
|
+
try {
|
|
3411
|
+
$ = await A(e, ds, "createContractEventFilter")({
|
|
3412
|
+
abi: n,
|
|
3413
|
+
address: r,
|
|
3414
|
+
args: s,
|
|
3415
|
+
eventName: o,
|
|
3416
|
+
strict: m,
|
|
3417
|
+
fromBlock: i
|
|
3418
|
+
});
|
|
3419
|
+
} catch {
|
|
3420
|
+
}
|
|
3421
|
+
F = !0;
|
|
3422
|
+
return;
|
|
3423
|
+
}
|
|
3424
|
+
try {
|
|
3425
|
+
let P;
|
|
3426
|
+
if ($)
|
|
3427
|
+
P = await A(e, $o, "getFilterChanges")({ filter: $ });
|
|
3428
|
+
else {
|
|
3429
|
+
const E = await A(e, Eo, "getBlockNumber")({});
|
|
3430
|
+
x && x < E ? P = await A(e, no, "getContractEvents")({
|
|
3431
|
+
abi: n,
|
|
3432
|
+
address: r,
|
|
3433
|
+
args: s,
|
|
3434
|
+
eventName: o,
|
|
3435
|
+
fromBlock: x + 1n,
|
|
3436
|
+
toBlock: E,
|
|
3437
|
+
strict: m
|
|
3438
|
+
}) : P = [], x = E;
|
|
3439
|
+
}
|
|
3440
|
+
if (P.length === 0)
|
|
3441
|
+
return;
|
|
3442
|
+
if (a)
|
|
3443
|
+
g.onLogs(P);
|
|
3444
|
+
else
|
|
3445
|
+
for (const E of P)
|
|
3446
|
+
g.onLogs([E]);
|
|
3447
|
+
} catch (P) {
|
|
3448
|
+
$ && P instanceof $e && (F = !1), (R = g.onError) == null || R.call(g, P);
|
|
3449
|
+
}
|
|
3450
|
+
}, {
|
|
3451
|
+
emitOnBegin: !0,
|
|
3452
|
+
interval: l
|
|
3453
|
+
});
|
|
3454
|
+
return async () => {
|
|
3455
|
+
$ && await A(e, Ao, "uninstallFilter")({ filter: $ }), M();
|
|
3456
|
+
};
|
|
3457
|
+
});
|
|
3458
|
+
})() : (() => {
|
|
3459
|
+
const m = f ?? !1, w = ne([
|
|
3460
|
+
"watchContractEvent",
|
|
3461
|
+
r,
|
|
3462
|
+
s,
|
|
3463
|
+
a,
|
|
3464
|
+
e.uid,
|
|
3465
|
+
o,
|
|
3466
|
+
l,
|
|
3467
|
+
m
|
|
3468
|
+
]);
|
|
3469
|
+
let g = !0, x = () => g = !1;
|
|
3470
|
+
return Wt(w, { onLogs: u, onError: c }, ($) => ((async () => {
|
|
3471
|
+
try {
|
|
3472
|
+
const F = (() => {
|
|
3473
|
+
if (e.transport.type === "fallback") {
|
|
3474
|
+
const P = e.transport.transports.find((E) => E.config.type === "webSocket");
|
|
3475
|
+
return P ? P.value : e.transport;
|
|
3476
|
+
}
|
|
3477
|
+
return e.transport;
|
|
3478
|
+
})(), M = o ? tt({
|
|
3479
|
+
abi: n,
|
|
3480
|
+
eventName: o,
|
|
3481
|
+
args: s
|
|
3482
|
+
}) : [], { unsubscribe: R } = await F.subscribe({
|
|
3483
|
+
params: ["logs", { address: r, topics: M }],
|
|
3484
|
+
onData(P) {
|
|
3485
|
+
var _;
|
|
3486
|
+
if (!g)
|
|
3487
|
+
return;
|
|
3488
|
+
const E = P.result;
|
|
3489
|
+
try {
|
|
3490
|
+
const { eventName: T, args: N } = Sn({
|
|
3491
|
+
abi: n,
|
|
3492
|
+
data: E.data,
|
|
3493
|
+
topics: E.topics,
|
|
3494
|
+
strict: f
|
|
3495
|
+
}), S = pe(E, {
|
|
3496
|
+
args: N,
|
|
3497
|
+
eventName: T
|
|
3498
|
+
});
|
|
3499
|
+
$.onLogs([S]);
|
|
3500
|
+
} catch (T) {
|
|
3501
|
+
let N, S;
|
|
3502
|
+
if (T instanceof be || T instanceof Ke) {
|
|
3503
|
+
if (f)
|
|
3504
|
+
return;
|
|
3505
|
+
N = T.abiItem.name, S = (_ = T.abiItem.inputs) == null ? void 0 : _.some((I) => !("name" in I && I.name));
|
|
3506
|
+
}
|
|
3507
|
+
const O = pe(E, {
|
|
3508
|
+
args: S ? [] : {},
|
|
3509
|
+
eventName: N
|
|
3510
|
+
});
|
|
3511
|
+
$.onLogs([O]);
|
|
3512
|
+
}
|
|
3513
|
+
},
|
|
3514
|
+
onError(P) {
|
|
3515
|
+
var E;
|
|
3516
|
+
(E = $.onError) == null || E.call($, P);
|
|
3517
|
+
}
|
|
3518
|
+
});
|
|
3519
|
+
x = R, g || x();
|
|
3520
|
+
} catch (F) {
|
|
3521
|
+
c == null || c(F);
|
|
3522
|
+
}
|
|
3523
|
+
})(), () => x()));
|
|
3524
|
+
})();
|
|
3525
|
+
}
|
|
3526
|
+
class Rn extends h {
|
|
3527
|
+
constructor({ docsPath: t } = {}) {
|
|
3528
|
+
super([
|
|
3529
|
+
"Could not find an Account to execute with this Action.",
|
|
3530
|
+
"Please provide an Account with the `account` argument on the Action, or by supplying an `account` to the Client."
|
|
3531
|
+
].join(`
|
|
3532
|
+
`), {
|
|
3533
|
+
docsPath: t,
|
|
3534
|
+
docsSlug: "account",
|
|
3535
|
+
name: "AccountNotFoundError"
|
|
3536
|
+
});
|
|
3537
|
+
}
|
|
3538
|
+
}
|
|
3539
|
+
class Re extends h {
|
|
3540
|
+
constructor({ docsPath: t, metaMessages: n, type: r }) {
|
|
3541
|
+
super(`Account type "${r}" is not supported.`, {
|
|
3542
|
+
docsPath: t,
|
|
3543
|
+
metaMessages: n,
|
|
3544
|
+
name: "AccountTypeNotSupportedError"
|
|
3545
|
+
});
|
|
3546
|
+
}
|
|
3547
|
+
}
|
|
3548
|
+
function Fo({ chain: e, currentChainId: t }) {
|
|
3549
|
+
if (!e)
|
|
3550
|
+
throw new Jn();
|
|
3551
|
+
if (t !== e.id)
|
|
3552
|
+
throw new Yn({ chain: e, currentChainId: t });
|
|
3553
|
+
}
|
|
3554
|
+
function Mo(e, { docsPath: t, ...n }) {
|
|
3555
|
+
const r = (() => {
|
|
3556
|
+
const s = wt(e, n);
|
|
3557
|
+
return s instanceof we ? e : s;
|
|
3558
|
+
})();
|
|
3559
|
+
return new Xn(r, {
|
|
3560
|
+
docsPath: t,
|
|
3561
|
+
...n
|
|
3562
|
+
});
|
|
3563
|
+
}
|
|
3564
|
+
async function So(e, { serializedTransaction: t }) {
|
|
3565
|
+
return e.request({
|
|
3566
|
+
method: "eth_sendRawTransaction",
|
|
3567
|
+
params: [t]
|
|
3568
|
+
}, { retryCount: 0 });
|
|
3569
|
+
}
|
|
3570
|
+
const Ie = new Qn(128);
|
|
3571
|
+
async function Co(e, t) {
|
|
3572
|
+
var w, g, x, $;
|
|
3573
|
+
const { account: n = e.account, chain: r = e.chain, accessList: s, authorizationList: a, blobs: o, data: i, gas: c, gasPrice: u, maxFeePerBlobGas: d, maxFeePerGas: l, maxPriorityFeePerGas: f, nonce: y, value: p, ...b } = t;
|
|
3574
|
+
if (typeof n > "u")
|
|
3575
|
+
throw new Rn({
|
|
3576
|
+
docsPath: "/docs/actions/wallet/sendTransaction"
|
|
3577
|
+
});
|
|
3578
|
+
const m = n ? U(n) : null;
|
|
3579
|
+
try {
|
|
3580
|
+
Fe(t);
|
|
3581
|
+
const F = await (async () => {
|
|
3582
|
+
if (t.to)
|
|
3583
|
+
return t.to;
|
|
3584
|
+
if (a && a.length > 0)
|
|
3585
|
+
return await vn({
|
|
3586
|
+
authorization: a[0]
|
|
3587
|
+
}).catch(() => {
|
|
3588
|
+
throw new h("`to` is required. Could not infer from `authorizationList`.");
|
|
3589
|
+
});
|
|
3590
|
+
})();
|
|
3591
|
+
if ((m == null ? void 0 : m.type) === "json-rpc" || m === null) {
|
|
3592
|
+
let M;
|
|
3593
|
+
r !== null && (M = await A(e, $n, "getChainId")({}), Fo({
|
|
3594
|
+
currentChainId: M,
|
|
3595
|
+
chain: r
|
|
3596
|
+
}));
|
|
3597
|
+
const R = (x = (g = (w = e.chain) == null ? void 0 : w.formatters) == null ? void 0 : g.transactionRequest) == null ? void 0 : x.format, E = (R || xt)({
|
|
3598
|
+
// Pick out extra data that might exist on the chain's transaction request type.
|
|
3599
|
+
...vt(b, { format: R }),
|
|
3600
|
+
accessList: s,
|
|
3601
|
+
authorizationList: a,
|
|
3602
|
+
blobs: o,
|
|
3603
|
+
chainId: M,
|
|
3604
|
+
data: i,
|
|
3605
|
+
from: m == null ? void 0 : m.address,
|
|
3606
|
+
gas: c,
|
|
3607
|
+
gasPrice: u,
|
|
3608
|
+
maxFeePerBlobGas: d,
|
|
3609
|
+
maxFeePerGas: l,
|
|
3610
|
+
maxPriorityFeePerGas: f,
|
|
3611
|
+
nonce: y,
|
|
3612
|
+
to: F,
|
|
3613
|
+
value: p
|
|
3614
|
+
}), _ = Ie.get(e.uid), T = _ ? "wallet_sendTransaction" : "eth_sendTransaction";
|
|
3615
|
+
try {
|
|
3616
|
+
return await e.request({
|
|
3617
|
+
method: T,
|
|
3618
|
+
params: [E]
|
|
3619
|
+
}, { retryCount: 0 });
|
|
3620
|
+
} catch (N) {
|
|
3621
|
+
if (_ === !1)
|
|
3622
|
+
throw N;
|
|
3623
|
+
const S = N;
|
|
3624
|
+
if (S.name === "InvalidInputRpcError" || S.name === "InvalidParamsRpcError" || S.name === "MethodNotFoundRpcError" || S.name === "MethodNotSupportedRpcError")
|
|
3625
|
+
return await e.request({
|
|
3626
|
+
method: "wallet_sendTransaction",
|
|
3627
|
+
params: [E]
|
|
3628
|
+
}, { retryCount: 0 }).then((O) => (Ie.set(e.uid, !0), O)).catch((O) => {
|
|
3629
|
+
const I = O;
|
|
3630
|
+
throw I.name === "MethodNotFoundRpcError" || I.name === "MethodNotSupportedRpcError" ? (Ie.set(e.uid, !1), S) : I;
|
|
3631
|
+
});
|
|
3632
|
+
throw S;
|
|
3633
|
+
}
|
|
3634
|
+
}
|
|
3635
|
+
if ((m == null ? void 0 : m.type) === "local") {
|
|
3636
|
+
const M = await A(e, Fn, "prepareTransactionRequest")({
|
|
3637
|
+
account: m,
|
|
3638
|
+
accessList: s,
|
|
3639
|
+
authorizationList: a,
|
|
3640
|
+
blobs: o,
|
|
3641
|
+
chain: r,
|
|
3642
|
+
data: i,
|
|
3643
|
+
gas: c,
|
|
3644
|
+
gasPrice: u,
|
|
3645
|
+
maxFeePerBlobGas: d,
|
|
3646
|
+
maxFeePerGas: l,
|
|
3647
|
+
maxPriorityFeePerGas: f,
|
|
3648
|
+
nonce: y,
|
|
3649
|
+
nonceManager: m.nonceManager,
|
|
3650
|
+
parameters: [...An, "sidecars"],
|
|
3651
|
+
value: p,
|
|
3652
|
+
...b,
|
|
3653
|
+
to: F
|
|
3654
|
+
}), R = ($ = r == null ? void 0 : r.serializers) == null ? void 0 : $.transaction, P = await m.signTransaction(M, {
|
|
3655
|
+
serializer: R
|
|
3656
|
+
});
|
|
3657
|
+
return await A(e, So, "sendRawTransaction")({
|
|
3658
|
+
serializedTransaction: P
|
|
3659
|
+
});
|
|
3660
|
+
}
|
|
3661
|
+
throw (m == null ? void 0 : m.type) === "smart" ? new Re({
|
|
3662
|
+
metaMessages: [
|
|
3663
|
+
"Consider using the `sendUserOperation` Action instead."
|
|
3664
|
+
],
|
|
3665
|
+
docsPath: "/docs/actions/bundler/sendUserOperation",
|
|
3666
|
+
type: "smart"
|
|
3667
|
+
}) : new Re({
|
|
3668
|
+
docsPath: "/docs/actions/wallet/sendTransaction",
|
|
3669
|
+
type: m == null ? void 0 : m.type
|
|
3670
|
+
});
|
|
3671
|
+
} catch (F) {
|
|
3672
|
+
throw F instanceof Re ? F : Mo(F, {
|
|
3673
|
+
...t,
|
|
3674
|
+
account: m,
|
|
3675
|
+
chain: t.chain || void 0
|
|
3676
|
+
});
|
|
3677
|
+
}
|
|
3678
|
+
}
|
|
3679
|
+
async function Wo(e, t) {
|
|
3680
|
+
const { abi: n, account: r = e.account, address: s, args: a, dataSuffix: o, functionName: i, ...c } = t;
|
|
3681
|
+
if (typeof r > "u")
|
|
3682
|
+
throw new Rn({
|
|
3683
|
+
docsPath: "/docs/contract/writeContract"
|
|
3684
|
+
});
|
|
3685
|
+
const u = r ? U(r) : null, d = ue({
|
|
3686
|
+
abi: n,
|
|
3687
|
+
args: a,
|
|
3688
|
+
functionName: i
|
|
3689
|
+
});
|
|
3690
|
+
try {
|
|
3691
|
+
return await A(e, Co, "sendTransaction")({
|
|
3692
|
+
data: `${d}${o ? o.replace("0x", "") : ""}`,
|
|
3693
|
+
to: s,
|
|
3694
|
+
account: u,
|
|
3695
|
+
...c
|
|
3696
|
+
});
|
|
3697
|
+
} catch (l) {
|
|
3698
|
+
throw Ae(l, {
|
|
3699
|
+
abi: n,
|
|
3700
|
+
address: s,
|
|
3701
|
+
args: a,
|
|
3702
|
+
docsPath: "/docs/contract/writeContract",
|
|
3703
|
+
functionName: i,
|
|
3704
|
+
sender: u == null ? void 0 : u.address
|
|
3705
|
+
});
|
|
3706
|
+
}
|
|
3707
|
+
}
|
|
3708
|
+
export {
|
|
3709
|
+
ko as $,
|
|
3710
|
+
js as A,
|
|
3711
|
+
uo as B,
|
|
3712
|
+
ht as C,
|
|
3713
|
+
Bs as D,
|
|
3714
|
+
fs as E,
|
|
3715
|
+
ao as F,
|
|
3716
|
+
ue as G,
|
|
3717
|
+
Ro as H,
|
|
3718
|
+
$e as I,
|
|
3719
|
+
ft as J,
|
|
3720
|
+
Lo as K,
|
|
3721
|
+
lt as L,
|
|
3722
|
+
dt as M,
|
|
3723
|
+
Go as N,
|
|
3724
|
+
Et as O,
|
|
3725
|
+
mt as P,
|
|
3726
|
+
_o as Q,
|
|
3727
|
+
ct as R,
|
|
3728
|
+
gt as S,
|
|
3729
|
+
ut as T,
|
|
3730
|
+
pt as U,
|
|
3731
|
+
Do as V,
|
|
3732
|
+
us as W,
|
|
3733
|
+
tt as X,
|
|
3734
|
+
Cn as Y,
|
|
3735
|
+
es as Z,
|
|
3736
|
+
Bo as _,
|
|
3737
|
+
no as a,
|
|
3738
|
+
Eo as a0,
|
|
3739
|
+
Ae as a1,
|
|
3740
|
+
Vt as a2,
|
|
3741
|
+
We as a3,
|
|
3742
|
+
wn as a4,
|
|
3743
|
+
Ho as a5,
|
|
3744
|
+
kn as a6,
|
|
3745
|
+
qo as a7,
|
|
3746
|
+
Ds as a8,
|
|
3747
|
+
Ts as a9,
|
|
3748
|
+
Wt as aa,
|
|
3749
|
+
ho as ab,
|
|
3750
|
+
co as ac,
|
|
3751
|
+
me as ad,
|
|
3752
|
+
Ks as ae,
|
|
3753
|
+
Sn as af,
|
|
3754
|
+
be as ag,
|
|
3755
|
+
Ke as ah,
|
|
3756
|
+
Ao as ai,
|
|
3757
|
+
$o as aj,
|
|
3758
|
+
to as ak,
|
|
3759
|
+
Mn as al,
|
|
3760
|
+
Ys as am,
|
|
3761
|
+
$n as an,
|
|
3762
|
+
Oo as ao,
|
|
3763
|
+
Pn as ap,
|
|
3764
|
+
No as aq,
|
|
3765
|
+
Js as ar,
|
|
3766
|
+
Fn as as,
|
|
3767
|
+
So as at,
|
|
3768
|
+
Co as au,
|
|
3769
|
+
Rn as av,
|
|
3770
|
+
Fe as aw,
|
|
3771
|
+
Fo as ax,
|
|
3772
|
+
xt as ay,
|
|
3773
|
+
Wo as b,
|
|
3774
|
+
ds as c,
|
|
3775
|
+
nt as d,
|
|
3776
|
+
zo as e,
|
|
3777
|
+
ne as f,
|
|
3778
|
+
A as g,
|
|
3779
|
+
As as h,
|
|
3780
|
+
Xs as i,
|
|
3781
|
+
Bn as j,
|
|
3782
|
+
Je as k,
|
|
3783
|
+
Kt as l,
|
|
3784
|
+
jo as m,
|
|
3785
|
+
bt as n,
|
|
3786
|
+
yt as o,
|
|
3787
|
+
U as p,
|
|
3788
|
+
it as q,
|
|
3789
|
+
Uo as r,
|
|
3790
|
+
Vo as s,
|
|
3791
|
+
Ee as t,
|
|
3792
|
+
at as u,
|
|
3793
|
+
ot as v,
|
|
3794
|
+
Zo as w,
|
|
3795
|
+
st as x,
|
|
3796
|
+
rt as y,
|
|
3797
|
+
Io as z
|
|
3798
|
+
};
|
|
3799
|
+
//# sourceMappingURL=writeContract-ChuHpJLC.js.map
|