@lombard.finance/sdk 2.0.7 → 2.0.9
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/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +432 -1639
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk/getNetworkFeeSignature/getNetworkFeeSignature.stories.tsx +2 -2
- package/src/sdk/index.ts +2 -0
- package/src/sdk/storeNetworkFeeSignature/storeNetworkFeeSignature.stories.tsx +3 -3
- package/src/sdk/storeStakeAndBakeSignature/index.ts +1 -0
- package/src/sdk/storeStakeAndBakeSignature/storeStakeAndBakeSignature.stories.tsx +185 -0
- package/src/sdk/storeStakeAndBakeSignature/storeStakeAndBakeSignature.ts +56 -0
- package/src/web3Sdk/getLBTCMintingFee/getLBTCMintingFee.stories.tsx +2 -2
- package/src/web3Sdk/index.ts +2 -11
- package/src/web3Sdk/signStakeAndBake/config.ts +13 -0
- package/src/web3Sdk/signStakeAndBake/contracts.ts +13 -0
- package/src/web3Sdk/signStakeAndBake/getTypedData.ts +78 -0
- package/src/web3Sdk/signStakeAndBake/index.ts +2 -0
- package/src/web3Sdk/signStakeAndBake/signStakeAndBake.stories.tsx +197 -0
- package/src/web3Sdk/signStakeAndBake/signStakeAndBake.ts +103 -0
package/dist/index.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
import { initEccLib as Ee, payments as Ae, networks as re, address as ve } from "bitcoinjs-lib";
|
|
9
|
-
const c = {
|
|
1
|
+
var K = Object.defineProperty;
|
|
2
|
+
var z = (e, t, n) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var A = (e, t, n) => (z(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
|
+
import h from "axios";
|
|
5
|
+
import v from "bignumber.js";
|
|
6
|
+
import H, { Web3 as G, utils as g } from "web3";
|
|
7
|
+
const T = {
|
|
10
8
|
prod: "prod",
|
|
11
9
|
testnet: "testnet",
|
|
12
10
|
stage: "stage"
|
|
@@ -21,35 +19,35 @@ const c = {
|
|
|
21
19
|
berachainBartioTestnet: 80084,
|
|
22
20
|
corn: 21e6,
|
|
23
21
|
swell: 1923
|
|
24
|
-
},
|
|
22
|
+
}, q = (e) => e === T.prod ? s.ethereum : s.holesky, j = (e) => e === T.prod ? s.binanceSmartChain : s.binanceSmartChainTestnet, J = (e) => e === T.prod ? s.base : s.baseTestnet, N = T.prod, u = "0x0000000000000000000000000000000000000000", X = {
|
|
25
23
|
baseApiUrl: "https://staging.prod.lombard.finance"
|
|
26
|
-
},
|
|
24
|
+
}, Y = {
|
|
27
25
|
baseApiUrl: "https://gastald-testnet.prod.lombard.finance"
|
|
28
|
-
},
|
|
26
|
+
}, Q = {
|
|
29
27
|
baseApiUrl: "https://mainnet.prod.lombard.finance"
|
|
30
|
-
},
|
|
28
|
+
}, w = (e = N) => {
|
|
31
29
|
switch (e) {
|
|
32
|
-
case
|
|
33
|
-
return
|
|
34
|
-
case
|
|
35
|
-
return
|
|
30
|
+
case T.prod:
|
|
31
|
+
return Q;
|
|
32
|
+
case T.testnet:
|
|
33
|
+
return Y;
|
|
36
34
|
default:
|
|
37
|
-
return
|
|
35
|
+
return X;
|
|
38
36
|
}
|
|
39
37
|
};
|
|
40
|
-
function
|
|
38
|
+
function C(e) {
|
|
41
39
|
return typeof e == "string" ? e : ((n) => {
|
|
42
40
|
var a;
|
|
43
41
|
return ((a = n == null ? void 0 : n.data) == null ? void 0 : a.message) && typeof n.data.message == "string";
|
|
44
|
-
})(e) ? e.data.message : e instanceof Error ?
|
|
42
|
+
})(e) ? e.data.message : e instanceof Error ? ee(e) : te(e);
|
|
45
43
|
}
|
|
46
|
-
function
|
|
44
|
+
function ee(e) {
|
|
47
45
|
return e.response ? e.response.data.message : e.message;
|
|
48
46
|
}
|
|
49
|
-
function
|
|
47
|
+
function te(e) {
|
|
50
48
|
return e != null && e.message ? e.message : "Unknown error";
|
|
51
49
|
}
|
|
52
|
-
const
|
|
50
|
+
const S = {
|
|
53
51
|
eth: "DESTINATION_BLOCKCHAIN_ETHEREUM",
|
|
54
52
|
base: "DESTINATION_BLOCKCHAIN_BASE",
|
|
55
53
|
bsc: "DESTINATION_BLOCKCHAIN_BSC",
|
|
@@ -59,141 +57,141 @@ const R = {
|
|
|
59
57
|
scroll: "DESTINATION_BLOCKCHAIN_SCROLL",
|
|
60
58
|
xlayer: "DESTINATION_BLOCKCHAIN_XLAYER"
|
|
61
59
|
};
|
|
62
|
-
function
|
|
60
|
+
function D(e) {
|
|
63
61
|
switch (e) {
|
|
64
62
|
case s.ethereum:
|
|
65
63
|
case s.holesky:
|
|
66
64
|
case s.sepolia:
|
|
67
|
-
return
|
|
65
|
+
return S.eth;
|
|
68
66
|
case s.base:
|
|
69
67
|
case s.baseTestnet:
|
|
70
|
-
return
|
|
68
|
+
return S.base;
|
|
71
69
|
case s.binanceSmartChain:
|
|
72
70
|
case s.binanceSmartChainTestnet:
|
|
73
|
-
return
|
|
71
|
+
return S.bsc;
|
|
74
72
|
default:
|
|
75
73
|
throw new Error(`Unknown chain ID: ${e}`);
|
|
76
74
|
}
|
|
77
75
|
}
|
|
78
|
-
const
|
|
79
|
-
async function
|
|
76
|
+
const ne = "sanctioned_address", ae = "api/v1/address/generate", se = "destination address is under sanctions";
|
|
77
|
+
async function ke({
|
|
80
78
|
address: e,
|
|
81
79
|
chainId: t,
|
|
82
80
|
signature: n,
|
|
83
81
|
eip712Data: a,
|
|
84
82
|
env: i,
|
|
85
83
|
referrerCode: r,
|
|
86
|
-
partnerId:
|
|
87
|
-
captchaToken:
|
|
84
|
+
partnerId: p,
|
|
85
|
+
captchaToken: o
|
|
88
86
|
}) {
|
|
89
|
-
const { baseApiUrl:
|
|
87
|
+
const { baseApiUrl: m } = w(i), c = D(t), d = {
|
|
90
88
|
to_address: e,
|
|
91
89
|
to_address_signature: n,
|
|
92
|
-
to_chain:
|
|
93
|
-
partner_id:
|
|
90
|
+
to_chain: c,
|
|
91
|
+
partner_id: p,
|
|
94
92
|
nonce: 0,
|
|
95
|
-
captcha:
|
|
93
|
+
captcha: o,
|
|
96
94
|
referrer_code: r,
|
|
97
95
|
eip_712_data: a
|
|
98
96
|
};
|
|
99
97
|
try {
|
|
100
|
-
const { data:
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
{ baseURL:
|
|
98
|
+
const { data: y } = await h.post(
|
|
99
|
+
ae,
|
|
100
|
+
d,
|
|
101
|
+
{ baseURL: m }
|
|
104
102
|
);
|
|
105
|
-
return
|
|
106
|
-
} catch (
|
|
107
|
-
const
|
|
108
|
-
if (
|
|
109
|
-
return
|
|
110
|
-
throw new Error(
|
|
103
|
+
return y.address;
|
|
104
|
+
} catch (y) {
|
|
105
|
+
const b = C(y);
|
|
106
|
+
if (ie(b))
|
|
107
|
+
return ne;
|
|
108
|
+
throw new Error(b);
|
|
111
109
|
}
|
|
112
110
|
}
|
|
113
|
-
function
|
|
114
|
-
return !!e.includes(
|
|
111
|
+
function ie(e) {
|
|
112
|
+
return !!e.includes(se);
|
|
115
113
|
}
|
|
116
|
-
const
|
|
117
|
-
async function
|
|
114
|
+
const re = "api/v1/address";
|
|
115
|
+
async function Le({
|
|
118
116
|
address: e,
|
|
119
117
|
chainId: t,
|
|
120
118
|
env: n,
|
|
121
119
|
partnerId: a
|
|
122
120
|
}) {
|
|
123
|
-
const i = await
|
|
121
|
+
const i = await oe({
|
|
124
122
|
address: e,
|
|
125
123
|
chainId: t,
|
|
126
124
|
env: n,
|
|
127
125
|
partnerId: a
|
|
128
|
-
}), r =
|
|
126
|
+
}), r = pe(i);
|
|
129
127
|
if (!r)
|
|
130
128
|
throw new Error("No address");
|
|
131
129
|
return r.btc_address;
|
|
132
130
|
}
|
|
133
|
-
function
|
|
131
|
+
function pe(e) {
|
|
134
132
|
if (!e.length)
|
|
135
133
|
return;
|
|
136
134
|
const t = e.reduce((n, a) => n.created_at < a.created_at ? a : n, e[0]);
|
|
137
135
|
return t.deprecated ? void 0 : t;
|
|
138
136
|
}
|
|
139
|
-
async function
|
|
137
|
+
async function oe({
|
|
140
138
|
address: e,
|
|
141
139
|
chainId: t,
|
|
142
140
|
env: n,
|
|
143
141
|
partnerId: a
|
|
144
142
|
}) {
|
|
145
|
-
const { baseApiUrl: i } =
|
|
143
|
+
const { baseApiUrl: i } = w(n), r = D(t), p = {
|
|
146
144
|
to_address: e,
|
|
147
145
|
to_blockchain: r,
|
|
148
146
|
limit: 1,
|
|
149
147
|
offset: 0,
|
|
150
148
|
asc: !1,
|
|
151
149
|
referralId: a
|
|
152
|
-
}, { data:
|
|
150
|
+
}, { data: o } = await h.get(re, {
|
|
153
151
|
baseURL: i,
|
|
154
|
-
params:
|
|
152
|
+
params: p
|
|
155
153
|
});
|
|
156
|
-
return (
|
|
154
|
+
return (o == null ? void 0 : o.addresses) || [];
|
|
157
155
|
}
|
|
158
|
-
const
|
|
159
|
-
function
|
|
160
|
-
return +e /
|
|
156
|
+
const ue = 8, P = 10 ** ue;
|
|
157
|
+
function M(e) {
|
|
158
|
+
return +e / P;
|
|
161
159
|
}
|
|
162
|
-
function
|
|
163
|
-
return Math.floor(+e *
|
|
160
|
+
function Ge(e) {
|
|
161
|
+
return Math.floor(+e * P);
|
|
164
162
|
}
|
|
165
|
-
function
|
|
163
|
+
function ye(e, t = N) {
|
|
166
164
|
switch (e) {
|
|
167
|
-
case
|
|
168
|
-
return
|
|
169
|
-
case
|
|
170
|
-
return
|
|
171
|
-
case
|
|
172
|
-
return
|
|
165
|
+
case S.eth:
|
|
166
|
+
return q(t);
|
|
167
|
+
case S.base:
|
|
168
|
+
return J(t);
|
|
169
|
+
case S.bsc:
|
|
170
|
+
return j(t);
|
|
173
171
|
default:
|
|
174
172
|
return s.ethereum;
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
|
-
var
|
|
178
|
-
async function
|
|
175
|
+
var de = /* @__PURE__ */ ((e) => (e.NOTARIZATION_STATUS_UNSPECIFIED = "NOTARIZATION_STATUS_UNSPECIFIED", e.NOTARIZATION_STATUS_PENDING = "NOTARIZATION_STATUS_PENDING", e.NOTARIZATION_STATUS_SUBMITTED = "NOTARIZATION_STATUS_SUBMITTED", e.NOTARIZATION_STATUS_SESSION_APPROVED = "NOTARIZATION_STATUS_SESSION_APPROVED", e.NOTARIZATION_STATUS_FAILED = "NOTARIZATION_STATUS_FAILED", e))(de || {}), le = /* @__PURE__ */ ((e) => (e.SESSION_STATE_UNSPECIFIED = "SESSION_STATE_UNSPECIFIED", e.SESSION_STATE_PENDING = "SESSION_STATE_PENDING", e.SESSION_STATE_COMPLETED = "SESSION_STATE_COMPLETED", e.SESSION_STATE_EXPIRED = "SESSION_STATE_EXPIRED", e))(le || {});
|
|
176
|
+
async function He({
|
|
179
177
|
address: e,
|
|
180
178
|
env: t
|
|
181
179
|
}) {
|
|
182
|
-
const { baseApiUrl: n } =
|
|
180
|
+
const { baseApiUrl: n } = w(t), { data: a } = await h.get(
|
|
183
181
|
`api/v1/address/outputs-v2/${e}`,
|
|
184
182
|
{ baseURL: n }
|
|
185
183
|
);
|
|
186
|
-
return ((a == null ? void 0 : a.outputs) ?? []).map(
|
|
184
|
+
return ((a == null ? void 0 : a.outputs) ?? []).map(me(t));
|
|
187
185
|
}
|
|
188
|
-
function
|
|
186
|
+
function me(e) {
|
|
189
187
|
return (t) => ({
|
|
190
188
|
txid: t.txid,
|
|
191
189
|
index: t.index ?? 0,
|
|
192
190
|
blockHeight: t.block_height ? Number(t.block_height) : void 0,
|
|
193
191
|
blockTime: t.block_time ? Number(t.block_time) : void 0,
|
|
194
|
-
value: new
|
|
192
|
+
value: new v(M(t.value)),
|
|
195
193
|
address: t.address,
|
|
196
|
-
chainId:
|
|
194
|
+
chainId: ye(t.to_chain, e),
|
|
197
195
|
claimedTxId: t.claim_tx,
|
|
198
196
|
rawPayload: t.raw_payload,
|
|
199
197
|
signature: t.proof,
|
|
@@ -205,26 +203,26 @@ function He(e) {
|
|
|
205
203
|
sessionState: t.session_state
|
|
206
204
|
});
|
|
207
205
|
}
|
|
208
|
-
const
|
|
209
|
-
async function
|
|
206
|
+
const ce = 2e-4;
|
|
207
|
+
async function We({
|
|
210
208
|
env: e,
|
|
211
209
|
chainId: t = s.ethereum,
|
|
212
210
|
amount: n = 1
|
|
213
211
|
}) {
|
|
214
|
-
const { baseApiUrl: a } =
|
|
212
|
+
const { baseApiUrl: a } = w(e), i = D(t), { data: r } = await h.get(
|
|
215
213
|
`api/v1/exchange/rate/${i}`,
|
|
216
214
|
{ baseURL: a, params: { amount: n } }
|
|
217
|
-
),
|
|
218
|
-
return { exchangeRate: +r.amount_out, minAmount: +
|
|
215
|
+
), p = new v(ce).multipliedBy(P).toFixed();
|
|
216
|
+
return { exchangeRate: +r.amount_out, minAmount: +p };
|
|
219
217
|
}
|
|
220
|
-
async function
|
|
218
|
+
async function $e({
|
|
221
219
|
address: e,
|
|
222
220
|
chainId: t,
|
|
223
221
|
env: n
|
|
224
222
|
}) {
|
|
225
|
-
const { baseApiUrl: a } =
|
|
223
|
+
const { baseApiUrl: a } = w(n);
|
|
226
224
|
try {
|
|
227
|
-
const { data: i } = await
|
|
225
|
+
const { data: i } = await h.get(
|
|
228
226
|
`${a}/api/v1/claimer/get-user-signature`,
|
|
229
227
|
{
|
|
230
228
|
params: {
|
|
@@ -239,19 +237,19 @@ async function jt({
|
|
|
239
237
|
isDelayed: i == null ? void 0 : i.is_delayed
|
|
240
238
|
};
|
|
241
239
|
} catch (i) {
|
|
242
|
-
const r =
|
|
240
|
+
const r = C(i);
|
|
243
241
|
throw new Error(r);
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
|
-
async function
|
|
244
|
+
async function Ve({
|
|
247
245
|
signature: e,
|
|
248
246
|
typedData: t,
|
|
249
247
|
address: n,
|
|
250
248
|
env: a
|
|
251
249
|
}) {
|
|
252
|
-
const { baseApiUrl: i } =
|
|
250
|
+
const { baseApiUrl: i } = w(a);
|
|
253
251
|
try {
|
|
254
|
-
const { data: r } = await
|
|
252
|
+
const { data: r } = await h.post(
|
|
255
253
|
`${i}/api/v1/claimer/save-user-signature`,
|
|
256
254
|
null,
|
|
257
255
|
{
|
|
@@ -264,11 +262,34 @@ async function qt({
|
|
|
264
262
|
);
|
|
265
263
|
return r.status;
|
|
266
264
|
} catch (r) {
|
|
267
|
-
const
|
|
268
|
-
throw new Error(
|
|
265
|
+
const p = C(r);
|
|
266
|
+
throw new Error(p);
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
async function Ze({
|
|
270
|
+
signature: e,
|
|
271
|
+
typedData: t,
|
|
272
|
+
env: n
|
|
273
|
+
}) {
|
|
274
|
+
const { baseApiUrl: a } = w(n);
|
|
275
|
+
try {
|
|
276
|
+
const { data: i } = await h.post(
|
|
277
|
+
`${a}/api/v1/claimer/save-stake-and-bake-signature`,
|
|
278
|
+
null,
|
|
279
|
+
{
|
|
280
|
+
params: {
|
|
281
|
+
typed_data: t,
|
|
282
|
+
signature: e
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
return i.status;
|
|
287
|
+
} catch (i) {
|
|
288
|
+
const r = C(i);
|
|
289
|
+
throw new Error(r);
|
|
269
290
|
}
|
|
270
291
|
}
|
|
271
|
-
const
|
|
292
|
+
const x = {
|
|
272
293
|
[s.ethereum]: "https://rpc.ankr.com/eth",
|
|
273
294
|
[s.holesky]: "https://rpc.ankr.com/eth_holesky",
|
|
274
295
|
[s.sepolia]: "https://rpc.ankr.com/eth_sepolia",
|
|
@@ -277,7 +298,7 @@ const N = {
|
|
|
277
298
|
[s.binanceSmartChain]: "https://rpc.ankr.com/bsc",
|
|
278
299
|
[s.binanceSmartChainTestnet]: "https://rpc.ankr.com/bsc_testnet_chapel"
|
|
279
300
|
};
|
|
280
|
-
async function
|
|
301
|
+
async function be(e) {
|
|
281
302
|
const n = await (await fetch(e, {
|
|
282
303
|
method: "POST",
|
|
283
304
|
headers: {
|
|
@@ -289,15 +310,15 @@ async function Je(e) {
|
|
|
289
310
|
method: "eth_maxPriorityFeePerGas",
|
|
290
311
|
params: []
|
|
291
312
|
})
|
|
292
|
-
})).json(), a =
|
|
293
|
-
return new
|
|
313
|
+
})).json(), a = H.utils.hexToNumber(n == null ? void 0 : n.result);
|
|
314
|
+
return new v(Number(a));
|
|
294
315
|
}
|
|
295
|
-
const
|
|
296
|
-
class
|
|
316
|
+
const Te = 2, fe = 25e3;
|
|
317
|
+
class O {
|
|
297
318
|
constructor({ chainId: t, rpcUrlConfig: n }) {
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
this.chainId = t, this.rpcConfig = { ...
|
|
319
|
+
A(this, "chainId");
|
|
320
|
+
A(this, "rpcConfig");
|
|
321
|
+
this.chainId = t, this.rpcConfig = { ...x, ...n };
|
|
301
322
|
}
|
|
302
323
|
/**
|
|
303
324
|
* Returns web3 instance for read operations.
|
|
@@ -306,7 +327,7 @@ class q {
|
|
|
306
327
|
* @returns {Web3} Web3 instance.
|
|
307
328
|
*/
|
|
308
329
|
getReadWeb3() {
|
|
309
|
-
const t = this.getRpcUrl(), n = new
|
|
330
|
+
const t = this.getRpcUrl(), n = new G(), a = new G.providers.HttpProvider(t);
|
|
310
331
|
return n.setProvider(a), n;
|
|
311
332
|
}
|
|
312
333
|
/**
|
|
@@ -334,10 +355,10 @@ class q {
|
|
|
334
355
|
async getMaxFees() {
|
|
335
356
|
const t = this.getReadWeb3(), n = this.getRpcUrl(), [a, i] = await Promise.all([
|
|
336
357
|
t.eth.getBlock("latest"),
|
|
337
|
-
|
|
358
|
+
be(n)
|
|
338
359
|
]);
|
|
339
360
|
return !(a != null && a.baseFeePerGas) && typeof (a == null ? void 0 : a.baseFeePerGas) != "bigint" ? {} : {
|
|
340
|
-
maxFeePerGas: +new
|
|
361
|
+
maxFeePerGas: +new v(a.baseFeePerGas.toString(10)).multipliedBy(Te).plus(i),
|
|
341
362
|
maxPriorityFeePerGas: +i
|
|
342
363
|
};
|
|
343
364
|
}
|
|
@@ -349,8 +370,8 @@ class q {
|
|
|
349
370
|
*/
|
|
350
371
|
async getSafeGasPriceWei() {
|
|
351
372
|
const t = await this.getReadWeb3().eth.getGasPrice();
|
|
352
|
-
return new
|
|
353
|
-
|
|
373
|
+
return new v(t.toString(10)).plus(
|
|
374
|
+
fe
|
|
354
375
|
);
|
|
355
376
|
}
|
|
356
377
|
/**
|
|
@@ -366,152 +387,60 @@ class q {
|
|
|
366
387
|
return new a.eth.Contract(t, n);
|
|
367
388
|
}
|
|
368
389
|
}
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
this.web3 = new ye(n), this.account = a, this.chainId = i, this.rpcConfig = { ...N, ...r };
|
|
376
|
-
}
|
|
377
|
-
/**
|
|
378
|
-
* Signs a message using the current provider and account.
|
|
379
|
-
* @public
|
|
380
|
-
* @param message - The message to be signed.
|
|
381
|
-
* @returns A promise that resolves to the signed message as a string.
|
|
382
|
-
*/
|
|
383
|
-
async signMessage(n) {
|
|
384
|
-
const { account: a } = this, i = `0x${Buffer.from(n, "utf8").toString("hex")}`;
|
|
385
|
-
return this.web3.currentProvider.request({
|
|
386
|
-
method: "personal_sign",
|
|
387
|
-
params: [i, a]
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
/**
|
|
391
|
-
* Custom replacement for web3js [send](https://docs.web3js.org/libdocs/Contract#send).
|
|
392
|
-
*
|
|
393
|
-
* @public
|
|
394
|
-
* @param {string} from - Address of the sender.
|
|
395
|
-
* @param {string} to - Address of the recipient.
|
|
396
|
-
* @param {ISendOptions} sendOptions - Options for sending transaction.
|
|
397
|
-
* @returns {Promise<IWeb3SendResult>} Promise with transaction hash and receipt promise.
|
|
398
|
-
*/
|
|
399
|
-
async sendTransactionAsync(n, a, i) {
|
|
400
|
-
const { chainId: r, web3: o } = this, p = this.getReadWeb3(), {
|
|
401
|
-
data: u,
|
|
402
|
-
estimate: g = !1,
|
|
403
|
-
estimateFee: f = !1,
|
|
404
|
-
extendedGasLimit: T,
|
|
405
|
-
gasLimit: E = "0",
|
|
406
|
-
value: fe = "0",
|
|
407
|
-
gasLimitMultiplier: Te = 1
|
|
408
|
-
} = i;
|
|
409
|
-
let { nonce: D } = i;
|
|
410
|
-
D || (D = await p.eth.getTransactionCount(n)), console.log(`Nonce: ${D}`);
|
|
411
|
-
const d = {
|
|
412
|
-
from: n,
|
|
413
|
-
to: a,
|
|
414
|
-
value: A.numberToHex(fe),
|
|
415
|
-
data: u,
|
|
416
|
-
nonce: D,
|
|
417
|
-
chainId: A.numberToHex(r)
|
|
418
|
-
};
|
|
419
|
-
if (g)
|
|
420
|
-
try {
|
|
421
|
-
const h = await p.eth.estimateGas(d), M = Math.round(
|
|
422
|
-
Number(h) * Te
|
|
423
|
-
);
|
|
424
|
-
T ? d.gas = A.numberToHex(M + T) : d.gas = A.numberToHex(M);
|
|
425
|
-
} catch (h) {
|
|
426
|
-
throw new Error(
|
|
427
|
-
h.message ?? "Failed to estimate gas limit for transaction."
|
|
428
|
-
);
|
|
429
|
-
}
|
|
430
|
-
else
|
|
431
|
-
d.gas = A.numberToHex(E);
|
|
432
|
-
const { maxFeePerGas: te, maxPriorityFeePerGas: ne } = f ? await this.getMaxFees().catch(() => i) : i;
|
|
433
|
-
if (ne !== void 0 && (d.maxPriorityFeePerGas = A.numberToHex(ne)), te !== void 0 && (d.maxFeePerGas = A.numberToHex(te)), !d.maxFeePerGas && !d.maxPriorityFeePerGas) {
|
|
434
|
-
const h = await this.getSafeGasPriceWei();
|
|
435
|
-
d.gasPrice = h.toString(10);
|
|
436
|
-
}
|
|
437
|
-
if (!d.maxFeePerGas && !d.maxPriorityFeePerGas) {
|
|
438
|
-
const h = await this.getSafeGasPriceWei();
|
|
439
|
-
d.gasPrice = h.toString(10);
|
|
440
|
-
}
|
|
441
|
-
return console.log("Sending transaction via Web3: ", d), new Promise((h, M) => {
|
|
442
|
-
const ae = o.eth.sendTransaction(d);
|
|
443
|
-
ae.once("transactionHash", async (se) => {
|
|
444
|
-
console.log(`Just signed transaction has is: ${se}`), h({
|
|
445
|
-
receiptPromise: ae,
|
|
446
|
-
transactionHash: se
|
|
447
|
-
});
|
|
448
|
-
}).catch(M);
|
|
449
|
-
});
|
|
450
|
-
}
|
|
451
|
-
createContract(n, a) {
|
|
452
|
-
return new this.web3.eth.Contract(n, a);
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
function Q(e) {
|
|
456
|
-
switch (e) {
|
|
457
|
-
case s.ethereum:
|
|
458
|
-
return 1.3;
|
|
459
|
-
case s.holesky:
|
|
460
|
-
case s.sepolia:
|
|
461
|
-
return 1.5;
|
|
462
|
-
default:
|
|
463
|
-
return 1.3;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
function ce(e) {
|
|
390
|
+
const ge = [
|
|
391
|
+
s.ethereum,
|
|
392
|
+
s.base,
|
|
393
|
+
s.binanceSmartChain
|
|
394
|
+
], W = (e) => ge.includes(e) ? T.prod : T.stage;
|
|
395
|
+
function $(e) {
|
|
467
396
|
return Object.values(s).includes(e);
|
|
468
397
|
}
|
|
469
|
-
const
|
|
398
|
+
const he = {
|
|
470
399
|
[s.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
|
|
471
|
-
[s.ethereum]:
|
|
400
|
+
[s.ethereum]: u,
|
|
472
401
|
[s.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
|
|
473
|
-
[s.binanceSmartChain]:
|
|
402
|
+
[s.binanceSmartChain]: u,
|
|
474
403
|
[s.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
|
|
475
|
-
[s.base]:
|
|
404
|
+
[s.base]: u,
|
|
476
405
|
// TODO: Add baseTestnet address
|
|
477
|
-
[s.baseTestnet]:
|
|
406
|
+
[s.baseTestnet]: u,
|
|
478
407
|
[s.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
|
|
479
|
-
[s.corn]:
|
|
480
|
-
[s.swell]:
|
|
481
|
-
},
|
|
408
|
+
[s.corn]: u,
|
|
409
|
+
[s.swell]: u
|
|
410
|
+
}, we = {
|
|
482
411
|
[s.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
|
|
483
|
-
[s.ethereum]:
|
|
412
|
+
[s.ethereum]: u,
|
|
484
413
|
[s.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
|
|
485
|
-
[s.binanceSmartChain]:
|
|
414
|
+
[s.binanceSmartChain]: u,
|
|
486
415
|
[s.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
|
|
487
|
-
[s.base]:
|
|
488
|
-
[s.baseTestnet]:
|
|
416
|
+
[s.base]: u,
|
|
417
|
+
[s.baseTestnet]: u,
|
|
489
418
|
[s.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
|
|
490
|
-
[s.corn]:
|
|
491
|
-
[s.swell]:
|
|
492
|
-
},
|
|
419
|
+
[s.corn]: u,
|
|
420
|
+
[s.swell]: u
|
|
421
|
+
}, Ae = {
|
|
493
422
|
[s.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
|
|
494
|
-
[s.holesky]:
|
|
495
|
-
[s.sepolia]:
|
|
496
|
-
[s.binanceSmartChainTestnet]:
|
|
423
|
+
[s.holesky]: u,
|
|
424
|
+
[s.sepolia]: u,
|
|
425
|
+
[s.binanceSmartChainTestnet]: u,
|
|
497
426
|
[s.binanceSmartChain]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
498
427
|
[s.base]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
499
|
-
[s.baseTestnet]:
|
|
500
|
-
[s.berachainBartioTestnet]:
|
|
428
|
+
[s.baseTestnet]: u,
|
|
429
|
+
[s.berachainBartioTestnet]: u,
|
|
501
430
|
[s.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
502
431
|
[s.swell]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
|
|
503
432
|
};
|
|
504
|
-
function
|
|
433
|
+
function Se(e = N) {
|
|
505
434
|
switch (e) {
|
|
506
|
-
case
|
|
507
|
-
return
|
|
508
|
-
case
|
|
509
|
-
return
|
|
435
|
+
case T.prod:
|
|
436
|
+
return Ae;
|
|
437
|
+
case T.testnet:
|
|
438
|
+
return we;
|
|
510
439
|
default:
|
|
511
|
-
return
|
|
440
|
+
return he;
|
|
512
441
|
}
|
|
513
442
|
}
|
|
514
|
-
const
|
|
443
|
+
const ve = [
|
|
515
444
|
{
|
|
516
445
|
constant: !0,
|
|
517
446
|
inputs: [],
|
|
@@ -732,7 +661,7 @@ const Ye = [
|
|
|
732
661
|
name: "Transfer",
|
|
733
662
|
type: "event"
|
|
734
663
|
}
|
|
735
|
-
],
|
|
664
|
+
], Ce = [
|
|
736
665
|
{
|
|
737
666
|
inputs: [],
|
|
738
667
|
stateMutability: "nonpayable",
|
|
@@ -2492,1336 +2421,133 @@ const Ye = [
|
|
|
2492
2421
|
stateMutability: "nonpayable",
|
|
2493
2422
|
type: "function"
|
|
2494
2423
|
}
|
|
2495
|
-
]
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
{
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
}
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2567
|
-
|
|
2568
|
-
|
|
2569
|
-
|
|
2570
|
-
|
|
2571
|
-
|
|
2572
|
-
|
|
2573
|
-
|
|
2574
|
-
|
|
2575
|
-
|
|
2576
|
-
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
name: "depositID",
|
|
2591
|
-
type: "bytes32"
|
|
2592
|
-
},
|
|
2593
|
-
{
|
|
2594
|
-
internalType: "uint256",
|
|
2595
|
-
name: "withdrawalAmount",
|
|
2596
|
-
type: "uint256"
|
|
2597
|
-
}
|
|
2598
|
-
],
|
|
2599
|
-
name: "AlreadyWithdrawn",
|
|
2600
|
-
type: "error"
|
|
2601
|
-
},
|
|
2602
|
-
{
|
|
2603
|
-
inputs: [],
|
|
2604
|
-
name: "BadDepositReport",
|
|
2605
|
-
type: "error"
|
|
2606
|
-
},
|
|
2607
|
-
{
|
|
2608
|
-
inputs: [],
|
|
2609
|
-
name: "EnforcedPause",
|
|
2610
|
-
type: "error"
|
|
2611
|
-
},
|
|
2612
|
-
{
|
|
2613
|
-
inputs: [],
|
|
2614
|
-
name: "ExpectedPause",
|
|
2615
|
-
type: "error"
|
|
2616
|
-
},
|
|
2617
|
-
{
|
|
2618
|
-
inputs: [
|
|
2619
|
-
{
|
|
2620
|
-
internalType: "uint8",
|
|
2621
|
-
name: "bits",
|
|
2622
|
-
type: "uint8"
|
|
2623
|
-
},
|
|
2624
|
-
{
|
|
2625
|
-
internalType: "uint256",
|
|
2626
|
-
name: "value",
|
|
2627
|
-
type: "uint256"
|
|
2628
|
-
}
|
|
2629
|
-
],
|
|
2630
|
-
name: "SafeCastOverflowedUintDowncast",
|
|
2631
|
-
type: "error"
|
|
2632
|
-
},
|
|
2633
|
-
{
|
|
2634
|
-
inputs: [],
|
|
2635
|
-
name: "SameValidationThreshold",
|
|
2636
|
-
type: "error"
|
|
2637
|
-
},
|
|
2638
|
-
{
|
|
2639
|
-
inputs: [
|
|
2640
|
-
{
|
|
2641
|
-
internalType: "bytes32",
|
|
2642
|
-
name: "depositID",
|
|
2643
|
-
type: "bytes32"
|
|
2644
|
-
},
|
|
2645
|
-
{
|
|
2646
|
-
internalType: "uint256",
|
|
2647
|
-
name: "withdrawalAmount",
|
|
2648
|
-
type: "uint256"
|
|
2424
|
+
];
|
|
2425
|
+
function _e(e) {
|
|
2426
|
+
switch (e) {
|
|
2427
|
+
case "LBTC":
|
|
2428
|
+
return Ce;
|
|
2429
|
+
default:
|
|
2430
|
+
return ve;
|
|
2431
|
+
}
|
|
2432
|
+
}
|
|
2433
|
+
function R(e, t) {
|
|
2434
|
+
const n = Se(t), { chainId: a } = e;
|
|
2435
|
+
if (!$(a))
|
|
2436
|
+
throw new Error(`This chain ${a} is not supported`);
|
|
2437
|
+
const i = n[a];
|
|
2438
|
+
if (!i)
|
|
2439
|
+
throw new Error(`Token address for chain ${a} is not defined`);
|
|
2440
|
+
const r = _e("LBTC"), p = e.createContract(r, i);
|
|
2441
|
+
return p.options.address || (p.options.address = i), p;
|
|
2442
|
+
}
|
|
2443
|
+
function V(e, t) {
|
|
2444
|
+
if (!$(e))
|
|
2445
|
+
throw new Error(`This chain ${e} is not supported`);
|
|
2446
|
+
const n = t ? { [e]: t } : x;
|
|
2447
|
+
if (!n[e])
|
|
2448
|
+
throw new Error(`RPC URL for chainId ${e} not found`);
|
|
2449
|
+
return n;
|
|
2450
|
+
}
|
|
2451
|
+
async function Ke({
|
|
2452
|
+
chainId: e,
|
|
2453
|
+
bakeGasEstimate: t = 0,
|
|
2454
|
+
rpcUrl: n
|
|
2455
|
+
}) {
|
|
2456
|
+
const a = V(e, n), i = new O({ chainId: e, rpcUrlConfig: a }), r = W(e), o = await R(i, r).methods.getMintFee().call(), m = new v(M(o.toString(10)));
|
|
2457
|
+
return t ? m.plus(M(t)) : m;
|
|
2458
|
+
}
|
|
2459
|
+
class F extends O {
|
|
2460
|
+
constructor({ provider: n, account: a, chainId: i, rpcUrlConfig: r }) {
|
|
2461
|
+
super({ chainId: i, rpcUrlConfig: r });
|
|
2462
|
+
A(this, "web3");
|
|
2463
|
+
A(this, "account");
|
|
2464
|
+
A(this, "rpcConfig", x);
|
|
2465
|
+
this.web3 = new H(n), this.account = a, this.chainId = i, this.rpcConfig = { ...x, ...r };
|
|
2466
|
+
}
|
|
2467
|
+
/**
|
|
2468
|
+
* Signs a message using the current provider and account.
|
|
2469
|
+
* @public
|
|
2470
|
+
* @param message - The message to be signed.
|
|
2471
|
+
* @returns A promise that resolves to the signed message as a string.
|
|
2472
|
+
*/
|
|
2473
|
+
async signMessage(n) {
|
|
2474
|
+
const { account: a } = this, i = `0x${Buffer.from(n, "utf8").toString("hex")}`;
|
|
2475
|
+
return this.web3.currentProvider.request({
|
|
2476
|
+
method: "personal_sign",
|
|
2477
|
+
params: [i, a]
|
|
2478
|
+
});
|
|
2479
|
+
}
|
|
2480
|
+
/**
|
|
2481
|
+
* Custom replacement for web3js [send](https://docs.web3js.org/libdocs/Contract#send).
|
|
2482
|
+
*
|
|
2483
|
+
* @public
|
|
2484
|
+
* @param {string} from - Address of the sender.
|
|
2485
|
+
* @param {string} to - Address of the recipient.
|
|
2486
|
+
* @param {ISendOptions} sendOptions - Options for sending transaction.
|
|
2487
|
+
* @returns {Promise<IWeb3SendResult>} Promise with transaction hash and receipt promise.
|
|
2488
|
+
*/
|
|
2489
|
+
async sendTransactionAsync(n, a, i) {
|
|
2490
|
+
const { chainId: r, web3: p } = this, o = this.getReadWeb3(), {
|
|
2491
|
+
data: m,
|
|
2492
|
+
estimate: c = !1,
|
|
2493
|
+
estimateFee: d = !1,
|
|
2494
|
+
extendedGasLimit: y,
|
|
2495
|
+
gasLimit: b = "0",
|
|
2496
|
+
value: _ = "0",
|
|
2497
|
+
gasLimitMultiplier: Z = 1
|
|
2498
|
+
} = i;
|
|
2499
|
+
let { nonce: E } = i;
|
|
2500
|
+
E || (E = await o.eth.getTransactionCount(n)), console.log(`Nonce: ${E}`);
|
|
2501
|
+
const l = {
|
|
2502
|
+
from: n,
|
|
2503
|
+
to: a,
|
|
2504
|
+
value: g.numberToHex(_),
|
|
2505
|
+
data: m,
|
|
2506
|
+
nonce: E,
|
|
2507
|
+
chainId: g.numberToHex(r)
|
|
2508
|
+
};
|
|
2509
|
+
if (c)
|
|
2510
|
+
try {
|
|
2511
|
+
const f = await o.eth.estimateGas(l), I = Math.round(
|
|
2512
|
+
Number(f) * Z
|
|
2513
|
+
);
|
|
2514
|
+
y ? l.gas = g.numberToHex(I + y) : l.gas = g.numberToHex(I);
|
|
2515
|
+
} catch (f) {
|
|
2516
|
+
throw new Error(
|
|
2517
|
+
f.message ?? "Failed to estimate gas limit for transaction."
|
|
2518
|
+
);
|
|
2649
2519
|
}
|
|
2650
|
-
|
|
2651
|
-
|
|
2652
|
-
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
inputs: [],
|
|
2657
|
-
name: "DefaultAdminDelayChangeCanceled",
|
|
2658
|
-
type: "event"
|
|
2659
|
-
},
|
|
2660
|
-
{
|
|
2661
|
-
anonymous: !1,
|
|
2662
|
-
inputs: [
|
|
2663
|
-
{
|
|
2664
|
-
indexed: !1,
|
|
2665
|
-
internalType: "uint48",
|
|
2666
|
-
name: "newDelay",
|
|
2667
|
-
type: "uint48"
|
|
2668
|
-
},
|
|
2669
|
-
{
|
|
2670
|
-
indexed: !1,
|
|
2671
|
-
internalType: "uint48",
|
|
2672
|
-
name: "effectSchedule",
|
|
2673
|
-
type: "uint48"
|
|
2674
|
-
}
|
|
2675
|
-
],
|
|
2676
|
-
name: "DefaultAdminDelayChangeScheduled",
|
|
2677
|
-
type: "event"
|
|
2678
|
-
},
|
|
2679
|
-
{
|
|
2680
|
-
anonymous: !1,
|
|
2681
|
-
inputs: [],
|
|
2682
|
-
name: "DefaultAdminTransferCanceled",
|
|
2683
|
-
type: "event"
|
|
2684
|
-
},
|
|
2685
|
-
{
|
|
2686
|
-
anonymous: !1,
|
|
2687
|
-
inputs: [
|
|
2688
|
-
{
|
|
2689
|
-
indexed: !0,
|
|
2690
|
-
internalType: "address",
|
|
2691
|
-
name: "newAdmin",
|
|
2692
|
-
type: "address"
|
|
2693
|
-
},
|
|
2694
|
-
{
|
|
2695
|
-
indexed: !1,
|
|
2696
|
-
internalType: "uint48",
|
|
2697
|
-
name: "acceptSchedule",
|
|
2698
|
-
type: "uint48"
|
|
2699
|
-
}
|
|
2700
|
-
],
|
|
2701
|
-
name: "DefaultAdminTransferScheduled",
|
|
2702
|
-
type: "event"
|
|
2703
|
-
},
|
|
2704
|
-
{
|
|
2705
|
-
anonymous: !1,
|
|
2706
|
-
inputs: [
|
|
2707
|
-
{
|
|
2708
|
-
indexed: !0,
|
|
2709
|
-
internalType: "bytes32",
|
|
2710
|
-
name: "reportId",
|
|
2711
|
-
type: "bytes32"
|
|
2712
|
-
},
|
|
2713
|
-
{
|
|
2714
|
-
indexed: !1,
|
|
2715
|
-
internalType: "uint256",
|
|
2716
|
-
name: "numDeposits",
|
|
2717
|
-
type: "uint256"
|
|
2718
|
-
}
|
|
2719
|
-
],
|
|
2720
|
-
name: "DepositsReported",
|
|
2721
|
-
type: "event"
|
|
2722
|
-
},
|
|
2723
|
-
{
|
|
2724
|
-
anonymous: !1,
|
|
2725
|
-
inputs: [
|
|
2726
|
-
{
|
|
2727
|
-
indexed: !1,
|
|
2728
|
-
internalType: "uint256",
|
|
2729
|
-
name: "numDeposits",
|
|
2730
|
-
type: "uint256"
|
|
2731
|
-
}
|
|
2732
|
-
],
|
|
2733
|
-
name: "MaxDepositsUpdated",
|
|
2734
|
-
type: "event"
|
|
2735
|
-
},
|
|
2736
|
-
{
|
|
2737
|
-
anonymous: !1,
|
|
2738
|
-
inputs: [
|
|
2739
|
-
{
|
|
2740
|
-
indexed: !1,
|
|
2741
|
-
internalType: "address",
|
|
2742
|
-
name: "account",
|
|
2743
|
-
type: "address"
|
|
2744
|
-
}
|
|
2745
|
-
],
|
|
2746
|
-
name: "Paused",
|
|
2747
|
-
type: "event"
|
|
2748
|
-
},
|
|
2749
|
-
{
|
|
2750
|
-
anonymous: !1,
|
|
2751
|
-
inputs: [
|
|
2752
|
-
{
|
|
2753
|
-
indexed: !0,
|
|
2754
|
-
internalType: "bytes32",
|
|
2755
|
-
name: "role",
|
|
2756
|
-
type: "bytes32"
|
|
2757
|
-
},
|
|
2758
|
-
{
|
|
2759
|
-
indexed: !0,
|
|
2760
|
-
internalType: "bytes32",
|
|
2761
|
-
name: "previousAdminRole",
|
|
2762
|
-
type: "bytes32"
|
|
2763
|
-
},
|
|
2764
|
-
{
|
|
2765
|
-
indexed: !0,
|
|
2766
|
-
internalType: "bytes32",
|
|
2767
|
-
name: "newAdminRole",
|
|
2768
|
-
type: "bytes32"
|
|
2769
|
-
}
|
|
2770
|
-
],
|
|
2771
|
-
name: "RoleAdminChanged",
|
|
2772
|
-
type: "event"
|
|
2773
|
-
},
|
|
2774
|
-
{
|
|
2775
|
-
anonymous: !1,
|
|
2776
|
-
inputs: [
|
|
2777
|
-
{
|
|
2778
|
-
indexed: !0,
|
|
2779
|
-
internalType: "bytes32",
|
|
2780
|
-
name: "role",
|
|
2781
|
-
type: "bytes32"
|
|
2782
|
-
},
|
|
2783
|
-
{
|
|
2784
|
-
indexed: !0,
|
|
2785
|
-
internalType: "address",
|
|
2786
|
-
name: "account",
|
|
2787
|
-
type: "address"
|
|
2788
|
-
},
|
|
2789
|
-
{
|
|
2790
|
-
indexed: !0,
|
|
2791
|
-
internalType: "address",
|
|
2792
|
-
name: "sender",
|
|
2793
|
-
type: "address"
|
|
2794
|
-
}
|
|
2795
|
-
],
|
|
2796
|
-
name: "RoleGranted",
|
|
2797
|
-
type: "event"
|
|
2798
|
-
},
|
|
2799
|
-
{
|
|
2800
|
-
anonymous: !1,
|
|
2801
|
-
inputs: [
|
|
2802
|
-
{
|
|
2803
|
-
indexed: !0,
|
|
2804
|
-
internalType: "bytes32",
|
|
2805
|
-
name: "role",
|
|
2806
|
-
type: "bytes32"
|
|
2807
|
-
},
|
|
2808
|
-
{
|
|
2809
|
-
indexed: !0,
|
|
2810
|
-
internalType: "address",
|
|
2811
|
-
name: "account",
|
|
2812
|
-
type: "address"
|
|
2813
|
-
},
|
|
2814
|
-
{
|
|
2815
|
-
indexed: !0,
|
|
2816
|
-
internalType: "address",
|
|
2817
|
-
name: "sender",
|
|
2818
|
-
type: "address"
|
|
2819
|
-
}
|
|
2820
|
-
],
|
|
2821
|
-
name: "RoleRevoked",
|
|
2822
|
-
type: "event"
|
|
2823
|
-
},
|
|
2824
|
-
{
|
|
2825
|
-
anonymous: !1,
|
|
2826
|
-
inputs: [
|
|
2827
|
-
{
|
|
2828
|
-
indexed: !1,
|
|
2829
|
-
internalType: "address",
|
|
2830
|
-
name: "account",
|
|
2831
|
-
type: "address"
|
|
2832
|
-
}
|
|
2833
|
-
],
|
|
2834
|
-
name: "Unpaused",
|
|
2835
|
-
type: "event"
|
|
2836
|
-
},
|
|
2837
|
-
{
|
|
2838
|
-
anonymous: !1,
|
|
2839
|
-
inputs: [
|
|
2840
|
-
{
|
|
2841
|
-
indexed: !1,
|
|
2842
|
-
internalType: "uint256",
|
|
2843
|
-
name: "oldThreshold",
|
|
2844
|
-
type: "uint256"
|
|
2845
|
-
},
|
|
2846
|
-
{
|
|
2847
|
-
indexed: !1,
|
|
2848
|
-
internalType: "uint256",
|
|
2849
|
-
name: "newThreshold",
|
|
2850
|
-
type: "uint256"
|
|
2851
|
-
}
|
|
2852
|
-
],
|
|
2853
|
-
name: "UpdateValidateThreshold",
|
|
2854
|
-
type: "event"
|
|
2855
|
-
},
|
|
2856
|
-
{
|
|
2857
|
-
anonymous: !1,
|
|
2858
|
-
inputs: [
|
|
2859
|
-
{
|
|
2860
|
-
indexed: !1,
|
|
2861
|
-
internalType: "bytes32",
|
|
2862
|
-
name: "depositID",
|
|
2863
|
-
type: "bytes32"
|
|
2864
|
-
},
|
|
2865
|
-
{
|
|
2866
|
-
indexed: !1,
|
|
2867
|
-
internalType: "uint256",
|
|
2868
|
-
name: "withdrawalAmount",
|
|
2869
|
-
type: "uint256"
|
|
2870
|
-
}
|
|
2871
|
-
],
|
|
2872
|
-
name: "WithdrawalNotValidated",
|
|
2873
|
-
type: "event"
|
|
2874
|
-
},
|
|
2875
|
-
{
|
|
2876
|
-
anonymous: !1,
|
|
2877
|
-
inputs: [
|
|
2878
|
-
{
|
|
2879
|
-
indexed: !1,
|
|
2880
|
-
internalType: "bytes32",
|
|
2881
|
-
name: "depositID",
|
|
2882
|
-
type: "bytes32"
|
|
2883
|
-
},
|
|
2884
|
-
{
|
|
2885
|
-
indexed: !1,
|
|
2886
|
-
internalType: "uint256",
|
|
2887
|
-
name: "withdrawalAmount",
|
|
2888
|
-
type: "uint256"
|
|
2889
|
-
}
|
|
2890
|
-
],
|
|
2891
|
-
name: "WithdrawalValidated",
|
|
2892
|
-
type: "event"
|
|
2893
|
-
},
|
|
2894
|
-
{
|
|
2895
|
-
inputs: [],
|
|
2896
|
-
name: "DEFAULT_ADMIN_ROLE",
|
|
2897
|
-
outputs: [
|
|
2898
|
-
{
|
|
2899
|
-
internalType: "bytes32",
|
|
2900
|
-
name: "",
|
|
2901
|
-
type: "bytes32"
|
|
2902
|
-
}
|
|
2903
|
-
],
|
|
2904
|
-
stateMutability: "view",
|
|
2905
|
-
type: "function"
|
|
2906
|
-
},
|
|
2907
|
-
{
|
|
2908
|
-
inputs: [],
|
|
2909
|
-
name: "DEPOSIT_REPORTER_ROLE",
|
|
2910
|
-
outputs: [
|
|
2911
|
-
{
|
|
2912
|
-
internalType: "bytes32",
|
|
2913
|
-
name: "",
|
|
2914
|
-
type: "bytes32"
|
|
2915
|
-
}
|
|
2916
|
-
],
|
|
2917
|
-
stateMutability: "view",
|
|
2918
|
-
type: "function"
|
|
2919
|
-
},
|
|
2920
|
-
{
|
|
2921
|
-
inputs: [],
|
|
2922
|
-
name: "PAUSER_ROLE",
|
|
2923
|
-
outputs: [
|
|
2924
|
-
{
|
|
2925
|
-
internalType: "bytes32",
|
|
2926
|
-
name: "",
|
|
2927
|
-
type: "bytes32"
|
|
2928
|
-
}
|
|
2929
|
-
],
|
|
2930
|
-
stateMutability: "view",
|
|
2931
|
-
type: "function"
|
|
2932
|
-
},
|
|
2933
|
-
{
|
|
2934
|
-
inputs: [],
|
|
2935
|
-
name: "VALIDATION_GUARDIAN_ROLE",
|
|
2936
|
-
outputs: [
|
|
2937
|
-
{
|
|
2938
|
-
internalType: "bytes32",
|
|
2939
|
-
name: "",
|
|
2940
|
-
type: "bytes32"
|
|
2941
|
-
}
|
|
2942
|
-
],
|
|
2943
|
-
stateMutability: "view",
|
|
2944
|
-
type: "function"
|
|
2945
|
-
},
|
|
2946
|
-
{
|
|
2947
|
-
inputs: [],
|
|
2948
|
-
name: "WITHDRAWAL_VALIDATOR_ROLE",
|
|
2949
|
-
outputs: [
|
|
2950
|
-
{
|
|
2951
|
-
internalType: "bytes32",
|
|
2952
|
-
name: "",
|
|
2953
|
-
type: "bytes32"
|
|
2954
|
-
}
|
|
2955
|
-
],
|
|
2956
|
-
stateMutability: "view",
|
|
2957
|
-
type: "function"
|
|
2958
|
-
},
|
|
2959
|
-
{
|
|
2960
|
-
inputs: [],
|
|
2961
|
-
name: "acceptDefaultAdminTransfer",
|
|
2962
|
-
outputs: [],
|
|
2963
|
-
stateMutability: "nonpayable",
|
|
2964
|
-
type: "function"
|
|
2965
|
-
},
|
|
2966
|
-
{
|
|
2967
|
-
inputs: [
|
|
2968
|
-
{
|
|
2969
|
-
internalType: "address",
|
|
2970
|
-
name: "newAdmin",
|
|
2971
|
-
type: "address"
|
|
2972
|
-
}
|
|
2973
|
-
],
|
|
2974
|
-
name: "beginDefaultAdminTransfer",
|
|
2975
|
-
outputs: [],
|
|
2976
|
-
stateMutability: "nonpayable",
|
|
2977
|
-
type: "function"
|
|
2978
|
-
},
|
|
2979
|
-
{
|
|
2980
|
-
inputs: [],
|
|
2981
|
-
name: "cancelDefaultAdminTransfer",
|
|
2982
|
-
outputs: [],
|
|
2983
|
-
stateMutability: "nonpayable",
|
|
2984
|
-
type: "function"
|
|
2985
|
-
},
|
|
2986
|
-
{
|
|
2987
|
-
inputs: [
|
|
2988
|
-
{
|
|
2989
|
-
internalType: "uint48",
|
|
2990
|
-
name: "newDelay",
|
|
2991
|
-
type: "uint48"
|
|
2992
|
-
}
|
|
2993
|
-
],
|
|
2994
|
-
name: "changeDefaultAdminDelay",
|
|
2995
|
-
outputs: [],
|
|
2996
|
-
stateMutability: "nonpayable",
|
|
2997
|
-
type: "function"
|
|
2998
|
-
},
|
|
2999
|
-
{
|
|
3000
|
-
inputs: [],
|
|
3001
|
-
name: "defaultAdmin",
|
|
3002
|
-
outputs: [
|
|
3003
|
-
{
|
|
3004
|
-
internalType: "address",
|
|
3005
|
-
name: "",
|
|
3006
|
-
type: "address"
|
|
3007
|
-
}
|
|
3008
|
-
],
|
|
3009
|
-
stateMutability: "view",
|
|
3010
|
-
type: "function"
|
|
3011
|
-
},
|
|
3012
|
-
{
|
|
3013
|
-
inputs: [],
|
|
3014
|
-
name: "defaultAdminDelay",
|
|
3015
|
-
outputs: [
|
|
3016
|
-
{
|
|
3017
|
-
internalType: "uint48",
|
|
3018
|
-
name: "",
|
|
3019
|
-
type: "uint48"
|
|
3020
|
-
}
|
|
3021
|
-
],
|
|
3022
|
-
stateMutability: "view",
|
|
3023
|
-
type: "function"
|
|
3024
|
-
},
|
|
3025
|
-
{
|
|
3026
|
-
inputs: [],
|
|
3027
|
-
name: "defaultAdminDelayIncreaseWait",
|
|
3028
|
-
outputs: [
|
|
3029
|
-
{
|
|
3030
|
-
internalType: "uint48",
|
|
3031
|
-
name: "",
|
|
3032
|
-
type: "uint48"
|
|
3033
|
-
}
|
|
3034
|
-
],
|
|
3035
|
-
stateMutability: "view",
|
|
3036
|
-
type: "function"
|
|
3037
|
-
},
|
|
3038
|
-
{
|
|
3039
|
-
inputs: [
|
|
3040
|
-
{
|
|
3041
|
-
internalType: "bytes32",
|
|
3042
|
-
name: "depositID",
|
|
3043
|
-
type: "bytes32"
|
|
3044
|
-
}
|
|
3045
|
-
],
|
|
3046
|
-
name: "depositHistory",
|
|
3047
|
-
outputs: [
|
|
3048
|
-
{
|
|
3049
|
-
internalType: "enum Bascule.DepositState",
|
|
3050
|
-
name: "status",
|
|
3051
|
-
type: "uint8"
|
|
3052
|
-
}
|
|
3053
|
-
],
|
|
3054
|
-
stateMutability: "view",
|
|
3055
|
-
type: "function"
|
|
3056
|
-
},
|
|
3057
|
-
{
|
|
3058
|
-
inputs: [
|
|
3059
|
-
{
|
|
3060
|
-
internalType: "bytes32",
|
|
3061
|
-
name: "role",
|
|
3062
|
-
type: "bytes32"
|
|
3063
|
-
}
|
|
3064
|
-
],
|
|
3065
|
-
name: "getRoleAdmin",
|
|
3066
|
-
outputs: [
|
|
3067
|
-
{
|
|
3068
|
-
internalType: "bytes32",
|
|
3069
|
-
name: "",
|
|
3070
|
-
type: "bytes32"
|
|
3071
|
-
}
|
|
3072
|
-
],
|
|
3073
|
-
stateMutability: "view",
|
|
3074
|
-
type: "function"
|
|
3075
|
-
},
|
|
3076
|
-
{
|
|
3077
|
-
inputs: [
|
|
3078
|
-
{
|
|
3079
|
-
internalType: "bytes32",
|
|
3080
|
-
name: "role",
|
|
3081
|
-
type: "bytes32"
|
|
3082
|
-
},
|
|
3083
|
-
{
|
|
3084
|
-
internalType: "address",
|
|
3085
|
-
name: "account",
|
|
3086
|
-
type: "address"
|
|
3087
|
-
}
|
|
3088
|
-
],
|
|
3089
|
-
name: "grantRole",
|
|
3090
|
-
outputs: [],
|
|
3091
|
-
stateMutability: "nonpayable",
|
|
3092
|
-
type: "function"
|
|
3093
|
-
},
|
|
3094
|
-
{
|
|
3095
|
-
inputs: [
|
|
3096
|
-
{
|
|
3097
|
-
internalType: "bytes32",
|
|
3098
|
-
name: "role",
|
|
3099
|
-
type: "bytes32"
|
|
3100
|
-
},
|
|
3101
|
-
{
|
|
3102
|
-
internalType: "address",
|
|
3103
|
-
name: "account",
|
|
3104
|
-
type: "address"
|
|
3105
|
-
}
|
|
3106
|
-
],
|
|
3107
|
-
name: "hasRole",
|
|
3108
|
-
outputs: [
|
|
3109
|
-
{
|
|
3110
|
-
internalType: "bool",
|
|
3111
|
-
name: "",
|
|
3112
|
-
type: "bool"
|
|
3113
|
-
}
|
|
3114
|
-
],
|
|
3115
|
-
stateMutability: "view",
|
|
3116
|
-
type: "function"
|
|
3117
|
-
},
|
|
3118
|
-
{
|
|
3119
|
-
inputs: [],
|
|
3120
|
-
name: "maxDeposits",
|
|
3121
|
-
outputs: [
|
|
3122
|
-
{
|
|
3123
|
-
internalType: "uint256",
|
|
3124
|
-
name: "",
|
|
3125
|
-
type: "uint256"
|
|
3126
|
-
}
|
|
3127
|
-
],
|
|
3128
|
-
stateMutability: "view",
|
|
3129
|
-
type: "function"
|
|
3130
|
-
},
|
|
3131
|
-
{
|
|
3132
|
-
inputs: [],
|
|
3133
|
-
name: "owner",
|
|
3134
|
-
outputs: [
|
|
3135
|
-
{
|
|
3136
|
-
internalType: "address",
|
|
3137
|
-
name: "",
|
|
3138
|
-
type: "address"
|
|
3139
|
-
}
|
|
3140
|
-
],
|
|
3141
|
-
stateMutability: "view",
|
|
3142
|
-
type: "function"
|
|
3143
|
-
},
|
|
3144
|
-
{
|
|
3145
|
-
inputs: [],
|
|
3146
|
-
name: "pause",
|
|
3147
|
-
outputs: [],
|
|
3148
|
-
stateMutability: "nonpayable",
|
|
3149
|
-
type: "function"
|
|
3150
|
-
},
|
|
3151
|
-
{
|
|
3152
|
-
inputs: [],
|
|
3153
|
-
name: "paused",
|
|
3154
|
-
outputs: [
|
|
3155
|
-
{
|
|
3156
|
-
internalType: "bool",
|
|
3157
|
-
name: "",
|
|
3158
|
-
type: "bool"
|
|
3159
|
-
}
|
|
3160
|
-
],
|
|
3161
|
-
stateMutability: "view",
|
|
3162
|
-
type: "function"
|
|
3163
|
-
},
|
|
3164
|
-
{
|
|
3165
|
-
inputs: [],
|
|
3166
|
-
name: "pendingDefaultAdmin",
|
|
3167
|
-
outputs: [
|
|
3168
|
-
{
|
|
3169
|
-
internalType: "address",
|
|
3170
|
-
name: "newAdmin",
|
|
3171
|
-
type: "address"
|
|
3172
|
-
},
|
|
3173
|
-
{
|
|
3174
|
-
internalType: "uint48",
|
|
3175
|
-
name: "schedule",
|
|
3176
|
-
type: "uint48"
|
|
3177
|
-
}
|
|
3178
|
-
],
|
|
3179
|
-
stateMutability: "view",
|
|
3180
|
-
type: "function"
|
|
3181
|
-
},
|
|
3182
|
-
{
|
|
3183
|
-
inputs: [],
|
|
3184
|
-
name: "pendingDefaultAdminDelay",
|
|
3185
|
-
outputs: [
|
|
3186
|
-
{
|
|
3187
|
-
internalType: "uint48",
|
|
3188
|
-
name: "newDelay",
|
|
3189
|
-
type: "uint48"
|
|
3190
|
-
},
|
|
3191
|
-
{
|
|
3192
|
-
internalType: "uint48",
|
|
3193
|
-
name: "schedule",
|
|
3194
|
-
type: "uint48"
|
|
3195
|
-
}
|
|
3196
|
-
],
|
|
3197
|
-
stateMutability: "view",
|
|
3198
|
-
type: "function"
|
|
3199
|
-
},
|
|
3200
|
-
{
|
|
3201
|
-
inputs: [
|
|
3202
|
-
{
|
|
3203
|
-
internalType: "bytes32",
|
|
3204
|
-
name: "role",
|
|
3205
|
-
type: "bytes32"
|
|
3206
|
-
},
|
|
3207
|
-
{
|
|
3208
|
-
internalType: "address",
|
|
3209
|
-
name: "account",
|
|
3210
|
-
type: "address"
|
|
3211
|
-
}
|
|
3212
|
-
],
|
|
3213
|
-
name: "renounceRole",
|
|
3214
|
-
outputs: [],
|
|
3215
|
-
stateMutability: "nonpayable",
|
|
3216
|
-
type: "function"
|
|
3217
|
-
},
|
|
3218
|
-
{
|
|
3219
|
-
inputs: [
|
|
3220
|
-
{
|
|
3221
|
-
internalType: "bytes32",
|
|
3222
|
-
name: "reportId",
|
|
3223
|
-
type: "bytes32"
|
|
3224
|
-
},
|
|
3225
|
-
{
|
|
3226
|
-
internalType: "bytes32[]",
|
|
3227
|
-
name: "depositIDs",
|
|
3228
|
-
type: "bytes32[]"
|
|
3229
|
-
}
|
|
3230
|
-
],
|
|
3231
|
-
name: "reportDeposits",
|
|
3232
|
-
outputs: [],
|
|
3233
|
-
stateMutability: "nonpayable",
|
|
3234
|
-
type: "function"
|
|
3235
|
-
},
|
|
3236
|
-
{
|
|
3237
|
-
inputs: [
|
|
3238
|
-
{
|
|
3239
|
-
internalType: "bytes32",
|
|
3240
|
-
name: "role",
|
|
3241
|
-
type: "bytes32"
|
|
3242
|
-
},
|
|
3243
|
-
{
|
|
3244
|
-
internalType: "address",
|
|
3245
|
-
name: "account",
|
|
3246
|
-
type: "address"
|
|
3247
|
-
}
|
|
3248
|
-
],
|
|
3249
|
-
name: "revokeRole",
|
|
3250
|
-
outputs: [],
|
|
3251
|
-
stateMutability: "nonpayable",
|
|
3252
|
-
type: "function"
|
|
3253
|
-
},
|
|
3254
|
-
{
|
|
3255
|
-
inputs: [],
|
|
3256
|
-
name: "rollbackDefaultAdminDelay",
|
|
3257
|
-
outputs: [],
|
|
3258
|
-
stateMutability: "nonpayable",
|
|
3259
|
-
type: "function"
|
|
3260
|
-
},
|
|
3261
|
-
{
|
|
3262
|
-
inputs: [
|
|
3263
|
-
{
|
|
3264
|
-
internalType: "uint256",
|
|
3265
|
-
name: "aMaxDeposits",
|
|
3266
|
-
type: "uint256"
|
|
3267
|
-
}
|
|
3268
|
-
],
|
|
3269
|
-
name: "setMaxDeposits",
|
|
3270
|
-
outputs: [],
|
|
3271
|
-
stateMutability: "nonpayable",
|
|
3272
|
-
type: "function"
|
|
3273
|
-
},
|
|
3274
|
-
{
|
|
3275
|
-
inputs: [
|
|
3276
|
-
{
|
|
3277
|
-
internalType: "bytes4",
|
|
3278
|
-
name: "interfaceId",
|
|
3279
|
-
type: "bytes4"
|
|
3280
|
-
}
|
|
3281
|
-
],
|
|
3282
|
-
name: "supportsInterface",
|
|
3283
|
-
outputs: [
|
|
3284
|
-
{
|
|
3285
|
-
internalType: "bool",
|
|
3286
|
-
name: "",
|
|
3287
|
-
type: "bool"
|
|
3288
|
-
}
|
|
3289
|
-
],
|
|
3290
|
-
stateMutability: "view",
|
|
3291
|
-
type: "function"
|
|
3292
|
-
},
|
|
3293
|
-
{
|
|
3294
|
-
inputs: [],
|
|
3295
|
-
name: "unpause",
|
|
3296
|
-
outputs: [],
|
|
3297
|
-
stateMutability: "nonpayable",
|
|
3298
|
-
type: "function"
|
|
3299
|
-
},
|
|
3300
|
-
{
|
|
3301
|
-
inputs: [
|
|
3302
|
-
{
|
|
3303
|
-
internalType: "uint256",
|
|
3304
|
-
name: "newThreshold",
|
|
3305
|
-
type: "uint256"
|
|
3306
|
-
}
|
|
3307
|
-
],
|
|
3308
|
-
name: "updateValidateThreshold",
|
|
3309
|
-
outputs: [],
|
|
3310
|
-
stateMutability: "nonpayable",
|
|
3311
|
-
type: "function"
|
|
3312
|
-
},
|
|
3313
|
-
{
|
|
3314
|
-
inputs: [],
|
|
3315
|
-
name: "validateThreshold",
|
|
3316
|
-
outputs: [
|
|
3317
|
-
{
|
|
3318
|
-
internalType: "uint256",
|
|
3319
|
-
name: "",
|
|
3320
|
-
type: "uint256"
|
|
3321
|
-
}
|
|
3322
|
-
],
|
|
3323
|
-
stateMutability: "view",
|
|
3324
|
-
type: "function"
|
|
3325
|
-
},
|
|
3326
|
-
{
|
|
3327
|
-
inputs: [
|
|
3328
|
-
{
|
|
3329
|
-
internalType: "bytes32",
|
|
3330
|
-
name: "depositID",
|
|
3331
|
-
type: "bytes32"
|
|
3332
|
-
},
|
|
3333
|
-
{
|
|
3334
|
-
internalType: "uint256",
|
|
3335
|
-
name: "withdrawalAmount",
|
|
3336
|
-
type: "uint256"
|
|
3337
|
-
}
|
|
3338
|
-
],
|
|
3339
|
-
name: "validateWithdrawal",
|
|
3340
|
-
outputs: [],
|
|
3341
|
-
stateMutability: "nonpayable",
|
|
3342
|
-
type: "function"
|
|
3343
|
-
}
|
|
3344
|
-
];
|
|
3345
|
-
function tt(e) {
|
|
3346
|
-
switch (e) {
|
|
3347
|
-
case "LBTC":
|
|
3348
|
-
return Qe;
|
|
3349
|
-
default:
|
|
3350
|
-
return Ye;
|
|
3351
|
-
}
|
|
3352
|
-
}
|
|
3353
|
-
function w(e, t) {
|
|
3354
|
-
const n = Xe(t), { chainId: a } = e;
|
|
3355
|
-
if (!ce(a))
|
|
3356
|
-
throw new Error(`This chain ${a} is not supported`);
|
|
3357
|
-
const i = n[a];
|
|
3358
|
-
if (!i)
|
|
3359
|
-
throw new Error(`Token address for chain ${a} is not defined`);
|
|
3360
|
-
const r = tt("LBTC"), o = e.createContract(r, i);
|
|
3361
|
-
return o.options.address || (o.options.address = i), o;
|
|
3362
|
-
}
|
|
3363
|
-
function zt({
|
|
3364
|
-
spender: e,
|
|
3365
|
-
amount: t,
|
|
3366
|
-
env: n,
|
|
3367
|
-
...a
|
|
3368
|
-
}) {
|
|
3369
|
-
const i = new x(a), r = w(i, n), o = de(t), p = r.methods.approve(e, o);
|
|
3370
|
-
return i.sendTransactionAsync(
|
|
3371
|
-
i.account,
|
|
3372
|
-
r.options.address,
|
|
3373
|
-
{
|
|
3374
|
-
data: p.encodeABI(),
|
|
3375
|
-
estimate: !0,
|
|
3376
|
-
estimateFee: !0,
|
|
3377
|
-
gasLimitMultiplier: Q(i.chainId)
|
|
2520
|
+
else
|
|
2521
|
+
l.gas = g.numberToHex(b);
|
|
2522
|
+
const { maxFeePerGas: U, maxPriorityFeePerGas: B } = d ? await this.getMaxFees().catch(() => i) : i;
|
|
2523
|
+
if (B !== void 0 && (l.maxPriorityFeePerGas = g.numberToHex(B)), U !== void 0 && (l.maxFeePerGas = g.numberToHex(U)), !l.maxFeePerGas && !l.maxPriorityFeePerGas) {
|
|
2524
|
+
const f = await this.getSafeGasPriceWei();
|
|
2525
|
+
l.gasPrice = f.toString(10);
|
|
3378
2526
|
}
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
r.options.address,
|
|
3393
|
-
{
|
|
3394
|
-
data: o.encodeABI(),
|
|
3395
|
-
// TODO: add getGasOptions from the app for bsc here
|
|
3396
|
-
estimate: !0,
|
|
3397
|
-
estimateFee: !0,
|
|
3398
|
-
gasLimitMultiplier: Q(i.chainId)
|
|
3399
|
-
}
|
|
3400
|
-
);
|
|
3401
|
-
} catch (p) {
|
|
3402
|
-
console.log("error", p);
|
|
3403
|
-
const u = _(p);
|
|
3404
|
-
throw u.includes(nt) ? new Error(at) : new Error(u);
|
|
3405
|
-
}
|
|
3406
|
-
}
|
|
3407
|
-
const st = 208, it = 4001, rt = 4100, ot = 4200, pt = 4900, ut = 4901, P = -32700, O = -32600, U = -32601, F = -32602, B = -32603, L = -32e3, k = -32001, G = -32002, W = -32003, V = -32004, H = -32005, $ = -32006;
|
|
3408
|
-
class le extends Error {
|
|
3409
|
-
constructor(t, n) {
|
|
3410
|
-
super(t), Array.isArray(n) ? this.cause = new z(n) : this.cause = n, this.name = this.constructor.name, typeof Error.captureStackTrace == "function" ? Error.captureStackTrace(new.target.constructor) : this.stack = new Error().stack;
|
|
3411
|
-
}
|
|
3412
|
-
/**
|
|
3413
|
-
* @deprecated Use the `cause` property instead.
|
|
3414
|
-
*/
|
|
3415
|
-
get innerError() {
|
|
3416
|
-
return this.cause instanceof z ? this.cause.errors : this.cause;
|
|
3417
|
-
}
|
|
3418
|
-
/**
|
|
3419
|
-
* @deprecated Use the `cause` property instead.
|
|
3420
|
-
*/
|
|
3421
|
-
set innerError(t) {
|
|
3422
|
-
Array.isArray(t) ? this.cause = new z(t) : this.cause = t;
|
|
3423
|
-
}
|
|
3424
|
-
static convertToString(t, n = !1) {
|
|
3425
|
-
if (t == null)
|
|
3426
|
-
return "undefined";
|
|
3427
|
-
const a = JSON.stringify(t, (i, r) => typeof r == "bigint" ? r.toString() : r);
|
|
3428
|
-
return n && ["bigint", "string"].includes(typeof t) ? a.replace(/['\\"]+/g, "") : a;
|
|
3429
|
-
}
|
|
3430
|
-
toJSON() {
|
|
3431
|
-
return {
|
|
3432
|
-
name: this.name,
|
|
3433
|
-
code: this.code,
|
|
3434
|
-
message: this.message,
|
|
3435
|
-
cause: this.cause,
|
|
3436
|
-
// deprecated
|
|
3437
|
-
innerError: this.cause
|
|
3438
|
-
};
|
|
3439
|
-
}
|
|
3440
|
-
}
|
|
3441
|
-
class z extends le {
|
|
3442
|
-
constructor(t) {
|
|
3443
|
-
super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = st, this.errors = t;
|
|
3444
|
-
}
|
|
3445
|
-
}
|
|
3446
|
-
const yt = "An Rpc error has occured with a code of *code*", l = {
|
|
3447
|
-
// EIP-1474 & JSON RPC 2.0
|
|
3448
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
3449
|
-
[P]: {
|
|
3450
|
-
message: "Parse error",
|
|
3451
|
-
description: "Invalid JSON"
|
|
3452
|
-
},
|
|
3453
|
-
[O]: {
|
|
3454
|
-
message: "Invalid request",
|
|
3455
|
-
description: "JSON is not a valid request object "
|
|
3456
|
-
},
|
|
3457
|
-
[U]: {
|
|
3458
|
-
message: "Method not found",
|
|
3459
|
-
description: "Method does not exist "
|
|
3460
|
-
},
|
|
3461
|
-
[F]: {
|
|
3462
|
-
message: "Invalid params",
|
|
3463
|
-
description: "Invalid method parameters"
|
|
3464
|
-
},
|
|
3465
|
-
[B]: {
|
|
3466
|
-
message: "Internal error",
|
|
3467
|
-
description: "Internal JSON-RPC error"
|
|
3468
|
-
},
|
|
3469
|
-
[L]: {
|
|
3470
|
-
message: "Invalid input",
|
|
3471
|
-
description: "Missing or invalid parameters"
|
|
3472
|
-
},
|
|
3473
|
-
[k]: {
|
|
3474
|
-
message: "Resource not found",
|
|
3475
|
-
description: "Requested resource not found"
|
|
3476
|
-
},
|
|
3477
|
-
[G]: {
|
|
3478
|
-
message: "Resource unavailable",
|
|
3479
|
-
description: "Requested resource not available"
|
|
3480
|
-
},
|
|
3481
|
-
[W]: {
|
|
3482
|
-
message: "Transaction rejected",
|
|
3483
|
-
description: "Transaction creation failed"
|
|
3484
|
-
},
|
|
3485
|
-
[V]: {
|
|
3486
|
-
message: "Method not supported",
|
|
3487
|
-
description: "Method is not implemented"
|
|
3488
|
-
},
|
|
3489
|
-
[H]: {
|
|
3490
|
-
message: "Limit exceeded",
|
|
3491
|
-
description: "Request exceeds defined limit"
|
|
3492
|
-
},
|
|
3493
|
-
[$]: {
|
|
3494
|
-
message: "JSON-RPC version not supported",
|
|
3495
|
-
description: "Version of JSON-RPC protocol is not supported"
|
|
3496
|
-
},
|
|
3497
|
-
// EIP-1193
|
|
3498
|
-
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
3499
|
-
[it]: {
|
|
3500
|
-
name: "User Rejected Request",
|
|
3501
|
-
message: "The user rejected the request."
|
|
3502
|
-
},
|
|
3503
|
-
[rt]: {
|
|
3504
|
-
name: "Unauthorized",
|
|
3505
|
-
message: "The requested method and/or account has not been authorized by the user."
|
|
3506
|
-
},
|
|
3507
|
-
[ot]: {
|
|
3508
|
-
name: "Unsupported Method",
|
|
3509
|
-
message: "The Provider does not support the requested method."
|
|
3510
|
-
},
|
|
3511
|
-
[pt]: {
|
|
3512
|
-
name: "Disconnected",
|
|
3513
|
-
message: "The Provider is disconnected from all chains."
|
|
3514
|
-
},
|
|
3515
|
-
[ut]: {
|
|
3516
|
-
name: "Chain Disconnected",
|
|
3517
|
-
message: "The Provider is not connected to the requested chain."
|
|
3518
|
-
},
|
|
3519
|
-
// EIP-1193 - CloseEvent
|
|
3520
|
-
// https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent/code
|
|
3521
|
-
"0-999": {
|
|
3522
|
-
name: "",
|
|
3523
|
-
message: "Not used."
|
|
3524
|
-
},
|
|
3525
|
-
1e3: {
|
|
3526
|
-
name: "Normal Closure",
|
|
3527
|
-
message: "The connection successfully completed the purpose for which it was created."
|
|
3528
|
-
},
|
|
3529
|
-
1001: {
|
|
3530
|
-
name: "Going Away",
|
|
3531
|
-
message: "The endpoint is going away, either because of a server failure or because the browser is navigating away from the page that opened the connection."
|
|
3532
|
-
},
|
|
3533
|
-
1002: {
|
|
3534
|
-
name: "Protocol error",
|
|
3535
|
-
message: "The endpoint is terminating the connection due to a protocol error."
|
|
3536
|
-
},
|
|
3537
|
-
1003: {
|
|
3538
|
-
name: "Unsupported Data",
|
|
3539
|
-
message: "The connection is being terminated because the endpoint received data of a type it cannot accept. (For example, a text-only endpoint received binary data.)"
|
|
3540
|
-
},
|
|
3541
|
-
1004: {
|
|
3542
|
-
name: "Reserved",
|
|
3543
|
-
message: "Reserved. A meaning might be defined in the future."
|
|
3544
|
-
},
|
|
3545
|
-
1005: {
|
|
3546
|
-
name: "No Status Rcvd",
|
|
3547
|
-
message: "Reserved. Indicates that no status code was provided even though one was expected."
|
|
3548
|
-
},
|
|
3549
|
-
1006: {
|
|
3550
|
-
name: "Abnormal Closure",
|
|
3551
|
-
message: "Reserved. Indicates that a connection was closed abnormally (that is, with no close frame being sent) when a status code is expected."
|
|
3552
|
-
},
|
|
3553
|
-
1007: {
|
|
3554
|
-
name: "Invalid frame payload data",
|
|
3555
|
-
message: "The endpoint is terminating the connection because a message was received that contained inconsistent data (e.g., non-UTF-8 data within a text message)."
|
|
3556
|
-
},
|
|
3557
|
-
1008: {
|
|
3558
|
-
name: "Policy Violation",
|
|
3559
|
-
message: "The endpoint is terminating the connection because it received a message that violates its policy. This is a generic status code, used when codes 1003 and 1009 are not suitable."
|
|
3560
|
-
},
|
|
3561
|
-
1009: {
|
|
3562
|
-
name: "Message Too Big",
|
|
3563
|
-
message: "The endpoint is terminating the connection because a data frame was received that is too large."
|
|
3564
|
-
},
|
|
3565
|
-
1010: {
|
|
3566
|
-
name: "Mandatory Ext.",
|
|
3567
|
-
message: "The client is terminating the connection because it expected the server to negotiate one or more extension, but the server didn't."
|
|
3568
|
-
},
|
|
3569
|
-
1011: {
|
|
3570
|
-
name: "Internal Error",
|
|
3571
|
-
message: "The server is terminating the connection because it encountered an unexpected condition that prevented it from fulfilling the request."
|
|
3572
|
-
},
|
|
3573
|
-
1012: {
|
|
3574
|
-
name: "Service Restart",
|
|
3575
|
-
message: "The server is terminating the connection because it is restarting."
|
|
3576
|
-
},
|
|
3577
|
-
1013: {
|
|
3578
|
-
name: "Try Again Later",
|
|
3579
|
-
message: "The server is terminating the connection due to a temporary condition, e.g. it is overloaded and is casting off some of its clients."
|
|
3580
|
-
},
|
|
3581
|
-
1014: {
|
|
3582
|
-
name: "Bad Gateway",
|
|
3583
|
-
message: "The server was acting as a gateway or proxy and received an invalid response from the upstream server. This is similar to 502 HTTP Status Code."
|
|
3584
|
-
},
|
|
3585
|
-
1015: {
|
|
3586
|
-
name: "TLS handshake",
|
|
3587
|
-
message: "Reserved. Indicates that the connection was closed due to a failure to perform a TLS handshake (e.g., the server certificate can't be verified)."
|
|
3588
|
-
},
|
|
3589
|
-
"1016-2999": {
|
|
3590
|
-
name: "",
|
|
3591
|
-
message: "For definition by future revisions of the WebSocket Protocol specification, and for definition by extension specifications."
|
|
3592
|
-
},
|
|
3593
|
-
"3000-3999": {
|
|
3594
|
-
name: "",
|
|
3595
|
-
message: "For use by libraries, frameworks, and applications. These status codes are registered directly with IANA. The interpretation of these codes is undefined by the WebSocket protocol."
|
|
3596
|
-
},
|
|
3597
|
-
"4000-4999": {
|
|
3598
|
-
name: "",
|
|
3599
|
-
message: "For private use, and thus can't be registered. Such codes can be used by prior agreements between WebSocket applications. The interpretation of these codes is undefined by the WebSocket protocol."
|
|
3600
|
-
}
|
|
3601
|
-
};
|
|
3602
|
-
class m extends le {
|
|
3603
|
-
constructor(t, n) {
|
|
3604
|
-
super(n ?? yt.replace("*code*", t.error.code.toString())), this.code = t.error.code, this.id = t.id, this.jsonrpc = t.jsonrpc, this.jsonRpcError = t.error;
|
|
3605
|
-
}
|
|
3606
|
-
toJSON() {
|
|
3607
|
-
return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
|
|
3608
|
-
}
|
|
3609
|
-
}
|
|
3610
|
-
class dt extends m {
|
|
3611
|
-
constructor(t) {
|
|
3612
|
-
super(t, l[P].message), this.code = P;
|
|
3613
|
-
}
|
|
3614
|
-
}
|
|
3615
|
-
class ct extends m {
|
|
3616
|
-
constructor(t) {
|
|
3617
|
-
super(t, l[O].message), this.code = O;
|
|
3618
|
-
}
|
|
3619
|
-
}
|
|
3620
|
-
class lt extends m {
|
|
3621
|
-
constructor(t) {
|
|
3622
|
-
super(t, l[U].message), this.code = U;
|
|
3623
|
-
}
|
|
3624
|
-
}
|
|
3625
|
-
class mt extends m {
|
|
3626
|
-
constructor(t) {
|
|
3627
|
-
super(t, l[F].message), this.code = F;
|
|
3628
|
-
}
|
|
3629
|
-
}
|
|
3630
|
-
class bt extends m {
|
|
3631
|
-
constructor(t) {
|
|
3632
|
-
super(t, l[B].message), this.code = B;
|
|
3633
|
-
}
|
|
3634
|
-
}
|
|
3635
|
-
class ft extends m {
|
|
3636
|
-
constructor(t) {
|
|
3637
|
-
super(t, l[L].message), this.code = L;
|
|
3638
|
-
}
|
|
3639
|
-
}
|
|
3640
|
-
class Tt extends m {
|
|
3641
|
-
constructor(t) {
|
|
3642
|
-
super(t, l[V].message), this.code = V;
|
|
3643
|
-
}
|
|
3644
|
-
}
|
|
3645
|
-
class ht extends m {
|
|
3646
|
-
constructor(t) {
|
|
3647
|
-
super(t, l[G].message), this.code = G;
|
|
3648
|
-
}
|
|
3649
|
-
}
|
|
3650
|
-
class gt extends m {
|
|
3651
|
-
constructor(t) {
|
|
3652
|
-
super(t, l[k].message), this.code = k;
|
|
3653
|
-
}
|
|
3654
|
-
}
|
|
3655
|
-
class wt extends m {
|
|
3656
|
-
constructor(t) {
|
|
3657
|
-
super(t, l[$].message), this.code = $;
|
|
3658
|
-
}
|
|
3659
|
-
}
|
|
3660
|
-
class Et extends m {
|
|
3661
|
-
constructor(t) {
|
|
3662
|
-
super(t, l[W].message), this.code = W;
|
|
3663
|
-
}
|
|
3664
|
-
}
|
|
3665
|
-
class At extends m {
|
|
3666
|
-
constructor(t) {
|
|
3667
|
-
super(t, l[H].message), this.code = H;
|
|
3668
|
-
}
|
|
3669
|
-
}
|
|
3670
|
-
const b = /* @__PURE__ */ new Map();
|
|
3671
|
-
b.set(P, { error: dt });
|
|
3672
|
-
b.set(O, {
|
|
3673
|
-
error: ct
|
|
3674
|
-
});
|
|
3675
|
-
b.set(U, {
|
|
3676
|
-
error: lt
|
|
3677
|
-
});
|
|
3678
|
-
b.set(F, { error: mt });
|
|
3679
|
-
b.set(B, { error: bt });
|
|
3680
|
-
b.set(L, { error: ft });
|
|
3681
|
-
b.set(V, {
|
|
3682
|
-
error: Tt
|
|
3683
|
-
});
|
|
3684
|
-
b.set(G, {
|
|
3685
|
-
error: ht
|
|
3686
|
-
});
|
|
3687
|
-
b.set(W, {
|
|
3688
|
-
error: Et
|
|
3689
|
-
});
|
|
3690
|
-
b.set(k, {
|
|
3691
|
-
error: gt
|
|
3692
|
-
});
|
|
3693
|
-
b.set($, {
|
|
3694
|
-
error: wt
|
|
3695
|
-
});
|
|
3696
|
-
b.set(H, { error: At });
|
|
3697
|
-
const vt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
|
|
3698
|
-
var J;
|
|
3699
|
-
(function(e) {
|
|
3700
|
-
e.NUMBER = "NUMBER_NUMBER", e.HEX = "NUMBER_HEX", e.STR = "NUMBER_STR", e.BIGINT = "NUMBER_BIGINT";
|
|
3701
|
-
})(J || (J = {}));
|
|
3702
|
-
var Z;
|
|
3703
|
-
(function(e) {
|
|
3704
|
-
e.HEX = "BYTES_HEX", e.UINT8ARRAY = "BYTES_UINT8ARRAY";
|
|
3705
|
-
})(Z || (Z = {}));
|
|
3706
|
-
J.BIGINT, Z.HEX;
|
|
3707
|
-
J.HEX, Z.HEX;
|
|
3708
|
-
var pe;
|
|
3709
|
-
(function(e) {
|
|
3710
|
-
e.EARLIEST = "earliest", e.LATEST = "latest", e.PENDING = "pending", e.SAFE = "safe", e.FINALIZED = "finalized";
|
|
3711
|
-
})(pe || (pe = {}));
|
|
3712
|
-
var ue;
|
|
3713
|
-
(function(e) {
|
|
3714
|
-
e.chainstart = "chainstart", e.frontier = "frontier", e.homestead = "homestead", e.dao = "dao", e.tangerineWhistle = "tangerineWhistle", e.spuriousDragon = "spuriousDragon", e.byzantium = "byzantium", e.constantinople = "constantinople", e.petersburg = "petersburg", e.istanbul = "istanbul", e.muirGlacier = "muirGlacier", e.berlin = "berlin", e.london = "london", e.altair = "altair", e.arrowGlacier = "arrowGlacier", e.grayGlacier = "grayGlacier", e.bellatrix = "bellatrix", e.merge = "merge", e.capella = "capella", e.shanghai = "shanghai";
|
|
3715
|
-
})(ue || (ue = {}));
|
|
3716
|
-
function Rt(e, t) {
|
|
3717
|
-
if (!t)
|
|
3718
|
-
throw new Error("The address for bascule module is not defined");
|
|
3719
|
-
const n = e.createContract(et, t);
|
|
3720
|
-
return n.options.address || (n.options.address = t), n;
|
|
3721
|
-
}
|
|
3722
|
-
const Ct = "No deposit ID provided. Please provide a deposit ID as an argument.", It = "Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";
|
|
3723
|
-
var St = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(St || {});
|
|
3724
|
-
async function Xt({
|
|
3725
|
-
txId: e,
|
|
3726
|
-
env: t,
|
|
3727
|
-
...n
|
|
3728
|
-
}) {
|
|
3729
|
-
if (!e)
|
|
3730
|
-
throw new Error(Ct);
|
|
3731
|
-
if (!vt(e))
|
|
3732
|
-
throw new Error(It);
|
|
3733
|
-
const a = new x(n), r = await w(a, t).methods.Bascule().call();
|
|
3734
|
-
if (r === y)
|
|
3735
|
-
return 1;
|
|
3736
|
-
const o = Rt(a, r);
|
|
3737
|
-
try {
|
|
3738
|
-
const p = await o.methods.depositHistory(Buffer.from(e.replace(/^0x/, ""), "hex")).call();
|
|
3739
|
-
return Number(p);
|
|
3740
|
-
} catch (p) {
|
|
3741
|
-
const u = _(p);
|
|
3742
|
-
throw new Error(u);
|
|
3743
|
-
}
|
|
3744
|
-
}
|
|
3745
|
-
const _t = [
|
|
3746
|
-
s.ethereum,
|
|
3747
|
-
s.base,
|
|
3748
|
-
s.binanceSmartChain
|
|
3749
|
-
], me = (e) => _t.includes(e) ? c.prod : c.stage;
|
|
3750
|
-
function be(e, t) {
|
|
3751
|
-
if (!ce(e))
|
|
3752
|
-
throw new Error(`This chain ${e} is not supported`);
|
|
3753
|
-
const n = t ? { [e]: t } : N;
|
|
3754
|
-
if (!n[e])
|
|
3755
|
-
throw new Error(`RPC URL for chainId ${e} not found`);
|
|
3756
|
-
return n;
|
|
3757
|
-
}
|
|
3758
|
-
async function Yt({
|
|
3759
|
-
chainId: e,
|
|
3760
|
-
bakeGasEstimate: t = 0,
|
|
3761
|
-
rpcUrl: n
|
|
3762
|
-
}) {
|
|
3763
|
-
const a = be(e, n), i = new q({ chainId: e, rpcUrlConfig: a }), r = me(e), p = await w(i, r).methods.getMintFee().call(), u = new C(K(p.toString(10)));
|
|
3764
|
-
return t ? u.plus(K(t)) : u;
|
|
3765
|
-
}
|
|
3766
|
-
async function Qt({
|
|
3767
|
-
env: e,
|
|
3768
|
-
rpcUrl: t,
|
|
3769
|
-
chainId: n
|
|
3770
|
-
}) {
|
|
3771
|
-
const a = { [n]: t }, i = new q({ chainId: n, rpcUrlConfig: a });
|
|
3772
|
-
return (await w(i, e).methods.totalSupply().call()).toString();
|
|
3773
|
-
}
|
|
3774
|
-
async function en({
|
|
3775
|
-
owner: e,
|
|
3776
|
-
rpcUrl: t,
|
|
3777
|
-
chainId: n
|
|
3778
|
-
}) {
|
|
3779
|
-
const a = be(n, t), i = new q({ chainId: n, rpcUrlConfig: a }), r = me(n), o = w(i, r);
|
|
3780
|
-
try {
|
|
3781
|
-
return (await o.methods.nonces(e).call()).toString();
|
|
3782
|
-
} catch (p) {
|
|
3783
|
-
const u = _(p);
|
|
3784
|
-
throw new Error(u);
|
|
3785
|
-
}
|
|
3786
|
-
}
|
|
3787
|
-
const ee = {
|
|
3788
|
-
[s.sepolia]: {
|
|
3789
|
-
[s.berachainBartioTestnet]: "0xe3748bF0Ec0A76767539eE28610B3367e35fe2C2"
|
|
3790
|
-
},
|
|
3791
|
-
[s.berachainBartioTestnet]: {
|
|
3792
|
-
[s.sepolia]: "0x1977013acaf27856ac8048C42EE2ed0134d53895"
|
|
3793
|
-
}
|
|
3794
|
-
}, xt = {
|
|
3795
|
-
...ee
|
|
3796
|
-
}, Dt = {
|
|
3797
|
-
...ee,
|
|
3798
|
-
[s.corn]: {
|
|
3799
|
-
[s.ethereum]: "0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A"
|
|
3800
|
-
},
|
|
3801
|
-
[s.ethereum]: {
|
|
3802
|
-
[s.corn]: "0x6bc15d7930839ec18a57f6f7df72ae1b439d077f",
|
|
3803
|
-
[s.swell]: "0x37E92d760a15231e652a2C502182a6b44c7510c0"
|
|
3804
|
-
},
|
|
3805
|
-
[s.swell]: {
|
|
3806
|
-
[s.ethereum]: "0x7B3784AD646C10A8Ddf42b47a4f4bd9aFD351E54"
|
|
2527
|
+
if (!l.maxFeePerGas && !l.maxPriorityFeePerGas) {
|
|
2528
|
+
const f = await this.getSafeGasPriceWei();
|
|
2529
|
+
l.gasPrice = f.toString(10);
|
|
2530
|
+
}
|
|
2531
|
+
return console.log("Sending transaction via Web3: ", l), new Promise((f, I) => {
|
|
2532
|
+
const k = p.eth.sendTransaction(l);
|
|
2533
|
+
k.once("transactionHash", async (L) => {
|
|
2534
|
+
console.log(`Just signed transaction has is: ${L}`), f({
|
|
2535
|
+
receiptPromise: k,
|
|
2536
|
+
transactionHash: L
|
|
2537
|
+
});
|
|
2538
|
+
}).catch(I);
|
|
2539
|
+
});
|
|
3807
2540
|
}
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
switch (e) {
|
|
3811
|
-
case c.prod:
|
|
3812
|
-
return Dt;
|
|
3813
|
-
case c.testnet:
|
|
3814
|
-
return xt;
|
|
3815
|
-
default:
|
|
3816
|
-
return ee;
|
|
2541
|
+
createContract(n, a) {
|
|
2542
|
+
return new this.web3.eth.Contract(n, a);
|
|
3817
2543
|
}
|
|
3818
2544
|
}
|
|
3819
|
-
async function
|
|
3820
|
-
const t = new
|
|
2545
|
+
async function ze(e) {
|
|
2546
|
+
const t = new F(e), n = `destination chain id is ${e.chainId}`;
|
|
3821
2547
|
return t.signMessage(n);
|
|
3822
2548
|
}
|
|
3823
|
-
const
|
|
3824
|
-
function
|
|
2549
|
+
const Ee = 24 * 60 * 60;
|
|
2550
|
+
function Ie({
|
|
3825
2551
|
chainId: e,
|
|
3826
2552
|
verifyingContract: t,
|
|
3827
2553
|
fee: n,
|
|
@@ -3855,113 +2581,180 @@ function Nt({
|
|
|
3855
2581
|
}
|
|
3856
2582
|
};
|
|
3857
2583
|
}
|
|
3858
|
-
const
|
|
3859
|
-
async function
|
|
2584
|
+
const xe = "Failed to obtain a valid signature. The response is undefined or invalid.", Me = () => Math.floor(Date.now() / 1e3 + Ee);
|
|
2585
|
+
async function qe({
|
|
3860
2586
|
address: e,
|
|
3861
2587
|
provider: t,
|
|
3862
2588
|
fee: n,
|
|
3863
2589
|
chainId: a,
|
|
3864
2590
|
env: i,
|
|
3865
|
-
expiry: r =
|
|
2591
|
+
expiry: r = Me()
|
|
3866
2592
|
}) {
|
|
3867
|
-
var
|
|
3868
|
-
const
|
|
2593
|
+
var y, b;
|
|
2594
|
+
const p = new F({
|
|
3869
2595
|
provider: t,
|
|
3870
2596
|
account: e,
|
|
3871
2597
|
chainId: a
|
|
3872
|
-
}),
|
|
3873
|
-
|
|
2598
|
+
}), m = R(p, i).options.address, c = JSON.stringify(
|
|
2599
|
+
Ie({
|
|
3874
2600
|
chainId: a,
|
|
3875
|
-
verifyingContract:
|
|
2601
|
+
verifyingContract: m,
|
|
3876
2602
|
fee: n,
|
|
3877
2603
|
expiry: r
|
|
3878
2604
|
})
|
|
3879
|
-
),
|
|
2605
|
+
), d = await ((b = (y = p.web3) == null ? void 0 : y.currentProvider) == null ? void 0 : b.request({
|
|
3880
2606
|
method: "eth_signTypedData_v4",
|
|
3881
|
-
params: [e,
|
|
2607
|
+
params: [e, c]
|
|
3882
2608
|
}));
|
|
3883
|
-
if (typeof
|
|
3884
|
-
return { signature:
|
|
3885
|
-
if (!(
|
|
3886
|
-
throw new Error(
|
|
3887
|
-
return { signature:
|
|
3888
|
-
}
|
|
3889
|
-
Ee(we);
|
|
3890
|
-
function Ut(e, t = c.prod) {
|
|
3891
|
-
var r;
|
|
3892
|
-
const n = Ft(e), i = (r = Ae[n]({
|
|
3893
|
-
address: e,
|
|
3894
|
-
network: t === c.prod ? re.bitcoin : re.testnet
|
|
3895
|
-
}).output) == null ? void 0 : r.toString("hex");
|
|
3896
|
-
if (!i)
|
|
3897
|
-
throw new Error("Output script is not found.");
|
|
3898
|
-
return `0x${i}`;
|
|
3899
|
-
}
|
|
3900
|
-
function Ft(e) {
|
|
3901
|
-
const t = ve.fromBech32(e);
|
|
3902
|
-
if (t.version === 1 && t.data.length === 32)
|
|
3903
|
-
return "p2tr";
|
|
3904
|
-
if (t.version === 0 && t.data.length === 20)
|
|
3905
|
-
return "p2wpkh";
|
|
3906
|
-
if (Bt(e))
|
|
3907
|
-
return "p2wsh";
|
|
3908
|
-
throw new Error("Address type is not supported.");
|
|
2609
|
+
if (typeof d == "string")
|
|
2610
|
+
return { signature: d, typedData: c };
|
|
2611
|
+
if (!(d != null && d.result))
|
|
2612
|
+
throw new Error(xe);
|
|
2613
|
+
return { signature: d.result, typedData: c };
|
|
3909
2614
|
}
|
|
3910
|
-
function
|
|
3911
|
-
|
|
2615
|
+
async function Ne({
|
|
2616
|
+
owner: e,
|
|
2617
|
+
rpcUrl: t,
|
|
2618
|
+
chainId: n
|
|
2619
|
+
}) {
|
|
2620
|
+
const a = V(n, t), i = new O({ chainId: n, rpcUrlConfig: a }), r = W(n), p = R(i, r);
|
|
2621
|
+
try {
|
|
2622
|
+
return (await p.methods.nonces(e).call()).toString();
|
|
2623
|
+
} catch (o) {
|
|
2624
|
+
const m = C(o);
|
|
2625
|
+
throw new Error(m);
|
|
2626
|
+
}
|
|
3912
2627
|
}
|
|
3913
|
-
function
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
|
|
3917
|
-
|
|
2628
|
+
async function De({
|
|
2629
|
+
chainId: e,
|
|
2630
|
+
expiry: t,
|
|
2631
|
+
owner: n,
|
|
2632
|
+
spender: a,
|
|
2633
|
+
value: i,
|
|
2634
|
+
rpcUrl: r,
|
|
2635
|
+
verifyingContract: p
|
|
3918
2636
|
}) {
|
|
3919
|
-
const
|
|
3920
|
-
|
|
3921
|
-
|
|
3922
|
-
r
|
|
3923
|
-
|
|
3924
|
-
|
|
3925
|
-
|
|
3926
|
-
|
|
3927
|
-
|
|
2637
|
+
const o = await Ne({
|
|
2638
|
+
owner: n,
|
|
2639
|
+
chainId: e,
|
|
2640
|
+
rpcUrl: r
|
|
2641
|
+
});
|
|
2642
|
+
return {
|
|
2643
|
+
domain: {
|
|
2644
|
+
name: "Lombard Staked Bitcoin",
|
|
2645
|
+
version: "1",
|
|
2646
|
+
chainId: e,
|
|
2647
|
+
verifyingContract: p
|
|
2648
|
+
},
|
|
2649
|
+
types: {
|
|
2650
|
+
EIP712Domain: [
|
|
2651
|
+
{
|
|
2652
|
+
name: "name",
|
|
2653
|
+
type: "string"
|
|
2654
|
+
},
|
|
2655
|
+
{
|
|
2656
|
+
name: "version",
|
|
2657
|
+
type: "string"
|
|
2658
|
+
},
|
|
2659
|
+
{
|
|
2660
|
+
name: "chainId",
|
|
2661
|
+
type: "uint256"
|
|
2662
|
+
},
|
|
2663
|
+
{
|
|
2664
|
+
name: "verifyingContract",
|
|
2665
|
+
type: "address"
|
|
2666
|
+
}
|
|
2667
|
+
],
|
|
2668
|
+
Permit: [
|
|
2669
|
+
{ name: "owner", type: "address" },
|
|
2670
|
+
{ name: "spender", type: "address" },
|
|
2671
|
+
{ name: "value", type: "uint256" },
|
|
2672
|
+
{ name: "nonce", type: "uint256" },
|
|
2673
|
+
{ name: "deadline", type: "uint256" }
|
|
2674
|
+
]
|
|
2675
|
+
},
|
|
2676
|
+
primaryType: "Permit",
|
|
2677
|
+
message: {
|
|
2678
|
+
owner: n,
|
|
2679
|
+
spender: a,
|
|
2680
|
+
value: i,
|
|
2681
|
+
nonce: o,
|
|
2682
|
+
deadline: t.toString()
|
|
3928
2683
|
}
|
|
3929
|
-
|
|
2684
|
+
};
|
|
2685
|
+
}
|
|
2686
|
+
const Pe = "Failed to obtain a valid signature. The response is undefined or invalid.";
|
|
2687
|
+
async function je({
|
|
2688
|
+
address: e,
|
|
2689
|
+
provider: t,
|
|
2690
|
+
chainId: n,
|
|
2691
|
+
value: a,
|
|
2692
|
+
expiry: i,
|
|
2693
|
+
rpcUrl: r,
|
|
2694
|
+
spender: p,
|
|
2695
|
+
verifyingContract: o
|
|
2696
|
+
}) {
|
|
2697
|
+
var b, _;
|
|
2698
|
+
const m = new F({
|
|
2699
|
+
provider: t,
|
|
2700
|
+
account: e,
|
|
2701
|
+
chainId: n
|
|
2702
|
+
}), c = await De({
|
|
2703
|
+
chainId: n,
|
|
2704
|
+
expiry: i,
|
|
2705
|
+
owner: e,
|
|
2706
|
+
spender: p,
|
|
2707
|
+
value: a,
|
|
2708
|
+
rpcUrl: r,
|
|
2709
|
+
verifyingContract: o
|
|
2710
|
+
}), d = JSON.stringify(c), y = await ((_ = (b = m.web3) == null ? void 0 : b.currentProvider) == null ? void 0 : _.request({
|
|
2711
|
+
method: "eth_signTypedData_v4",
|
|
2712
|
+
params: [e, d]
|
|
2713
|
+
}));
|
|
2714
|
+
if (typeof y == "string")
|
|
2715
|
+
return { signature: y, typedData: d };
|
|
2716
|
+
if (!(y != null && y.result))
|
|
2717
|
+
throw new Error(Pe);
|
|
2718
|
+
return { signature: y.result, typedData: d };
|
|
3930
2719
|
}
|
|
2720
|
+
const Oe = {
|
|
2721
|
+
[s.holesky]: "0x52BD640617eeD47A00dA0da93351092D49208d1d"
|
|
2722
|
+
}, Je = (e) => {
|
|
2723
|
+
const t = Oe[e];
|
|
2724
|
+
if (!t)
|
|
2725
|
+
throw new Error(`No spender address configured for chain ID ${e}`);
|
|
2726
|
+
return t;
|
|
2727
|
+
};
|
|
3931
2728
|
export {
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
Ve as ESessionState,
|
|
2729
|
+
de as ENotarizationStatus,
|
|
2730
|
+
le as ESessionState,
|
|
3935
2731
|
s as OChainId,
|
|
3936
|
-
|
|
3937
|
-
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
3946
|
-
|
|
3947
|
-
|
|
3948
|
-
|
|
3949
|
-
|
|
3950
|
-
|
|
3951
|
-
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
|
|
3955
|
-
|
|
3956
|
-
|
|
3957
|
-
|
|
3958
|
-
|
|
3959
|
-
|
|
3960
|
-
|
|
3961
|
-
|
|
3962
|
-
|
|
3963
|
-
qt as storeNetworkFeeSignature,
|
|
3964
|
-
de as toSatoshi,
|
|
3965
|
-
sn as unstakeLBTC
|
|
2732
|
+
T as OEnv,
|
|
2733
|
+
ne as SANCTIONED_ADDRESS,
|
|
2734
|
+
P as SATOSHI_SCALE,
|
|
2735
|
+
Oe as STAKE_AND_BAKE_SPENDER_ADDRESSES,
|
|
2736
|
+
M as fromSatoshi,
|
|
2737
|
+
ke as generateDepositBtcAddress,
|
|
2738
|
+
w as getApiConfig,
|
|
2739
|
+
J as getBaseNetworkByEnv,
|
|
2740
|
+
j as getBscNetworkByEnv,
|
|
2741
|
+
ye as getChainIdByName,
|
|
2742
|
+
D as getChainNameById,
|
|
2743
|
+
Le as getDepositBtcAddress,
|
|
2744
|
+
oe as getDepositBtcAddresses,
|
|
2745
|
+
He as getDepositsByAddress,
|
|
2746
|
+
q as getEthNetworkByEnv,
|
|
2747
|
+
We as getLBTCExchangeRate,
|
|
2748
|
+
Ke as getLBTCMintingFee,
|
|
2749
|
+
$e as getNetworkFeeSignature,
|
|
2750
|
+
Je as getStakeAndBakeSpenderAddress,
|
|
2751
|
+
De as getStakeAndBakeTypedData,
|
|
2752
|
+
$ as isValidChain,
|
|
2753
|
+
ze as signLbtcDestionationAddr,
|
|
2754
|
+
qe as signNetworkFee,
|
|
2755
|
+
je as signStakeAndBake,
|
|
2756
|
+
Ve as storeNetworkFeeSignature,
|
|
2757
|
+
Ze as storeStakeAndBakeSignature,
|
|
2758
|
+
Ge as toSatoshi
|
|
3966
2759
|
};
|
|
3967
2760
|
//# sourceMappingURL=index.js.map
|