@lombard.finance/sdk 2.0.12 → 2.0.15
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 +289 -284
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sdk/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.stories.tsx +34 -5
- package/src/sdk/getUserStakeAndBakeSignature/getUserStakeAndBakeSignature.ts +10 -2
- package/src/sdk/storeStakeAndBakeSignature/storeStakeAndBakeSignature.stories.tsx +50 -43
- package/src/web3Sdk/getLBTCMintingFee/getLBTCMintingFee.stories.tsx +0 -5
- package/src/web3Sdk/getLBTCMintingFee/getLBTCMintingFee.tsx +1 -11
- package/src/web3Sdk/signStakeAndBake/config.ts +2 -2
- package/src/web3Sdk/signStakeAndBake/contracts.ts +11 -11
- package/src/web3Sdk/signStakeAndBake/index.ts +1 -0
- package/src/web3Sdk/signStakeAndBake/signStakeAndBake.stories.tsx +8 -24
- package/src/web3Sdk/signStakeAndBake/signStakeAndBake.ts +3 -5
- package/src/web3Sdk/signStakeAndBake/utils.ts +16 -0
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
1
|
+
var fe = Object.defineProperty;
|
|
2
|
+
var Te = (e, t, n) => t in e ? fe(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var S = (e, t, n) => (Te(e, typeof t != "symbol" ? t + "" : t, n), n);
|
|
4
4
|
import E from "axios";
|
|
5
|
-
import
|
|
5
|
+
import I from "bignumber.js";
|
|
6
6
|
import pe, { Web3 as se, utils as R } from "web3";
|
|
7
|
-
const
|
|
7
|
+
const h = {
|
|
8
8
|
prod: "prod",
|
|
9
9
|
testnet: "testnet",
|
|
10
10
|
stage: "stage"
|
|
@@ -19,35 +19,35 @@ const g = {
|
|
|
19
19
|
berachainBartioTestnet: 80084,
|
|
20
20
|
corn: 21e6,
|
|
21
21
|
swell: 1923
|
|
22
|
-
},
|
|
22
|
+
}, he = (e) => e === h.prod ? i.ethereum : i.holesky, ge = (e) => e === h.prod ? i.binanceSmartChain : i.binanceSmartChainTestnet, we = (e) => e === h.prod ? i.base : i.baseTestnet, z = h.prod, u = "0x0000000000000000000000000000000000000000", Ee = {
|
|
23
23
|
baseApiUrl: "https://staging.prod.lombard.finance"
|
|
24
|
-
},
|
|
24
|
+
}, Ae = {
|
|
25
25
|
baseApiUrl: "https://gastald-testnet.prod.lombard.finance"
|
|
26
|
-
},
|
|
26
|
+
}, ve = {
|
|
27
27
|
baseApiUrl: "https://mainnet.prod.lombard.finance"
|
|
28
|
-
},
|
|
28
|
+
}, A = (e = z) => {
|
|
29
29
|
switch (e) {
|
|
30
|
-
case
|
|
31
|
-
return
|
|
32
|
-
case
|
|
33
|
-
return
|
|
30
|
+
case h.prod:
|
|
31
|
+
return ve;
|
|
32
|
+
case h.testnet:
|
|
33
|
+
return Ae;
|
|
34
34
|
default:
|
|
35
|
-
return
|
|
35
|
+
return Ee;
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
|
-
function
|
|
38
|
+
function v(e) {
|
|
39
39
|
return typeof e == "string" ? e : ((n) => {
|
|
40
40
|
var a;
|
|
41
41
|
return ((a = n == null ? void 0 : n.data) == null ? void 0 : a.message) && typeof n.data.message == "string";
|
|
42
|
-
})(e) ? e.data.message : e instanceof Error ?
|
|
42
|
+
})(e) ? e.data.message : e instanceof Error ? Re(e) : Se(e);
|
|
43
43
|
}
|
|
44
|
-
function
|
|
44
|
+
function Re(e) {
|
|
45
45
|
return e.response ? e.response.data.message : e.message;
|
|
46
46
|
}
|
|
47
|
-
function
|
|
47
|
+
function Se(e) {
|
|
48
48
|
return e != null && e.message ? e.message : "Unknown error";
|
|
49
49
|
}
|
|
50
|
-
const
|
|
50
|
+
const _ = {
|
|
51
51
|
eth: "DESTINATION_BLOCKCHAIN_ETHEREUM",
|
|
52
52
|
base: "DESTINATION_BLOCKCHAIN_BASE",
|
|
53
53
|
bsc: "DESTINATION_BLOCKCHAIN_BSC",
|
|
@@ -57,24 +57,24 @@ const S = {
|
|
|
57
57
|
scroll: "DESTINATION_BLOCKCHAIN_SCROLL",
|
|
58
58
|
xlayer: "DESTINATION_BLOCKCHAIN_XLAYER"
|
|
59
59
|
};
|
|
60
|
-
function
|
|
60
|
+
function K(e) {
|
|
61
61
|
switch (e) {
|
|
62
62
|
case i.ethereum:
|
|
63
63
|
case i.holesky:
|
|
64
64
|
case i.sepolia:
|
|
65
|
-
return
|
|
65
|
+
return _.eth;
|
|
66
66
|
case i.base:
|
|
67
67
|
case i.baseTestnet:
|
|
68
|
-
return
|
|
68
|
+
return _.base;
|
|
69
69
|
case i.binanceSmartChain:
|
|
70
70
|
case i.binanceSmartChainTestnet:
|
|
71
|
-
return
|
|
71
|
+
return _.bsc;
|
|
72
72
|
default:
|
|
73
73
|
throw new Error(`Unknown chain ID: ${e}`);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
|
-
const
|
|
77
|
-
async function
|
|
76
|
+
const _e = "sanctioned_address", Ie = "api/v1/address/generate", Ce = "destination address is under sanctions";
|
|
77
|
+
async function Ut({
|
|
78
78
|
address: e,
|
|
79
79
|
chainId: t,
|
|
80
80
|
signature: n,
|
|
@@ -84,10 +84,10 @@ async function Ot({
|
|
|
84
84
|
partnerId: o,
|
|
85
85
|
captchaToken: p
|
|
86
86
|
}) {
|
|
87
|
-
const { baseApiUrl:
|
|
87
|
+
const { baseApiUrl: d } = A(s), g = K(t), c = {
|
|
88
88
|
to_address: e,
|
|
89
89
|
to_address_signature: n,
|
|
90
|
-
to_chain:
|
|
90
|
+
to_chain: g,
|
|
91
91
|
partner_id: o,
|
|
92
92
|
nonce: 0,
|
|
93
93
|
captcha: p,
|
|
@@ -95,103 +95,103 @@ async function Ot({
|
|
|
95
95
|
eip_712_data: a
|
|
96
96
|
};
|
|
97
97
|
try {
|
|
98
|
-
const { data:
|
|
98
|
+
const { data: y } = await E.post(
|
|
99
99
|
Ie,
|
|
100
100
|
c,
|
|
101
|
-
{ baseURL:
|
|
101
|
+
{ baseURL: d }
|
|
102
102
|
);
|
|
103
|
-
return
|
|
104
|
-
} catch (
|
|
105
|
-
const
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
throw new Error(
|
|
103
|
+
return y.address;
|
|
104
|
+
} catch (y) {
|
|
105
|
+
const T = v(y);
|
|
106
|
+
if (De(T))
|
|
107
|
+
return _e;
|
|
108
|
+
throw new Error(T);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
return !!e.includes(
|
|
111
|
+
function De(e) {
|
|
112
|
+
return !!e.includes(Ce);
|
|
113
113
|
}
|
|
114
|
-
const
|
|
115
|
-
async function
|
|
114
|
+
const xe = "api/v1/address";
|
|
115
|
+
async function Ft({
|
|
116
116
|
address: e,
|
|
117
117
|
chainId: t,
|
|
118
118
|
env: n,
|
|
119
119
|
partnerId: a
|
|
120
120
|
}) {
|
|
121
|
-
const s = await
|
|
121
|
+
const s = await Me({
|
|
122
122
|
address: e,
|
|
123
123
|
chainId: t,
|
|
124
124
|
env: n,
|
|
125
125
|
partnerId: a
|
|
126
|
-
}), r =
|
|
126
|
+
}), r = Ne(s);
|
|
127
127
|
if (!r)
|
|
128
128
|
throw new Error("No address");
|
|
129
129
|
return r.btc_address;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Ne(e) {
|
|
132
132
|
if (!e.length)
|
|
133
133
|
return;
|
|
134
134
|
const t = e.reduce((n, a) => n.created_at < a.created_at ? a : n, e[0]);
|
|
135
135
|
return t.deprecated ? void 0 : t;
|
|
136
136
|
}
|
|
137
|
-
async function
|
|
137
|
+
async function Me({
|
|
138
138
|
address: e,
|
|
139
139
|
chainId: t,
|
|
140
140
|
env: n,
|
|
141
141
|
partnerId: a
|
|
142
142
|
}) {
|
|
143
|
-
const { baseApiUrl: s } =
|
|
143
|
+
const { baseApiUrl: s } = A(n), r = K(t), o = {
|
|
144
144
|
to_address: e,
|
|
145
145
|
to_blockchain: r,
|
|
146
146
|
limit: 1,
|
|
147
147
|
offset: 0,
|
|
148
148
|
asc: !1,
|
|
149
149
|
referralId: a
|
|
150
|
-
}, { data: p } = await E.get(
|
|
150
|
+
}, { data: p } = await E.get(xe, {
|
|
151
151
|
baseURL: s,
|
|
152
152
|
params: o
|
|
153
153
|
});
|
|
154
154
|
return (p == null ? void 0 : p.addresses) || [];
|
|
155
155
|
}
|
|
156
|
-
const
|
|
157
|
-
function
|
|
158
|
-
return +e /
|
|
156
|
+
const Pe = 8, X = 10 ** Pe;
|
|
157
|
+
function ue(e) {
|
|
158
|
+
return +e / X;
|
|
159
159
|
}
|
|
160
|
-
function
|
|
161
|
-
return Math.floor(+e *
|
|
160
|
+
function Bt(e) {
|
|
161
|
+
return Math.floor(+e * X);
|
|
162
162
|
}
|
|
163
|
-
function
|
|
163
|
+
function Oe(e, t = z) {
|
|
164
164
|
switch (e) {
|
|
165
|
-
case
|
|
166
|
-
return Te(t);
|
|
167
|
-
case S.base:
|
|
165
|
+
case _.eth:
|
|
168
166
|
return he(t);
|
|
169
|
-
case
|
|
170
|
-
return
|
|
167
|
+
case _.base:
|
|
168
|
+
return we(t);
|
|
169
|
+
case _.bsc:
|
|
170
|
+
return ge(t);
|
|
171
171
|
default:
|
|
172
172
|
return i.ethereum;
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
|
-
var
|
|
176
|
-
async function
|
|
175
|
+
var Ue = /* @__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))(Ue || {}), Fe = /* @__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))(Fe || {});
|
|
176
|
+
async function Lt({
|
|
177
177
|
address: e,
|
|
178
178
|
env: t
|
|
179
179
|
}) {
|
|
180
|
-
const { baseApiUrl: n } =
|
|
180
|
+
const { baseApiUrl: n } = A(t), { data: a } = await E.get(
|
|
181
181
|
`api/v1/address/outputs-v2/${e}`,
|
|
182
182
|
{ baseURL: n }
|
|
183
183
|
);
|
|
184
|
-
return ((a == null ? void 0 : a.outputs) ?? []).map(
|
|
184
|
+
return ((a == null ? void 0 : a.outputs) ?? []).map(Be(t));
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function Be(e) {
|
|
187
187
|
return (t) => ({
|
|
188
188
|
txid: t.txid,
|
|
189
189
|
index: t.index ?? 0,
|
|
190
190
|
blockHeight: t.block_height ? Number(t.block_height) : void 0,
|
|
191
191
|
blockTime: t.block_time ? Number(t.block_time) : void 0,
|
|
192
|
-
value: new
|
|
192
|
+
value: new I(ue(t.value)),
|
|
193
193
|
address: t.address,
|
|
194
|
-
chainId:
|
|
194
|
+
chainId: Oe(t.to_chain, e),
|
|
195
195
|
claimedTxId: t.claim_tx,
|
|
196
196
|
rawPayload: t.raw_payload,
|
|
197
197
|
signature: t.proof,
|
|
@@ -203,24 +203,24 @@ function Ue(e) {
|
|
|
203
203
|
sessionState: t.session_state
|
|
204
204
|
});
|
|
205
205
|
}
|
|
206
|
-
const
|
|
207
|
-
async function
|
|
206
|
+
const Le = 2e-4;
|
|
207
|
+
async function kt({
|
|
208
208
|
env: e,
|
|
209
209
|
chainId: t = i.ethereum,
|
|
210
210
|
amount: n = 1
|
|
211
211
|
}) {
|
|
212
|
-
const { baseApiUrl: a } =
|
|
212
|
+
const { baseApiUrl: a } = A(e), s = K(t), { data: r } = await E.get(
|
|
213
213
|
`api/v1/exchange/rate/${s}`,
|
|
214
214
|
{ baseURL: a, params: { amount: n } }
|
|
215
|
-
), o = new
|
|
215
|
+
), o = new I(Le).multipliedBy(X).toFixed();
|
|
216
216
|
return { exchangeRate: +r.amount_out, minAmount: +o };
|
|
217
217
|
}
|
|
218
|
-
async function
|
|
218
|
+
async function Gt({
|
|
219
219
|
address: e,
|
|
220
220
|
chainId: t,
|
|
221
221
|
env: n
|
|
222
222
|
}) {
|
|
223
|
-
const { baseApiUrl: a } =
|
|
223
|
+
const { baseApiUrl: a } = A(n);
|
|
224
224
|
try {
|
|
225
225
|
const { data: s } = await E.get(
|
|
226
226
|
`${a}/api/v1/claimer/get-user-signature`,
|
|
@@ -237,16 +237,16 @@ async function kt({
|
|
|
237
237
|
isDelayed: s == null ? void 0 : s.is_delayed
|
|
238
238
|
};
|
|
239
239
|
} catch (s) {
|
|
240
|
-
const r =
|
|
240
|
+
const r = v(s);
|
|
241
241
|
throw new Error(r);
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
|
-
async function
|
|
244
|
+
async function Wt({
|
|
245
245
|
userDestinationAddress: e,
|
|
246
246
|
chainId: t,
|
|
247
247
|
env: n
|
|
248
248
|
}) {
|
|
249
|
-
const { baseApiUrl: a } =
|
|
249
|
+
const { baseApiUrl: a } = A(n);
|
|
250
250
|
try {
|
|
251
251
|
const { data: s } = await E.get(
|
|
252
252
|
`${a}/api/v1/claimer/get-user-stake-and-bake-signature`,
|
|
@@ -259,19 +259,19 @@ async function Gt({
|
|
|
259
259
|
);
|
|
260
260
|
return s;
|
|
261
261
|
} catch (s) {
|
|
262
|
-
const r =
|
|
262
|
+
const r = v(s);
|
|
263
263
|
throw new Error(
|
|
264
264
|
`Failed to get user stake and bake signature: ${r}`
|
|
265
265
|
);
|
|
266
266
|
}
|
|
267
267
|
}
|
|
268
|
-
async function
|
|
268
|
+
async function Vt({
|
|
269
269
|
signature: e,
|
|
270
270
|
typedData: t,
|
|
271
271
|
address: n,
|
|
272
272
|
env: a
|
|
273
273
|
}) {
|
|
274
|
-
const { baseApiUrl: s } =
|
|
274
|
+
const { baseApiUrl: s } = A(a);
|
|
275
275
|
try {
|
|
276
276
|
const { data: r } = await E.post(
|
|
277
277
|
`${s}/api/v1/claimer/save-user-signature`,
|
|
@@ -286,16 +286,16 @@ async function Wt({
|
|
|
286
286
|
);
|
|
287
287
|
return r.status;
|
|
288
288
|
} catch (r) {
|
|
289
|
-
const o =
|
|
289
|
+
const o = v(r);
|
|
290
290
|
throw new Error(o);
|
|
291
291
|
}
|
|
292
292
|
}
|
|
293
|
-
async function
|
|
293
|
+
async function $t({
|
|
294
294
|
signature: e,
|
|
295
295
|
typedData: t,
|
|
296
296
|
env: n
|
|
297
297
|
}) {
|
|
298
|
-
const { baseApiUrl: a } =
|
|
298
|
+
const { baseApiUrl: a } = A(n);
|
|
299
299
|
try {
|
|
300
300
|
const { data: s } = await E.post(
|
|
301
301
|
`${a}/api/v1/claimer/save-stake-and-bake-signature`,
|
|
@@ -309,7 +309,7 @@ async function Vt({
|
|
|
309
309
|
);
|
|
310
310
|
return s.status;
|
|
311
311
|
} catch (s) {
|
|
312
|
-
const r =
|
|
312
|
+
const r = v(s);
|
|
313
313
|
throw new Error(r);
|
|
314
314
|
}
|
|
315
315
|
}
|
|
@@ -322,7 +322,7 @@ const P = {
|
|
|
322
322
|
[i.binanceSmartChain]: "https://rpc.ankr.com/bsc",
|
|
323
323
|
[i.binanceSmartChainTestnet]: "https://rpc.ankr.com/bsc_testnet_chapel"
|
|
324
324
|
};
|
|
325
|
-
async function
|
|
325
|
+
async function ke(e) {
|
|
326
326
|
const n = await (await fetch(e, {
|
|
327
327
|
method: "POST",
|
|
328
328
|
headers: {
|
|
@@ -335,13 +335,13 @@ async function Be(e) {
|
|
|
335
335
|
params: []
|
|
336
336
|
})
|
|
337
337
|
})).json(), a = pe.utils.hexToNumber(n == null ? void 0 : n.result);
|
|
338
|
-
return new
|
|
338
|
+
return new I(Number(a));
|
|
339
339
|
}
|
|
340
|
-
const
|
|
341
|
-
class
|
|
340
|
+
const Ge = 2, We = 25e3;
|
|
341
|
+
class Y {
|
|
342
342
|
constructor({ chainId: t, rpcUrlConfig: n }) {
|
|
343
|
-
|
|
344
|
-
|
|
343
|
+
S(this, "chainId");
|
|
344
|
+
S(this, "rpcConfig");
|
|
345
345
|
this.chainId = t, this.rpcConfig = { ...P, ...n };
|
|
346
346
|
}
|
|
347
347
|
/**
|
|
@@ -379,10 +379,10 @@ class Q {
|
|
|
379
379
|
async getMaxFees() {
|
|
380
380
|
const t = this.getReadWeb3(), n = this.getRpcUrl(), [a, s] = await Promise.all([
|
|
381
381
|
t.eth.getBlock("latest"),
|
|
382
|
-
|
|
382
|
+
ke(n)
|
|
383
383
|
]);
|
|
384
384
|
return !(a != null && a.baseFeePerGas) && typeof (a == null ? void 0 : a.baseFeePerGas) != "bigint" ? {} : {
|
|
385
|
-
maxFeePerGas: +new
|
|
385
|
+
maxFeePerGas: +new I(a.baseFeePerGas.toString(10)).multipliedBy(Ge).plus(s),
|
|
386
386
|
maxPriorityFeePerGas: +s
|
|
387
387
|
};
|
|
388
388
|
}
|
|
@@ -394,8 +394,8 @@ class Q {
|
|
|
394
394
|
*/
|
|
395
395
|
async getSafeGasPriceWei() {
|
|
396
396
|
const t = await this.getReadWeb3().eth.getGasPrice();
|
|
397
|
-
return new
|
|
398
|
-
|
|
397
|
+
return new I(t.toString(10)).plus(
|
|
398
|
+
We
|
|
399
399
|
);
|
|
400
400
|
}
|
|
401
401
|
/**
|
|
@@ -411,12 +411,12 @@ class Q {
|
|
|
411
411
|
return new a.eth.Contract(t, n);
|
|
412
412
|
}
|
|
413
413
|
}
|
|
414
|
-
class C extends
|
|
414
|
+
class C extends Y {
|
|
415
415
|
constructor({ provider: n, account: a, chainId: s, rpcUrlConfig: r }) {
|
|
416
416
|
super({ chainId: s, rpcUrlConfig: r });
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
417
|
+
S(this, "web3");
|
|
418
|
+
S(this, "account");
|
|
419
|
+
S(this, "rpcConfig", P);
|
|
420
420
|
this.web3 = new pe(n), this.account = a, this.chainId = s, this.rpcConfig = { ...P, ...r };
|
|
421
421
|
}
|
|
422
422
|
/**
|
|
@@ -443,13 +443,13 @@ class C extends Q {
|
|
|
443
443
|
*/
|
|
444
444
|
async sendTransactionAsync(n, a, s) {
|
|
445
445
|
const { chainId: r, web3: o } = this, p = this.getReadWeb3(), {
|
|
446
|
-
data:
|
|
447
|
-
estimate:
|
|
446
|
+
data: d,
|
|
447
|
+
estimate: g = !1,
|
|
448
448
|
estimateFee: c = !1,
|
|
449
|
-
extendedGasLimit:
|
|
450
|
-
gasLimit:
|
|
449
|
+
extendedGasLimit: y,
|
|
450
|
+
gasLimit: T = "0",
|
|
451
451
|
value: x = "0",
|
|
452
|
-
gasLimitMultiplier:
|
|
452
|
+
gasLimitMultiplier: be = 1
|
|
453
453
|
} = s;
|
|
454
454
|
let { nonce: N } = s;
|
|
455
455
|
N || (N = await p.eth.getTransactionCount(n)), console.log(`Nonce: ${N}`);
|
|
@@ -457,23 +457,23 @@ class C extends Q {
|
|
|
457
457
|
from: n,
|
|
458
458
|
to: a,
|
|
459
459
|
value: R.numberToHex(x),
|
|
460
|
-
data:
|
|
460
|
+
data: d,
|
|
461
461
|
nonce: N,
|
|
462
462
|
chainId: R.numberToHex(r)
|
|
463
463
|
};
|
|
464
|
-
if (
|
|
464
|
+
if (g)
|
|
465
465
|
try {
|
|
466
466
|
const w = await p.eth.estimateGas(l), M = Math.round(
|
|
467
|
-
Number(w) *
|
|
467
|
+
Number(w) * be
|
|
468
468
|
);
|
|
469
|
-
|
|
469
|
+
y ? l.gas = R.numberToHex(M + y) : l.gas = R.numberToHex(M);
|
|
470
470
|
} catch (w) {
|
|
471
471
|
throw new Error(
|
|
472
472
|
w.message ?? "Failed to estimate gas limit for transaction."
|
|
473
473
|
);
|
|
474
474
|
}
|
|
475
475
|
else
|
|
476
|
-
l.gas = R.numberToHex(
|
|
476
|
+
l.gas = R.numberToHex(T);
|
|
477
477
|
const { maxFeePerGas: ee, maxPriorityFeePerGas: te } = c ? await this.getMaxFees().catch(() => s) : s;
|
|
478
478
|
if (te !== void 0 && (l.maxPriorityFeePerGas = R.numberToHex(te)), ee !== void 0 && (l.maxFeePerGas = R.numberToHex(ee)), !l.maxFeePerGas && !l.maxPriorityFeePerGas) {
|
|
479
479
|
const w = await this.getSafeGasPriceWei();
|
|
@@ -497,7 +497,7 @@ class C extends Q {
|
|
|
497
497
|
return new this.web3.eth.Contract(n, a);
|
|
498
498
|
}
|
|
499
499
|
}
|
|
500
|
-
function
|
|
500
|
+
function Ve(e) {
|
|
501
501
|
switch (e) {
|
|
502
502
|
case i.ethereum:
|
|
503
503
|
return 1.3;
|
|
@@ -508,52 +508,52 @@ function Ge(e) {
|
|
|
508
508
|
return 1.3;
|
|
509
509
|
}
|
|
510
510
|
}
|
|
511
|
-
function
|
|
511
|
+
function ye(e) {
|
|
512
512
|
return Object.values(i).includes(e);
|
|
513
513
|
}
|
|
514
|
-
const
|
|
514
|
+
const $e = {
|
|
515
515
|
[i.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
|
|
516
|
-
[i.ethereum]:
|
|
516
|
+
[i.ethereum]: u,
|
|
517
517
|
[i.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
|
|
518
|
-
[i.binanceSmartChain]:
|
|
518
|
+
[i.binanceSmartChain]: u,
|
|
519
519
|
[i.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
|
|
520
|
-
[i.base]:
|
|
520
|
+
[i.base]: u,
|
|
521
521
|
// TODO: Add baseTestnet address
|
|
522
|
-
[i.baseTestnet]:
|
|
522
|
+
[i.baseTestnet]: u,
|
|
523
523
|
[i.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
|
|
524
|
-
[i.corn]:
|
|
525
|
-
[i.swell]:
|
|
526
|
-
},
|
|
524
|
+
[i.corn]: u,
|
|
525
|
+
[i.swell]: u
|
|
526
|
+
}, He = {
|
|
527
527
|
[i.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
|
|
528
|
-
[i.ethereum]:
|
|
528
|
+
[i.ethereum]: u,
|
|
529
529
|
[i.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
|
|
530
|
-
[i.binanceSmartChain]:
|
|
530
|
+
[i.binanceSmartChain]: u,
|
|
531
531
|
[i.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
|
|
532
|
-
[i.base]:
|
|
533
|
-
[i.baseTestnet]:
|
|
532
|
+
[i.base]: u,
|
|
533
|
+
[i.baseTestnet]: u,
|
|
534
534
|
[i.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
|
|
535
|
-
[i.corn]:
|
|
536
|
-
[i.swell]:
|
|
537
|
-
},
|
|
535
|
+
[i.corn]: u,
|
|
536
|
+
[i.swell]: u
|
|
537
|
+
}, je = {
|
|
538
538
|
[i.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
|
|
539
|
-
[i.holesky]:
|
|
540
|
-
[i.sepolia]:
|
|
541
|
-
[i.binanceSmartChainTestnet]:
|
|
539
|
+
[i.holesky]: u,
|
|
540
|
+
[i.sepolia]: u,
|
|
541
|
+
[i.binanceSmartChainTestnet]: u,
|
|
542
542
|
[i.binanceSmartChain]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
543
543
|
[i.base]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
544
|
-
[i.baseTestnet]:
|
|
545
|
-
[i.berachainBartioTestnet]:
|
|
544
|
+
[i.baseTestnet]: u,
|
|
545
|
+
[i.berachainBartioTestnet]: u,
|
|
546
546
|
[i.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
|
|
547
547
|
[i.swell]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
|
|
548
548
|
};
|
|
549
|
-
function
|
|
549
|
+
function de(e = z) {
|
|
550
550
|
switch (e) {
|
|
551
|
-
case
|
|
552
|
-
return
|
|
553
|
-
case
|
|
554
|
-
return
|
|
551
|
+
case h.prod:
|
|
552
|
+
return je;
|
|
553
|
+
case h.testnet:
|
|
554
|
+
return He;
|
|
555
555
|
default:
|
|
556
|
-
return
|
|
556
|
+
return $e;
|
|
557
557
|
}
|
|
558
558
|
}
|
|
559
559
|
const Je = [
|
|
@@ -777,7 +777,7 @@ const Je = [
|
|
|
777
777
|
name: "Transfer",
|
|
778
778
|
type: "event"
|
|
779
779
|
}
|
|
780
|
-
],
|
|
780
|
+
], qe = [
|
|
781
781
|
{
|
|
782
782
|
inputs: [],
|
|
783
783
|
stateMutability: "nonpayable",
|
|
@@ -2537,7 +2537,7 @@ const Je = [
|
|
|
2537
2537
|
stateMutability: "nonpayable",
|
|
2538
2538
|
type: "function"
|
|
2539
2539
|
}
|
|
2540
|
-
],
|
|
2540
|
+
], Ze = [
|
|
2541
2541
|
{
|
|
2542
2542
|
inputs: [
|
|
2543
2543
|
{
|
|
@@ -3387,26 +3387,26 @@ const Je = [
|
|
|
3387
3387
|
type: "function"
|
|
3388
3388
|
}
|
|
3389
3389
|
];
|
|
3390
|
-
function
|
|
3390
|
+
function ze(e) {
|
|
3391
3391
|
switch (e) {
|
|
3392
3392
|
case "LBTC":
|
|
3393
|
-
return
|
|
3393
|
+
return qe;
|
|
3394
3394
|
default:
|
|
3395
3395
|
return Je;
|
|
3396
3396
|
}
|
|
3397
3397
|
}
|
|
3398
3398
|
function D(e, t) {
|
|
3399
|
-
const n =
|
|
3400
|
-
if (!
|
|
3399
|
+
const n = de(t), { chainId: a } = e;
|
|
3400
|
+
if (!ye(a))
|
|
3401
3401
|
throw new Error(`This chain ${a} is not supported`);
|
|
3402
3402
|
const s = n[a];
|
|
3403
3403
|
if (!s)
|
|
3404
3404
|
throw new Error(`Token address for chain ${a} is not defined`);
|
|
3405
|
-
const r =
|
|
3405
|
+
const r = ze("LBTC"), o = e.createContract(r, s);
|
|
3406
3406
|
return o.options.address || (o.options.address = s), o;
|
|
3407
3407
|
}
|
|
3408
|
-
const
|
|
3409
|
-
async function
|
|
3408
|
+
const Ke = "insufficient funds", Xe = "Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.", ie = (e) => e.startsWith("0x") ? e : "0x" + e;
|
|
3409
|
+
async function Ht({
|
|
3410
3410
|
data: e,
|
|
3411
3411
|
proofSignature: t,
|
|
3412
3412
|
env: n,
|
|
@@ -3422,17 +3422,17 @@ async function $t({
|
|
|
3422
3422
|
// TODO: add getGasOptions from the app for bsc here
|
|
3423
3423
|
estimate: !0,
|
|
3424
3424
|
estimateFee: !0,
|
|
3425
|
-
gasLimitMultiplier:
|
|
3425
|
+
gasLimitMultiplier: Ve(s.chainId)
|
|
3426
3426
|
}
|
|
3427
3427
|
);
|
|
3428
3428
|
} catch (p) {
|
|
3429
3429
|
console.log("error", p);
|
|
3430
|
-
const
|
|
3431
|
-
throw
|
|
3430
|
+
const d = v(p);
|
|
3431
|
+
throw d.includes(Ke) ? new Error(Xe) : new Error(d);
|
|
3432
3432
|
}
|
|
3433
3433
|
}
|
|
3434
|
-
const
|
|
3435
|
-
class
|
|
3434
|
+
const Ye = 208, Qe = 4001, et = 4100, tt = 4200, nt = 4900, at = 4901, O = -32700, U = -32600, F = -32601, B = -32602, L = -32603, k = -32e3, G = -32001, W = -32002, V = -32003, $ = -32004, H = -32005, j = -32006;
|
|
3435
|
+
class ce extends Error {
|
|
3436
3436
|
constructor(t, n) {
|
|
3437
3437
|
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;
|
|
3438
3438
|
}
|
|
@@ -3465,12 +3465,12 @@ class ye extends Error {
|
|
|
3465
3465
|
};
|
|
3466
3466
|
}
|
|
3467
3467
|
}
|
|
3468
|
-
class Z extends
|
|
3468
|
+
class Z extends ce {
|
|
3469
3469
|
constructor(t) {
|
|
3470
|
-
super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code =
|
|
3470
|
+
super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = Ye, this.errors = t;
|
|
3471
3471
|
}
|
|
3472
3472
|
}
|
|
3473
|
-
const
|
|
3473
|
+
const st = "An Rpc error has occured with a code of *code*", m = {
|
|
3474
3474
|
// EIP-1474 & JSON RPC 2.0
|
|
3475
3475
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
|
|
3476
3476
|
[O]: {
|
|
@@ -3517,29 +3517,29 @@ const at = "An Rpc error has occured with a code of *code*", m = {
|
|
|
3517
3517
|
message: "Limit exceeded",
|
|
3518
3518
|
description: "Request exceeds defined limit"
|
|
3519
3519
|
},
|
|
3520
|
-
[
|
|
3520
|
+
[j]: {
|
|
3521
3521
|
message: "JSON-RPC version not supported",
|
|
3522
3522
|
description: "Version of JSON-RPC protocol is not supported"
|
|
3523
3523
|
},
|
|
3524
3524
|
// EIP-1193
|
|
3525
3525
|
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
|
|
3526
|
-
[
|
|
3526
|
+
[Qe]: {
|
|
3527
3527
|
name: "User Rejected Request",
|
|
3528
3528
|
message: "The user rejected the request."
|
|
3529
3529
|
},
|
|
3530
|
-
[
|
|
3530
|
+
[et]: {
|
|
3531
3531
|
name: "Unauthorized",
|
|
3532
3532
|
message: "The requested method and/or account has not been authorized by the user."
|
|
3533
3533
|
},
|
|
3534
|
-
[
|
|
3534
|
+
[tt]: {
|
|
3535
3535
|
name: "Unsupported Method",
|
|
3536
3536
|
message: "The Provider does not support the requested method."
|
|
3537
3537
|
},
|
|
3538
|
-
[
|
|
3538
|
+
[nt]: {
|
|
3539
3539
|
name: "Disconnected",
|
|
3540
3540
|
message: "The Provider is disconnected from all chains."
|
|
3541
3541
|
},
|
|
3542
|
-
[
|
|
3542
|
+
[at]: {
|
|
3543
3543
|
name: "Chain Disconnected",
|
|
3544
3544
|
message: "The Provider is not connected to the requested chain."
|
|
3545
3545
|
},
|
|
@@ -3626,112 +3626,112 @@ const at = "An Rpc error has occured with a code of *code*", m = {
|
|
|
3626
3626
|
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."
|
|
3627
3627
|
}
|
|
3628
3628
|
};
|
|
3629
|
-
class b extends
|
|
3629
|
+
class b extends ce {
|
|
3630
3630
|
constructor(t, n) {
|
|
3631
|
-
super(n ??
|
|
3631
|
+
super(n ?? st.replace("*code*", t.error.code.toString())), this.code = t.error.code, this.id = t.id, this.jsonrpc = t.jsonrpc, this.jsonRpcError = t.error;
|
|
3632
3632
|
}
|
|
3633
3633
|
toJSON() {
|
|
3634
3634
|
return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
|
|
3635
3635
|
}
|
|
3636
3636
|
}
|
|
3637
|
-
class
|
|
3637
|
+
class it extends b {
|
|
3638
3638
|
constructor(t) {
|
|
3639
3639
|
super(t, m[O].message), this.code = O;
|
|
3640
3640
|
}
|
|
3641
3641
|
}
|
|
3642
|
-
class
|
|
3642
|
+
class rt extends b {
|
|
3643
3643
|
constructor(t) {
|
|
3644
3644
|
super(t, m[U].message), this.code = U;
|
|
3645
3645
|
}
|
|
3646
3646
|
}
|
|
3647
|
-
class
|
|
3647
|
+
class ot extends b {
|
|
3648
3648
|
constructor(t) {
|
|
3649
3649
|
super(t, m[F].message), this.code = F;
|
|
3650
3650
|
}
|
|
3651
3651
|
}
|
|
3652
|
-
class
|
|
3652
|
+
class pt extends b {
|
|
3653
3653
|
constructor(t) {
|
|
3654
3654
|
super(t, m[B].message), this.code = B;
|
|
3655
3655
|
}
|
|
3656
3656
|
}
|
|
3657
|
-
class
|
|
3657
|
+
class ut extends b {
|
|
3658
3658
|
constructor(t) {
|
|
3659
3659
|
super(t, m[L].message), this.code = L;
|
|
3660
3660
|
}
|
|
3661
3661
|
}
|
|
3662
|
-
class
|
|
3662
|
+
class yt extends b {
|
|
3663
3663
|
constructor(t) {
|
|
3664
3664
|
super(t, m[k].message), this.code = k;
|
|
3665
3665
|
}
|
|
3666
3666
|
}
|
|
3667
|
-
class
|
|
3667
|
+
class dt extends b {
|
|
3668
3668
|
constructor(t) {
|
|
3669
3669
|
super(t, m[$].message), this.code = $;
|
|
3670
3670
|
}
|
|
3671
3671
|
}
|
|
3672
|
-
class
|
|
3672
|
+
class ct extends b {
|
|
3673
3673
|
constructor(t) {
|
|
3674
3674
|
super(t, m[W].message), this.code = W;
|
|
3675
3675
|
}
|
|
3676
3676
|
}
|
|
3677
|
-
class
|
|
3677
|
+
class lt extends b {
|
|
3678
3678
|
constructor(t) {
|
|
3679
3679
|
super(t, m[G].message), this.code = G;
|
|
3680
3680
|
}
|
|
3681
3681
|
}
|
|
3682
|
-
class
|
|
3682
|
+
class mt extends b {
|
|
3683
3683
|
constructor(t) {
|
|
3684
|
-
super(t, m[
|
|
3684
|
+
super(t, m[j].message), this.code = j;
|
|
3685
3685
|
}
|
|
3686
3686
|
}
|
|
3687
|
-
class
|
|
3687
|
+
class bt extends b {
|
|
3688
3688
|
constructor(t) {
|
|
3689
3689
|
super(t, m[V].message), this.code = V;
|
|
3690
3690
|
}
|
|
3691
3691
|
}
|
|
3692
|
-
class
|
|
3692
|
+
class ft extends b {
|
|
3693
3693
|
constructor(t) {
|
|
3694
3694
|
super(t, m[H].message), this.code = H;
|
|
3695
3695
|
}
|
|
3696
3696
|
}
|
|
3697
|
-
const
|
|
3698
|
-
|
|
3699
|
-
|
|
3700
|
-
error: it
|
|
3701
|
-
});
|
|
3702
|
-
T.set(F, {
|
|
3697
|
+
const f = /* @__PURE__ */ new Map();
|
|
3698
|
+
f.set(O, { error: it });
|
|
3699
|
+
f.set(U, {
|
|
3703
3700
|
error: rt
|
|
3704
3701
|
});
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
T.set(k, { error: ut });
|
|
3708
|
-
T.set($, {
|
|
3709
|
-
error: yt
|
|
3702
|
+
f.set(F, {
|
|
3703
|
+
error: ot
|
|
3710
3704
|
});
|
|
3711
|
-
|
|
3705
|
+
f.set(B, { error: pt });
|
|
3706
|
+
f.set(L, { error: ut });
|
|
3707
|
+
f.set(k, { error: yt });
|
|
3708
|
+
f.set($, {
|
|
3712
3709
|
error: dt
|
|
3713
3710
|
});
|
|
3714
|
-
|
|
3715
|
-
error: mt
|
|
3716
|
-
});
|
|
3717
|
-
T.set(G, {
|
|
3711
|
+
f.set(W, {
|
|
3718
3712
|
error: ct
|
|
3719
3713
|
});
|
|
3720
|
-
|
|
3714
|
+
f.set(V, {
|
|
3715
|
+
error: bt
|
|
3716
|
+
});
|
|
3717
|
+
f.set(G, {
|
|
3721
3718
|
error: lt
|
|
3722
3719
|
});
|
|
3723
|
-
|
|
3720
|
+
f.set(j, {
|
|
3721
|
+
error: mt
|
|
3722
|
+
});
|
|
3723
|
+
f.set(H, { error: ft });
|
|
3724
3724
|
const Tt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
|
|
3725
|
-
var
|
|
3725
|
+
var J;
|
|
3726
3726
|
(function(e) {
|
|
3727
3727
|
e.NUMBER = "NUMBER_NUMBER", e.HEX = "NUMBER_HEX", e.STR = "NUMBER_STR", e.BIGINT = "NUMBER_BIGINT";
|
|
3728
|
-
})(
|
|
3728
|
+
})(J || (J = {}));
|
|
3729
3729
|
var q;
|
|
3730
3730
|
(function(e) {
|
|
3731
3731
|
e.HEX = "BYTES_HEX", e.UINT8ARRAY = "BYTES_UINT8ARRAY";
|
|
3732
3732
|
})(q || (q = {}));
|
|
3733
|
-
|
|
3734
|
-
|
|
3733
|
+
J.BIGINT, q.HEX;
|
|
3734
|
+
J.HEX, q.HEX;
|
|
3735
3735
|
var re;
|
|
3736
3736
|
(function(e) {
|
|
3737
3737
|
e.EARLIEST = "earliest", e.LATEST = "latest", e.PENDING = "pending", e.SAFE = "safe", e.FINALIZED = "finalized";
|
|
@@ -3740,42 +3740,42 @@ var oe;
|
|
|
3740
3740
|
(function(e) {
|
|
3741
3741
|
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";
|
|
3742
3742
|
})(oe || (oe = {}));
|
|
3743
|
-
function
|
|
3743
|
+
function ht(e, t) {
|
|
3744
3744
|
if (!t)
|
|
3745
3745
|
throw new Error("The address for bascule module is not defined");
|
|
3746
|
-
const n = e.createContract(
|
|
3746
|
+
const n = e.createContract(Ze, t);
|
|
3747
3747
|
return n.options.address || (n.options.address = t), n;
|
|
3748
3748
|
}
|
|
3749
|
-
const
|
|
3750
|
-
var
|
|
3751
|
-
async function
|
|
3749
|
+
const gt = "No deposit ID provided. Please provide a deposit ID as an argument.", wt = "Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";
|
|
3750
|
+
var Et = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(Et || {});
|
|
3751
|
+
async function jt({
|
|
3752
3752
|
txId: e,
|
|
3753
3753
|
env: t,
|
|
3754
3754
|
...n
|
|
3755
3755
|
}) {
|
|
3756
3756
|
if (!e)
|
|
3757
|
-
throw new Error(ht);
|
|
3758
|
-
if (!Tt(e))
|
|
3759
3757
|
throw new Error(gt);
|
|
3758
|
+
if (!Tt(e))
|
|
3759
|
+
throw new Error(wt);
|
|
3760
3760
|
const a = new C(n), r = await D(a, t).methods.Bascule().call();
|
|
3761
|
-
if (r ===
|
|
3761
|
+
if (r === u)
|
|
3762
3762
|
return 1;
|
|
3763
|
-
const o =
|
|
3763
|
+
const o = ht(a, r);
|
|
3764
3764
|
try {
|
|
3765
3765
|
const p = await o.methods.depositHistory(Buffer.from(e.replace(/^0x/, ""), "hex")).call();
|
|
3766
3766
|
return Number(p);
|
|
3767
3767
|
} catch (p) {
|
|
3768
|
-
const
|
|
3769
|
-
throw new Error(
|
|
3768
|
+
const d = v(p);
|
|
3769
|
+
throw new Error(d);
|
|
3770
3770
|
}
|
|
3771
3771
|
}
|
|
3772
|
-
const
|
|
3772
|
+
const At = [
|
|
3773
3773
|
i.ethereum,
|
|
3774
3774
|
i.base,
|
|
3775
3775
|
i.binanceSmartChain
|
|
3776
|
-
],
|
|
3777
|
-
function
|
|
3778
|
-
if (!
|
|
3776
|
+
], le = (e) => At.includes(e) ? h.prod : h.stage;
|
|
3777
|
+
function me(e, t) {
|
|
3778
|
+
if (!ye(e))
|
|
3779
3779
|
throw new Error(`This chain ${e} is not supported`);
|
|
3780
3780
|
const n = t ? { [e]: t } : P;
|
|
3781
3781
|
if (!n[e])
|
|
@@ -3784,18 +3784,17 @@ function ce(e, t) {
|
|
|
3784
3784
|
}
|
|
3785
3785
|
async function Jt({
|
|
3786
3786
|
chainId: e,
|
|
3787
|
-
|
|
3788
|
-
rpcUrl: n
|
|
3787
|
+
rpcUrl: t
|
|
3789
3788
|
}) {
|
|
3790
|
-
const
|
|
3791
|
-
return
|
|
3789
|
+
const n = me(e, t), a = new Y({ chainId: e, rpcUrlConfig: n }), s = le(e), o = await D(a, s).methods.getMintFee().call();
|
|
3790
|
+
return new I(ue(o.toString(10)));
|
|
3792
3791
|
}
|
|
3793
|
-
async function
|
|
3792
|
+
async function qt(e) {
|
|
3794
3793
|
const t = new C(e), n = `destination chain id is ${e.chainId}`;
|
|
3795
3794
|
return t.signMessage(n);
|
|
3796
3795
|
}
|
|
3797
3796
|
const vt = 24 * 60 * 60;
|
|
3798
|
-
function
|
|
3797
|
+
function Rt({
|
|
3799
3798
|
chainId: e,
|
|
3800
3799
|
verifyingContract: t,
|
|
3801
3800
|
fee: n,
|
|
@@ -3829,51 +3828,56 @@ function At({
|
|
|
3829
3828
|
}
|
|
3830
3829
|
};
|
|
3831
3830
|
}
|
|
3832
|
-
const
|
|
3833
|
-
async function
|
|
3831
|
+
const St = "Failed to obtain a valid signature. The response is undefined or invalid.", _t = () => Math.floor(Date.now() / 1e3 + vt);
|
|
3832
|
+
async function Zt({
|
|
3834
3833
|
address: e,
|
|
3835
3834
|
provider: t,
|
|
3836
3835
|
fee: n,
|
|
3837
3836
|
chainId: a,
|
|
3838
3837
|
env: s,
|
|
3839
|
-
expiry: r =
|
|
3838
|
+
expiry: r = _t()
|
|
3840
3839
|
}) {
|
|
3841
|
-
var
|
|
3840
|
+
var y, T;
|
|
3842
3841
|
const o = new C({
|
|
3843
3842
|
provider: t,
|
|
3844
3843
|
account: e,
|
|
3845
3844
|
chainId: a
|
|
3846
|
-
}),
|
|
3847
|
-
|
|
3845
|
+
}), d = D(o, s).options.address, g = JSON.stringify(
|
|
3846
|
+
Rt({
|
|
3848
3847
|
chainId: a,
|
|
3849
|
-
verifyingContract:
|
|
3848
|
+
verifyingContract: d,
|
|
3850
3849
|
fee: n,
|
|
3851
3850
|
expiry: r
|
|
3852
3851
|
})
|
|
3853
|
-
), c = await ((
|
|
3852
|
+
), c = await ((T = (y = o.web3) == null ? void 0 : y.currentProvider) == null ? void 0 : T.request({
|
|
3854
3853
|
method: "eth_signTypedData_v4",
|
|
3855
|
-
params: [e,
|
|
3854
|
+
params: [e, g]
|
|
3856
3855
|
}));
|
|
3857
3856
|
if (typeof c == "string")
|
|
3858
|
-
return { signature: c, typedData:
|
|
3857
|
+
return { signature: c, typedData: g };
|
|
3859
3858
|
if (!(c != null && c.result))
|
|
3860
|
-
throw new Error(
|
|
3861
|
-
return { signature: c.result, typedData:
|
|
3859
|
+
throw new Error(St);
|
|
3860
|
+
return { signature: c.result, typedData: g };
|
|
3862
3861
|
}
|
|
3863
|
-
|
|
3862
|
+
const Q = {
|
|
3863
|
+
[i.holesky]: "0x52BD640617eeD47A00dA0da93351092D49208d1d"
|
|
3864
|
+
}, zt = Object.keys(
|
|
3865
|
+
Q
|
|
3866
|
+
).map(Number), Kt = (e) => Q[e];
|
|
3867
|
+
async function It({
|
|
3864
3868
|
owner: e,
|
|
3865
3869
|
rpcUrl: t,
|
|
3866
3870
|
chainId: n
|
|
3867
3871
|
}) {
|
|
3868
|
-
const a =
|
|
3872
|
+
const a = me(n, t), s = new Y({ chainId: n, rpcUrlConfig: a }), r = le(n), o = D(s, r);
|
|
3869
3873
|
try {
|
|
3870
3874
|
return (await o.methods.nonces(e).call()).toString();
|
|
3871
3875
|
} catch (p) {
|
|
3872
|
-
const
|
|
3873
|
-
throw new Error(
|
|
3876
|
+
const d = v(p);
|
|
3877
|
+
throw new Error(d);
|
|
3874
3878
|
}
|
|
3875
3879
|
}
|
|
3876
|
-
async function
|
|
3880
|
+
async function Ct({
|
|
3877
3881
|
chainId: e,
|
|
3878
3882
|
expiry: t,
|
|
3879
3883
|
owner: n,
|
|
@@ -3882,7 +3886,7 @@ async function _t({
|
|
|
3882
3886
|
rpcUrl: r,
|
|
3883
3887
|
verifyingContract: o
|
|
3884
3888
|
}) {
|
|
3885
|
-
const p = await
|
|
3889
|
+
const p = await It({
|
|
3886
3890
|
owner: n,
|
|
3887
3891
|
chainId: e,
|
|
3888
3892
|
rpcUrl: r
|
|
@@ -3931,86 +3935,87 @@ async function _t({
|
|
|
3931
3935
|
}
|
|
3932
3936
|
};
|
|
3933
3937
|
}
|
|
3934
|
-
const
|
|
3935
|
-
|
|
3938
|
+
const Dt = (e) => {
|
|
3939
|
+
const n = de("stage")[e];
|
|
3940
|
+
if (!n)
|
|
3941
|
+
throw new Error(`No LBTC contract address configured for chain ID ${e}`);
|
|
3942
|
+
return n;
|
|
3943
|
+
}, xt = "Failed to obtain a valid signature. The response is undefined or invalid.";
|
|
3944
|
+
async function Xt({
|
|
3936
3945
|
address: e,
|
|
3937
3946
|
provider: t,
|
|
3938
3947
|
chainId: n,
|
|
3939
3948
|
value: a,
|
|
3940
3949
|
expiry: s,
|
|
3941
3950
|
rpcUrl: r,
|
|
3942
|
-
spender: o
|
|
3943
|
-
verifyingContract: p
|
|
3951
|
+
spender: o
|
|
3944
3952
|
}) {
|
|
3945
|
-
var
|
|
3946
|
-
const
|
|
3953
|
+
var T, x;
|
|
3954
|
+
const p = new C({
|
|
3947
3955
|
provider: t,
|
|
3948
3956
|
account: e,
|
|
3949
3957
|
chainId: n
|
|
3950
|
-
}),
|
|
3958
|
+
}), d = Dt(n), g = await Ct({
|
|
3951
3959
|
chainId: n,
|
|
3952
3960
|
expiry: s,
|
|
3953
3961
|
owner: e,
|
|
3954
3962
|
spender: o,
|
|
3955
3963
|
value: a,
|
|
3956
3964
|
rpcUrl: r,
|
|
3957
|
-
verifyingContract:
|
|
3958
|
-
}), c = JSON.stringify(
|
|
3965
|
+
verifyingContract: d
|
|
3966
|
+
}), c = JSON.stringify(g), y = await ((x = (T = p.web3) == null ? void 0 : T.currentProvider) == null ? void 0 : x.request({
|
|
3959
3967
|
method: "eth_signTypedData_v4",
|
|
3960
3968
|
params: [e, c]
|
|
3961
3969
|
}));
|
|
3962
|
-
if (typeof
|
|
3963
|
-
return { signature:
|
|
3964
|
-
if (!(
|
|
3965
|
-
throw new Error(
|
|
3966
|
-
return { signature:
|
|
3970
|
+
if (typeof y == "string")
|
|
3971
|
+
return { signature: y, typedData: c };
|
|
3972
|
+
if (!(y != null && y.result))
|
|
3973
|
+
throw new Error(xt);
|
|
3974
|
+
return { signature: y.result, typedData: c };
|
|
3967
3975
|
}
|
|
3968
|
-
const
|
|
3969
|
-
[
|
|
3970
|
-
SPENDER: "0x52BD640617eeD47A00dA0da93351092D49208d1d",
|
|
3971
|
-
VERIFYING_CONTRACT: "0xED7bfd5C1790576105Af4649817f6d35A75CD818"
|
|
3972
|
-
}
|
|
3973
|
-
}, zt = (e) => {
|
|
3974
|
-
var n;
|
|
3975
|
-
const t = (n = Dt[e]) == null ? void 0 : n.SPENDER;
|
|
3976
|
+
const Yt = (e) => {
|
|
3977
|
+
const t = Q[e];
|
|
3976
3978
|
if (!t)
|
|
3977
3979
|
throw new Error(`No spender address configured for chain ID ${e}`);
|
|
3978
3980
|
return t;
|
|
3979
3981
|
};
|
|
3980
3982
|
export {
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3983
|
+
Et as BasculeDepositStatus,
|
|
3984
|
+
Ue as ENotarizationStatus,
|
|
3985
|
+
Fe as ESessionState,
|
|
3984
3986
|
i as OChainId,
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
Lt as
|
|
3987
|
+
h as OEnv,
|
|
3988
|
+
_e as SANCTIONED_ADDRESS,
|
|
3989
|
+
X as SATOSHI_SCALE,
|
|
3990
|
+
Q as STAKE_AND_BAKE_SPENDER_CONTRACTS,
|
|
3991
|
+
zt as SUPPORTED_STAKE_AND_BAKE_CHAINS,
|
|
3992
|
+
Ht as claimLBTC,
|
|
3993
|
+
ue as fromSatoshi,
|
|
3994
|
+
Ut as generateDepositBtcAddress,
|
|
3995
|
+
A as getApiConfig,
|
|
3996
|
+
jt as getBasculeDepositStatus,
|
|
3997
|
+
we as getBaseNetworkByEnv,
|
|
3998
|
+
ge as getBscNetworkByEnv,
|
|
3999
|
+
Oe as getChainIdByName,
|
|
4000
|
+
K as getChainNameById,
|
|
4001
|
+
Ft as getDepositBtcAddress,
|
|
4002
|
+
Me as getDepositBtcAddresses,
|
|
4003
|
+
Lt as getDepositsByAddress,
|
|
4004
|
+
he as getEthNetworkByEnv,
|
|
4005
|
+
kt as getLBTCExchangeRate,
|
|
4002
4006
|
Jt as getLBTCMintingFee,
|
|
4003
|
-
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
qt as
|
|
4011
|
-
Zt as
|
|
4012
|
-
|
|
4013
|
-
Vt as
|
|
4014
|
-
|
|
4007
|
+
de as getLbtcAddressConfig,
|
|
4008
|
+
Gt as getNetworkFeeSignature,
|
|
4009
|
+
Yt as getStakeAndBakeSpenderAddress,
|
|
4010
|
+
Kt as getStakeAndBakeSpenderContract,
|
|
4011
|
+
Ct as getStakeAndBakeTypedData,
|
|
4012
|
+
Wt as getUserStakeAndBakeSignature,
|
|
4013
|
+
ye as isValidChain,
|
|
4014
|
+
qt as signLbtcDestionationAddr,
|
|
4015
|
+
Zt as signNetworkFee,
|
|
4016
|
+
Xt as signStakeAndBake,
|
|
4017
|
+
Vt as storeNetworkFeeSignature,
|
|
4018
|
+
$t as storeStakeAndBakeSignature,
|
|
4019
|
+
Bt as toSatoshi
|
|
4015
4020
|
};
|
|
4016
4021
|
//# sourceMappingURL=index.js.map
|