@pufferfinance/puffer-sdk 1.9.0 → 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.js +2 -2
- 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.map +1 -1
- package/dist/contracts/abis/mainnet/AtomicQueue.js.map +1 -1
- 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 +1 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.cjs.map +1 -1
- package/dist/contracts/abis/nucleus-atomic-queue-abis.js +1 -1
- 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.js +1 -1
- 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 +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.d.ts +11128 -2714
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js +2 -2
- package/dist/contracts/handlers/nucleus-atomic-queue-handler.js.map +1 -1
- 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,2028 @@
|
|
|
1
|
+
import { g as R, r as q, p as V, l as Et, f as B, H as L, m as It, U as ee, S as Ce, C as Ee, P as Ie, n as Ne, o as ke, J as xe, L as te, M as Ae, T as Pe, R as Be, q as De, I as re, t as ne, u as qe, v as Fe, x as Se, y as _e, z as Me, A as Nt, B as kt, D as $e, E as xt, F as j, G as Q, K as ze, N as Ge, O as de, Q as Le, V as At, W as fe, X as Ze, Y as Pt, k as le, Z as Bt, _ as Dt, $ as qt, a0 as K, a1 as Ue, a2 as Ft, a3 as St, a4 as _t, a5 as He, a6 as Je, a7 as Mt, j as Ve, i as Qe, a8 as $t, a9 as zt, aa as M, ab as X, ac as Lt, ad as _, ae as Ut, af as Ht, ag as jt, ah as Ot, ai as pe, aj as he, ak as Ke, c as Wt, e as Gt, al as Zt, am as Jt, an as me, a as Vt, ao as Qt, ap as Kt, aq as Xt, ar as Yt, as as Xe, at as Ye, s as er, w as tr, au as et, av as ge, aw as rr, ax as nr, ay as ar, b as sr } from "./writeContract-ChuHpJLC.js";
|
|
2
|
+
import { B as D, n as k, L as or, k as P, s as J, i as tt, b as H, t as ir, a as U, c as ye, d as S, e as cr, h as rt, f as ae, g as ur, I as dr, j as se, l as fr, m as lr, o as nt, T as at, q as pr, r as st, u as hr, v as oe, w as mr, x as ot, W as gr, y as yr } from "./constants-BjRNQpT2.js";
|
|
3
|
+
import { secp256k1 as wr } from "./secp256k1-3OC5y4qp.js";
|
|
4
|
+
class br extends D {
|
|
5
|
+
constructor({ address: t }) {
|
|
6
|
+
super(`No EIP-712 domain found on contract "${t}".`, {
|
|
7
|
+
metaMessages: [
|
|
8
|
+
"Ensure that:",
|
|
9
|
+
`- The contract is deployed at the address "${t}".`,
|
|
10
|
+
"- `eip712Domain()` function exists on the contract.",
|
|
11
|
+
"- `eip712Domain()` function matches signature to ERC-5267 specification."
|
|
12
|
+
],
|
|
13
|
+
name: "Eip712DomainNotFoundError"
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
async function vr(e, t) {
|
|
18
|
+
const { address: r, factory: n, factoryData: a } = t;
|
|
19
|
+
try {
|
|
20
|
+
const [s, o, u, d, f, i, c] = await R(e, q, "readContract")({
|
|
21
|
+
abi: Tr,
|
|
22
|
+
address: r,
|
|
23
|
+
functionName: "eip712Domain",
|
|
24
|
+
factory: n,
|
|
25
|
+
factoryData: a
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
domain: {
|
|
29
|
+
name: o,
|
|
30
|
+
version: u,
|
|
31
|
+
chainId: Number(d),
|
|
32
|
+
verifyingContract: f,
|
|
33
|
+
salt: i
|
|
34
|
+
},
|
|
35
|
+
extensions: c,
|
|
36
|
+
fields: s
|
|
37
|
+
};
|
|
38
|
+
} catch (s) {
|
|
39
|
+
const o = s;
|
|
40
|
+
throw o.name === "ContractFunctionExecutionError" && o.cause.name === "ContractFunctionZeroDataError" ? new br({ address: r }) : o;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
const Tr = [
|
|
44
|
+
{
|
|
45
|
+
inputs: [],
|
|
46
|
+
name: "eip712Domain",
|
|
47
|
+
outputs: [
|
|
48
|
+
{ name: "fields", type: "bytes1" },
|
|
49
|
+
{ name: "name", type: "string" },
|
|
50
|
+
{ name: "version", type: "string" },
|
|
51
|
+
{ name: "chainId", type: "uint256" },
|
|
52
|
+
{ name: "verifyingContract", type: "address" },
|
|
53
|
+
{ name: "salt", type: "bytes32" },
|
|
54
|
+
{ name: "extensions", type: "uint256[]" }
|
|
55
|
+
],
|
|
56
|
+
stateMutability: "view",
|
|
57
|
+
type: "function"
|
|
58
|
+
}
|
|
59
|
+
];
|
|
60
|
+
async function Rr(e, { chain: t }) {
|
|
61
|
+
const { id: r, name: n, nativeCurrency: a, rpcUrls: s, blockExplorers: o } = t;
|
|
62
|
+
await e.request({
|
|
63
|
+
method: "wallet_addEthereumChain",
|
|
64
|
+
params: [
|
|
65
|
+
{
|
|
66
|
+
chainId: k(r),
|
|
67
|
+
chainName: n,
|
|
68
|
+
nativeCurrency: a,
|
|
69
|
+
rpcUrls: s.default.http,
|
|
70
|
+
blockExplorerUrls: o ? Object.values(o).map(({ url: u }) => u) : void 0
|
|
71
|
+
}
|
|
72
|
+
]
|
|
73
|
+
}, { dedupe: !0, retryCount: 0 });
|
|
74
|
+
}
|
|
75
|
+
const ie = 256;
|
|
76
|
+
let O = ie, W;
|
|
77
|
+
function it(e = 11) {
|
|
78
|
+
if (!W || O + e > ie * 2) {
|
|
79
|
+
W = "", O = 0;
|
|
80
|
+
for (let t = 0; t < ie; t++)
|
|
81
|
+
W += (256 + Math.random() * 256 | 0).toString(16).substring(1);
|
|
82
|
+
}
|
|
83
|
+
return W.substring(O, O++ + e);
|
|
84
|
+
}
|
|
85
|
+
function ct(e) {
|
|
86
|
+
const { batch: t, cacheTime: r = e.pollingInterval ?? 4e3, ccipRead: n, key: a = "base", name: s = "Base Client", pollingInterval: o = 4e3, type: u = "base" } = e, d = e.chain, f = e.account ? V(e.account) : void 0, { config: i, request: c, value: l } = e.transport({
|
|
87
|
+
chain: d,
|
|
88
|
+
pollingInterval: o
|
|
89
|
+
}), h = { ...i, ...l }, m = {
|
|
90
|
+
account: f,
|
|
91
|
+
batch: t,
|
|
92
|
+
cacheTime: r,
|
|
93
|
+
ccipRead: n,
|
|
94
|
+
chain: d,
|
|
95
|
+
key: a,
|
|
96
|
+
name: s,
|
|
97
|
+
pollingInterval: o,
|
|
98
|
+
request: c,
|
|
99
|
+
transport: h,
|
|
100
|
+
type: u,
|
|
101
|
+
uid: it()
|
|
102
|
+
};
|
|
103
|
+
function g(b) {
|
|
104
|
+
return (p) => {
|
|
105
|
+
const y = p(b);
|
|
106
|
+
for (const T in m)
|
|
107
|
+
delete y[T];
|
|
108
|
+
const w = { ...b, ...y };
|
|
109
|
+
return Object.assign(w, { extend: g(w) });
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
return Object.assign(m, { extend: g(m) });
|
|
113
|
+
}
|
|
114
|
+
const G = /* @__PURE__ */ new or(8192);
|
|
115
|
+
function Cr(e, { enabled: t = !0, id: r }) {
|
|
116
|
+
if (!t || !r)
|
|
117
|
+
return e();
|
|
118
|
+
if (G.get(r))
|
|
119
|
+
return G.get(r);
|
|
120
|
+
const n = e().finally(() => G.delete(r));
|
|
121
|
+
return G.set(r, n), n;
|
|
122
|
+
}
|
|
123
|
+
function ce(e, { delay: t = 100, retryCount: r = 2, shouldRetry: n = () => !0 } = {}) {
|
|
124
|
+
return new Promise((a, s) => {
|
|
125
|
+
const o = async ({ count: u = 0 } = {}) => {
|
|
126
|
+
const d = async ({ error: f }) => {
|
|
127
|
+
const i = typeof t == "function" ? t({ count: u, error: f }) : t;
|
|
128
|
+
i && await Et(i), o({ count: u + 1 });
|
|
129
|
+
};
|
|
130
|
+
try {
|
|
131
|
+
const f = await e();
|
|
132
|
+
a(f);
|
|
133
|
+
} catch (f) {
|
|
134
|
+
if (u < r && await n({ count: u, error: f }))
|
|
135
|
+
return d({ error: f });
|
|
136
|
+
s(f);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
o();
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
function Er(e, t = {}) {
|
|
143
|
+
return async (r, n = {}) => {
|
|
144
|
+
const { dedupe: a = !1, retryDelay: s = 150, retryCount: o = 3, uid: u } = {
|
|
145
|
+
...t,
|
|
146
|
+
...n
|
|
147
|
+
}, d = a ? P(J(`${u}.${B(r)}`)) : void 0;
|
|
148
|
+
return Cr(() => ce(async () => {
|
|
149
|
+
try {
|
|
150
|
+
return await e(r);
|
|
151
|
+
} catch (f) {
|
|
152
|
+
const i = f;
|
|
153
|
+
switch (i.code) {
|
|
154
|
+
// -32700
|
|
155
|
+
case _e.code:
|
|
156
|
+
throw new _e(i);
|
|
157
|
+
// -32600
|
|
158
|
+
case Se.code:
|
|
159
|
+
throw new Se(i);
|
|
160
|
+
// -32601
|
|
161
|
+
case Fe.code:
|
|
162
|
+
throw new Fe(i, { method: r.method });
|
|
163
|
+
// -32602
|
|
164
|
+
case qe.code:
|
|
165
|
+
throw new qe(i);
|
|
166
|
+
// -32603
|
|
167
|
+
case ne.code:
|
|
168
|
+
throw new ne(i);
|
|
169
|
+
// -32000
|
|
170
|
+
case re.code:
|
|
171
|
+
throw new re(i);
|
|
172
|
+
// -32001
|
|
173
|
+
case De.code:
|
|
174
|
+
throw new De(i);
|
|
175
|
+
// -32002
|
|
176
|
+
case Be.code:
|
|
177
|
+
throw new Be(i);
|
|
178
|
+
// -32003
|
|
179
|
+
case Pe.code:
|
|
180
|
+
throw new Pe(i);
|
|
181
|
+
// -32004
|
|
182
|
+
case Ae.code:
|
|
183
|
+
throw new Ae(i, {
|
|
184
|
+
method: r.method
|
|
185
|
+
});
|
|
186
|
+
// -32005
|
|
187
|
+
case te.code:
|
|
188
|
+
throw new te(i);
|
|
189
|
+
// -32006
|
|
190
|
+
case xe.code:
|
|
191
|
+
throw new xe(i);
|
|
192
|
+
// 4001
|
|
193
|
+
case ee.code:
|
|
194
|
+
throw new ee(i);
|
|
195
|
+
// 4100
|
|
196
|
+
case ke.code:
|
|
197
|
+
throw new ke(i);
|
|
198
|
+
// 4200
|
|
199
|
+
case Ne.code:
|
|
200
|
+
throw new Ne(i);
|
|
201
|
+
// 4900
|
|
202
|
+
case Ie.code:
|
|
203
|
+
throw new Ie(i);
|
|
204
|
+
// 4901
|
|
205
|
+
case Ee.code:
|
|
206
|
+
throw new Ee(i);
|
|
207
|
+
// 4902
|
|
208
|
+
case Ce.code:
|
|
209
|
+
throw new Ce(i);
|
|
210
|
+
// CAIP-25: User Rejected Error
|
|
211
|
+
// https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25
|
|
212
|
+
case 5e3:
|
|
213
|
+
throw new ee(i);
|
|
214
|
+
default:
|
|
215
|
+
throw f instanceof D ? f : new It(i);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}, {
|
|
219
|
+
delay: ({ count: f, error: i }) => {
|
|
220
|
+
var c;
|
|
221
|
+
if (i && i instanceof L) {
|
|
222
|
+
const l = (c = i == null ? void 0 : i.headers) == null ? void 0 : c.get("Retry-After");
|
|
223
|
+
if (l != null && l.match(/\d/))
|
|
224
|
+
return Number.parseInt(l) * 1e3;
|
|
225
|
+
}
|
|
226
|
+
return ~~(1 << f) * s;
|
|
227
|
+
},
|
|
228
|
+
retryCount: o,
|
|
229
|
+
shouldRetry: ({ error: f }) => Ir(f)
|
|
230
|
+
}), { enabled: a, id: d });
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
function Ir(e) {
|
|
234
|
+
return "code" in e && typeof e.code == "number" ? e.code === -1 || e.code === te.code || e.code === ne.code : e instanceof L && e.status ? e.status === 403 || e.status === 408 || e.status === 413 || e.status === 429 || e.status === 500 || e.status === 502 || e.status === 503 || e.status === 504 : !0;
|
|
235
|
+
}
|
|
236
|
+
function Nr({ key: e, name: t, request: r, retryCount: n = 3, retryDelay: a = 150, timeout: s, type: o }, u) {
|
|
237
|
+
const d = it();
|
|
238
|
+
return {
|
|
239
|
+
config: {
|
|
240
|
+
key: e,
|
|
241
|
+
name: t,
|
|
242
|
+
request: r,
|
|
243
|
+
retryCount: n,
|
|
244
|
+
retryDelay: a,
|
|
245
|
+
timeout: s,
|
|
246
|
+
type: o
|
|
247
|
+
},
|
|
248
|
+
request: Er(r, { retryCount: n, retryDelay: a, uid: d }),
|
|
249
|
+
value: u
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
class kr extends D {
|
|
253
|
+
constructor() {
|
|
254
|
+
super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.", {
|
|
255
|
+
docsPath: "/docs/clients/intro",
|
|
256
|
+
name: "UrlRequiredError"
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
function xr(e, { errorInstance: t = new Error("timed out"), timeout: r, signal: n }) {
|
|
261
|
+
return new Promise((a, s) => {
|
|
262
|
+
(async () => {
|
|
263
|
+
let o;
|
|
264
|
+
try {
|
|
265
|
+
const u = new AbortController();
|
|
266
|
+
r > 0 && (o = setTimeout(() => {
|
|
267
|
+
n ? u.abort() : s(t);
|
|
268
|
+
}, r)), a(await e({ signal: (u == null ? void 0 : u.signal) || null }));
|
|
269
|
+
} catch (u) {
|
|
270
|
+
(u == null ? void 0 : u.name) === "AbortError" && s(t), s(u);
|
|
271
|
+
} finally {
|
|
272
|
+
clearTimeout(o);
|
|
273
|
+
}
|
|
274
|
+
})();
|
|
275
|
+
});
|
|
276
|
+
}
|
|
277
|
+
function Ar() {
|
|
278
|
+
return {
|
|
279
|
+
current: 0,
|
|
280
|
+
take() {
|
|
281
|
+
return this.current++;
|
|
282
|
+
},
|
|
283
|
+
reset() {
|
|
284
|
+
this.current = 0;
|
|
285
|
+
}
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
const je = /* @__PURE__ */ Ar();
|
|
289
|
+
function Pr(e, t = {}) {
|
|
290
|
+
return {
|
|
291
|
+
async request(r) {
|
|
292
|
+
var c;
|
|
293
|
+
const { body: n, onRequest: a = t.onRequest, onResponse: s = t.onResponse, timeout: o = t.timeout ?? 1e4 } = r, u = {
|
|
294
|
+
...t.fetchOptions ?? {},
|
|
295
|
+
...r.fetchOptions ?? {}
|
|
296
|
+
}, { headers: d, method: f, signal: i } = u;
|
|
297
|
+
try {
|
|
298
|
+
const l = await xr(async ({ signal: m }) => {
|
|
299
|
+
const g = {
|
|
300
|
+
...u,
|
|
301
|
+
body: Array.isArray(n) ? B(n.map((w) => ({
|
|
302
|
+
jsonrpc: "2.0",
|
|
303
|
+
id: w.id ?? je.take(),
|
|
304
|
+
...w
|
|
305
|
+
}))) : B({
|
|
306
|
+
jsonrpc: "2.0",
|
|
307
|
+
id: n.id ?? je.take(),
|
|
308
|
+
...n
|
|
309
|
+
}),
|
|
310
|
+
headers: {
|
|
311
|
+
"Content-Type": "application/json",
|
|
312
|
+
...d
|
|
313
|
+
},
|
|
314
|
+
method: f || "POST",
|
|
315
|
+
signal: i || (o > 0 ? m : null)
|
|
316
|
+
}, b = new Request(e, g), p = await (a == null ? void 0 : a(b, g)) ?? { ...g, url: e };
|
|
317
|
+
return await fetch(p.url ?? e, p);
|
|
318
|
+
}, {
|
|
319
|
+
errorInstance: new Me({ body: n, url: e }),
|
|
320
|
+
timeout: o,
|
|
321
|
+
signal: !0
|
|
322
|
+
});
|
|
323
|
+
s && await s(l);
|
|
324
|
+
let h;
|
|
325
|
+
if ((c = l.headers.get("Content-Type")) != null && c.startsWith("application/json"))
|
|
326
|
+
h = await l.json();
|
|
327
|
+
else {
|
|
328
|
+
h = await l.text();
|
|
329
|
+
try {
|
|
330
|
+
h = JSON.parse(h || "{}");
|
|
331
|
+
} catch (m) {
|
|
332
|
+
if (l.ok)
|
|
333
|
+
throw m;
|
|
334
|
+
h = { error: h };
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (!l.ok)
|
|
338
|
+
throw new L({
|
|
339
|
+
body: n,
|
|
340
|
+
details: B(h.error) || l.statusText,
|
|
341
|
+
headers: l.headers,
|
|
342
|
+
status: l.status,
|
|
343
|
+
url: e
|
|
344
|
+
});
|
|
345
|
+
return h;
|
|
346
|
+
} catch (l) {
|
|
347
|
+
throw l instanceof L || l instanceof Me ? l : new L({
|
|
348
|
+
body: n,
|
|
349
|
+
cause: l,
|
|
350
|
+
url: e
|
|
351
|
+
});
|
|
352
|
+
}
|
|
353
|
+
}
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
function Jn(e, t = {}) {
|
|
357
|
+
const { batch: r, fetchOptions: n, key: a = "http", name: s = "HTTP JSON-RPC", onFetchRequest: o, onFetchResponse: u, retryDelay: d } = t;
|
|
358
|
+
return ({ chain: f, retryCount: i, timeout: c }) => {
|
|
359
|
+
const { batchSize: l = 1e3, wait: h = 0 } = typeof r == "object" ? r : {}, m = t.retryCount ?? i, g = c ?? t.timeout ?? 1e4, b = e || (f == null ? void 0 : f.rpcUrls.default.http[0]);
|
|
360
|
+
if (!b)
|
|
361
|
+
throw new kr();
|
|
362
|
+
const p = Pr(b, {
|
|
363
|
+
fetchOptions: n,
|
|
364
|
+
onRequest: o,
|
|
365
|
+
onResponse: u,
|
|
366
|
+
timeout: g
|
|
367
|
+
});
|
|
368
|
+
return Nr({
|
|
369
|
+
key: a,
|
|
370
|
+
name: s,
|
|
371
|
+
async request({ method: y, params: w }) {
|
|
372
|
+
const T = { method: y, params: w }, { schedule: I } = kt({
|
|
373
|
+
id: b,
|
|
374
|
+
wait: h,
|
|
375
|
+
shouldSplitBatch(E) {
|
|
376
|
+
return E.length > l;
|
|
377
|
+
},
|
|
378
|
+
fn: (E) => p.request({
|
|
379
|
+
body: E
|
|
380
|
+
}),
|
|
381
|
+
sort: (E, A) => E.id - A.id
|
|
382
|
+
}), C = async (E) => r ? I(E) : [
|
|
383
|
+
await p.request({
|
|
384
|
+
body: E
|
|
385
|
+
})
|
|
386
|
+
], [{ error: v, result: N }] = await C(T);
|
|
387
|
+
if (v)
|
|
388
|
+
throw new Nt({
|
|
389
|
+
body: T,
|
|
390
|
+
error: v,
|
|
391
|
+
url: b
|
|
392
|
+
});
|
|
393
|
+
return N;
|
|
394
|
+
},
|
|
395
|
+
retryCount: m,
|
|
396
|
+
retryDelay: d,
|
|
397
|
+
timeout: g,
|
|
398
|
+
type: "http"
|
|
399
|
+
}, {
|
|
400
|
+
fetchOptions: n,
|
|
401
|
+
url: b
|
|
402
|
+
});
|
|
403
|
+
};
|
|
404
|
+
}
|
|
405
|
+
function we(e, t) {
|
|
406
|
+
var n, a, s, o, u, d;
|
|
407
|
+
if (!(e instanceof D))
|
|
408
|
+
return !1;
|
|
409
|
+
const r = e.walk((f) => f instanceof $e);
|
|
410
|
+
return r instanceof $e ? !!(((n = r.data) == null ? void 0 : n.errorName) === "ResolverNotFound" || ((a = r.data) == null ? void 0 : a.errorName) === "ResolverWildcardNotSupported" || ((s = r.data) == null ? void 0 : s.errorName) === "ResolverNotContract" || ((o = r.data) == null ? void 0 : o.errorName) === "ResolverError" || ((u = r.data) == null ? void 0 : u.errorName) === "HttpError" || (d = r.reason) != null && d.includes("Wildcard on non-extended resolvers is not supported") || t === "reverse" && r.reason === xt[50]) : !1;
|
|
411
|
+
}
|
|
412
|
+
function ut(e) {
|
|
413
|
+
if (e.length !== 66 || e.indexOf("[") !== 0 || e.indexOf("]") !== 65)
|
|
414
|
+
return null;
|
|
415
|
+
const t = `0x${e.slice(1, 65)}`;
|
|
416
|
+
return tt(t) ? t : null;
|
|
417
|
+
}
|
|
418
|
+
function Z(e) {
|
|
419
|
+
let t = new Uint8Array(32).fill(0);
|
|
420
|
+
if (!e)
|
|
421
|
+
return H(t);
|
|
422
|
+
const r = e.split(".");
|
|
423
|
+
for (let n = r.length - 1; n >= 0; n -= 1) {
|
|
424
|
+
const a = ut(r[n]), s = a ? ir(a) : P(U(r[n]), "bytes");
|
|
425
|
+
t = P(ye([t, s]), "bytes");
|
|
426
|
+
}
|
|
427
|
+
return H(t);
|
|
428
|
+
}
|
|
429
|
+
function Br(e) {
|
|
430
|
+
return `[${e.slice(2)}]`;
|
|
431
|
+
}
|
|
432
|
+
function Dr(e) {
|
|
433
|
+
const t = new Uint8Array(32).fill(0);
|
|
434
|
+
return e ? ut(e) || P(U(e)) : H(t);
|
|
435
|
+
}
|
|
436
|
+
function Y(e) {
|
|
437
|
+
const t = e.replace(/^\.|\.$/gm, "");
|
|
438
|
+
if (t.length === 0)
|
|
439
|
+
return new Uint8Array(1);
|
|
440
|
+
const r = new Uint8Array(U(t).byteLength + 2);
|
|
441
|
+
let n = 0;
|
|
442
|
+
const a = t.split(".");
|
|
443
|
+
for (let s = 0; s < a.length; s++) {
|
|
444
|
+
let o = U(a[s]);
|
|
445
|
+
o.byteLength > 255 && (o = U(Br(Dr(a[s])))), r[n] = o.length, r.set(o, n + 1), n += o.length + 1;
|
|
446
|
+
}
|
|
447
|
+
return r.byteLength !== n + 1 ? r.slice(0, n + 1) : r;
|
|
448
|
+
}
|
|
449
|
+
async function qr(e, { blockNumber: t, blockTag: r, coinType: n, name: a, gatewayUrls: s, strict: o, universalResolverAddress: u }) {
|
|
450
|
+
let d = u;
|
|
451
|
+
if (!d) {
|
|
452
|
+
if (!e.chain)
|
|
453
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
454
|
+
d = j({
|
|
455
|
+
blockNumber: t,
|
|
456
|
+
chain: e.chain,
|
|
457
|
+
contract: "ensUniversalResolver"
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
try {
|
|
461
|
+
const f = Q({
|
|
462
|
+
abi: ze,
|
|
463
|
+
functionName: "addr",
|
|
464
|
+
...n != null ? { args: [Z(a), BigInt(n)] } : { args: [Z(a)] }
|
|
465
|
+
}), i = {
|
|
466
|
+
address: d,
|
|
467
|
+
abi: Ge,
|
|
468
|
+
functionName: "resolve",
|
|
469
|
+
args: [S(Y(a)), f],
|
|
470
|
+
blockNumber: t,
|
|
471
|
+
blockTag: r
|
|
472
|
+
}, c = R(e, q, "readContract"), l = s ? await c({
|
|
473
|
+
...i,
|
|
474
|
+
args: [...i.args, s]
|
|
475
|
+
}) : await c(i);
|
|
476
|
+
if (l[0] === "0x")
|
|
477
|
+
return null;
|
|
478
|
+
const h = de({
|
|
479
|
+
abi: ze,
|
|
480
|
+
args: n != null ? [Z(a), BigInt(n)] : void 0,
|
|
481
|
+
functionName: "addr",
|
|
482
|
+
data: l[0]
|
|
483
|
+
});
|
|
484
|
+
return h === "0x" || cr(h) === "0x00" ? null : h;
|
|
485
|
+
} catch (f) {
|
|
486
|
+
if (o)
|
|
487
|
+
throw f;
|
|
488
|
+
if (we(f, "resolve"))
|
|
489
|
+
return null;
|
|
490
|
+
throw f;
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
class Fr extends D {
|
|
494
|
+
constructor({ data: t }) {
|
|
495
|
+
super("Unable to extract image from metadata. The metadata may be malformed or invalid.", {
|
|
496
|
+
metaMessages: [
|
|
497
|
+
"- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.",
|
|
498
|
+
"",
|
|
499
|
+
`Provided data: ${JSON.stringify(t)}`
|
|
500
|
+
],
|
|
501
|
+
name: "EnsAvatarInvalidMetadataError"
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
class z extends D {
|
|
506
|
+
constructor({ reason: t }) {
|
|
507
|
+
super(`ENS NFT avatar URI is invalid. ${t}`, {
|
|
508
|
+
name: "EnsAvatarInvalidNftUriError"
|
|
509
|
+
});
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
class be extends D {
|
|
513
|
+
constructor({ uri: t }) {
|
|
514
|
+
super(`Unable to resolve ENS avatar URI "${t}". The URI may be malformed, invalid, or does not respond with a valid image.`, { name: "EnsAvatarUriResolutionError" });
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
class Sr extends D {
|
|
518
|
+
constructor({ namespace: t }) {
|
|
519
|
+
super(`ENS NFT avatar namespace "${t}" is not supported. Must be "erc721" or "erc1155".`, { name: "EnsAvatarUnsupportedNamespaceError" });
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const _r = /(?<protocol>https?:\/\/[^\/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/, Mr = /^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/, $r = /^data:([a-zA-Z\-/+]*);base64,([^"].*)/, zr = /^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;
|
|
523
|
+
async function Lr(e) {
|
|
524
|
+
try {
|
|
525
|
+
const t = await fetch(e, { method: "HEAD" });
|
|
526
|
+
if (t.status === 200) {
|
|
527
|
+
const r = t.headers.get("content-type");
|
|
528
|
+
return r == null ? void 0 : r.startsWith("image/");
|
|
529
|
+
}
|
|
530
|
+
return !1;
|
|
531
|
+
} catch (t) {
|
|
532
|
+
return typeof t == "object" && typeof t.response < "u" || !globalThis.hasOwnProperty("Image") ? !1 : new Promise((r) => {
|
|
533
|
+
const n = new Image();
|
|
534
|
+
n.onload = () => {
|
|
535
|
+
r(!0);
|
|
536
|
+
}, n.onerror = () => {
|
|
537
|
+
r(!1);
|
|
538
|
+
}, n.src = e;
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
}
|
|
542
|
+
function Oe(e, t) {
|
|
543
|
+
return e ? e.endsWith("/") ? e.slice(0, -1) : e : t;
|
|
544
|
+
}
|
|
545
|
+
function dt({ uri: e, gatewayUrls: t }) {
|
|
546
|
+
const r = $r.test(e);
|
|
547
|
+
if (r)
|
|
548
|
+
return { uri: e, isOnChain: !0, isEncoded: r };
|
|
549
|
+
const n = Oe(t == null ? void 0 : t.ipfs, "https://ipfs.io"), a = Oe(t == null ? void 0 : t.arweave, "https://arweave.net"), s = e.match(_r), { protocol: o, subpath: u, target: d, subtarget: f = "" } = (s == null ? void 0 : s.groups) || {}, i = o === "ipns:/" || u === "ipns/", c = o === "ipfs:/" || u === "ipfs/" || Mr.test(e);
|
|
550
|
+
if (e.startsWith("http") && !i && !c) {
|
|
551
|
+
let h = e;
|
|
552
|
+
return t != null && t.arweave && (h = e.replace(/https:\/\/arweave.net/g, t == null ? void 0 : t.arweave)), { uri: h, isOnChain: !1, isEncoded: !1 };
|
|
553
|
+
}
|
|
554
|
+
if ((i || c) && d)
|
|
555
|
+
return {
|
|
556
|
+
uri: `${n}/${i ? "ipns" : "ipfs"}/${d}${f}`,
|
|
557
|
+
isOnChain: !1,
|
|
558
|
+
isEncoded: !1
|
|
559
|
+
};
|
|
560
|
+
if (o === "ar:/" && d)
|
|
561
|
+
return {
|
|
562
|
+
uri: `${a}/${d}${f || ""}`,
|
|
563
|
+
isOnChain: !1,
|
|
564
|
+
isEncoded: !1
|
|
565
|
+
};
|
|
566
|
+
let l = e.replace(zr, "");
|
|
567
|
+
if (l.startsWith("<svg") && (l = `data:image/svg+xml;base64,${btoa(l)}`), l.startsWith("data:") || l.startsWith("{"))
|
|
568
|
+
return {
|
|
569
|
+
uri: l,
|
|
570
|
+
isOnChain: !0,
|
|
571
|
+
isEncoded: !1
|
|
572
|
+
};
|
|
573
|
+
throw new be({ uri: e });
|
|
574
|
+
}
|
|
575
|
+
function ft(e) {
|
|
576
|
+
if (typeof e != "object" || !("image" in e) && !("image_url" in e) && !("image_data" in e))
|
|
577
|
+
throw new Fr({ data: e });
|
|
578
|
+
return e.image || e.image_url || e.image_data;
|
|
579
|
+
}
|
|
580
|
+
async function Ur({ gatewayUrls: e, uri: t }) {
|
|
581
|
+
try {
|
|
582
|
+
const r = await fetch(t).then((a) => a.json());
|
|
583
|
+
return await ve({
|
|
584
|
+
gatewayUrls: e,
|
|
585
|
+
uri: ft(r)
|
|
586
|
+
});
|
|
587
|
+
} catch {
|
|
588
|
+
throw new be({ uri: t });
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
async function ve({ gatewayUrls: e, uri: t }) {
|
|
592
|
+
const { uri: r, isOnChain: n } = dt({ uri: t, gatewayUrls: e });
|
|
593
|
+
if (n || await Lr(r))
|
|
594
|
+
return r;
|
|
595
|
+
throw new be({ uri: t });
|
|
596
|
+
}
|
|
597
|
+
function Hr(e) {
|
|
598
|
+
let t = e;
|
|
599
|
+
t.startsWith("did:nft:") && (t = t.replace("did:nft:", "").replace(/_/g, "/"));
|
|
600
|
+
const [r, n, a] = t.split("/"), [s, o] = r.split(":"), [u, d] = n.split(":");
|
|
601
|
+
if (!s || s.toLowerCase() !== "eip155")
|
|
602
|
+
throw new z({ reason: "Only EIP-155 supported" });
|
|
603
|
+
if (!o)
|
|
604
|
+
throw new z({ reason: "Chain ID not found" });
|
|
605
|
+
if (!d)
|
|
606
|
+
throw new z({
|
|
607
|
+
reason: "Contract address not found"
|
|
608
|
+
});
|
|
609
|
+
if (!a)
|
|
610
|
+
throw new z({ reason: "Token ID not found" });
|
|
611
|
+
if (!u)
|
|
612
|
+
throw new z({ reason: "ERC namespace not found" });
|
|
613
|
+
return {
|
|
614
|
+
chainID: Number.parseInt(o),
|
|
615
|
+
namespace: u.toLowerCase(),
|
|
616
|
+
contractAddress: d,
|
|
617
|
+
tokenID: a
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
async function jr(e, { nft: t }) {
|
|
621
|
+
if (t.namespace === "erc721")
|
|
622
|
+
return q(e, {
|
|
623
|
+
address: t.contractAddress,
|
|
624
|
+
abi: [
|
|
625
|
+
{
|
|
626
|
+
name: "tokenURI",
|
|
627
|
+
type: "function",
|
|
628
|
+
stateMutability: "view",
|
|
629
|
+
inputs: [{ name: "tokenId", type: "uint256" }],
|
|
630
|
+
outputs: [{ name: "", type: "string" }]
|
|
631
|
+
}
|
|
632
|
+
],
|
|
633
|
+
functionName: "tokenURI",
|
|
634
|
+
args: [BigInt(t.tokenID)]
|
|
635
|
+
});
|
|
636
|
+
if (t.namespace === "erc1155")
|
|
637
|
+
return q(e, {
|
|
638
|
+
address: t.contractAddress,
|
|
639
|
+
abi: [
|
|
640
|
+
{
|
|
641
|
+
name: "uri",
|
|
642
|
+
type: "function",
|
|
643
|
+
stateMutability: "view",
|
|
644
|
+
inputs: [{ name: "_id", type: "uint256" }],
|
|
645
|
+
outputs: [{ name: "", type: "string" }]
|
|
646
|
+
}
|
|
647
|
+
],
|
|
648
|
+
functionName: "uri",
|
|
649
|
+
args: [BigInt(t.tokenID)]
|
|
650
|
+
});
|
|
651
|
+
throw new Sr({ namespace: t.namespace });
|
|
652
|
+
}
|
|
653
|
+
async function Or(e, { gatewayUrls: t, record: r }) {
|
|
654
|
+
return /eip155:/i.test(r) ? Wr(e, { gatewayUrls: t, record: r }) : ve({ uri: r, gatewayUrls: t });
|
|
655
|
+
}
|
|
656
|
+
async function Wr(e, { gatewayUrls: t, record: r }) {
|
|
657
|
+
const n = Hr(r), a = await jr(e, { nft: n }), { uri: s, isOnChain: o, isEncoded: u } = dt({ uri: a, gatewayUrls: t });
|
|
658
|
+
if (o && (s.includes("data:application/json;base64,") || s.startsWith("{"))) {
|
|
659
|
+
const f = u ? (
|
|
660
|
+
// if it is encoded, decode it
|
|
661
|
+
atob(s.replace("data:application/json;base64,", ""))
|
|
662
|
+
) : (
|
|
663
|
+
// if it isn't encoded assume it is a JSON string, but it could be anything (it will error if it is)
|
|
664
|
+
s
|
|
665
|
+
), i = JSON.parse(f);
|
|
666
|
+
return ve({ uri: ft(i), gatewayUrls: t });
|
|
667
|
+
}
|
|
668
|
+
let d = n.tokenID;
|
|
669
|
+
return n.namespace === "erc1155" && (d = d.replace("0x", "").padStart(64, "0")), Ur({
|
|
670
|
+
gatewayUrls: t,
|
|
671
|
+
uri: s.replace(/(?:0x)?{id}/, d)
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
async function lt(e, { blockNumber: t, blockTag: r, name: n, key: a, gatewayUrls: s, strict: o, universalResolverAddress: u }) {
|
|
675
|
+
let d = u;
|
|
676
|
+
if (!d) {
|
|
677
|
+
if (!e.chain)
|
|
678
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
679
|
+
d = j({
|
|
680
|
+
blockNumber: t,
|
|
681
|
+
chain: e.chain,
|
|
682
|
+
contract: "ensUniversalResolver"
|
|
683
|
+
});
|
|
684
|
+
}
|
|
685
|
+
try {
|
|
686
|
+
const f = {
|
|
687
|
+
address: d,
|
|
688
|
+
abi: Ge,
|
|
689
|
+
functionName: "resolve",
|
|
690
|
+
args: [
|
|
691
|
+
S(Y(n)),
|
|
692
|
+
Q({
|
|
693
|
+
abi: Le,
|
|
694
|
+
functionName: "text",
|
|
695
|
+
args: [Z(n), a]
|
|
696
|
+
})
|
|
697
|
+
],
|
|
698
|
+
blockNumber: t,
|
|
699
|
+
blockTag: r
|
|
700
|
+
}, i = R(e, q, "readContract"), c = s ? await i({
|
|
701
|
+
...f,
|
|
702
|
+
args: [...f.args, s]
|
|
703
|
+
}) : await i(f);
|
|
704
|
+
if (c[0] === "0x")
|
|
705
|
+
return null;
|
|
706
|
+
const l = de({
|
|
707
|
+
abi: Le,
|
|
708
|
+
functionName: "text",
|
|
709
|
+
data: c[0]
|
|
710
|
+
});
|
|
711
|
+
return l === "" ? null : l;
|
|
712
|
+
} catch (f) {
|
|
713
|
+
if (o)
|
|
714
|
+
throw f;
|
|
715
|
+
if (we(f, "resolve"))
|
|
716
|
+
return null;
|
|
717
|
+
throw f;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
async function Gr(e, { blockNumber: t, blockTag: r, assetGatewayUrls: n, name: a, gatewayUrls: s, strict: o, universalResolverAddress: u }) {
|
|
721
|
+
const d = await R(e, lt, "getEnsText")({
|
|
722
|
+
blockNumber: t,
|
|
723
|
+
blockTag: r,
|
|
724
|
+
key: "avatar",
|
|
725
|
+
name: a,
|
|
726
|
+
universalResolverAddress: u,
|
|
727
|
+
gatewayUrls: s,
|
|
728
|
+
strict: o
|
|
729
|
+
});
|
|
730
|
+
if (!d)
|
|
731
|
+
return null;
|
|
732
|
+
try {
|
|
733
|
+
return await Or(e, {
|
|
734
|
+
record: d,
|
|
735
|
+
gatewayUrls: n
|
|
736
|
+
});
|
|
737
|
+
} catch {
|
|
738
|
+
return null;
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
async function Zr(e, { address: t, blockNumber: r, blockTag: n, gatewayUrls: a, strict: s, universalResolverAddress: o }) {
|
|
742
|
+
let u = o;
|
|
743
|
+
if (!u) {
|
|
744
|
+
if (!e.chain)
|
|
745
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
746
|
+
u = j({
|
|
747
|
+
blockNumber: r,
|
|
748
|
+
chain: e.chain,
|
|
749
|
+
contract: "ensUniversalResolver"
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
const d = `${t.toLowerCase().substring(2)}.addr.reverse`;
|
|
753
|
+
try {
|
|
754
|
+
const f = {
|
|
755
|
+
address: u,
|
|
756
|
+
abi: At,
|
|
757
|
+
functionName: "reverse",
|
|
758
|
+
args: [S(Y(d))],
|
|
759
|
+
blockNumber: r,
|
|
760
|
+
blockTag: n
|
|
761
|
+
}, i = R(e, q, "readContract"), [c, l] = a ? await i({
|
|
762
|
+
...f,
|
|
763
|
+
args: [...f.args, a]
|
|
764
|
+
}) : await i(f);
|
|
765
|
+
return t.toLowerCase() !== l.toLowerCase() ? null : c;
|
|
766
|
+
} catch (f) {
|
|
767
|
+
if (s)
|
|
768
|
+
throw f;
|
|
769
|
+
if (we(f, "reverse"))
|
|
770
|
+
return null;
|
|
771
|
+
throw f;
|
|
772
|
+
}
|
|
773
|
+
}
|
|
774
|
+
async function Jr(e, { blockNumber: t, blockTag: r, name: n, universalResolverAddress: a }) {
|
|
775
|
+
let s = a;
|
|
776
|
+
if (!s) {
|
|
777
|
+
if (!e.chain)
|
|
778
|
+
throw new Error("client chain not configured. universalResolverAddress is required.");
|
|
779
|
+
s = j({
|
|
780
|
+
blockNumber: t,
|
|
781
|
+
chain: e.chain,
|
|
782
|
+
contract: "ensUniversalResolver"
|
|
783
|
+
});
|
|
784
|
+
}
|
|
785
|
+
const [o] = await R(e, q, "readContract")({
|
|
786
|
+
address: s,
|
|
787
|
+
abi: [
|
|
788
|
+
{
|
|
789
|
+
inputs: [{ type: "bytes" }],
|
|
790
|
+
name: "findResolver",
|
|
791
|
+
outputs: [{ type: "address" }, { type: "bytes32" }],
|
|
792
|
+
stateMutability: "view",
|
|
793
|
+
type: "function"
|
|
794
|
+
}
|
|
795
|
+
],
|
|
796
|
+
functionName: "findResolver",
|
|
797
|
+
args: [S(Y(n))],
|
|
798
|
+
blockNumber: t,
|
|
799
|
+
blockTag: r
|
|
800
|
+
});
|
|
801
|
+
return o;
|
|
802
|
+
}
|
|
803
|
+
async function Vr(e) {
|
|
804
|
+
const t = fe(e, {
|
|
805
|
+
method: "eth_newBlockFilter"
|
|
806
|
+
}), r = await e.request({
|
|
807
|
+
method: "eth_newBlockFilter"
|
|
808
|
+
});
|
|
809
|
+
return { id: r, request: t(r), type: "block" };
|
|
810
|
+
}
|
|
811
|
+
async function pt(e, { address: t, args: r, event: n, events: a, fromBlock: s, strict: o, toBlock: u } = {}) {
|
|
812
|
+
const d = a ?? (n ? [n] : void 0), f = fe(e, {
|
|
813
|
+
method: "eth_newFilter"
|
|
814
|
+
});
|
|
815
|
+
let i = [];
|
|
816
|
+
d && (i = [d.flatMap((h) => Ze({
|
|
817
|
+
abi: [h],
|
|
818
|
+
eventName: h.name,
|
|
819
|
+
args: r
|
|
820
|
+
}))], n && (i = i[0]));
|
|
821
|
+
const c = await e.request({
|
|
822
|
+
method: "eth_newFilter",
|
|
823
|
+
params: [
|
|
824
|
+
{
|
|
825
|
+
address: t,
|
|
826
|
+
fromBlock: typeof s == "bigint" ? k(s) : s,
|
|
827
|
+
toBlock: typeof u == "bigint" ? k(u) : u,
|
|
828
|
+
...i.length ? { topics: i } : {}
|
|
829
|
+
}
|
|
830
|
+
]
|
|
831
|
+
});
|
|
832
|
+
return {
|
|
833
|
+
abi: d,
|
|
834
|
+
args: r,
|
|
835
|
+
eventName: n ? n.name : void 0,
|
|
836
|
+
fromBlock: s,
|
|
837
|
+
id: c,
|
|
838
|
+
request: f(c),
|
|
839
|
+
strict: !!o,
|
|
840
|
+
toBlock: u,
|
|
841
|
+
type: "event"
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
async function ht(e) {
|
|
845
|
+
const t = fe(e, {
|
|
846
|
+
method: "eth_newPendingTransactionFilter"
|
|
847
|
+
}), r = await e.request({
|
|
848
|
+
method: "eth_newPendingTransactionFilter"
|
|
849
|
+
});
|
|
850
|
+
return { id: r, request: t(r), type: "transaction" };
|
|
851
|
+
}
|
|
852
|
+
async function Qr(e) {
|
|
853
|
+
const t = await e.request({
|
|
854
|
+
method: "eth_blobBaseFee"
|
|
855
|
+
});
|
|
856
|
+
return BigInt(t);
|
|
857
|
+
}
|
|
858
|
+
async function Kr(e, { blockHash: t, blockNumber: r, blockTag: n = "latest" } = {}) {
|
|
859
|
+
const a = r !== void 0 ? k(r) : void 0;
|
|
860
|
+
let s;
|
|
861
|
+
return t ? s = await e.request({
|
|
862
|
+
method: "eth_getBlockTransactionCountByHash",
|
|
863
|
+
params: [t]
|
|
864
|
+
}, { dedupe: !0 }) : s = await e.request({
|
|
865
|
+
method: "eth_getBlockTransactionCountByNumber",
|
|
866
|
+
params: [a || n]
|
|
867
|
+
}, { dedupe: !!a }), rt(s);
|
|
868
|
+
}
|
|
869
|
+
async function We(e, { address: t, blockNumber: r, blockTag: n = "latest" }) {
|
|
870
|
+
const a = r !== void 0 ? k(r) : void 0, s = await e.request({
|
|
871
|
+
method: "eth_getCode",
|
|
872
|
+
params: [t, a || n]
|
|
873
|
+
}, { dedupe: !!a });
|
|
874
|
+
if (s !== "0x")
|
|
875
|
+
return s;
|
|
876
|
+
}
|
|
877
|
+
function Xr(e) {
|
|
878
|
+
var t;
|
|
879
|
+
return {
|
|
880
|
+
baseFeePerGas: e.baseFeePerGas.map((r) => BigInt(r)),
|
|
881
|
+
gasUsedRatio: e.gasUsedRatio,
|
|
882
|
+
oldestBlock: BigInt(e.oldestBlock),
|
|
883
|
+
reward: (t = e.reward) == null ? void 0 : t.map((r) => r.map((n) => BigInt(n)))
|
|
884
|
+
};
|
|
885
|
+
}
|
|
886
|
+
async function Yr(e, { blockCount: t, blockNumber: r, blockTag: n = "latest", rewardPercentiles: a }) {
|
|
887
|
+
const s = r ? k(r) : void 0, o = await e.request({
|
|
888
|
+
method: "eth_feeHistory",
|
|
889
|
+
params: [
|
|
890
|
+
k(t),
|
|
891
|
+
s || n,
|
|
892
|
+
a
|
|
893
|
+
]
|
|
894
|
+
}, { dedupe: !!s });
|
|
895
|
+
return Xr(o);
|
|
896
|
+
}
|
|
897
|
+
async function en(e, { filter: t }) {
|
|
898
|
+
const r = t.strict ?? !1, a = (await t.request({
|
|
899
|
+
method: "eth_getFilterLogs",
|
|
900
|
+
params: [t.id]
|
|
901
|
+
})).map((s) => ae(s));
|
|
902
|
+
return t.abi ? Pt({
|
|
903
|
+
abi: t.abi,
|
|
904
|
+
logs: a,
|
|
905
|
+
strict: r
|
|
906
|
+
}) : a;
|
|
907
|
+
}
|
|
908
|
+
class tn extends D {
|
|
909
|
+
constructor({ domain: t }) {
|
|
910
|
+
super(`Invalid domain "${B(t)}".`, {
|
|
911
|
+
metaMessages: ["Must be a valid EIP-712 domain."]
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
}
|
|
915
|
+
class rn extends D {
|
|
916
|
+
constructor({ primaryType: t, types: r }) {
|
|
917
|
+
super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(r))}\`.`, {
|
|
918
|
+
docsPath: "/api/glossary/Errors#typeddatainvalidprimarytypeerror",
|
|
919
|
+
metaMessages: ["Check that the primary type is a key in `types`."]
|
|
920
|
+
});
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
class nn extends D {
|
|
924
|
+
constructor({ type: t }) {
|
|
925
|
+
super(`Struct type "${t}" is invalid.`, {
|
|
926
|
+
metaMessages: ["Struct type must not be a Solidity type."],
|
|
927
|
+
name: "InvalidStructTypeError"
|
|
928
|
+
});
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
function an(e) {
|
|
932
|
+
const { domain: t = {}, message: r, primaryType: n } = e, a = {
|
|
933
|
+
EIP712Domain: vt({ domain: t }),
|
|
934
|
+
...e.types
|
|
935
|
+
};
|
|
936
|
+
bt({
|
|
937
|
+
domain: t,
|
|
938
|
+
message: r,
|
|
939
|
+
primaryType: n,
|
|
940
|
+
types: a
|
|
941
|
+
});
|
|
942
|
+
const s = ["0x1901"];
|
|
943
|
+
return t && s.push(sn({
|
|
944
|
+
domain: t,
|
|
945
|
+
types: a
|
|
946
|
+
})), n !== "EIP712Domain" && s.push(mt({
|
|
947
|
+
data: r,
|
|
948
|
+
primaryType: n,
|
|
949
|
+
types: a
|
|
950
|
+
})), P(ye(s));
|
|
951
|
+
}
|
|
952
|
+
function sn({ domain: e, types: t }) {
|
|
953
|
+
return mt({
|
|
954
|
+
data: e,
|
|
955
|
+
primaryType: "EIP712Domain",
|
|
956
|
+
types: t
|
|
957
|
+
});
|
|
958
|
+
}
|
|
959
|
+
function mt({ data: e, primaryType: t, types: r }) {
|
|
960
|
+
const n = gt({
|
|
961
|
+
data: e,
|
|
962
|
+
primaryType: t,
|
|
963
|
+
types: r
|
|
964
|
+
});
|
|
965
|
+
return P(n);
|
|
966
|
+
}
|
|
967
|
+
function gt({ data: e, primaryType: t, types: r }) {
|
|
968
|
+
const n = [{ type: "bytes32" }], a = [on({ primaryType: t, types: r })];
|
|
969
|
+
for (const s of r[t]) {
|
|
970
|
+
const [o, u] = wt({
|
|
971
|
+
types: r,
|
|
972
|
+
name: s.name,
|
|
973
|
+
type: s.type,
|
|
974
|
+
value: e[s.name]
|
|
975
|
+
});
|
|
976
|
+
n.push(o), a.push(u);
|
|
977
|
+
}
|
|
978
|
+
return le(n, a);
|
|
979
|
+
}
|
|
980
|
+
function on({ primaryType: e, types: t }) {
|
|
981
|
+
const r = S(cn({ primaryType: e, types: t }));
|
|
982
|
+
return P(r);
|
|
983
|
+
}
|
|
984
|
+
function cn({ primaryType: e, types: t }) {
|
|
985
|
+
let r = "";
|
|
986
|
+
const n = yt({ primaryType: e, types: t });
|
|
987
|
+
n.delete(e);
|
|
988
|
+
const a = [e, ...Array.from(n).sort()];
|
|
989
|
+
for (const s of a)
|
|
990
|
+
r += `${s}(${t[s].map(({ name: o, type: u }) => `${u} ${o}`).join(",")})`;
|
|
991
|
+
return r;
|
|
992
|
+
}
|
|
993
|
+
function yt({ primaryType: e, types: t }, r = /* @__PURE__ */ new Set()) {
|
|
994
|
+
const n = e.match(/^\w*/u), a = n == null ? void 0 : n[0];
|
|
995
|
+
if (r.has(a) || t[a] === void 0)
|
|
996
|
+
return r;
|
|
997
|
+
r.add(a);
|
|
998
|
+
for (const s of t[a])
|
|
999
|
+
yt({ primaryType: s.type, types: t }, r);
|
|
1000
|
+
return r;
|
|
1001
|
+
}
|
|
1002
|
+
function wt({ types: e, name: t, type: r, value: n }) {
|
|
1003
|
+
if (e[r] !== void 0)
|
|
1004
|
+
return [
|
|
1005
|
+
{ type: "bytes32" },
|
|
1006
|
+
P(gt({ data: n, primaryType: r, types: e }))
|
|
1007
|
+
];
|
|
1008
|
+
if (r === "bytes")
|
|
1009
|
+
return n = `0x${(n.length % 2 ? "0" : "") + n.slice(2)}`, [{ type: "bytes32" }, P(n)];
|
|
1010
|
+
if (r === "string")
|
|
1011
|
+
return [{ type: "bytes32" }, P(S(n))];
|
|
1012
|
+
if (r.lastIndexOf("]") === r.length - 1) {
|
|
1013
|
+
const a = r.slice(0, r.lastIndexOf("[")), s = n.map((o) => wt({
|
|
1014
|
+
name: t,
|
|
1015
|
+
type: a,
|
|
1016
|
+
types: e,
|
|
1017
|
+
value: o
|
|
1018
|
+
}));
|
|
1019
|
+
return [
|
|
1020
|
+
{ type: "bytes32" },
|
|
1021
|
+
P(le(s.map(([o]) => o), s.map(([, o]) => o)))
|
|
1022
|
+
];
|
|
1023
|
+
}
|
|
1024
|
+
return [{ type: r }, n];
|
|
1025
|
+
}
|
|
1026
|
+
function un(e) {
|
|
1027
|
+
const { domain: t, message: r, primaryType: n, types: a } = e, s = (d, f) => {
|
|
1028
|
+
const i = { ...f };
|
|
1029
|
+
for (const c of d) {
|
|
1030
|
+
const { name: l, type: h } = c;
|
|
1031
|
+
h === "address" && (i[l] = i[l].toLowerCase());
|
|
1032
|
+
}
|
|
1033
|
+
return i;
|
|
1034
|
+
}, o = a.EIP712Domain ? t ? s(a.EIP712Domain, t) : {} : {}, u = (() => {
|
|
1035
|
+
if (n !== "EIP712Domain")
|
|
1036
|
+
return s(a[n], r);
|
|
1037
|
+
})();
|
|
1038
|
+
return B({ domain: o, message: u, primaryType: n, types: a });
|
|
1039
|
+
}
|
|
1040
|
+
function bt(e) {
|
|
1041
|
+
const { domain: t, message: r, primaryType: n, types: a } = e, s = (o, u) => {
|
|
1042
|
+
for (const d of o) {
|
|
1043
|
+
const { name: f, type: i } = d, c = u[f], l = i.match(Bt);
|
|
1044
|
+
if (l && (typeof c == "number" || typeof c == "bigint")) {
|
|
1045
|
+
const [g, b, p] = l;
|
|
1046
|
+
k(c, {
|
|
1047
|
+
signed: b === "int",
|
|
1048
|
+
size: Number.parseInt(p) / 8
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
if (i === "address" && typeof c == "string" && !ur(c))
|
|
1052
|
+
throw new dr({ address: c });
|
|
1053
|
+
const h = i.match(Dt);
|
|
1054
|
+
if (h) {
|
|
1055
|
+
const [g, b] = h;
|
|
1056
|
+
if (b && se(c) !== Number.parseInt(b))
|
|
1057
|
+
throw new qt({
|
|
1058
|
+
expectedSize: Number.parseInt(b),
|
|
1059
|
+
givenSize: se(c)
|
|
1060
|
+
});
|
|
1061
|
+
}
|
|
1062
|
+
const m = a[i];
|
|
1063
|
+
m && (dn(i), s(m, c));
|
|
1064
|
+
}
|
|
1065
|
+
};
|
|
1066
|
+
if (a.EIP712Domain && t) {
|
|
1067
|
+
if (typeof t != "object")
|
|
1068
|
+
throw new tn({ domain: t });
|
|
1069
|
+
s(a.EIP712Domain, t);
|
|
1070
|
+
}
|
|
1071
|
+
if (n !== "EIP712Domain")
|
|
1072
|
+
if (a[n])
|
|
1073
|
+
s(a[n], r);
|
|
1074
|
+
else
|
|
1075
|
+
throw new rn({ primaryType: n, types: a });
|
|
1076
|
+
}
|
|
1077
|
+
function vt({ domain: e }) {
|
|
1078
|
+
return [
|
|
1079
|
+
typeof (e == null ? void 0 : e.name) == "string" && { name: "name", type: "string" },
|
|
1080
|
+
(e == null ? void 0 : e.version) && { name: "version", type: "string" },
|
|
1081
|
+
typeof (e == null ? void 0 : e.chainId) == "number" && {
|
|
1082
|
+
name: "chainId",
|
|
1083
|
+
type: "uint256"
|
|
1084
|
+
},
|
|
1085
|
+
(e == null ? void 0 : e.verifyingContract) && {
|
|
1086
|
+
name: "verifyingContract",
|
|
1087
|
+
type: "address"
|
|
1088
|
+
},
|
|
1089
|
+
(e == null ? void 0 : e.salt) && { name: "salt", type: "bytes32" }
|
|
1090
|
+
].filter(Boolean);
|
|
1091
|
+
}
|
|
1092
|
+
function dn(e) {
|
|
1093
|
+
if (e === "address" || e === "bool" || e === "string" || e.startsWith("bytes") || e.startsWith("uint") || e.startsWith("int"))
|
|
1094
|
+
throw new nn({ type: e });
|
|
1095
|
+
}
|
|
1096
|
+
const fn = `Ethereum Signed Message:
|
|
1097
|
+
`;
|
|
1098
|
+
function ln(e) {
|
|
1099
|
+
const t = typeof e == "string" ? J(e) : typeof e.raw == "string" ? e.raw : H(e.raw), r = J(`${fn}${se(t)}`);
|
|
1100
|
+
return ye([r, t]);
|
|
1101
|
+
}
|
|
1102
|
+
function Tt(e, t) {
|
|
1103
|
+
return P(ln(e), t);
|
|
1104
|
+
}
|
|
1105
|
+
const Rt = "0x6492649264926492649264926492649264926492649264926492649264926492";
|
|
1106
|
+
function pn(e) {
|
|
1107
|
+
return fr(e, -32) === Rt;
|
|
1108
|
+
}
|
|
1109
|
+
function hn(e) {
|
|
1110
|
+
const { address: t, data: r, signature: n, to: a = "hex" } = e, s = lr([
|
|
1111
|
+
le([{ type: "address" }, { type: "bytes" }, { type: "bytes" }], [t, r, n]),
|
|
1112
|
+
Rt
|
|
1113
|
+
]);
|
|
1114
|
+
return a === "hex" ? s : nt(s);
|
|
1115
|
+
}
|
|
1116
|
+
function mn(e) {
|
|
1117
|
+
return e.map((t) => ({
|
|
1118
|
+
...t,
|
|
1119
|
+
value: BigInt(t.value)
|
|
1120
|
+
}));
|
|
1121
|
+
}
|
|
1122
|
+
function gn(e) {
|
|
1123
|
+
return {
|
|
1124
|
+
...e,
|
|
1125
|
+
balance: e.balance ? BigInt(e.balance) : void 0,
|
|
1126
|
+
nonce: e.nonce ? rt(e.nonce) : void 0,
|
|
1127
|
+
storageProof: e.storageProof ? mn(e.storageProof) : void 0
|
|
1128
|
+
};
|
|
1129
|
+
}
|
|
1130
|
+
async function yn(e, { address: t, blockNumber: r, blockTag: n, storageKeys: a }) {
|
|
1131
|
+
const s = n ?? "latest", o = r !== void 0 ? k(r) : void 0, u = await e.request({
|
|
1132
|
+
method: "eth_getProof",
|
|
1133
|
+
params: [t, a, o || s]
|
|
1134
|
+
});
|
|
1135
|
+
return gn(u);
|
|
1136
|
+
}
|
|
1137
|
+
async function wn(e, { address: t, blockNumber: r, blockTag: n = "latest", slot: a }) {
|
|
1138
|
+
const s = r !== void 0 ? k(r) : void 0;
|
|
1139
|
+
return await e.request({
|
|
1140
|
+
method: "eth_getStorageAt",
|
|
1141
|
+
params: [t, a, s || n]
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
async function Te(e, { blockHash: t, blockNumber: r, blockTag: n, hash: a, index: s }) {
|
|
1145
|
+
var i, c, l;
|
|
1146
|
+
const o = n || "latest", u = r !== void 0 ? k(r) : void 0;
|
|
1147
|
+
let d = null;
|
|
1148
|
+
if (a ? d = await e.request({
|
|
1149
|
+
method: "eth_getTransactionByHash",
|
|
1150
|
+
params: [a]
|
|
1151
|
+
}, { dedupe: !0 }) : t ? d = await e.request({
|
|
1152
|
+
method: "eth_getTransactionByBlockHashAndIndex",
|
|
1153
|
+
params: [t, k(s)]
|
|
1154
|
+
}, { dedupe: !0 }) : (u || o) && (d = await e.request({
|
|
1155
|
+
method: "eth_getTransactionByBlockNumberAndIndex",
|
|
1156
|
+
params: [u || o, k(s)]
|
|
1157
|
+
}, { dedupe: !!u })), !d)
|
|
1158
|
+
throw new at({
|
|
1159
|
+
blockHash: t,
|
|
1160
|
+
blockNumber: r,
|
|
1161
|
+
blockTag: o,
|
|
1162
|
+
hash: a,
|
|
1163
|
+
index: s
|
|
1164
|
+
});
|
|
1165
|
+
return (((l = (c = (i = e.chain) == null ? void 0 : i.formatters) == null ? void 0 : c.transaction) == null ? void 0 : l.format) || pr)(d);
|
|
1166
|
+
}
|
|
1167
|
+
async function bn(e, { hash: t, transactionReceipt: r }) {
|
|
1168
|
+
const [n, a] = await Promise.all([
|
|
1169
|
+
R(e, K, "getBlockNumber")({}),
|
|
1170
|
+
t ? R(e, Te, "getTransaction")({ hash: t }) : void 0
|
|
1171
|
+
]), s = (r == null ? void 0 : r.blockNumber) || (a == null ? void 0 : a.blockNumber);
|
|
1172
|
+
return s ? n - s + 1n : 0n;
|
|
1173
|
+
}
|
|
1174
|
+
async function ue(e, { hash: t }) {
|
|
1175
|
+
var a, s, o;
|
|
1176
|
+
const r = await e.request({
|
|
1177
|
+
method: "eth_getTransactionReceipt",
|
|
1178
|
+
params: [t]
|
|
1179
|
+
}, { dedupe: !0 });
|
|
1180
|
+
if (!r)
|
|
1181
|
+
throw new st({ hash: t });
|
|
1182
|
+
return (((o = (s = (a = e.chain) == null ? void 0 : a.formatters) == null ? void 0 : s.transactionReceipt) == null ? void 0 : o.format) || hr)(r);
|
|
1183
|
+
}
|
|
1184
|
+
async function vn(e, t) {
|
|
1185
|
+
var b;
|
|
1186
|
+
const { allowFailure: r = !0, batchSize: n, blockNumber: a, blockTag: s, multicallAddress: o, stateOverride: u } = t, d = t.contracts, f = n ?? (typeof ((b = e.batch) == null ? void 0 : b.multicall) == "object" && e.batch.multicall.batchSize || 1024);
|
|
1187
|
+
let i = o;
|
|
1188
|
+
if (!i) {
|
|
1189
|
+
if (!e.chain)
|
|
1190
|
+
throw new Error("client chain not configured. multicallAddress is required.");
|
|
1191
|
+
i = j({
|
|
1192
|
+
blockNumber: a,
|
|
1193
|
+
chain: e.chain,
|
|
1194
|
+
contract: "multicall3"
|
|
1195
|
+
});
|
|
1196
|
+
}
|
|
1197
|
+
const c = [[]];
|
|
1198
|
+
let l = 0, h = 0;
|
|
1199
|
+
for (let p = 0; p < d.length; p++) {
|
|
1200
|
+
const { abi: y, address: w, args: T, functionName: I } = d[p];
|
|
1201
|
+
try {
|
|
1202
|
+
const C = Q({ abi: y, args: T, functionName: I });
|
|
1203
|
+
h += (C.length - 2) / 2, // Check if batching is enabled.
|
|
1204
|
+
f > 0 && // Check if the current size of the batch exceeds the size limit.
|
|
1205
|
+
h > f && // Check if the current chunk is not already empty.
|
|
1206
|
+
c[l].length > 0 && (l++, h = (C.length - 2) / 2, c[l] = []), c[l] = [
|
|
1207
|
+
...c[l],
|
|
1208
|
+
{
|
|
1209
|
+
allowFailure: !0,
|
|
1210
|
+
callData: C,
|
|
1211
|
+
target: w
|
|
1212
|
+
}
|
|
1213
|
+
];
|
|
1214
|
+
} catch (C) {
|
|
1215
|
+
const v = Ue(C, {
|
|
1216
|
+
abi: y,
|
|
1217
|
+
address: w,
|
|
1218
|
+
args: T,
|
|
1219
|
+
docsPath: "/docs/contract/multicall",
|
|
1220
|
+
functionName: I
|
|
1221
|
+
});
|
|
1222
|
+
if (!r)
|
|
1223
|
+
throw v;
|
|
1224
|
+
c[l] = [
|
|
1225
|
+
...c[l],
|
|
1226
|
+
{
|
|
1227
|
+
allowFailure: !0,
|
|
1228
|
+
callData: "0x",
|
|
1229
|
+
target: w
|
|
1230
|
+
}
|
|
1231
|
+
];
|
|
1232
|
+
}
|
|
1233
|
+
}
|
|
1234
|
+
const m = await Promise.allSettled(c.map((p) => R(e, q, "readContract")({
|
|
1235
|
+
abi: Ft,
|
|
1236
|
+
address: i,
|
|
1237
|
+
args: [p],
|
|
1238
|
+
blockNumber: a,
|
|
1239
|
+
blockTag: s,
|
|
1240
|
+
functionName: "aggregate3",
|
|
1241
|
+
stateOverride: u
|
|
1242
|
+
}))), g = [];
|
|
1243
|
+
for (let p = 0; p < m.length; p++) {
|
|
1244
|
+
const y = m[p];
|
|
1245
|
+
if (y.status === "rejected") {
|
|
1246
|
+
if (!r)
|
|
1247
|
+
throw y.reason;
|
|
1248
|
+
for (let T = 0; T < c[p].length; T++)
|
|
1249
|
+
g.push({
|
|
1250
|
+
status: "failure",
|
|
1251
|
+
error: y.reason,
|
|
1252
|
+
result: void 0
|
|
1253
|
+
});
|
|
1254
|
+
continue;
|
|
1255
|
+
}
|
|
1256
|
+
const w = y.value;
|
|
1257
|
+
for (let T = 0; T < w.length; T++) {
|
|
1258
|
+
const { returnData: I, success: C } = w[T], { callData: v } = c[p][T], { abi: N, address: E, functionName: A, args: x } = d[g.length];
|
|
1259
|
+
try {
|
|
1260
|
+
if (v === "0x")
|
|
1261
|
+
throw new St();
|
|
1262
|
+
if (!C)
|
|
1263
|
+
throw new _t({ data: I });
|
|
1264
|
+
const F = de({
|
|
1265
|
+
abi: N,
|
|
1266
|
+
args: x,
|
|
1267
|
+
data: I,
|
|
1268
|
+
functionName: A
|
|
1269
|
+
});
|
|
1270
|
+
g.push(r ? { result: F, status: "success" } : F);
|
|
1271
|
+
} catch (F) {
|
|
1272
|
+
const $ = Ue(F, {
|
|
1273
|
+
abi: N,
|
|
1274
|
+
address: E,
|
|
1275
|
+
args: x,
|
|
1276
|
+
docsPath: "/docs/contract/multicall",
|
|
1277
|
+
functionName: A
|
|
1278
|
+
});
|
|
1279
|
+
if (!r)
|
|
1280
|
+
throw $;
|
|
1281
|
+
g.push({ error: $, result: void 0, status: "failure" });
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
if (g.length !== d.length)
|
|
1286
|
+
throw new D("multicall results mismatch");
|
|
1287
|
+
return g;
|
|
1288
|
+
}
|
|
1289
|
+
function Tn({ r: e, s: t, to: r = "hex", v: n, yParity: a }) {
|
|
1290
|
+
const s = (() => {
|
|
1291
|
+
if (a === 0 || a === 1)
|
|
1292
|
+
return a;
|
|
1293
|
+
if (n && (n === 27n || n === 28n || n >= 35n))
|
|
1294
|
+
return n % 2n === 0n ? 1 : 0;
|
|
1295
|
+
throw new Error("Invalid `v` or `yParity` value");
|
|
1296
|
+
})(), o = `0x${new wr.Signature(oe(e), oe(t)).toCompactHex()}${s === 0 ? "1b" : "1c"}`;
|
|
1297
|
+
return r === "hex" ? o : nt(o);
|
|
1298
|
+
}
|
|
1299
|
+
async function Re(e, t) {
|
|
1300
|
+
var c, l, h;
|
|
1301
|
+
const { address: r, factory: n, factoryData: a, hash: s, signature: o, universalSignatureVerifierAddress: u = (h = (l = (c = e.chain) == null ? void 0 : c.contracts) == null ? void 0 : l.universalSignatureVerifier) == null ? void 0 : h.address, ...d } = t, f = tt(o) ? o : typeof o == "object" && "r" in o && "s" in o ? Tn(o) : H(o), i = await (async () => !n && !a || pn(f) ? f : hn({
|
|
1302
|
+
address: n,
|
|
1303
|
+
data: a,
|
|
1304
|
+
signature: f
|
|
1305
|
+
}))();
|
|
1306
|
+
try {
|
|
1307
|
+
const m = u ? {
|
|
1308
|
+
to: u,
|
|
1309
|
+
data: Q({
|
|
1310
|
+
abi: He,
|
|
1311
|
+
functionName: "isValidSig",
|
|
1312
|
+
args: [r, s, i]
|
|
1313
|
+
}),
|
|
1314
|
+
...d
|
|
1315
|
+
} : {
|
|
1316
|
+
data: Je({
|
|
1317
|
+
abi: He,
|
|
1318
|
+
args: [r, s, i],
|
|
1319
|
+
bytecode: Mt
|
|
1320
|
+
}),
|
|
1321
|
+
...d
|
|
1322
|
+
}, { data: g } = await R(e, Ve, "call")(m);
|
|
1323
|
+
return mr(g ?? "0x0");
|
|
1324
|
+
} catch (m) {
|
|
1325
|
+
try {
|
|
1326
|
+
if (Qe(ot(r), await $t({ hash: s, signature: o })))
|
|
1327
|
+
return !0;
|
|
1328
|
+
} catch {
|
|
1329
|
+
}
|
|
1330
|
+
if (m instanceof zt)
|
|
1331
|
+
return !1;
|
|
1332
|
+
throw m;
|
|
1333
|
+
}
|
|
1334
|
+
}
|
|
1335
|
+
async function Rn(e, { address: t, message: r, factory: n, factoryData: a, signature: s, ...o }) {
|
|
1336
|
+
const u = Tt(r);
|
|
1337
|
+
return Re(e, {
|
|
1338
|
+
address: t,
|
|
1339
|
+
factory: n,
|
|
1340
|
+
factoryData: a,
|
|
1341
|
+
hash: u,
|
|
1342
|
+
signature: s,
|
|
1343
|
+
...o
|
|
1344
|
+
});
|
|
1345
|
+
}
|
|
1346
|
+
async function Cn(e, t) {
|
|
1347
|
+
const { address: r, factory: n, factoryData: a, signature: s, message: o, primaryType: u, types: d, domain: f, ...i } = t, c = an({ message: o, primaryType: u, types: d, domain: f });
|
|
1348
|
+
return Re(e, {
|
|
1349
|
+
address: r,
|
|
1350
|
+
factory: n,
|
|
1351
|
+
factoryData: a,
|
|
1352
|
+
hash: c,
|
|
1353
|
+
signature: s,
|
|
1354
|
+
...i
|
|
1355
|
+
});
|
|
1356
|
+
}
|
|
1357
|
+
function Ct(e, { emitOnBegin: t = !1, emitMissed: r = !1, onBlockNumber: n, onError: a, poll: s, pollingInterval: o = e.pollingInterval }) {
|
|
1358
|
+
const u = typeof s < "u" ? s : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket");
|
|
1359
|
+
let d;
|
|
1360
|
+
return u ? (() => {
|
|
1361
|
+
const c = B([
|
|
1362
|
+
"watchBlockNumber",
|
|
1363
|
+
e.uid,
|
|
1364
|
+
t,
|
|
1365
|
+
r,
|
|
1366
|
+
o
|
|
1367
|
+
]);
|
|
1368
|
+
return M(c, { onBlockNumber: n, onError: a }, (l) => X(async () => {
|
|
1369
|
+
var h;
|
|
1370
|
+
try {
|
|
1371
|
+
const m = await R(e, K, "getBlockNumber")({ cacheTime: 0 });
|
|
1372
|
+
if (d) {
|
|
1373
|
+
if (m === d)
|
|
1374
|
+
return;
|
|
1375
|
+
if (m - d > 1 && r)
|
|
1376
|
+
for (let g = d + 1n; g < m; g++)
|
|
1377
|
+
l.onBlockNumber(g, d), d = g;
|
|
1378
|
+
}
|
|
1379
|
+
(!d || m > d) && (l.onBlockNumber(m, d), d = m);
|
|
1380
|
+
} catch (m) {
|
|
1381
|
+
(h = l.onError) == null || h.call(l, m);
|
|
1382
|
+
}
|
|
1383
|
+
}, {
|
|
1384
|
+
emitOnBegin: t,
|
|
1385
|
+
interval: o
|
|
1386
|
+
}));
|
|
1387
|
+
})() : (() => {
|
|
1388
|
+
const c = B([
|
|
1389
|
+
"watchBlockNumber",
|
|
1390
|
+
e.uid,
|
|
1391
|
+
t,
|
|
1392
|
+
r
|
|
1393
|
+
]);
|
|
1394
|
+
return M(c, { onBlockNumber: n, onError: a }, (l) => {
|
|
1395
|
+
let h = !0, m = () => h = !1;
|
|
1396
|
+
return (async () => {
|
|
1397
|
+
try {
|
|
1398
|
+
const g = (() => {
|
|
1399
|
+
if (e.transport.type === "fallback") {
|
|
1400
|
+
const p = e.transport.transports.find((y) => y.config.type === "webSocket");
|
|
1401
|
+
return p ? p.value : e.transport;
|
|
1402
|
+
}
|
|
1403
|
+
return e.transport;
|
|
1404
|
+
})(), { unsubscribe: b } = await g.subscribe({
|
|
1405
|
+
params: ["newHeads"],
|
|
1406
|
+
onData(p) {
|
|
1407
|
+
var w;
|
|
1408
|
+
if (!h)
|
|
1409
|
+
return;
|
|
1410
|
+
const y = oe((w = p.result) == null ? void 0 : w.number);
|
|
1411
|
+
l.onBlockNumber(y, d), d = y;
|
|
1412
|
+
},
|
|
1413
|
+
onError(p) {
|
|
1414
|
+
var y;
|
|
1415
|
+
(y = l.onError) == null || y.call(l, p);
|
|
1416
|
+
}
|
|
1417
|
+
});
|
|
1418
|
+
m = b, h || m();
|
|
1419
|
+
} catch (g) {
|
|
1420
|
+
a == null || a(g);
|
|
1421
|
+
}
|
|
1422
|
+
})(), () => m();
|
|
1423
|
+
});
|
|
1424
|
+
})();
|
|
1425
|
+
}
|
|
1426
|
+
async function En(e, {
|
|
1427
|
+
confirmations: t = 1,
|
|
1428
|
+
hash: r,
|
|
1429
|
+
onReplaced: n,
|
|
1430
|
+
pollingInterval: a = e.pollingInterval,
|
|
1431
|
+
retryCount: s = 6,
|
|
1432
|
+
retryDelay: o = ({ count: d }) => ~~(1 << d) * 200,
|
|
1433
|
+
// exponential backoff
|
|
1434
|
+
timeout: u = 18e4
|
|
1435
|
+
}) {
|
|
1436
|
+
const d = B(["waitForTransactionReceipt", e.uid, r]);
|
|
1437
|
+
let f, i, c, l = !1;
|
|
1438
|
+
const { promise: h, resolve: m, reject: g } = Lt(), b = u ? setTimeout(() => g(new gr({ hash: r })), u) : void 0, p = M(d, { onReplaced: n, resolve: m, reject: g }, (y) => {
|
|
1439
|
+
const w = R(e, Ct, "watchBlockNumber")({
|
|
1440
|
+
emitMissed: !0,
|
|
1441
|
+
emitOnBegin: !0,
|
|
1442
|
+
poll: !0,
|
|
1443
|
+
pollingInterval: a,
|
|
1444
|
+
async onBlockNumber(T) {
|
|
1445
|
+
const I = (v) => {
|
|
1446
|
+
clearTimeout(b), w(), v(), p();
|
|
1447
|
+
};
|
|
1448
|
+
let C = T;
|
|
1449
|
+
if (!l)
|
|
1450
|
+
try {
|
|
1451
|
+
if (c) {
|
|
1452
|
+
if (t > 1 && (!c.blockNumber || C - c.blockNumber + 1n < t))
|
|
1453
|
+
return;
|
|
1454
|
+
I(() => y.resolve(c));
|
|
1455
|
+
return;
|
|
1456
|
+
}
|
|
1457
|
+
if (f || (l = !0, await ce(async () => {
|
|
1458
|
+
f = await R(e, Te, "getTransaction")({ hash: r }), f.blockNumber && (C = f.blockNumber);
|
|
1459
|
+
}, {
|
|
1460
|
+
delay: o,
|
|
1461
|
+
retryCount: s
|
|
1462
|
+
}), l = !1), c = await R(e, ue, "getTransactionReceipt")({ hash: r }), t > 1 && (!c.blockNumber || C - c.blockNumber + 1n < t))
|
|
1463
|
+
return;
|
|
1464
|
+
I(() => y.resolve(c));
|
|
1465
|
+
} catch (v) {
|
|
1466
|
+
if (v instanceof at || v instanceof st) {
|
|
1467
|
+
if (!f) {
|
|
1468
|
+
l = !1;
|
|
1469
|
+
return;
|
|
1470
|
+
}
|
|
1471
|
+
try {
|
|
1472
|
+
i = f, l = !0;
|
|
1473
|
+
const N = await ce(() => R(e, _, "getBlock")({
|
|
1474
|
+
blockNumber: C,
|
|
1475
|
+
includeTransactions: !0
|
|
1476
|
+
}), {
|
|
1477
|
+
delay: o,
|
|
1478
|
+
retryCount: s,
|
|
1479
|
+
shouldRetry: ({ error: x }) => x instanceof Ut
|
|
1480
|
+
});
|
|
1481
|
+
l = !1;
|
|
1482
|
+
const E = N.transactions.find(({ from: x, nonce: F }) => x === i.from && F === i.nonce);
|
|
1483
|
+
if (!E || (c = await R(e, ue, "getTransactionReceipt")({
|
|
1484
|
+
hash: E.hash
|
|
1485
|
+
}), t > 1 && (!c.blockNumber || C - c.blockNumber + 1n < t)))
|
|
1486
|
+
return;
|
|
1487
|
+
let A = "replaced";
|
|
1488
|
+
E.to === i.to && E.value === i.value ? A = "repriced" : E.from === E.to && E.value === 0n && (A = "cancelled"), I(() => {
|
|
1489
|
+
var x;
|
|
1490
|
+
(x = y.onReplaced) == null || x.call(y, {
|
|
1491
|
+
reason: A,
|
|
1492
|
+
replacedTransaction: i,
|
|
1493
|
+
transaction: E,
|
|
1494
|
+
transactionReceipt: c
|
|
1495
|
+
}), y.resolve(c);
|
|
1496
|
+
});
|
|
1497
|
+
} catch (N) {
|
|
1498
|
+
I(() => y.reject(N));
|
|
1499
|
+
}
|
|
1500
|
+
} else
|
|
1501
|
+
I(() => y.reject(v));
|
|
1502
|
+
}
|
|
1503
|
+
}
|
|
1504
|
+
});
|
|
1505
|
+
});
|
|
1506
|
+
return h;
|
|
1507
|
+
}
|
|
1508
|
+
function In(e, { blockTag: t = "latest", emitMissed: r = !1, emitOnBegin: n = !1, onBlock: a, onError: s, includeTransactions: o, poll: u, pollingInterval: d = e.pollingInterval }) {
|
|
1509
|
+
const f = typeof u < "u" ? u : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"), i = o ?? !1;
|
|
1510
|
+
let c;
|
|
1511
|
+
return f ? (() => {
|
|
1512
|
+
const m = B([
|
|
1513
|
+
"watchBlocks",
|
|
1514
|
+
e.uid,
|
|
1515
|
+
t,
|
|
1516
|
+
r,
|
|
1517
|
+
n,
|
|
1518
|
+
i,
|
|
1519
|
+
d
|
|
1520
|
+
]);
|
|
1521
|
+
return M(m, { onBlock: a, onError: s }, (g) => X(async () => {
|
|
1522
|
+
var b;
|
|
1523
|
+
try {
|
|
1524
|
+
const p = await R(e, _, "getBlock")({
|
|
1525
|
+
blockTag: t,
|
|
1526
|
+
includeTransactions: i
|
|
1527
|
+
});
|
|
1528
|
+
if (p.number && (c != null && c.number)) {
|
|
1529
|
+
if (p.number === c.number)
|
|
1530
|
+
return;
|
|
1531
|
+
if (p.number - c.number > 1 && r)
|
|
1532
|
+
for (let y = (c == null ? void 0 : c.number) + 1n; y < p.number; y++) {
|
|
1533
|
+
const w = await R(e, _, "getBlock")({
|
|
1534
|
+
blockNumber: y,
|
|
1535
|
+
includeTransactions: i
|
|
1536
|
+
});
|
|
1537
|
+
g.onBlock(w, c), c = w;
|
|
1538
|
+
}
|
|
1539
|
+
}
|
|
1540
|
+
// If no previous block exists, emit.
|
|
1541
|
+
(!(c != null && c.number) || // If the block tag is "pending" with no block number, emit.
|
|
1542
|
+
t === "pending" && !(p != null && p.number) || // If the next block number is greater than the previous block number, emit.
|
|
1543
|
+
// We don't want to emit blocks in the past.
|
|
1544
|
+
p.number && p.number > c.number) && (g.onBlock(p, c), c = p);
|
|
1545
|
+
} catch (p) {
|
|
1546
|
+
(b = g.onError) == null || b.call(g, p);
|
|
1547
|
+
}
|
|
1548
|
+
}, {
|
|
1549
|
+
emitOnBegin: n,
|
|
1550
|
+
interval: d
|
|
1551
|
+
}));
|
|
1552
|
+
})() : (() => {
|
|
1553
|
+
let m = !0, g = !0, b = () => m = !1;
|
|
1554
|
+
return (async () => {
|
|
1555
|
+
try {
|
|
1556
|
+
n && R(e, _, "getBlock")({
|
|
1557
|
+
blockTag: t,
|
|
1558
|
+
includeTransactions: i
|
|
1559
|
+
}).then((w) => {
|
|
1560
|
+
m && g && (a(w, void 0), g = !1);
|
|
1561
|
+
});
|
|
1562
|
+
const p = (() => {
|
|
1563
|
+
if (e.transport.type === "fallback") {
|
|
1564
|
+
const w = e.transport.transports.find((T) => T.config.type === "webSocket");
|
|
1565
|
+
return w ? w.value : e.transport;
|
|
1566
|
+
}
|
|
1567
|
+
return e.transport;
|
|
1568
|
+
})(), { unsubscribe: y } = await p.subscribe({
|
|
1569
|
+
params: ["newHeads"],
|
|
1570
|
+
async onData(w) {
|
|
1571
|
+
if (!m)
|
|
1572
|
+
return;
|
|
1573
|
+
const T = await R(e, _, "getBlock")({
|
|
1574
|
+
blockNumber: w.blockNumber,
|
|
1575
|
+
includeTransactions: i
|
|
1576
|
+
}).catch(() => {
|
|
1577
|
+
});
|
|
1578
|
+
m && (a(T, c), g = !1, c = T);
|
|
1579
|
+
},
|
|
1580
|
+
onError(w) {
|
|
1581
|
+
s == null || s(w);
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
b = y, m || b();
|
|
1585
|
+
} catch (p) {
|
|
1586
|
+
s == null || s(p);
|
|
1587
|
+
}
|
|
1588
|
+
})(), () => b();
|
|
1589
|
+
})();
|
|
1590
|
+
}
|
|
1591
|
+
function Nn(e, { address: t, args: r, batch: n = !0, event: a, events: s, fromBlock: o, onError: u, onLogs: d, poll: f, pollingInterval: i = e.pollingInterval, strict: c }) {
|
|
1592
|
+
const l = typeof f < "u" ? f : typeof o == "bigint" ? !0 : !(e.transport.type === "webSocket" || e.transport.type === "fallback" && e.transport.transports[0].config.type === "webSocket"), h = c ?? !1;
|
|
1593
|
+
return l ? (() => {
|
|
1594
|
+
const b = B([
|
|
1595
|
+
"watchEvent",
|
|
1596
|
+
t,
|
|
1597
|
+
r,
|
|
1598
|
+
n,
|
|
1599
|
+
e.uid,
|
|
1600
|
+
a,
|
|
1601
|
+
i,
|
|
1602
|
+
o
|
|
1603
|
+
]);
|
|
1604
|
+
return M(b, { onLogs: d, onError: u }, (p) => {
|
|
1605
|
+
let y;
|
|
1606
|
+
o !== void 0 && (y = o - 1n);
|
|
1607
|
+
let w, T = !1;
|
|
1608
|
+
const I = X(async () => {
|
|
1609
|
+
var C;
|
|
1610
|
+
if (!T) {
|
|
1611
|
+
try {
|
|
1612
|
+
w = await R(e, pt, "createEventFilter")({
|
|
1613
|
+
address: t,
|
|
1614
|
+
args: r,
|
|
1615
|
+
event: a,
|
|
1616
|
+
events: s,
|
|
1617
|
+
strict: h,
|
|
1618
|
+
fromBlock: o
|
|
1619
|
+
});
|
|
1620
|
+
} catch {
|
|
1621
|
+
}
|
|
1622
|
+
T = !0;
|
|
1623
|
+
return;
|
|
1624
|
+
}
|
|
1625
|
+
try {
|
|
1626
|
+
let v;
|
|
1627
|
+
if (w)
|
|
1628
|
+
v = await R(e, he, "getFilterChanges")({ filter: w });
|
|
1629
|
+
else {
|
|
1630
|
+
const N = await R(e, K, "getBlockNumber")({});
|
|
1631
|
+
y && y !== N ? v = await R(e, Ke, "getLogs")({
|
|
1632
|
+
address: t,
|
|
1633
|
+
args: r,
|
|
1634
|
+
event: a,
|
|
1635
|
+
events: s,
|
|
1636
|
+
fromBlock: y + 1n,
|
|
1637
|
+
toBlock: N
|
|
1638
|
+
}) : v = [], y = N;
|
|
1639
|
+
}
|
|
1640
|
+
if (v.length === 0)
|
|
1641
|
+
return;
|
|
1642
|
+
if (n)
|
|
1643
|
+
p.onLogs(v);
|
|
1644
|
+
else
|
|
1645
|
+
for (const N of v)
|
|
1646
|
+
p.onLogs([N]);
|
|
1647
|
+
} catch (v) {
|
|
1648
|
+
w && v instanceof re && (T = !1), (C = p.onError) == null || C.call(p, v);
|
|
1649
|
+
}
|
|
1650
|
+
}, {
|
|
1651
|
+
emitOnBegin: !0,
|
|
1652
|
+
interval: i
|
|
1653
|
+
});
|
|
1654
|
+
return async () => {
|
|
1655
|
+
w && await R(e, pe, "uninstallFilter")({ filter: w }), I();
|
|
1656
|
+
};
|
|
1657
|
+
});
|
|
1658
|
+
})() : (() => {
|
|
1659
|
+
let b = !0, p = () => b = !1;
|
|
1660
|
+
return (async () => {
|
|
1661
|
+
try {
|
|
1662
|
+
const y = (() => {
|
|
1663
|
+
if (e.transport.type === "fallback") {
|
|
1664
|
+
const C = e.transport.transports.find((v) => v.config.type === "webSocket");
|
|
1665
|
+
return C ? C.value : e.transport;
|
|
1666
|
+
}
|
|
1667
|
+
return e.transport;
|
|
1668
|
+
})(), w = s ?? (a ? [a] : void 0);
|
|
1669
|
+
let T = [];
|
|
1670
|
+
w && (T = [w.flatMap((v) => Ze({
|
|
1671
|
+
abi: [v],
|
|
1672
|
+
eventName: v.name,
|
|
1673
|
+
args: r
|
|
1674
|
+
}))], a && (T = T[0]));
|
|
1675
|
+
const { unsubscribe: I } = await y.subscribe({
|
|
1676
|
+
params: ["logs", { address: t, topics: T }],
|
|
1677
|
+
onData(C) {
|
|
1678
|
+
var N;
|
|
1679
|
+
if (!b)
|
|
1680
|
+
return;
|
|
1681
|
+
const v = C.result;
|
|
1682
|
+
try {
|
|
1683
|
+
const { eventName: E, args: A } = Ht({
|
|
1684
|
+
abi: w ?? [],
|
|
1685
|
+
data: v.data,
|
|
1686
|
+
topics: v.topics,
|
|
1687
|
+
strict: h
|
|
1688
|
+
}), x = ae(v, { args: A, eventName: E });
|
|
1689
|
+
d([x]);
|
|
1690
|
+
} catch (E) {
|
|
1691
|
+
let A, x;
|
|
1692
|
+
if (E instanceof jt || E instanceof Ot) {
|
|
1693
|
+
if (c)
|
|
1694
|
+
return;
|
|
1695
|
+
A = E.abiItem.name, x = (N = E.abiItem.inputs) == null ? void 0 : N.some(($) => !("name" in $ && $.name));
|
|
1696
|
+
}
|
|
1697
|
+
const F = ae(v, {
|
|
1698
|
+
args: x ? [] : {},
|
|
1699
|
+
eventName: A
|
|
1700
|
+
});
|
|
1701
|
+
d([F]);
|
|
1702
|
+
}
|
|
1703
|
+
},
|
|
1704
|
+
onError(C) {
|
|
1705
|
+
u == null || u(C);
|
|
1706
|
+
}
|
|
1707
|
+
});
|
|
1708
|
+
p = I, b || p();
|
|
1709
|
+
} catch (y) {
|
|
1710
|
+
u == null || u(y);
|
|
1711
|
+
}
|
|
1712
|
+
})(), () => p();
|
|
1713
|
+
})();
|
|
1714
|
+
}
|
|
1715
|
+
function kn(e, { batch: t = !0, onError: r, onTransactions: n, poll: a, pollingInterval: s = e.pollingInterval }) {
|
|
1716
|
+
return (typeof a < "u" ? a : e.transport.type !== "webSocket") ? (() => {
|
|
1717
|
+
const f = B([
|
|
1718
|
+
"watchPendingTransactions",
|
|
1719
|
+
e.uid,
|
|
1720
|
+
t,
|
|
1721
|
+
s
|
|
1722
|
+
]);
|
|
1723
|
+
return M(f, { onTransactions: n, onError: r }, (i) => {
|
|
1724
|
+
let c;
|
|
1725
|
+
const l = X(async () => {
|
|
1726
|
+
var h;
|
|
1727
|
+
try {
|
|
1728
|
+
if (!c)
|
|
1729
|
+
try {
|
|
1730
|
+
c = await R(e, ht, "createPendingTransactionFilter")({});
|
|
1731
|
+
return;
|
|
1732
|
+
} catch (g) {
|
|
1733
|
+
throw l(), g;
|
|
1734
|
+
}
|
|
1735
|
+
const m = await R(e, he, "getFilterChanges")({ filter: c });
|
|
1736
|
+
if (m.length === 0)
|
|
1737
|
+
return;
|
|
1738
|
+
if (t)
|
|
1739
|
+
i.onTransactions(m);
|
|
1740
|
+
else
|
|
1741
|
+
for (const g of m)
|
|
1742
|
+
i.onTransactions([g]);
|
|
1743
|
+
} catch (m) {
|
|
1744
|
+
(h = i.onError) == null || h.call(i, m);
|
|
1745
|
+
}
|
|
1746
|
+
}, {
|
|
1747
|
+
emitOnBegin: !0,
|
|
1748
|
+
interval: s
|
|
1749
|
+
});
|
|
1750
|
+
return async () => {
|
|
1751
|
+
c && await R(e, pe, "uninstallFilter")({ filter: c }), l();
|
|
1752
|
+
};
|
|
1753
|
+
});
|
|
1754
|
+
})() : (() => {
|
|
1755
|
+
let f = !0, i = () => f = !1;
|
|
1756
|
+
return (async () => {
|
|
1757
|
+
try {
|
|
1758
|
+
const { unsubscribe: c } = await e.transport.subscribe({
|
|
1759
|
+
params: ["newPendingTransactions"],
|
|
1760
|
+
onData(l) {
|
|
1761
|
+
if (!f)
|
|
1762
|
+
return;
|
|
1763
|
+
const h = l.result;
|
|
1764
|
+
n([h]);
|
|
1765
|
+
},
|
|
1766
|
+
onError(l) {
|
|
1767
|
+
r == null || r(l);
|
|
1768
|
+
}
|
|
1769
|
+
});
|
|
1770
|
+
i = c, f || i();
|
|
1771
|
+
} catch (c) {
|
|
1772
|
+
r == null || r(c);
|
|
1773
|
+
}
|
|
1774
|
+
})(), () => i();
|
|
1775
|
+
})();
|
|
1776
|
+
}
|
|
1777
|
+
function xn(e) {
|
|
1778
|
+
var c, l, h;
|
|
1779
|
+
const { scheme: t, statement: r, ...n } = ((c = e.match(An)) == null ? void 0 : c.groups) ?? {}, { chainId: a, expirationTime: s, issuedAt: o, notBefore: u, requestId: d, ...f } = ((l = e.match(Pn)) == null ? void 0 : l.groups) ?? {}, i = (h = e.split("Resources:")[1]) == null ? void 0 : h.split(`
|
|
1780
|
+
- `).slice(1);
|
|
1781
|
+
return {
|
|
1782
|
+
...n,
|
|
1783
|
+
...f,
|
|
1784
|
+
...a ? { chainId: Number(a) } : {},
|
|
1785
|
+
...s ? { expirationTime: new Date(s) } : {},
|
|
1786
|
+
...o ? { issuedAt: new Date(o) } : {},
|
|
1787
|
+
...u ? { notBefore: new Date(u) } : {},
|
|
1788
|
+
...d ? { requestId: d } : {},
|
|
1789
|
+
...i ? { resources: i } : {},
|
|
1790
|
+
...t ? { scheme: t } : {},
|
|
1791
|
+
...r ? { statement: r } : {}
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
const An = /^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/, Pn = /(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;
|
|
1795
|
+
function Bn(e) {
|
|
1796
|
+
const { address: t, domain: r, message: n, nonce: a, scheme: s, time: o = /* @__PURE__ */ new Date() } = e;
|
|
1797
|
+
if (r && n.domain !== r || a && n.nonce !== a || s && n.scheme !== s || n.expirationTime && o >= n.expirationTime || n.notBefore && o < n.notBefore)
|
|
1798
|
+
return !1;
|
|
1799
|
+
try {
|
|
1800
|
+
if (!n.address || t && !Qe(n.address, t))
|
|
1801
|
+
return !1;
|
|
1802
|
+
} catch {
|
|
1803
|
+
return !1;
|
|
1804
|
+
}
|
|
1805
|
+
return !0;
|
|
1806
|
+
}
|
|
1807
|
+
async function Dn(e, t) {
|
|
1808
|
+
const { address: r, domain: n, message: a, nonce: s, scheme: o, signature: u, time: d = /* @__PURE__ */ new Date(), ...f } = t, i = xn(a);
|
|
1809
|
+
if (!i.address || !Bn({
|
|
1810
|
+
address: r,
|
|
1811
|
+
domain: n,
|
|
1812
|
+
message: i,
|
|
1813
|
+
nonce: s,
|
|
1814
|
+
scheme: o,
|
|
1815
|
+
time: d
|
|
1816
|
+
}))
|
|
1817
|
+
return !1;
|
|
1818
|
+
const l = Tt(a);
|
|
1819
|
+
return Re(e, {
|
|
1820
|
+
address: i.address,
|
|
1821
|
+
hash: l,
|
|
1822
|
+
signature: u,
|
|
1823
|
+
...f
|
|
1824
|
+
});
|
|
1825
|
+
}
|
|
1826
|
+
function qn(e) {
|
|
1827
|
+
return {
|
|
1828
|
+
call: (t) => Ve(e, t),
|
|
1829
|
+
createBlockFilter: () => Vr(e),
|
|
1830
|
+
createContractEventFilter: (t) => Wt(e, t),
|
|
1831
|
+
createEventFilter: (t) => pt(e, t),
|
|
1832
|
+
createPendingTransactionFilter: () => ht(e),
|
|
1833
|
+
estimateContractGas: (t) => Gt(e, t),
|
|
1834
|
+
estimateGas: (t) => Zt(e, t),
|
|
1835
|
+
getBalance: (t) => Jt(e, t),
|
|
1836
|
+
getBlobBaseFee: () => Qr(e),
|
|
1837
|
+
getBlock: (t) => _(e, t),
|
|
1838
|
+
getBlockNumber: (t) => K(e, t),
|
|
1839
|
+
getBlockTransactionCount: (t) => Kr(e, t),
|
|
1840
|
+
getBytecode: (t) => We(e, t),
|
|
1841
|
+
getChainId: () => me(e),
|
|
1842
|
+
getCode: (t) => We(e, t),
|
|
1843
|
+
getContractEvents: (t) => Vt(e, t),
|
|
1844
|
+
getEip712Domain: (t) => vr(e, t),
|
|
1845
|
+
getEnsAddress: (t) => qr(e, t),
|
|
1846
|
+
getEnsAvatar: (t) => Gr(e, t),
|
|
1847
|
+
getEnsName: (t) => Zr(e, t),
|
|
1848
|
+
getEnsResolver: (t) => Jr(e, t),
|
|
1849
|
+
getEnsText: (t) => lt(e, t),
|
|
1850
|
+
getFeeHistory: (t) => Yr(e, t),
|
|
1851
|
+
estimateFeesPerGas: (t) => Qt(e, t),
|
|
1852
|
+
getFilterChanges: (t) => he(e, t),
|
|
1853
|
+
getFilterLogs: (t) => en(e, t),
|
|
1854
|
+
getGasPrice: () => Kt(e),
|
|
1855
|
+
getLogs: (t) => Ke(e, t),
|
|
1856
|
+
getProof: (t) => yn(e, t),
|
|
1857
|
+
estimateMaxPriorityFeePerGas: (t) => Xt(e, t),
|
|
1858
|
+
getStorageAt: (t) => wn(e, t),
|
|
1859
|
+
getTransaction: (t) => Te(e, t),
|
|
1860
|
+
getTransactionConfirmations: (t) => bn(e, t),
|
|
1861
|
+
getTransactionCount: (t) => Yt(e, t),
|
|
1862
|
+
getTransactionReceipt: (t) => ue(e, t),
|
|
1863
|
+
multicall: (t) => vn(e, t),
|
|
1864
|
+
prepareTransactionRequest: (t) => Xe(e, t),
|
|
1865
|
+
readContract: (t) => q(e, t),
|
|
1866
|
+
sendRawTransaction: (t) => Ye(e, t),
|
|
1867
|
+
simulateContract: (t) => er(e, t),
|
|
1868
|
+
verifyMessage: (t) => Rn(e, t),
|
|
1869
|
+
verifySiweMessage: (t) => Dn(e, t),
|
|
1870
|
+
verifyTypedData: (t) => Cn(e, t),
|
|
1871
|
+
uninstallFilter: (t) => pe(e, t),
|
|
1872
|
+
waitForTransactionReceipt: (t) => En(e, t),
|
|
1873
|
+
watchBlocks: (t) => In(e, t),
|
|
1874
|
+
watchBlockNumber: (t) => Ct(e, t),
|
|
1875
|
+
watchContractEvent: (t) => tr(e, t),
|
|
1876
|
+
watchEvent: (t) => Nn(e, t),
|
|
1877
|
+
watchPendingTransactions: (t) => kn(e, t)
|
|
1878
|
+
};
|
|
1879
|
+
}
|
|
1880
|
+
function Vn(e) {
|
|
1881
|
+
const { key: t = "public", name: r = "Public Client" } = e;
|
|
1882
|
+
return ct({
|
|
1883
|
+
...e,
|
|
1884
|
+
key: t,
|
|
1885
|
+
name: r,
|
|
1886
|
+
type: "publicClient"
|
|
1887
|
+
}).extend(qn);
|
|
1888
|
+
}
|
|
1889
|
+
function Fn(e, t) {
|
|
1890
|
+
const { abi: r, args: n, bytecode: a, ...s } = t, o = Je({ abi: r, args: n, bytecode: a });
|
|
1891
|
+
return et(e, {
|
|
1892
|
+
...s,
|
|
1893
|
+
data: o
|
|
1894
|
+
});
|
|
1895
|
+
}
|
|
1896
|
+
async function Sn(e) {
|
|
1897
|
+
var r;
|
|
1898
|
+
return ((r = e.account) == null ? void 0 : r.type) === "local" ? [e.account.address] : (await e.request({ method: "eth_accounts" }, { dedupe: !0 })).map((n) => yr(n));
|
|
1899
|
+
}
|
|
1900
|
+
async function _n(e) {
|
|
1901
|
+
return await e.request({ method: "wallet_getPermissions" }, { dedupe: !0 });
|
|
1902
|
+
}
|
|
1903
|
+
async function Mn(e) {
|
|
1904
|
+
return (await e.request({ method: "eth_requestAccounts" }, { dedupe: !0, retryCount: 0 })).map((r) => ot(r));
|
|
1905
|
+
}
|
|
1906
|
+
async function $n(e, t) {
|
|
1907
|
+
return e.request({
|
|
1908
|
+
method: "wallet_requestPermissions",
|
|
1909
|
+
params: [t]
|
|
1910
|
+
}, { retryCount: 0 });
|
|
1911
|
+
}
|
|
1912
|
+
async function zn(e, { account: t = e.account, message: r }) {
|
|
1913
|
+
if (!t)
|
|
1914
|
+
throw new ge({
|
|
1915
|
+
docsPath: "/docs/actions/wallet/signMessage"
|
|
1916
|
+
});
|
|
1917
|
+
const n = V(t);
|
|
1918
|
+
if (n.signMessage)
|
|
1919
|
+
return n.signMessage({ message: r });
|
|
1920
|
+
const a = typeof r == "string" ? J(r) : r.raw instanceof Uint8Array ? S(r.raw) : r.raw;
|
|
1921
|
+
return e.request({
|
|
1922
|
+
method: "personal_sign",
|
|
1923
|
+
params: [a, n.address]
|
|
1924
|
+
}, { retryCount: 0 });
|
|
1925
|
+
}
|
|
1926
|
+
async function Ln(e, t) {
|
|
1927
|
+
var f, i, c, l;
|
|
1928
|
+
const { account: r = e.account, chain: n = e.chain, ...a } = t;
|
|
1929
|
+
if (!r)
|
|
1930
|
+
throw new ge({
|
|
1931
|
+
docsPath: "/docs/actions/wallet/signTransaction"
|
|
1932
|
+
});
|
|
1933
|
+
const s = V(r);
|
|
1934
|
+
rr({
|
|
1935
|
+
account: s,
|
|
1936
|
+
...t
|
|
1937
|
+
});
|
|
1938
|
+
const o = await R(e, me, "getChainId")({});
|
|
1939
|
+
n !== null && nr({
|
|
1940
|
+
currentChainId: o,
|
|
1941
|
+
chain: n
|
|
1942
|
+
});
|
|
1943
|
+
const u = (n == null ? void 0 : n.formatters) || ((f = e.chain) == null ? void 0 : f.formatters), d = ((i = u == null ? void 0 : u.transactionRequest) == null ? void 0 : i.format) || ar;
|
|
1944
|
+
return s.signTransaction ? s.signTransaction({
|
|
1945
|
+
...a,
|
|
1946
|
+
chainId: o
|
|
1947
|
+
}, { serializer: (l = (c = e.chain) == null ? void 0 : c.serializers) == null ? void 0 : l.transaction }) : await e.request({
|
|
1948
|
+
method: "eth_signTransaction",
|
|
1949
|
+
params: [
|
|
1950
|
+
{
|
|
1951
|
+
...d(a),
|
|
1952
|
+
chainId: k(o),
|
|
1953
|
+
from: s.address
|
|
1954
|
+
}
|
|
1955
|
+
]
|
|
1956
|
+
}, { retryCount: 0 });
|
|
1957
|
+
}
|
|
1958
|
+
async function Un(e, t) {
|
|
1959
|
+
const { account: r = e.account, domain: n, message: a, primaryType: s } = t;
|
|
1960
|
+
if (!r)
|
|
1961
|
+
throw new ge({
|
|
1962
|
+
docsPath: "/docs/actions/wallet/signTypedData"
|
|
1963
|
+
});
|
|
1964
|
+
const o = V(r), u = {
|
|
1965
|
+
EIP712Domain: vt({ domain: n }),
|
|
1966
|
+
...t.types
|
|
1967
|
+
};
|
|
1968
|
+
if (bt({ domain: n, message: a, primaryType: s, types: u }), o.signTypedData)
|
|
1969
|
+
return o.signTypedData({ domain: n, message: a, primaryType: s, types: u });
|
|
1970
|
+
const d = un({ domain: n, message: a, primaryType: s, types: u });
|
|
1971
|
+
return e.request({
|
|
1972
|
+
method: "eth_signTypedData_v4",
|
|
1973
|
+
params: [o.address, d]
|
|
1974
|
+
}, { retryCount: 0 });
|
|
1975
|
+
}
|
|
1976
|
+
async function Hn(e, { id: t }) {
|
|
1977
|
+
await e.request({
|
|
1978
|
+
method: "wallet_switchEthereumChain",
|
|
1979
|
+
params: [
|
|
1980
|
+
{
|
|
1981
|
+
chainId: k(t)
|
|
1982
|
+
}
|
|
1983
|
+
]
|
|
1984
|
+
}, { retryCount: 0 });
|
|
1985
|
+
}
|
|
1986
|
+
async function jn(e, t) {
|
|
1987
|
+
return await e.request({
|
|
1988
|
+
method: "wallet_watchAsset",
|
|
1989
|
+
params: t
|
|
1990
|
+
}, { retryCount: 0 });
|
|
1991
|
+
}
|
|
1992
|
+
function On(e) {
|
|
1993
|
+
return {
|
|
1994
|
+
addChain: (t) => Rr(e, t),
|
|
1995
|
+
deployContract: (t) => Fn(e, t),
|
|
1996
|
+
getAddresses: () => Sn(e),
|
|
1997
|
+
getChainId: () => me(e),
|
|
1998
|
+
getPermissions: () => _n(e),
|
|
1999
|
+
prepareTransactionRequest: (t) => Xe(e, t),
|
|
2000
|
+
requestAddresses: () => Mn(e),
|
|
2001
|
+
requestPermissions: (t) => $n(e, t),
|
|
2002
|
+
sendRawTransaction: (t) => Ye(e, t),
|
|
2003
|
+
sendTransaction: (t) => et(e, t),
|
|
2004
|
+
signMessage: (t) => zn(e, t),
|
|
2005
|
+
signTransaction: (t) => Ln(e, t),
|
|
2006
|
+
signTypedData: (t) => Un(e, t),
|
|
2007
|
+
switchChain: (t) => Hn(e, t),
|
|
2008
|
+
watchAsset: (t) => jn(e, t),
|
|
2009
|
+
writeContract: (t) => sr(e, t)
|
|
2010
|
+
};
|
|
2011
|
+
}
|
|
2012
|
+
function Qn(e) {
|
|
2013
|
+
const { key: t = "wallet", name: r = "Wallet Client", transport: n } = e;
|
|
2014
|
+
return ct({
|
|
2015
|
+
...e,
|
|
2016
|
+
key: t,
|
|
2017
|
+
name: r,
|
|
2018
|
+
transport: n,
|
|
2019
|
+
type: "walletClient"
|
|
2020
|
+
}).extend(On);
|
|
2021
|
+
}
|
|
2022
|
+
export {
|
|
2023
|
+
Vn as a,
|
|
2024
|
+
Nr as b,
|
|
2025
|
+
Qn as c,
|
|
2026
|
+
Jn as h
|
|
2027
|
+
};
|
|
2028
|
+
//# sourceMappingURL=createWalletClient-DNcW-ENe.js.map
|