@lombard.finance/sdk 2.0.2 → 2.0.5

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.js CHANGED
@@ -1,12 +1,12 @@
1
1
  var he = Object.defineProperty;
2
2
  var ge = (e, t, n) => t in e ? he(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
3
  var A = (e, t, n) => (ge(e, typeof t != "symbol" ? t + "" : t, n), n);
4
- import R from "axios";
5
- import v from "bignumber.js";
4
+ import C from "axios";
5
+ import R from "bignumber.js";
6
6
  import ye, { Web3 as re, utils as w } from "web3";
7
7
  import * as we from "@bitcoin-js/tiny-secp256k1-asmjs";
8
8
  import { initEccLib as Ee, payments as Ae, networks as oe, address as ve } from "bitcoinjs-lib";
9
- const c = {
9
+ const d = {
10
10
  prod: "prod",
11
11
  testnet: "testnet",
12
12
  stage: "stage"
@@ -20,60 +20,62 @@ const c = {
20
20
  baseTestnet: 84532,
21
21
  berachainBartioTestnet: 80084,
22
22
  corn: 21e6
23
- }, _ = c.prod, o = "0x0000000000000000000000000000000000000000", Re = {
24
- baseApiUrl: "https://staging.prod.lombard.finance",
25
- claimerApiUrl: "https://claimer.staging.lombard.finance"
26
- }, Ce = {
27
- baseApiUrl: "https://gastald-testnet.prod.lombard.finance",
28
- claimerApiUrl: "https://claimer.staging.lombard.finance"
29
- }, Se = {
30
- baseApiUrl: "https://mainnet.prod.lombard.finance",
31
- claimerApiUrl: ""
32
- }, C = (e = _) => {
23
+ }, Re = (e) => e === d.prod ? a.ethereum : a.holesky, Ce = (e) => e === d.prod ? a.binanceSmartChain : a.binanceSmartChainTestnet, Se = (e) => e === d.prod ? a.base : a.baseTestnet, x = d.prod, o = "0x0000000000000000000000000000000000000000", Ie = {
24
+ baseApiUrl: "https://staging.prod.lombard.finance"
25
+ }, _e = {
26
+ baseApiUrl: "https://gastald-testnet.prod.lombard.finance"
27
+ }, xe = {
28
+ baseApiUrl: "https://mainnet.prod.lombard.finance"
29
+ }, S = (e = x) => {
33
30
  switch (e) {
34
- case c.prod:
35
- return Se;
36
- case c.testnet:
37
- return Ce;
31
+ case d.prod:
32
+ return xe;
33
+ case d.testnet:
34
+ return _e;
38
35
  default:
39
- return Re;
36
+ return Ie;
40
37
  }
41
38
  };
42
- function S(e) {
39
+ function I(e) {
43
40
  return typeof e == "string" ? e : ((n) => {
44
41
  var s;
45
42
  return ((s = n == null ? void 0 : n.data) == null ? void 0 : s.message) && typeof n.data.message == "string";
46
- })(e) ? e.data.message : e instanceof Error ? Ie(e) : _e(e);
43
+ })(e) ? e.data.message : e instanceof Error ? De(e) : Me(e);
47
44
  }
48
- function Ie(e) {
45
+ function De(e) {
49
46
  return e.response ? e.response.data.message : e.message;
50
47
  }
51
- function _e(e) {
48
+ function Me(e) {
52
49
  return e != null && e.message ? e.message : "Unknown error";
53
50
  }
54
- const Z = {
51
+ const v = {
55
52
  eth: "DESTINATION_BLOCKCHAIN_ETHEREUM",
56
53
  base: "DESTINATION_BLOCKCHAIN_BASE",
57
- bsc: "DESTINATION_BLOCKCHAIN_BSC"
54
+ bsc: "DESTINATION_BLOCKCHAIN_BSC",
55
+ mantle: "DESTINATION_BLOCKCHAIN_MANTLE",
56
+ linea: "DESTINATION_BLOCKCHAIN_LINEA",
57
+ zcircuit: "DESTINATION_BLOCKCHAIN_ZIRCUIT",
58
+ scroll: "DESTINATION_BLOCKCHAIN_SCROLL",
59
+ xlayer: "DESTINATION_BLOCKCHAIN_XLAYER"
58
60
  };
59
- function K(e) {
61
+ function X(e) {
60
62
  switch (e) {
63
+ case a.ethereum:
61
64
  case a.holesky:
62
65
  case a.sepolia:
63
- case a.ethereum:
64
- return Z.eth;
66
+ return v.eth;
65
67
  case a.base:
66
68
  case a.baseTestnet:
67
- return Z.base;
69
+ return v.base;
68
70
  case a.binanceSmartChain:
69
71
  case a.binanceSmartChainTestnet:
70
- return Z.bsc;
72
+ return v.bsc;
71
73
  default:
72
74
  throw new Error(`Unknown chain ID: ${e}`);
73
75
  }
74
76
  }
75
- const xe = "sanctioned_address", De = "api/v1/address/generate", Me = "destination address is under sanctions";
76
- async function Vt({
77
+ const Ne = "sanctioned_address", Pe = "api/v1/address/generate", Oe = "destination address is under sanctions";
78
+ async function Jt({
77
79
  address: e,
78
80
  chainId: t,
79
81
  signature: n,
@@ -82,109 +84,113 @@ async function Vt({
82
84
  partnerId: r,
83
85
  captchaToken: p = ""
84
86
  }) {
85
- const { baseApiUrl: u } = C(s), d = K(t), h = {
87
+ const { baseApiUrl: u } = S(s), y = X(t), h = {
86
88
  to_address: e,
87
89
  to_address_signature: n,
88
- to_chain: d,
90
+ to_chain: y,
89
91
  referrer_code: i,
90
92
  partner_id: r,
91
93
  nonce: 0,
92
94
  captcha: p
93
95
  };
94
96
  try {
95
- const { data: l } = await R.post(
96
- De,
97
+ const { data: l } = await C.post(
98
+ Pe,
97
99
  h,
98
100
  { baseURL: u }
99
101
  );
100
102
  return l.address;
101
103
  } catch (l) {
102
- const g = S(l);
103
- if (Ne(g))
104
- return xe;
104
+ const g = I(l);
105
+ if (Ue(g))
106
+ return Ne;
105
107
  throw new Error(g);
106
108
  }
107
109
  }
108
- function Ne(e) {
109
- return !!e.includes(Me);
110
+ function Ue(e) {
111
+ return !!e.includes(Oe);
110
112
  }
111
- const Pe = "api/v1/address";
112
- async function $t({
113
+ const Fe = "api/v1/address";
114
+ async function Zt({
113
115
  address: e,
114
116
  chainId: t,
115
117
  env: n,
116
118
  partnerId: s
117
119
  }) {
118
- const i = await Ue({
120
+ const i = await Le({
119
121
  address: e,
120
122
  chainId: t,
121
123
  env: n,
122
124
  partnerId: s
123
- }), r = Oe(i);
125
+ }), r = Be(i);
124
126
  if (!r)
125
127
  throw new Error("No address");
126
128
  return r.btc_address;
127
129
  }
128
- function Oe(e) {
130
+ function Be(e) {
129
131
  if (!e.length)
130
132
  return;
131
133
  const t = e.reduce((n, s) => n.created_at < s.created_at ? s : n, e[0]);
132
134
  return t.deprecated ? void 0 : t;
133
135
  }
134
- async function Ue({
136
+ async function Le({
135
137
  address: e,
136
138
  chainId: t,
137
139
  env: n,
138
140
  partnerId: s
139
141
  }) {
140
- const { baseApiUrl: i } = C(n), r = K(t), p = {
142
+ const { baseApiUrl: i } = S(n), r = X(t), p = {
141
143
  to_address: e,
142
144
  to_blockchain: r,
143
145
  limit: 1,
144
146
  offset: 0,
145
147
  asc: !1,
146
- partnerId: s
147
- }, { data: u } = await R.get(Pe, {
148
+ referralId: s
149
+ }, { data: u } = await C.get(Fe, {
148
150
  baseURL: i,
149
151
  params: p
150
152
  });
151
153
  return (u == null ? void 0 : u.addresses) || [];
152
154
  }
153
- const Fe = 8, Y = 10 ** Fe;
154
- function X(e) {
155
+ const ke = 8, Y = 10 ** ke;
156
+ function K(e) {
155
157
  return +e / Y;
156
158
  }
157
159
  function ce(e) {
158
160
  return Math.floor(+e * Y);
159
161
  }
160
- function Be(e, t = _) {
162
+ function Ge(e, t = x) {
161
163
  switch (e) {
162
- case "DESTINATION_BLOCKCHAIN_ETHEREUM":
163
- return t === c.prod ? a.ethereum : a.sepolia;
164
+ case v.eth:
165
+ return Re(t);
166
+ case v.base:
167
+ return Se(t);
168
+ case v.bsc:
169
+ return Ce(t);
164
170
  default:
165
171
  return a.ethereum;
166
172
  }
167
173
  }
168
- var Le = /* @__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))(Le || {}), Ge = /* @__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))(Ge || {});
169
- async function Ht({
174
+ var We = /* @__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))(We || {}), Ve = /* @__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))(Ve || {});
175
+ async function jt({
170
176
  address: e,
171
177
  env: t
172
178
  }) {
173
- const { baseApiUrl: n } = C(t), { data: s } = await R.get(
179
+ const { baseApiUrl: n } = S(t), { data: s } = await C.get(
174
180
  `api/v1/address/outputs-v2/${e}`,
175
181
  { baseURL: n }
176
182
  );
177
- return ((s == null ? void 0 : s.outputs) ?? []).map(ke(t));
183
+ return ((s == null ? void 0 : s.outputs) ?? []).map($e(t));
178
184
  }
179
- function ke(e) {
185
+ function $e(e) {
180
186
  return (t) => ({
181
187
  txid: t.txid,
182
188
  index: t.index ?? 0,
183
189
  blockHeight: t.block_height ? Number(t.block_height) : void 0,
184
190
  blockTime: t.block_time ? Number(t.block_time) : void 0,
185
- value: new v(X(t.value)),
191
+ value: new R(K(t.value)),
186
192
  address: t.address,
187
- chainId: Be(t.to_chain, e),
193
+ chainId: Ge(t.to_chain, e),
188
194
  claimedTxId: t.claim_tx,
189
195
  rawPayload: t.raw_payload,
190
196
  signature: t.proof,
@@ -196,27 +202,27 @@ function ke(e) {
196
202
  sessionState: t.session_state
197
203
  });
198
204
  }
199
- const We = 2e-4;
200
- async function Jt({
205
+ const He = 2e-4;
206
+ async function qt({
201
207
  env: e,
202
208
  chainId: t = a.ethereum,
203
209
  amount: n = 1
204
210
  }) {
205
- const { baseApiUrl: s } = C(e), i = K(t), { data: r } = await R.get(
211
+ const { baseApiUrl: s } = S(e), i = X(t), { data: r } = await C.get(
206
212
  `api/v1/exchange/rate/${i}`,
207
213
  { baseURL: s, params: { amount: n } }
208
- ), p = new v(We).multipliedBy(Y).toFixed();
214
+ ), p = new R(He).multipliedBy(Y).toFixed();
209
215
  return { exchangeRate: +r.amount_out, minAmount: +p };
210
216
  }
211
- async function jt({
217
+ async function zt({
212
218
  address: e,
213
219
  chainId: t,
214
220
  env: n
215
221
  }) {
216
- const { claimerApiUrl: s } = C(n);
222
+ const { baseApiUrl: s } = S(n);
217
223
  try {
218
- const { data: i } = await R.get(
219
- `${s}/claimer/v1/mintwithfee/get-user-signature`,
224
+ const { data: i } = await C.get(
225
+ `${s}/api/v1/claimer/get-user-signature`,
220
226
  {
221
227
  params: {
222
228
  user_destination_address: e,
@@ -230,20 +236,20 @@ async function jt({
230
236
  isDelayed: i == null ? void 0 : i.is_delayed
231
237
  };
232
238
  } catch (i) {
233
- const r = S(i);
239
+ const r = I(i);
234
240
  throw new Error(r);
235
241
  }
236
242
  }
237
- async function qt({
243
+ async function Kt({
238
244
  signature: e,
239
245
  typedData: t,
240
246
  address: n,
241
247
  env: s
242
248
  }) {
243
- const { claimerApiUrl: i } = C(s);
249
+ const { baseApiUrl: i } = S(s);
244
250
  try {
245
- const { data: r } = await R.post(
246
- `${i}/claimer/v1/mintwithfee/save-user-signature`,
251
+ const { data: r } = await C.post(
252
+ `${i}/api/v1/claimer/save-user-signature`,
247
253
  null,
248
254
  {
249
255
  params: {
@@ -255,19 +261,20 @@ async function qt({
255
261
  );
256
262
  return r.status;
257
263
  } catch (r) {
258
- const p = S(r);
264
+ const p = I(r);
259
265
  throw new Error(p);
260
266
  }
261
267
  }
262
- const N = {
268
+ const P = {
263
269
  [a.ethereum]: "https://rpc.ankr.com/eth",
264
270
  [a.holesky]: "https://rpc.ankr.com/eth_holesky",
265
271
  [a.sepolia]: "https://rpc.ankr.com/eth_sepolia",
266
272
  [a.base]: "https://rpc.ankr.com/base",
267
273
  [a.baseTestnet]: "https://rpc.ankr.com/base_sepolia",
268
- [a.binanceSmartChain]: "https://rpc.ankr.com/bsc"
274
+ [a.binanceSmartChain]: "https://rpc.ankr.com/bsc",
275
+ [a.binanceSmartChainTestnet]: "https://rpc.ankr.com/bsc_testnet_chapel"
269
276
  };
270
- async function Ve(e) {
277
+ async function Je(e) {
271
278
  const n = await (await fetch(e, {
272
279
  method: "POST",
273
280
  headers: {
@@ -280,14 +287,14 @@ async function Ve(e) {
280
287
  params: []
281
288
  })
282
289
  })).json(), s = ye.utils.hexToNumber(n == null ? void 0 : n.result);
283
- return new v(Number(s));
290
+ return new R(Number(s));
284
291
  }
285
- const $e = 2, He = 25e3;
292
+ const Ze = 2, je = 25e3;
286
293
  class q {
287
294
  constructor({ chainId: t, rpcUrlConfig: n }) {
288
295
  A(this, "chainId");
289
296
  A(this, "rpcConfig");
290
- this.chainId = t, this.rpcConfig = { ...N, ...n };
297
+ this.chainId = t, this.rpcConfig = { ...P, ...n };
291
298
  }
292
299
  /**
293
300
  * Returns web3 instance for read operations.
@@ -324,10 +331,10 @@ class q {
324
331
  async getMaxFees() {
325
332
  const t = this.getReadWeb3(), n = this.getRpcUrl(), [s, i] = await Promise.all([
326
333
  t.eth.getBlock("latest"),
327
- Ve(n)
334
+ Je(n)
328
335
  ]);
329
336
  return !(s != null && s.baseFeePerGas) && typeof (s == null ? void 0 : s.baseFeePerGas) != "bigint" ? {} : {
330
- maxFeePerGas: +new v(s.baseFeePerGas.toString(10)).multipliedBy($e).plus(i),
337
+ maxFeePerGas: +new R(s.baseFeePerGas.toString(10)).multipliedBy(Ze).plus(i),
331
338
  maxPriorityFeePerGas: +i
332
339
  };
333
340
  }
@@ -339,8 +346,8 @@ class q {
339
346
  */
340
347
  async getSafeGasPriceWei() {
341
348
  const t = await this.getReadWeb3().eth.getGasPrice();
342
- return new v(t.toString(10)).plus(
343
- He
349
+ return new R(t.toString(10)).plus(
350
+ je
344
351
  );
345
352
  }
346
353
  /**
@@ -356,13 +363,13 @@ class q {
356
363
  return new s.eth.Contract(t, n);
357
364
  }
358
365
  }
359
- class I extends q {
366
+ class _ extends q {
360
367
  constructor({ provider: n, account: s, chainId: i, rpcUrlConfig: r }) {
361
368
  super({ chainId: i, rpcUrlConfig: r });
362
369
  A(this, "web3");
363
370
  A(this, "account");
364
- A(this, "rpcConfig", N);
365
- this.web3 = new ye(n), this.account = s, this.chainId = i, this.rpcConfig = { ...N, ...r };
371
+ A(this, "rpcConfig", P);
372
+ this.web3 = new ye(n), this.account = s, this.chainId = i, this.rpcConfig = { ...P, ...r };
366
373
  }
367
374
  /**
368
375
  * Signs a message using the current provider and account.
@@ -388,54 +395,54 @@ class I extends q {
388
395
  */
389
396
  async sendTransactionAsync(n, s, i) {
390
397
  const { chainId: r, web3: p } = this, u = this.getReadWeb3(), {
391
- data: d,
398
+ data: y,
392
399
  estimate: h = !1,
393
400
  estimateFee: l = !1,
394
401
  extendedGasLimit: g,
395
- gasLimit: x = "0",
402
+ gasLimit: D = "0",
396
403
  value: fe = "0",
397
404
  gasLimitMultiplier: Te = 1
398
405
  } = i;
399
- let { nonce: D } = i;
400
- D || (D = await u.eth.getTransactionCount(n)), console.log(`Nonce: ${D}`);
401
- const y = {
406
+ let { nonce: M } = i;
407
+ M || (M = await u.eth.getTransactionCount(n)), console.log(`Nonce: ${M}`);
408
+ const c = {
402
409
  from: n,
403
410
  to: s,
404
411
  value: w.numberToHex(fe),
405
- data: d,
406
- nonce: D,
412
+ data: y,
413
+ nonce: M,
407
414
  chainId: w.numberToHex(r)
408
415
  };
409
416
  if (h)
410
417
  try {
411
- const T = await u.eth.estimateGas(y), M = Math.round(
418
+ const T = await u.eth.estimateGas(c), N = Math.round(
412
419
  Number(T) * Te
413
420
  );
414
- g ? y.gas = w.numberToHex(M + g) : y.gas = w.numberToHex(M);
421
+ g ? c.gas = w.numberToHex(N + g) : c.gas = w.numberToHex(N);
415
422
  } catch (T) {
416
423
  throw new Error(
417
424
  T.message ?? "Failed to estimate gas limit for transaction."
418
425
  );
419
426
  }
420
427
  else
421
- y.gas = w.numberToHex(x);
428
+ c.gas = w.numberToHex(D);
422
429
  const { maxFeePerGas: ne, maxPriorityFeePerGas: ae } = l ? await this.getMaxFees().catch(() => i) : i;
423
- if (ae !== void 0 && (y.maxPriorityFeePerGas = w.numberToHex(ae)), ne !== void 0 && (y.maxFeePerGas = w.numberToHex(ne)), !y.maxFeePerGas && !y.maxPriorityFeePerGas) {
430
+ if (ae !== void 0 && (c.maxPriorityFeePerGas = w.numberToHex(ae)), ne !== void 0 && (c.maxFeePerGas = w.numberToHex(ne)), !c.maxFeePerGas && !c.maxPriorityFeePerGas) {
424
431
  const T = await this.getSafeGasPriceWei();
425
- y.gasPrice = T.toString(10);
432
+ c.gasPrice = T.toString(10);
426
433
  }
427
- if (!y.maxFeePerGas && !y.maxPriorityFeePerGas) {
434
+ if (!c.maxFeePerGas && !c.maxPriorityFeePerGas) {
428
435
  const T = await this.getSafeGasPriceWei();
429
- y.gasPrice = T.toString(10);
436
+ c.gasPrice = T.toString(10);
430
437
  }
431
- return console.log("Sending transaction via Web3: ", y), new Promise((T, M) => {
432
- const se = p.eth.sendTransaction(y);
438
+ return console.log("Sending transaction via Web3: ", c), new Promise((T, N) => {
439
+ const se = p.eth.sendTransaction(c);
433
440
  se.once("transactionHash", async (ie) => {
434
441
  console.log(`Just signed transaction has is: ${ie}`), T({
435
442
  receiptPromise: se,
436
443
  transactionHash: ie
437
444
  });
438
- }).catch(M);
445
+ }).catch(N);
439
446
  });
440
447
  }
441
448
  createContract(n, s) {
@@ -456,7 +463,7 @@ function Q(e) {
456
463
  function ee(e) {
457
464
  return Object.values(a).includes(e);
458
465
  }
459
- const Je = {
466
+ const qe = {
460
467
  [a.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
461
468
  [a.ethereum]: o,
462
469
  [a.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
@@ -467,7 +474,7 @@ const Je = {
467
474
  [a.baseTestnet]: o,
468
475
  [a.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
469
476
  [a.corn]: o
470
- }, je = {
477
+ }, ze = {
471
478
  [a.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
472
479
  [a.ethereum]: o,
473
480
  [a.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
@@ -477,7 +484,7 @@ const Je = {
477
484
  [a.baseTestnet]: o,
478
485
  [a.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
479
486
  [a.corn]: o
480
- }, qe = {
487
+ }, Ke = {
481
488
  [a.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
482
489
  [a.holesky]: o,
483
490
  [a.sepolia]: o,
@@ -488,17 +495,17 @@ const Je = {
488
495
  [a.berachainBartioTestnet]: o,
489
496
  [a.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
490
497
  };
491
- function Ze(e = _) {
498
+ function Xe(e = x) {
492
499
  switch (e) {
493
- case c.prod:
494
- return qe;
495
- case c.testnet:
496
- return je;
500
+ case d.prod:
501
+ return Ke;
502
+ case d.testnet:
503
+ return ze;
497
504
  default:
498
- return Je;
505
+ return qe;
499
506
  }
500
507
  }
501
- const ze = [
508
+ const Ye = [
502
509
  {
503
510
  constant: !0,
504
511
  inputs: [],
@@ -719,7 +726,7 @@ const ze = [
719
726
  name: "Transfer",
720
727
  type: "event"
721
728
  }
722
- ], Xe = [
729
+ ], Qe = [
723
730
  {
724
731
  inputs: [],
725
732
  stateMutability: "nonpayable",
@@ -2479,7 +2486,7 @@ const ze = [
2479
2486
  stateMutability: "nonpayable",
2480
2487
  type: "function"
2481
2488
  }
2482
- ], Ke = [
2489
+ ], et = [
2483
2490
  {
2484
2491
  inputs: [
2485
2492
  {
@@ -3329,31 +3336,31 @@ const ze = [
3329
3336
  type: "function"
3330
3337
  }
3331
3338
  ];
3332
- function Ye(e) {
3339
+ function tt(e) {
3333
3340
  switch (e) {
3334
3341
  case "LBTC":
3335
- return Xe;
3342
+ return Qe;
3336
3343
  default:
3337
- return ze;
3344
+ return Ye;
3338
3345
  }
3339
3346
  }
3340
3347
  function E(e, t) {
3341
- const n = Ze(t), { chainId: s } = e;
3348
+ const n = Xe(t), { chainId: s } = e;
3342
3349
  if (!ee(s))
3343
3350
  throw new Error(`This chain ${s} is not supported`);
3344
3351
  const i = n[s];
3345
3352
  if (!i)
3346
3353
  throw new Error(`Token address for chain ${s} is not defined`);
3347
- const r = Ye("LBTC"), p = e.createContract(r, i);
3354
+ const r = tt("LBTC"), p = e.createContract(r, i);
3348
3355
  return p.options.address || (p.options.address = i), p;
3349
3356
  }
3350
- function Zt({
3357
+ function Xt({
3351
3358
  spender: e,
3352
3359
  amount: t,
3353
3360
  env: n,
3354
3361
  ...s
3355
3362
  }) {
3356
- const i = new I(s), r = E(i, n), p = ce(t), u = r.methods.approve(e, p);
3363
+ const i = new _(s), r = E(i, n), p = ce(t), u = r.methods.approve(e, p);
3357
3364
  return i.sendTransactionAsync(
3358
3365
  i.account,
3359
3366
  r.options.address,
@@ -3365,20 +3372,21 @@ function Zt({
3365
3372
  }
3366
3373
  );
3367
3374
  }
3368
- const Qe = "insufficient funds", et = "Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.", pe = (e) => e.startsWith("0x") ? e : "0x" + e;
3369
- async function zt({
3375
+ const nt = "insufficient funds", at = "Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.", pe = (e) => e.startsWith("0x") ? e : "0x" + e;
3376
+ async function Yt({
3370
3377
  data: e,
3371
3378
  proofSignature: t,
3372
3379
  env: n,
3373
3380
  ...s
3374
3381
  }) {
3375
- const i = new I(s), r = E(i, n), p = r.methods.mint(pe(e), pe(t));
3382
+ const i = new _(s), r = E(i, n), p = r.methods.mint(pe(e), pe(t));
3376
3383
  try {
3377
3384
  return await i.sendTransactionAsync(
3378
3385
  i.account,
3379
3386
  r.options.address,
3380
3387
  {
3381
3388
  data: p.encodeABI(),
3389
+ // TODO: add getGasOptions from the app for bsc here
3382
3390
  estimate: !0,
3383
3391
  estimateFee: !0,
3384
3392
  gasLimitMultiplier: Q(i.chainId)
@@ -3386,11 +3394,11 @@ async function zt({
3386
3394
  );
3387
3395
  } catch (u) {
3388
3396
  console.log("error", u);
3389
- const d = S(u);
3390
- throw d.includes(Qe) ? new Error(et) : new Error(d);
3397
+ const y = I(u);
3398
+ throw y.includes(nt) ? new Error(at) : new Error(y);
3391
3399
  }
3392
3400
  }
3393
- const tt = 208, nt = 4001, at = 4100, st = 4200, it = 4900, rt = 4901, P = -32700, O = -32600, U = -32601, F = -32602, B = -32603, L = -32e3, G = -32001, k = -32002, W = -32003, V = -32004, $ = -32005, H = -32006;
3401
+ const st = 208, it = 4001, rt = 4100, ot = 4200, pt = 4900, ut = 4901, O = -32700, U = -32600, F = -32601, B = -32602, L = -32603, k = -32e3, G = -32001, W = -32002, V = -32003, $ = -32004, H = -32005, J = -32006;
3394
3402
  class le extends Error {
3395
3403
  constructor(t, n) {
3396
3404
  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;
@@ -3426,33 +3434,33 @@ class le extends Error {
3426
3434
  }
3427
3435
  class z extends le {
3428
3436
  constructor(t) {
3429
- super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = tt, this.errors = t;
3437
+ super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = st, this.errors = t;
3430
3438
  }
3431
3439
  }
3432
- const ot = "An Rpc error has occured with a code of *code*", m = {
3440
+ const dt = "An Rpc error has occured with a code of *code*", m = {
3433
3441
  // EIP-1474 & JSON RPC 2.0
3434
3442
  // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
3435
- [P]: {
3443
+ [O]: {
3436
3444
  message: "Parse error",
3437
3445
  description: "Invalid JSON"
3438
3446
  },
3439
- [O]: {
3447
+ [U]: {
3440
3448
  message: "Invalid request",
3441
3449
  description: "JSON is not a valid request object "
3442
3450
  },
3443
- [U]: {
3451
+ [F]: {
3444
3452
  message: "Method not found",
3445
3453
  description: "Method does not exist "
3446
3454
  },
3447
- [F]: {
3455
+ [B]: {
3448
3456
  message: "Invalid params",
3449
3457
  description: "Invalid method parameters"
3450
3458
  },
3451
- [B]: {
3459
+ [L]: {
3452
3460
  message: "Internal error",
3453
3461
  description: "Internal JSON-RPC error"
3454
3462
  },
3455
- [L]: {
3463
+ [k]: {
3456
3464
  message: "Invalid input",
3457
3465
  description: "Missing or invalid parameters"
3458
3466
  },
@@ -3460,45 +3468,45 @@ const ot = "An Rpc error has occured with a code of *code*", m = {
3460
3468
  message: "Resource not found",
3461
3469
  description: "Requested resource not found"
3462
3470
  },
3463
- [k]: {
3471
+ [W]: {
3464
3472
  message: "Resource unavailable",
3465
3473
  description: "Requested resource not available"
3466
3474
  },
3467
- [W]: {
3475
+ [V]: {
3468
3476
  message: "Transaction rejected",
3469
3477
  description: "Transaction creation failed"
3470
3478
  },
3471
- [V]: {
3479
+ [$]: {
3472
3480
  message: "Method not supported",
3473
3481
  description: "Method is not implemented"
3474
3482
  },
3475
- [$]: {
3483
+ [H]: {
3476
3484
  message: "Limit exceeded",
3477
3485
  description: "Request exceeds defined limit"
3478
3486
  },
3479
- [H]: {
3487
+ [J]: {
3480
3488
  message: "JSON-RPC version not supported",
3481
3489
  description: "Version of JSON-RPC protocol is not supported"
3482
3490
  },
3483
3491
  // EIP-1193
3484
3492
  // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
3485
- [nt]: {
3493
+ [it]: {
3486
3494
  name: "User Rejected Request",
3487
3495
  message: "The user rejected the request."
3488
3496
  },
3489
- [at]: {
3497
+ [rt]: {
3490
3498
  name: "Unauthorized",
3491
3499
  message: "The requested method and/or account has not been authorized by the user."
3492
3500
  },
3493
- [st]: {
3501
+ [ot]: {
3494
3502
  name: "Unsupported Method",
3495
3503
  message: "The Provider does not support the requested method."
3496
3504
  },
3497
- [it]: {
3505
+ [pt]: {
3498
3506
  name: "Disconnected",
3499
3507
  message: "The Provider is disconnected from all chains."
3500
3508
  },
3501
- [rt]: {
3509
+ [ut]: {
3502
3510
  name: "Chain Disconnected",
3503
3511
  message: "The Provider is not connected to the requested chain."
3504
3512
  },
@@ -3587,110 +3595,110 @@ const ot = "An Rpc error has occured with a code of *code*", m = {
3587
3595
  };
3588
3596
  class b extends le {
3589
3597
  constructor(t, n) {
3590
- super(n ?? ot.replace("*code*", t.error.code.toString())), this.code = t.error.code, this.id = t.id, this.jsonrpc = t.jsonrpc, this.jsonRpcError = t.error;
3598
+ super(n ?? dt.replace("*code*", t.error.code.toString())), this.code = t.error.code, this.id = t.id, this.jsonrpc = t.jsonrpc, this.jsonRpcError = t.error;
3591
3599
  }
3592
3600
  toJSON() {
3593
3601
  return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
3594
3602
  }
3595
3603
  }
3596
- class pt extends b {
3597
- constructor(t) {
3598
- super(t, m[P].message), this.code = P;
3599
- }
3600
- }
3601
- class ut extends b {
3604
+ class yt extends b {
3602
3605
  constructor(t) {
3603
3606
  super(t, m[O].message), this.code = O;
3604
3607
  }
3605
3608
  }
3606
- class dt extends b {
3609
+ class ct extends b {
3607
3610
  constructor(t) {
3608
3611
  super(t, m[U].message), this.code = U;
3609
3612
  }
3610
3613
  }
3611
- class yt extends b {
3614
+ class lt extends b {
3612
3615
  constructor(t) {
3613
3616
  super(t, m[F].message), this.code = F;
3614
3617
  }
3615
3618
  }
3616
- class ct extends b {
3619
+ class mt extends b {
3617
3620
  constructor(t) {
3618
3621
  super(t, m[B].message), this.code = B;
3619
3622
  }
3620
3623
  }
3621
- class lt extends b {
3624
+ class bt extends b {
3622
3625
  constructor(t) {
3623
3626
  super(t, m[L].message), this.code = L;
3624
3627
  }
3625
3628
  }
3626
- class mt extends b {
3629
+ class ft extends b {
3627
3630
  constructor(t) {
3628
- super(t, m[V].message), this.code = V;
3631
+ super(t, m[k].message), this.code = k;
3629
3632
  }
3630
3633
  }
3631
- class bt extends b {
3634
+ class Tt extends b {
3632
3635
  constructor(t) {
3633
- super(t, m[k].message), this.code = k;
3636
+ super(t, m[$].message), this.code = $;
3634
3637
  }
3635
3638
  }
3636
- class ft extends b {
3639
+ class ht extends b {
3640
+ constructor(t) {
3641
+ super(t, m[W].message), this.code = W;
3642
+ }
3643
+ }
3644
+ class gt extends b {
3637
3645
  constructor(t) {
3638
3646
  super(t, m[G].message), this.code = G;
3639
3647
  }
3640
3648
  }
3641
- class Tt extends b {
3649
+ class wt extends b {
3642
3650
  constructor(t) {
3643
- super(t, m[H].message), this.code = H;
3651
+ super(t, m[J].message), this.code = J;
3644
3652
  }
3645
3653
  }
3646
- class ht extends b {
3654
+ class Et extends b {
3647
3655
  constructor(t) {
3648
- super(t, m[W].message), this.code = W;
3656
+ super(t, m[V].message), this.code = V;
3649
3657
  }
3650
3658
  }
3651
- class gt extends b {
3659
+ class At extends b {
3652
3660
  constructor(t) {
3653
- super(t, m[$].message), this.code = $;
3661
+ super(t, m[H].message), this.code = H;
3654
3662
  }
3655
3663
  }
3656
3664
  const f = /* @__PURE__ */ new Map();
3657
- f.set(P, { error: pt });
3658
- f.set(O, {
3659
- error: ut
3660
- });
3665
+ f.set(O, { error: yt });
3661
3666
  f.set(U, {
3662
- error: dt
3667
+ error: ct
3663
3668
  });
3664
- f.set(F, { error: yt });
3665
- f.set(B, { error: ct });
3666
- f.set(L, { error: lt });
3667
- f.set(V, {
3668
- error: mt
3669
+ f.set(F, {
3670
+ error: lt
3669
3671
  });
3670
- f.set(k, {
3671
- error: bt
3672
+ f.set(B, { error: mt });
3673
+ f.set(L, { error: bt });
3674
+ f.set(k, { error: ft });
3675
+ f.set($, {
3676
+ error: Tt
3672
3677
  });
3673
3678
  f.set(W, {
3674
3679
  error: ht
3675
3680
  });
3681
+ f.set(V, {
3682
+ error: Et
3683
+ });
3676
3684
  f.set(G, {
3677
- error: ft
3685
+ error: gt
3678
3686
  });
3679
- f.set(H, {
3680
- error: Tt
3687
+ f.set(J, {
3688
+ error: wt
3681
3689
  });
3682
- f.set($, { error: gt });
3683
- const wt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
3684
- var J;
3690
+ f.set(H, { error: At });
3691
+ const vt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
3692
+ var Z;
3685
3693
  (function(e) {
3686
3694
  e.NUMBER = "NUMBER_NUMBER", e.HEX = "NUMBER_HEX", e.STR = "NUMBER_STR", e.BIGINT = "NUMBER_BIGINT";
3687
- })(J || (J = {}));
3695
+ })(Z || (Z = {}));
3688
3696
  var j;
3689
3697
  (function(e) {
3690
3698
  e.HEX = "BYTES_HEX", e.UINT8ARRAY = "BYTES_UINT8ARRAY";
3691
3699
  })(j || (j = {}));
3692
- J.BIGINT, j.HEX;
3693
- J.HEX, j.HEX;
3700
+ Z.BIGINT, j.HEX;
3701
+ Z.HEX, j.HEX;
3694
3702
  var ue;
3695
3703
  (function(e) {
3696
3704
  e.EARLIEST = "earliest", e.LATEST = "latest", e.PENDING = "pending", e.SAFE = "safe", e.FINALIZED = "finalized";
@@ -3699,7 +3707,7 @@ var de;
3699
3707
  (function(e) {
3700
3708
  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";
3701
3709
  })(de || (de = {}));
3702
- const Et = {
3710
+ const Rt = {
3703
3711
  [a.holesky]: "0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",
3704
3712
  [a.sepolia]: o,
3705
3713
  [a.ethereum]: o,
@@ -3709,7 +3717,7 @@ const Et = {
3709
3717
  [a.baseTestnet]: o,
3710
3718
  [a.berachainBartioTestnet]: o,
3711
3719
  [a.corn]: o
3712
- }, At = {
3720
+ }, Ct = {
3713
3721
  [a.holesky]: "0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",
3714
3722
  [a.sepolia]: o,
3715
3723
  [a.ethereum]: o,
@@ -3719,7 +3727,7 @@ const Et = {
3719
3727
  [a.baseTestnet]: o,
3720
3728
  [a.berachainBartioTestnet]: o,
3721
3729
  [a.corn]: o
3722
- }, vt = {
3730
+ }, St = {
3723
3731
  [a.holesky]: o,
3724
3732
  [a.sepolia]: o,
3725
3733
  [a.ethereum]: "0xc750eCAC7250E0D18ecE2C7a5F130E3A765dc260",
@@ -3730,64 +3738,64 @@ const Et = {
3730
3738
  [a.berachainBartioTestnet]: o,
3731
3739
  [a.corn]: o
3732
3740
  };
3733
- function Rt(e = _) {
3741
+ function It(e = x) {
3734
3742
  switch (e) {
3735
- case c.prod:
3736
- return vt;
3737
- case c.testnet:
3738
- return At;
3743
+ case d.prod:
3744
+ return St;
3745
+ case d.testnet:
3746
+ return Ct;
3739
3747
  default:
3740
- return Et;
3748
+ return Rt;
3741
3749
  }
3742
3750
  }
3743
- function Ct(e, t) {
3744
- const n = Rt(t), { chainId: s } = e;
3751
+ function _t(e, t) {
3752
+ const n = It(t), { chainId: s } = e;
3745
3753
  if (!ee(s))
3746
3754
  throw new Error(`This chain ${s} is not supported`);
3747
3755
  const i = n[s];
3748
3756
  if (!i)
3749
3757
  throw new Error("The address for bascule module is not defined");
3750
- const r = e.createContract(Ke, i);
3758
+ const r = e.createContract(et, i);
3751
3759
  return r.options.address || (r.options.address = i), r;
3752
3760
  }
3753
- const St = "No deposit ID provided. Please provide a deposit ID as an argument.", It = "Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";
3754
- var _t = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(_t || {});
3755
- async function Xt({
3761
+ const xt = "No deposit ID provided. Please provide a deposit ID as an argument.", Dt = "Invalid deposit ID. Expected a 0x-prefixed 32-byte hex string.";
3762
+ var Mt = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(Mt || {});
3763
+ async function Qt({
3756
3764
  txId: e,
3757
3765
  env: t,
3758
3766
  ...n
3759
3767
  }) {
3760
3768
  if (!e)
3761
- throw new Error(St);
3762
- if (!wt(e))
3763
- throw new Error(It);
3764
- const s = new I(n), i = Ct(s, t);
3769
+ throw new Error(xt);
3770
+ if (!vt(e))
3771
+ throw new Error(Dt);
3772
+ const s = new _(n), i = _t(s, t);
3765
3773
  try {
3766
3774
  const r = await i.methods.depositHistory(Buffer.from(e.replace(/^0x/, ""), "hex")).call();
3767
3775
  return Number(r);
3768
3776
  } catch (r) {
3769
- const p = S(r);
3777
+ const p = I(r);
3770
3778
  throw new Error(p);
3771
3779
  }
3772
3780
  }
3773
- const me = (e) => e in [a.ethereum, a.base, a.binanceSmartChain] ? c.prod : c.stage;
3781
+ const me = (e) => e in [a.ethereum, a.base, a.binanceSmartChain] ? d.prod : d.stage;
3774
3782
  function be(e, t) {
3775
3783
  if (!ee(e))
3776
3784
  throw new Error(`This chain ${e} is not supported`);
3777
- const n = t ? { [e]: t } : N;
3785
+ const n = t ? { [e]: t } : P;
3778
3786
  if (!n[e])
3779
3787
  throw new Error(`RPC URL for chainId ${e} not found`);
3780
3788
  return n;
3781
3789
  }
3782
- async function Kt({
3790
+ async function en({
3783
3791
  chainId: e,
3784
3792
  bakeGasEstimate: t = 0,
3785
3793
  rpcUrl: n
3786
3794
  }) {
3787
- const s = be(e, n), i = new q({ chainId: e, rpcUrlConfig: s }), r = me(e), u = await E(i, r).methods.getMintFee().call(), d = new v(X(u.toString(10)));
3788
- return t ? d.plus(X(t)) : d;
3795
+ const s = be(e, n), i = new q({ chainId: e, rpcUrlConfig: s }), r = me(e), u = await E(i, r).methods.getMintFee().call(), y = new R(K(u.toString(10)));
3796
+ return t ? y.plus(K(t)) : y;
3789
3797
  }
3790
- async function Yt({
3798
+ async function tn({
3791
3799
  env: e,
3792
3800
  rpcUrl: t,
3793
3801
  chainId: n
@@ -3795,7 +3803,7 @@ async function Yt({
3795
3803
  const s = { [n]: t }, i = new q({ chainId: n, rpcUrlConfig: s });
3796
3804
  return (await E(i, e).methods.totalSupply().call()).toString();
3797
3805
  }
3798
- async function Qt({
3806
+ async function nn({
3799
3807
  owner: e,
3800
3808
  rpcUrl: t,
3801
3809
  chainId: n
@@ -3804,8 +3812,8 @@ async function Qt({
3804
3812
  try {
3805
3813
  return (await p.methods.nonces(e).call()).toString();
3806
3814
  } catch (u) {
3807
- const d = S(u);
3808
- throw new Error(d);
3815
+ const y = I(u);
3816
+ throw new Error(y);
3809
3817
  }
3810
3818
  }
3811
3819
  const te = {
@@ -3813,29 +3821,29 @@ const te = {
3813
3821
  [a.berachainBartioTestnet]: "0x1977013acaf27856ac8048C42EE2ed0134d53895",
3814
3822
  [a.corn]: o,
3815
3823
  [a.ethereum]: o
3816
- }, xt = {
3824
+ }, Nt = {
3817
3825
  ...te
3818
- }, Dt = {
3826
+ }, Pt = {
3819
3827
  ...te,
3820
3828
  [a.corn]: "0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A",
3821
3829
  [a.ethereum]: "0x6bc15d7930839ec18a57f6f7df72ae1b439d077f"
3822
3830
  };
3823
- function en(e = _) {
3831
+ function an(e = x) {
3824
3832
  switch (e) {
3825
- case c.prod:
3826
- return Dt;
3827
- case c.testnet:
3828
- return xt;
3833
+ case d.prod:
3834
+ return Pt;
3835
+ case d.testnet:
3836
+ return Nt;
3829
3837
  default:
3830
3838
  return te;
3831
3839
  }
3832
3840
  }
3833
- async function tn(e) {
3834
- const t = new I(e), n = `destination chain id is ${e.chainId}`;
3841
+ async function sn(e) {
3842
+ const t = new _(e), n = `destination chain id is ${e.chainId}`;
3835
3843
  return t.signMessage(n);
3836
3844
  }
3837
- const Mt = 24 * 60 * 60;
3838
- function Nt({
3845
+ const Ot = 24 * 60 * 60;
3846
+ function Ut({
3839
3847
  chainId: e,
3840
3848
  verifyingContract: t,
3841
3849
  fee: n,
@@ -3869,73 +3877,73 @@ function Nt({
3869
3877
  }
3870
3878
  };
3871
3879
  }
3872
- const Pt = "Failed to obtain a valid signature. The response is undefined or invalid.";
3873
- async function nn({
3880
+ const Ft = "Failed to obtain a valid signature. The response is undefined or invalid.";
3881
+ async function rn({
3874
3882
  address: e,
3875
3883
  provider: t,
3876
3884
  fee: n,
3877
3885
  chainId: s,
3878
3886
  env: i,
3879
- expiry: r = Date.now() + Mt
3887
+ expiry: r = Date.now() + Ot
3880
3888
  }) {
3881
- var g, x;
3882
- const p = new I({
3889
+ var g, D;
3890
+ const p = new _({
3883
3891
  provider: t,
3884
3892
  account: e,
3885
3893
  chainId: s
3886
- }), d = E(p, i).options.address, h = JSON.stringify(
3887
- Nt({
3894
+ }), y = E(p, i).options.address, h = JSON.stringify(
3895
+ Ut({
3888
3896
  chainId: s,
3889
- verifyingContract: d,
3897
+ verifyingContract: y,
3890
3898
  fee: n,
3891
3899
  expiry: r.toString()
3892
3900
  })
3893
- ), l = await ((x = (g = p.web3) == null ? void 0 : g.currentProvider) == null ? void 0 : x.request({
3901
+ ), l = await ((D = (g = p.web3) == null ? void 0 : g.currentProvider) == null ? void 0 : D.request({
3894
3902
  method: "eth_signTypedData_v4",
3895
3903
  params: [e, h]
3896
3904
  }));
3897
3905
  if (typeof l == "string")
3898
3906
  return { signature: l, typedData: h };
3899
3907
  if (!(l != null && l.result))
3900
- throw new Error(Pt);
3908
+ throw new Error(Ft);
3901
3909
  return { signature: l.result, typedData: h };
3902
3910
  }
3903
3911
  Ee(we);
3904
- function Ot(e, t = c.prod) {
3912
+ function Bt(e, t = d.prod) {
3905
3913
  var r;
3906
- const n = Ut(e), i = (r = Ae[n]({
3914
+ const n = Lt(e), i = (r = Ae[n]({
3907
3915
  address: e,
3908
- network: t === c.prod ? oe.bitcoin : oe.testnet
3916
+ network: t === d.prod ? oe.bitcoin : oe.testnet
3909
3917
  }).output) == null ? void 0 : r.toString("hex");
3910
3918
  if (!i)
3911
3919
  throw new Error("Output script is not found.");
3912
3920
  return `0x${i}`;
3913
3921
  }
3914
- function Ut(e) {
3922
+ function Lt(e) {
3915
3923
  const t = ve.fromBech32(e);
3916
3924
  if (t.version === 1 && t.data.length === 32)
3917
3925
  return "p2tr";
3918
3926
  if (t.version === 0 && t.data.length === 20)
3919
3927
  return "p2wpkh";
3920
- if (Ft(e))
3928
+ if (kt(e))
3921
3929
  return "p2wsh";
3922
3930
  throw new Error("Address type is not supported.");
3923
3931
  }
3924
- function Ft(e) {
3932
+ function kt(e) {
3925
3933
  return (e.startsWith("bc1") || e.startsWith("tb1")) && e.length === 62;
3926
3934
  }
3927
- function an({
3935
+ function on({
3928
3936
  btcAddress: e,
3929
3937
  amount: t,
3930
3938
  env: n,
3931
3939
  ...s
3932
3940
  }) {
3933
- const i = new I(s), r = E(i, n), p = Ot(e, n), u = ce(t), d = r.methods.redeem(p, u);
3941
+ const i = new _(s), r = E(i, n), p = Bt(e, n), u = ce(t), y = r.methods.redeem(p, u);
3934
3942
  return i.sendTransactionAsync(
3935
3943
  i.account,
3936
3944
  r.options.address,
3937
3945
  {
3938
- data: d.encodeABI(),
3946
+ data: y.encodeABI(),
3939
3947
  estimate: !0,
3940
3948
  estimateFee: !0,
3941
3949
  gasLimitMultiplier: Q(i.chainId)
@@ -3943,34 +3951,39 @@ function an({
3943
3951
  );
3944
3952
  }
3945
3953
  export {
3946
- _t as BasculeDepositStatus,
3947
- Le as ENotarizationStatus,
3948
- Ge as ESessionState,
3954
+ Mt as BasculeDepositStatus,
3955
+ We as ENotarizationStatus,
3956
+ Ve as ESessionState,
3949
3957
  a as OChainId,
3950
- c as OEnv,
3951
- xe as SANCTIONED_ADDRESS,
3958
+ d as OEnv,
3959
+ Ne as SANCTIONED_ADDRESS,
3952
3960
  Y as SATOSHI_SCALE,
3953
- Zt as approveLBTC,
3954
- zt as claimLBTC,
3955
- X as fromSatoshi,
3956
- Vt as generateDepositBtcAddress,
3957
- C as getApiConfig,
3958
- Xt as getBasculeDepositStatus,
3959
- $t as getDepositBtcAddress,
3960
- Ue as getDepositBtcAddresses,
3961
- Ht as getDepositsByAddress,
3962
- Jt as getLBTCExchangeRate,
3963
- Kt as getLBTCMintingFee,
3964
- Yt as getLBTCTotalSupply,
3965
- Ze as getLbtcAddressConfig,
3966
- en as getLbtcOFTAdapterAddressConfig,
3967
- jt as getNetworkFeeSignature,
3968
- Qt as getPermitNonce,
3961
+ Xt as approveLBTC,
3962
+ Yt as claimLBTC,
3963
+ K as fromSatoshi,
3964
+ Jt as generateDepositBtcAddress,
3965
+ S as getApiConfig,
3966
+ Qt as getBasculeDepositStatus,
3967
+ Se as getBaseNetworkByEnv,
3968
+ Ce as getBscNetworkByEnv,
3969
+ Ge as getChainIdByName,
3970
+ X as getChainNameById,
3971
+ Zt as getDepositBtcAddress,
3972
+ Le as getDepositBtcAddresses,
3973
+ jt as getDepositsByAddress,
3974
+ Re as getEthNetworkByEnv,
3975
+ qt as getLBTCExchangeRate,
3976
+ en as getLBTCMintingFee,
3977
+ tn as getLBTCTotalSupply,
3978
+ Xe as getLbtcAddressConfig,
3979
+ an as getLbtcOFTAdapterAddressConfig,
3980
+ zt as getNetworkFeeSignature,
3981
+ nn as getPermitNonce,
3969
3982
  ee as isValidChain,
3970
- tn as signLbtcDestionationAddr,
3971
- nn as signNetworkFee,
3972
- qt as storeNetworkFeeSignature,
3983
+ sn as signLbtcDestionationAddr,
3984
+ rn as signNetworkFee,
3985
+ Kt as storeNetworkFeeSignature,
3973
3986
  ce as toSatoshi,
3974
- an as unstakeLBTC
3987
+ on as unstakeLBTC
3975
3988
  };
3976
3989
  //# sourceMappingURL=index.js.map