@lombard.finance/sdk 2.0.2 → 2.0.4

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,11 +261,11 @@ 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",
@@ -267,7 +273,7 @@ const N = {
267
273
  [a.baseTestnet]: "https://rpc.ankr.com/base_sepolia",
268
274
  [a.binanceSmartChain]: "https://rpc.ankr.com/bsc"
269
275
  };
270
- async function Ve(e) {
276
+ async function Je(e) {
271
277
  const n = await (await fetch(e, {
272
278
  method: "POST",
273
279
  headers: {
@@ -280,14 +286,14 @@ async function Ve(e) {
280
286
  params: []
281
287
  })
282
288
  })).json(), s = ye.utils.hexToNumber(n == null ? void 0 : n.result);
283
- return new v(Number(s));
289
+ return new R(Number(s));
284
290
  }
285
- const $e = 2, He = 25e3;
291
+ const Ze = 2, je = 25e3;
286
292
  class q {
287
293
  constructor({ chainId: t, rpcUrlConfig: n }) {
288
294
  A(this, "chainId");
289
295
  A(this, "rpcConfig");
290
- this.chainId = t, this.rpcConfig = { ...N, ...n };
296
+ this.chainId = t, this.rpcConfig = { ...P, ...n };
291
297
  }
292
298
  /**
293
299
  * Returns web3 instance for read operations.
@@ -324,10 +330,10 @@ class q {
324
330
  async getMaxFees() {
325
331
  const t = this.getReadWeb3(), n = this.getRpcUrl(), [s, i] = await Promise.all([
326
332
  t.eth.getBlock("latest"),
327
- Ve(n)
333
+ Je(n)
328
334
  ]);
329
335
  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),
336
+ maxFeePerGas: +new R(s.baseFeePerGas.toString(10)).multipliedBy(Ze).plus(i),
331
337
  maxPriorityFeePerGas: +i
332
338
  };
333
339
  }
@@ -339,8 +345,8 @@ class q {
339
345
  */
340
346
  async getSafeGasPriceWei() {
341
347
  const t = await this.getReadWeb3().eth.getGasPrice();
342
- return new v(t.toString(10)).plus(
343
- He
348
+ return new R(t.toString(10)).plus(
349
+ je
344
350
  );
345
351
  }
346
352
  /**
@@ -356,13 +362,13 @@ class q {
356
362
  return new s.eth.Contract(t, n);
357
363
  }
358
364
  }
359
- class I extends q {
365
+ class _ extends q {
360
366
  constructor({ provider: n, account: s, chainId: i, rpcUrlConfig: r }) {
361
367
  super({ chainId: i, rpcUrlConfig: r });
362
368
  A(this, "web3");
363
369
  A(this, "account");
364
- A(this, "rpcConfig", N);
365
- this.web3 = new ye(n), this.account = s, this.chainId = i, this.rpcConfig = { ...N, ...r };
370
+ A(this, "rpcConfig", P);
371
+ this.web3 = new ye(n), this.account = s, this.chainId = i, this.rpcConfig = { ...P, ...r };
366
372
  }
367
373
  /**
368
374
  * Signs a message using the current provider and account.
@@ -388,54 +394,54 @@ class I extends q {
388
394
  */
389
395
  async sendTransactionAsync(n, s, i) {
390
396
  const { chainId: r, web3: p } = this, u = this.getReadWeb3(), {
391
- data: d,
397
+ data: y,
392
398
  estimate: h = !1,
393
399
  estimateFee: l = !1,
394
400
  extendedGasLimit: g,
395
- gasLimit: x = "0",
401
+ gasLimit: D = "0",
396
402
  value: fe = "0",
397
403
  gasLimitMultiplier: Te = 1
398
404
  } = i;
399
- let { nonce: D } = i;
400
- D || (D = await u.eth.getTransactionCount(n)), console.log(`Nonce: ${D}`);
401
- const y = {
405
+ let { nonce: M } = i;
406
+ M || (M = await u.eth.getTransactionCount(n)), console.log(`Nonce: ${M}`);
407
+ const c = {
402
408
  from: n,
403
409
  to: s,
404
410
  value: w.numberToHex(fe),
405
- data: d,
406
- nonce: D,
411
+ data: y,
412
+ nonce: M,
407
413
  chainId: w.numberToHex(r)
408
414
  };
409
415
  if (h)
410
416
  try {
411
- const T = await u.eth.estimateGas(y), M = Math.round(
417
+ const T = await u.eth.estimateGas(c), N = Math.round(
412
418
  Number(T) * Te
413
419
  );
414
- g ? y.gas = w.numberToHex(M + g) : y.gas = w.numberToHex(M);
420
+ g ? c.gas = w.numberToHex(N + g) : c.gas = w.numberToHex(N);
415
421
  } catch (T) {
416
422
  throw new Error(
417
423
  T.message ?? "Failed to estimate gas limit for transaction."
418
424
  );
419
425
  }
420
426
  else
421
- y.gas = w.numberToHex(x);
427
+ c.gas = w.numberToHex(D);
422
428
  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) {
429
+ if (ae !== void 0 && (c.maxPriorityFeePerGas = w.numberToHex(ae)), ne !== void 0 && (c.maxFeePerGas = w.numberToHex(ne)), !c.maxFeePerGas && !c.maxPriorityFeePerGas) {
424
430
  const T = await this.getSafeGasPriceWei();
425
- y.gasPrice = T.toString(10);
431
+ c.gasPrice = T.toString(10);
426
432
  }
427
- if (!y.maxFeePerGas && !y.maxPriorityFeePerGas) {
433
+ if (!c.maxFeePerGas && !c.maxPriorityFeePerGas) {
428
434
  const T = await this.getSafeGasPriceWei();
429
- y.gasPrice = T.toString(10);
435
+ c.gasPrice = T.toString(10);
430
436
  }
431
- return console.log("Sending transaction via Web3: ", y), new Promise((T, M) => {
432
- const se = p.eth.sendTransaction(y);
437
+ return console.log("Sending transaction via Web3: ", c), new Promise((T, N) => {
438
+ const se = p.eth.sendTransaction(c);
433
439
  se.once("transactionHash", async (ie) => {
434
440
  console.log(`Just signed transaction has is: ${ie}`), T({
435
441
  receiptPromise: se,
436
442
  transactionHash: ie
437
443
  });
438
- }).catch(M);
444
+ }).catch(N);
439
445
  });
440
446
  }
441
447
  createContract(n, s) {
@@ -456,7 +462,7 @@ function Q(e) {
456
462
  function ee(e) {
457
463
  return Object.values(a).includes(e);
458
464
  }
459
- const Je = {
465
+ const qe = {
460
466
  [a.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
461
467
  [a.ethereum]: o,
462
468
  [a.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
@@ -467,7 +473,7 @@ const Je = {
467
473
  [a.baseTestnet]: o,
468
474
  [a.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
469
475
  [a.corn]: o
470
- }, je = {
476
+ }, ze = {
471
477
  [a.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
472
478
  [a.ethereum]: o,
473
479
  [a.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
@@ -477,7 +483,7 @@ const Je = {
477
483
  [a.baseTestnet]: o,
478
484
  [a.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
479
485
  [a.corn]: o
480
- }, qe = {
486
+ }, Ke = {
481
487
  [a.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
482
488
  [a.holesky]: o,
483
489
  [a.sepolia]: o,
@@ -488,17 +494,17 @@ const Je = {
488
494
  [a.berachainBartioTestnet]: o,
489
495
  [a.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
490
496
  };
491
- function Ze(e = _) {
497
+ function Xe(e = x) {
492
498
  switch (e) {
493
- case c.prod:
494
- return qe;
495
- case c.testnet:
496
- return je;
499
+ case d.prod:
500
+ return Ke;
501
+ case d.testnet:
502
+ return ze;
497
503
  default:
498
- return Je;
504
+ return qe;
499
505
  }
500
506
  }
501
- const ze = [
507
+ const Ye = [
502
508
  {
503
509
  constant: !0,
504
510
  inputs: [],
@@ -719,7 +725,7 @@ const ze = [
719
725
  name: "Transfer",
720
726
  type: "event"
721
727
  }
722
- ], Xe = [
728
+ ], Qe = [
723
729
  {
724
730
  inputs: [],
725
731
  stateMutability: "nonpayable",
@@ -2479,7 +2485,7 @@ const ze = [
2479
2485
  stateMutability: "nonpayable",
2480
2486
  type: "function"
2481
2487
  }
2482
- ], Ke = [
2488
+ ], et = [
2483
2489
  {
2484
2490
  inputs: [
2485
2491
  {
@@ -3329,31 +3335,31 @@ const ze = [
3329
3335
  type: "function"
3330
3336
  }
3331
3337
  ];
3332
- function Ye(e) {
3338
+ function tt(e) {
3333
3339
  switch (e) {
3334
3340
  case "LBTC":
3335
- return Xe;
3341
+ return Qe;
3336
3342
  default:
3337
- return ze;
3343
+ return Ye;
3338
3344
  }
3339
3345
  }
3340
3346
  function E(e, t) {
3341
- const n = Ze(t), { chainId: s } = e;
3347
+ const n = Xe(t), { chainId: s } = e;
3342
3348
  if (!ee(s))
3343
3349
  throw new Error(`This chain ${s} is not supported`);
3344
3350
  const i = n[s];
3345
3351
  if (!i)
3346
3352
  throw new Error(`Token address for chain ${s} is not defined`);
3347
- const r = Ye("LBTC"), p = e.createContract(r, i);
3353
+ const r = tt("LBTC"), p = e.createContract(r, i);
3348
3354
  return p.options.address || (p.options.address = i), p;
3349
3355
  }
3350
- function Zt({
3356
+ function Xt({
3351
3357
  spender: e,
3352
3358
  amount: t,
3353
3359
  env: n,
3354
3360
  ...s
3355
3361
  }) {
3356
- const i = new I(s), r = E(i, n), p = ce(t), u = r.methods.approve(e, p);
3362
+ const i = new _(s), r = E(i, n), p = ce(t), u = r.methods.approve(e, p);
3357
3363
  return i.sendTransactionAsync(
3358
3364
  i.account,
3359
3365
  r.options.address,
@@ -3365,14 +3371,14 @@ function Zt({
3365
3371
  }
3366
3372
  );
3367
3373
  }
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({
3374
+ 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;
3375
+ async function Yt({
3370
3376
  data: e,
3371
3377
  proofSignature: t,
3372
3378
  env: n,
3373
3379
  ...s
3374
3380
  }) {
3375
- const i = new I(s), r = E(i, n), p = r.methods.mint(pe(e), pe(t));
3381
+ const i = new _(s), r = E(i, n), p = r.methods.mint(pe(e), pe(t));
3376
3382
  try {
3377
3383
  return await i.sendTransactionAsync(
3378
3384
  i.account,
@@ -3386,11 +3392,11 @@ async function zt({
3386
3392
  );
3387
3393
  } catch (u) {
3388
3394
  console.log("error", u);
3389
- const d = S(u);
3390
- throw d.includes(Qe) ? new Error(et) : new Error(d);
3395
+ const y = I(u);
3396
+ throw y.includes(nt) ? new Error(at) : new Error(y);
3391
3397
  }
3392
3398
  }
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;
3399
+ 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
3400
  class le extends Error {
3395
3401
  constructor(t, n) {
3396
3402
  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 +3432,33 @@ class le extends Error {
3426
3432
  }
3427
3433
  class z extends le {
3428
3434
  constructor(t) {
3429
- super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = tt, this.errors = t;
3435
+ super(`Multiple errors occurred: [${t.map((n) => n.message).join("], [")}]`), this.code = st, this.errors = t;
3430
3436
  }
3431
3437
  }
3432
- const ot = "An Rpc error has occured with a code of *code*", m = {
3438
+ const dt = "An Rpc error has occured with a code of *code*", m = {
3433
3439
  // EIP-1474 & JSON RPC 2.0
3434
3440
  // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1474.md
3435
- [P]: {
3441
+ [O]: {
3436
3442
  message: "Parse error",
3437
3443
  description: "Invalid JSON"
3438
3444
  },
3439
- [O]: {
3445
+ [U]: {
3440
3446
  message: "Invalid request",
3441
3447
  description: "JSON is not a valid request object "
3442
3448
  },
3443
- [U]: {
3449
+ [F]: {
3444
3450
  message: "Method not found",
3445
3451
  description: "Method does not exist "
3446
3452
  },
3447
- [F]: {
3453
+ [B]: {
3448
3454
  message: "Invalid params",
3449
3455
  description: "Invalid method parameters"
3450
3456
  },
3451
- [B]: {
3457
+ [L]: {
3452
3458
  message: "Internal error",
3453
3459
  description: "Internal JSON-RPC error"
3454
3460
  },
3455
- [L]: {
3461
+ [k]: {
3456
3462
  message: "Invalid input",
3457
3463
  description: "Missing or invalid parameters"
3458
3464
  },
@@ -3460,45 +3466,45 @@ const ot = "An Rpc error has occured with a code of *code*", m = {
3460
3466
  message: "Resource not found",
3461
3467
  description: "Requested resource not found"
3462
3468
  },
3463
- [k]: {
3469
+ [W]: {
3464
3470
  message: "Resource unavailable",
3465
3471
  description: "Requested resource not available"
3466
3472
  },
3467
- [W]: {
3473
+ [V]: {
3468
3474
  message: "Transaction rejected",
3469
3475
  description: "Transaction creation failed"
3470
3476
  },
3471
- [V]: {
3477
+ [$]: {
3472
3478
  message: "Method not supported",
3473
3479
  description: "Method is not implemented"
3474
3480
  },
3475
- [$]: {
3481
+ [H]: {
3476
3482
  message: "Limit exceeded",
3477
3483
  description: "Request exceeds defined limit"
3478
3484
  },
3479
- [H]: {
3485
+ [J]: {
3480
3486
  message: "JSON-RPC version not supported",
3481
3487
  description: "Version of JSON-RPC protocol is not supported"
3482
3488
  },
3483
3489
  // EIP-1193
3484
3490
  // https://github.com/ethereum/EIPs/blob/master/EIPS/eip-1193.md#provider-errors
3485
- [nt]: {
3491
+ [it]: {
3486
3492
  name: "User Rejected Request",
3487
3493
  message: "The user rejected the request."
3488
3494
  },
3489
- [at]: {
3495
+ [rt]: {
3490
3496
  name: "Unauthorized",
3491
3497
  message: "The requested method and/or account has not been authorized by the user."
3492
3498
  },
3493
- [st]: {
3499
+ [ot]: {
3494
3500
  name: "Unsupported Method",
3495
3501
  message: "The Provider does not support the requested method."
3496
3502
  },
3497
- [it]: {
3503
+ [pt]: {
3498
3504
  name: "Disconnected",
3499
3505
  message: "The Provider is disconnected from all chains."
3500
3506
  },
3501
- [rt]: {
3507
+ [ut]: {
3502
3508
  name: "Chain Disconnected",
3503
3509
  message: "The Provider is not connected to the requested chain."
3504
3510
  },
@@ -3587,110 +3593,110 @@ const ot = "An Rpc error has occured with a code of *code*", m = {
3587
3593
  };
3588
3594
  class b extends le {
3589
3595
  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;
3596
+ 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
3597
  }
3592
3598
  toJSON() {
3593
3599
  return Object.assign(Object.assign({}, super.toJSON()), { error: this.jsonRpcError, id: this.id, jsonRpc: this.jsonrpc });
3594
3600
  }
3595
3601
  }
3596
- class pt extends b {
3597
- constructor(t) {
3598
- super(t, m[P].message), this.code = P;
3599
- }
3600
- }
3601
- class ut extends b {
3602
+ class yt extends b {
3602
3603
  constructor(t) {
3603
3604
  super(t, m[O].message), this.code = O;
3604
3605
  }
3605
3606
  }
3606
- class dt extends b {
3607
+ class ct extends b {
3607
3608
  constructor(t) {
3608
3609
  super(t, m[U].message), this.code = U;
3609
3610
  }
3610
3611
  }
3611
- class yt extends b {
3612
+ class lt extends b {
3612
3613
  constructor(t) {
3613
3614
  super(t, m[F].message), this.code = F;
3614
3615
  }
3615
3616
  }
3616
- class ct extends b {
3617
+ class mt extends b {
3617
3618
  constructor(t) {
3618
3619
  super(t, m[B].message), this.code = B;
3619
3620
  }
3620
3621
  }
3621
- class lt extends b {
3622
+ class bt extends b {
3622
3623
  constructor(t) {
3623
3624
  super(t, m[L].message), this.code = L;
3624
3625
  }
3625
3626
  }
3626
- class mt extends b {
3627
+ class ft extends b {
3627
3628
  constructor(t) {
3628
- super(t, m[V].message), this.code = V;
3629
+ super(t, m[k].message), this.code = k;
3629
3630
  }
3630
3631
  }
3631
- class bt extends b {
3632
+ class Tt extends b {
3632
3633
  constructor(t) {
3633
- super(t, m[k].message), this.code = k;
3634
+ super(t, m[$].message), this.code = $;
3634
3635
  }
3635
3636
  }
3636
- class ft extends b {
3637
+ class ht extends b {
3638
+ constructor(t) {
3639
+ super(t, m[W].message), this.code = W;
3640
+ }
3641
+ }
3642
+ class gt extends b {
3637
3643
  constructor(t) {
3638
3644
  super(t, m[G].message), this.code = G;
3639
3645
  }
3640
3646
  }
3641
- class Tt extends b {
3647
+ class wt extends b {
3642
3648
  constructor(t) {
3643
- super(t, m[H].message), this.code = H;
3649
+ super(t, m[J].message), this.code = J;
3644
3650
  }
3645
3651
  }
3646
- class ht extends b {
3652
+ class Et extends b {
3647
3653
  constructor(t) {
3648
- super(t, m[W].message), this.code = W;
3654
+ super(t, m[V].message), this.code = V;
3649
3655
  }
3650
3656
  }
3651
- class gt extends b {
3657
+ class At extends b {
3652
3658
  constructor(t) {
3653
- super(t, m[$].message), this.code = $;
3659
+ super(t, m[H].message), this.code = H;
3654
3660
  }
3655
3661
  }
3656
3662
  const f = /* @__PURE__ */ new Map();
3657
- f.set(P, { error: pt });
3658
- f.set(O, {
3659
- error: ut
3660
- });
3663
+ f.set(O, { error: yt });
3661
3664
  f.set(U, {
3662
- error: dt
3665
+ error: ct
3663
3666
  });
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
3667
+ f.set(F, {
3668
+ error: lt
3669
3669
  });
3670
- f.set(k, {
3671
- error: bt
3670
+ f.set(B, { error: mt });
3671
+ f.set(L, { error: bt });
3672
+ f.set(k, { error: ft });
3673
+ f.set($, {
3674
+ error: Tt
3672
3675
  });
3673
3676
  f.set(W, {
3674
3677
  error: ht
3675
3678
  });
3679
+ f.set(V, {
3680
+ error: Et
3681
+ });
3676
3682
  f.set(G, {
3677
- error: ft
3683
+ error: gt
3678
3684
  });
3679
- f.set(H, {
3680
- error: Tt
3685
+ f.set(J, {
3686
+ error: wt
3681
3687
  });
3682
- f.set($, { error: gt });
3683
- const wt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
3684
- var J;
3688
+ f.set(H, { error: At });
3689
+ const vt = (e) => typeof e == "string" && /^((-)?0x[0-9a-f]+|(0x))$/i.test(e);
3690
+ var Z;
3685
3691
  (function(e) {
3686
3692
  e.NUMBER = "NUMBER_NUMBER", e.HEX = "NUMBER_HEX", e.STR = "NUMBER_STR", e.BIGINT = "NUMBER_BIGINT";
3687
- })(J || (J = {}));
3693
+ })(Z || (Z = {}));
3688
3694
  var j;
3689
3695
  (function(e) {
3690
3696
  e.HEX = "BYTES_HEX", e.UINT8ARRAY = "BYTES_UINT8ARRAY";
3691
3697
  })(j || (j = {}));
3692
- J.BIGINT, j.HEX;
3693
- J.HEX, j.HEX;
3698
+ Z.BIGINT, j.HEX;
3699
+ Z.HEX, j.HEX;
3694
3700
  var ue;
3695
3701
  (function(e) {
3696
3702
  e.EARLIEST = "earliest", e.LATEST = "latest", e.PENDING = "pending", e.SAFE = "safe", e.FINALIZED = "finalized";
@@ -3699,7 +3705,7 @@ var de;
3699
3705
  (function(e) {
3700
3706
  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
3707
  })(de || (de = {}));
3702
- const Et = {
3708
+ const Rt = {
3703
3709
  [a.holesky]: "0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",
3704
3710
  [a.sepolia]: o,
3705
3711
  [a.ethereum]: o,
@@ -3709,7 +3715,7 @@ const Et = {
3709
3715
  [a.baseTestnet]: o,
3710
3716
  [a.berachainBartioTestnet]: o,
3711
3717
  [a.corn]: o
3712
- }, At = {
3718
+ }, Ct = {
3713
3719
  [a.holesky]: "0x3a0c40c84b5034ed9a98a9a47a02af2b0885246f",
3714
3720
  [a.sepolia]: o,
3715
3721
  [a.ethereum]: o,
@@ -3719,7 +3725,7 @@ const Et = {
3719
3725
  [a.baseTestnet]: o,
3720
3726
  [a.berachainBartioTestnet]: o,
3721
3727
  [a.corn]: o
3722
- }, vt = {
3728
+ }, St = {
3723
3729
  [a.holesky]: o,
3724
3730
  [a.sepolia]: o,
3725
3731
  [a.ethereum]: "0xc750eCAC7250E0D18ecE2C7a5F130E3A765dc260",
@@ -3730,64 +3736,64 @@ const Et = {
3730
3736
  [a.berachainBartioTestnet]: o,
3731
3737
  [a.corn]: o
3732
3738
  };
3733
- function Rt(e = _) {
3739
+ function It(e = x) {
3734
3740
  switch (e) {
3735
- case c.prod:
3736
- return vt;
3737
- case c.testnet:
3738
- return At;
3741
+ case d.prod:
3742
+ return St;
3743
+ case d.testnet:
3744
+ return Ct;
3739
3745
  default:
3740
- return Et;
3746
+ return Rt;
3741
3747
  }
3742
3748
  }
3743
- function Ct(e, t) {
3744
- const n = Rt(t), { chainId: s } = e;
3749
+ function _t(e, t) {
3750
+ const n = It(t), { chainId: s } = e;
3745
3751
  if (!ee(s))
3746
3752
  throw new Error(`This chain ${s} is not supported`);
3747
3753
  const i = n[s];
3748
3754
  if (!i)
3749
3755
  throw new Error("The address for bascule module is not defined");
3750
- const r = e.createContract(Ke, i);
3756
+ const r = e.createContract(et, i);
3751
3757
  return r.options.address || (r.options.address = i), r;
3752
3758
  }
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({
3759
+ 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.";
3760
+ var Mt = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(Mt || {});
3761
+ async function Qt({
3756
3762
  txId: e,
3757
3763
  env: t,
3758
3764
  ...n
3759
3765
  }) {
3760
3766
  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);
3767
+ throw new Error(xt);
3768
+ if (!vt(e))
3769
+ throw new Error(Dt);
3770
+ const s = new _(n), i = _t(s, t);
3765
3771
  try {
3766
3772
  const r = await i.methods.depositHistory(Buffer.from(e.replace(/^0x/, ""), "hex")).call();
3767
3773
  return Number(r);
3768
3774
  } catch (r) {
3769
- const p = S(r);
3775
+ const p = I(r);
3770
3776
  throw new Error(p);
3771
3777
  }
3772
3778
  }
3773
- const me = (e) => e in [a.ethereum, a.base, a.binanceSmartChain] ? c.prod : c.stage;
3779
+ const me = (e) => e in [a.ethereum, a.base, a.binanceSmartChain] ? d.prod : d.stage;
3774
3780
  function be(e, t) {
3775
3781
  if (!ee(e))
3776
3782
  throw new Error(`This chain ${e} is not supported`);
3777
- const n = t ? { [e]: t } : N;
3783
+ const n = t ? { [e]: t } : P;
3778
3784
  if (!n[e])
3779
3785
  throw new Error(`RPC URL for chainId ${e} not found`);
3780
3786
  return n;
3781
3787
  }
3782
- async function Kt({
3788
+ async function en({
3783
3789
  chainId: e,
3784
3790
  bakeGasEstimate: t = 0,
3785
3791
  rpcUrl: n
3786
3792
  }) {
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;
3793
+ 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)));
3794
+ return t ? y.plus(K(t)) : y;
3789
3795
  }
3790
- async function Yt({
3796
+ async function tn({
3791
3797
  env: e,
3792
3798
  rpcUrl: t,
3793
3799
  chainId: n
@@ -3795,7 +3801,7 @@ async function Yt({
3795
3801
  const s = { [n]: t }, i = new q({ chainId: n, rpcUrlConfig: s });
3796
3802
  return (await E(i, e).methods.totalSupply().call()).toString();
3797
3803
  }
3798
- async function Qt({
3804
+ async function nn({
3799
3805
  owner: e,
3800
3806
  rpcUrl: t,
3801
3807
  chainId: n
@@ -3804,8 +3810,8 @@ async function Qt({
3804
3810
  try {
3805
3811
  return (await p.methods.nonces(e).call()).toString();
3806
3812
  } catch (u) {
3807
- const d = S(u);
3808
- throw new Error(d);
3813
+ const y = I(u);
3814
+ throw new Error(y);
3809
3815
  }
3810
3816
  }
3811
3817
  const te = {
@@ -3813,29 +3819,29 @@ const te = {
3813
3819
  [a.berachainBartioTestnet]: "0x1977013acaf27856ac8048C42EE2ed0134d53895",
3814
3820
  [a.corn]: o,
3815
3821
  [a.ethereum]: o
3816
- }, xt = {
3822
+ }, Nt = {
3817
3823
  ...te
3818
- }, Dt = {
3824
+ }, Pt = {
3819
3825
  ...te,
3820
3826
  [a.corn]: "0xfc7B20D9B59A8A466f4fC3d34aA69a7D98e71d7A",
3821
3827
  [a.ethereum]: "0x6bc15d7930839ec18a57f6f7df72ae1b439d077f"
3822
3828
  };
3823
- function en(e = _) {
3829
+ function an(e = x) {
3824
3830
  switch (e) {
3825
- case c.prod:
3826
- return Dt;
3827
- case c.testnet:
3828
- return xt;
3831
+ case d.prod:
3832
+ return Pt;
3833
+ case d.testnet:
3834
+ return Nt;
3829
3835
  default:
3830
3836
  return te;
3831
3837
  }
3832
3838
  }
3833
- async function tn(e) {
3834
- const t = new I(e), n = `destination chain id is ${e.chainId}`;
3839
+ async function sn(e) {
3840
+ const t = new _(e), n = `destination chain id is ${e.chainId}`;
3835
3841
  return t.signMessage(n);
3836
3842
  }
3837
- const Mt = 24 * 60 * 60;
3838
- function Nt({
3843
+ const Ot = 24 * 60 * 60;
3844
+ function Ut({
3839
3845
  chainId: e,
3840
3846
  verifyingContract: t,
3841
3847
  fee: n,
@@ -3869,73 +3875,73 @@ function Nt({
3869
3875
  }
3870
3876
  };
3871
3877
  }
3872
- const Pt = "Failed to obtain a valid signature. The response is undefined or invalid.";
3873
- async function nn({
3878
+ const Ft = "Failed to obtain a valid signature. The response is undefined or invalid.";
3879
+ async function rn({
3874
3880
  address: e,
3875
3881
  provider: t,
3876
3882
  fee: n,
3877
3883
  chainId: s,
3878
3884
  env: i,
3879
- expiry: r = Date.now() + Mt
3885
+ expiry: r = Date.now() + Ot
3880
3886
  }) {
3881
- var g, x;
3882
- const p = new I({
3887
+ var g, D;
3888
+ const p = new _({
3883
3889
  provider: t,
3884
3890
  account: e,
3885
3891
  chainId: s
3886
- }), d = E(p, i).options.address, h = JSON.stringify(
3887
- Nt({
3892
+ }), y = E(p, i).options.address, h = JSON.stringify(
3893
+ Ut({
3888
3894
  chainId: s,
3889
- verifyingContract: d,
3895
+ verifyingContract: y,
3890
3896
  fee: n,
3891
3897
  expiry: r.toString()
3892
3898
  })
3893
- ), l = await ((x = (g = p.web3) == null ? void 0 : g.currentProvider) == null ? void 0 : x.request({
3899
+ ), l = await ((D = (g = p.web3) == null ? void 0 : g.currentProvider) == null ? void 0 : D.request({
3894
3900
  method: "eth_signTypedData_v4",
3895
3901
  params: [e, h]
3896
3902
  }));
3897
3903
  if (typeof l == "string")
3898
3904
  return { signature: l, typedData: h };
3899
3905
  if (!(l != null && l.result))
3900
- throw new Error(Pt);
3906
+ throw new Error(Ft);
3901
3907
  return { signature: l.result, typedData: h };
3902
3908
  }
3903
3909
  Ee(we);
3904
- function Ot(e, t = c.prod) {
3910
+ function Bt(e, t = d.prod) {
3905
3911
  var r;
3906
- const n = Ut(e), i = (r = Ae[n]({
3912
+ const n = Lt(e), i = (r = Ae[n]({
3907
3913
  address: e,
3908
- network: t === c.prod ? oe.bitcoin : oe.testnet
3914
+ network: t === d.prod ? oe.bitcoin : oe.testnet
3909
3915
  }).output) == null ? void 0 : r.toString("hex");
3910
3916
  if (!i)
3911
3917
  throw new Error("Output script is not found.");
3912
3918
  return `0x${i}`;
3913
3919
  }
3914
- function Ut(e) {
3920
+ function Lt(e) {
3915
3921
  const t = ve.fromBech32(e);
3916
3922
  if (t.version === 1 && t.data.length === 32)
3917
3923
  return "p2tr";
3918
3924
  if (t.version === 0 && t.data.length === 20)
3919
3925
  return "p2wpkh";
3920
- if (Ft(e))
3926
+ if (kt(e))
3921
3927
  return "p2wsh";
3922
3928
  throw new Error("Address type is not supported.");
3923
3929
  }
3924
- function Ft(e) {
3930
+ function kt(e) {
3925
3931
  return (e.startsWith("bc1") || e.startsWith("tb1")) && e.length === 62;
3926
3932
  }
3927
- function an({
3933
+ function on({
3928
3934
  btcAddress: e,
3929
3935
  amount: t,
3930
3936
  env: n,
3931
3937
  ...s
3932
3938
  }) {
3933
- const i = new I(s), r = E(i, n), p = Ot(e, n), u = ce(t), d = r.methods.redeem(p, u);
3939
+ const i = new _(s), r = E(i, n), p = Bt(e, n), u = ce(t), y = r.methods.redeem(p, u);
3934
3940
  return i.sendTransactionAsync(
3935
3941
  i.account,
3936
3942
  r.options.address,
3937
3943
  {
3938
- data: d.encodeABI(),
3944
+ data: y.encodeABI(),
3939
3945
  estimate: !0,
3940
3946
  estimateFee: !0,
3941
3947
  gasLimitMultiplier: Q(i.chainId)
@@ -3943,34 +3949,39 @@ function an({
3943
3949
  );
3944
3950
  }
3945
3951
  export {
3946
- _t as BasculeDepositStatus,
3947
- Le as ENotarizationStatus,
3948
- Ge as ESessionState,
3952
+ Mt as BasculeDepositStatus,
3953
+ We as ENotarizationStatus,
3954
+ Ve as ESessionState,
3949
3955
  a as OChainId,
3950
- c as OEnv,
3951
- xe as SANCTIONED_ADDRESS,
3956
+ d as OEnv,
3957
+ Ne as SANCTIONED_ADDRESS,
3952
3958
  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,
3959
+ Xt as approveLBTC,
3960
+ Yt as claimLBTC,
3961
+ K as fromSatoshi,
3962
+ Jt as generateDepositBtcAddress,
3963
+ S as getApiConfig,
3964
+ Qt as getBasculeDepositStatus,
3965
+ Se as getBaseNetworkByEnv,
3966
+ Ce as getBscNetworkByEnv,
3967
+ Ge as getChainIdByName,
3968
+ X as getChainNameById,
3969
+ Zt as getDepositBtcAddress,
3970
+ Le as getDepositBtcAddresses,
3971
+ jt as getDepositsByAddress,
3972
+ Re as getEthNetworkByEnv,
3973
+ qt as getLBTCExchangeRate,
3974
+ en as getLBTCMintingFee,
3975
+ tn as getLBTCTotalSupply,
3976
+ Xe as getLbtcAddressConfig,
3977
+ an as getLbtcOFTAdapterAddressConfig,
3978
+ zt as getNetworkFeeSignature,
3979
+ nn as getPermitNonce,
3969
3980
  ee as isValidChain,
3970
- tn as signLbtcDestionationAddr,
3971
- nn as signNetworkFee,
3972
- qt as storeNetworkFeeSignature,
3981
+ sn as signLbtcDestionationAddr,
3982
+ rn as signNetworkFee,
3983
+ Kt as storeNetworkFeeSignature,
3973
3984
  ce as toSatoshi,
3974
- an as unstakeLBTC
3985
+ on as unstakeLBTC
3975
3986
  };
3976
3987
  //# sourceMappingURL=index.js.map