@lombard.finance/sdk 2.1.3 → 2.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -18,10 +18,14 @@ const l = {
18
18
  sepolia: 11155111,
19
19
  base: 8453,
20
20
  baseSepoliaTestnet: 84532,
21
+ berachain: 80094,
21
22
  berachainBartioTestnet: 80084,
22
23
  corn: 21e6,
23
- swell: 1923
24
- }, se = (e) => e === l.prod ? i.ethereum : i.holesky, ie = (e) => e === l.prod ? i.binanceSmartChain : i.binanceSmartChainTestnet, re = (e) => e === l.prod ? i.base : i.baseSepoliaTestnet, P = l.prod, y = "0x0000000000000000000000000000000000000000", oe = {
24
+ swell: 1923,
25
+ sonic: 146,
26
+ morph: 2818,
27
+ morphHolesky: 2810
28
+ }, se = (e) => e === l.prod ? i.ethereum : i.holesky, ie = (e) => e === l.prod ? i.binanceSmartChain : i.binanceSmartChainTestnet, re = (e) => e === l.prod ? i.base : i.baseSepoliaTestnet, P = l.prod, u = "0x0000000000000000000000000000000000000000", oe = {
25
29
  baseApiUrl: "https://staging.prod.lombard.finance"
26
30
  }, pe = {
27
31
  baseApiUrl: "https://gastald-testnet.prod.lombard.finance"
@@ -37,7 +41,7 @@ const l = {
37
41
  return oe;
38
42
  }
39
43
  };
40
- function w(e) {
44
+ function T(e) {
41
45
  return typeof e == "string" ? e : ((n) => {
42
46
  var a;
43
47
  return ((a = n == null ? void 0 : n.data) == null ? void 0 : a.message) && typeof n.data.message == "string";
@@ -49,7 +53,7 @@ function ye(e) {
49
53
  function de(e) {
50
54
  return e != null && e.message ? e.message : "Unknown error";
51
55
  }
52
- const g = {
56
+ const w = {
53
57
  eth: "DESTINATION_BLOCKCHAIN_ETHEREUM",
54
58
  ethOld: "BLOCKCHAIN_ETHEREUM",
55
59
  base: "DESTINATION_BLOCKCHAIN_BASE",
@@ -62,19 +66,19 @@ function O(e) {
62
66
  case i.ethereum:
63
67
  case i.holesky:
64
68
  case i.sepolia:
65
- return g.eth;
69
+ return w.eth;
66
70
  case i.base:
67
71
  case i.baseSepoliaTestnet:
68
- return g.base;
72
+ return w.base;
69
73
  case i.binanceSmartChain:
70
74
  case i.binanceSmartChainTestnet:
71
- return g.bsc;
75
+ return w.bsc;
72
76
  default:
73
77
  throw new Error(`Unknown chain ID: ${e}`);
74
78
  }
75
79
  }
76
80
  const le = "sanctioned_address", ce = "api/v1/address/generate", me = "destination address is under sanctions";
77
- async function rt({
81
+ async function ot({
78
82
  address: e,
79
83
  chainId: t,
80
84
  signature: n,
@@ -83,9 +87,9 @@ async function rt({
83
87
  referrerCode: r,
84
88
  partnerId: o,
85
89
  captchaToken: p,
86
- signatureData: u
90
+ signatureData: y
87
91
  }) {
88
- const { baseApiUrl: f } = v(s), c = O(t), T = {
92
+ const { baseApiUrl: f } = v(s), c = O(t), h = {
89
93
  to_address: e,
90
94
  to_address_signature: n,
91
95
  to_chain: c,
@@ -94,17 +98,17 @@ async function rt({
94
98
  captcha: p,
95
99
  referrer_code: r,
96
100
  eip_712_data: a,
97
- sb_signature_data: u
101
+ sb_signature_data: y
98
102
  };
99
103
  try {
100
104
  const { data: m } = await A.post(
101
105
  ce,
102
- T,
106
+ h,
103
107
  { baseURL: f }
104
108
  );
105
109
  return m.address;
106
110
  } catch (m) {
107
- const b = w(m);
111
+ const b = T(m);
108
112
  if (be(b))
109
113
  return le;
110
114
  throw new Error(b);
@@ -114,7 +118,7 @@ function be(e) {
114
118
  return !!e.includes(me);
115
119
  }
116
120
  const fe = "api/v1/address";
117
- async function ot({
121
+ async function pt({
118
122
  address: e,
119
123
  chainId: t,
120
124
  env: n,
@@ -159,26 +163,26 @@ const ge = 8, F = 10 ** ge;
159
163
  function K(e) {
160
164
  return +e / F;
161
165
  }
162
- function z(e) {
166
+ function q(e) {
163
167
  return Math.floor(+e * F);
164
168
  }
165
169
  function we(e, t = P) {
166
170
  switch (e) {
167
- case g.eth:
168
- case g.ethOld:
171
+ case w.eth:
172
+ case w.ethOld:
169
173
  return se(t);
170
- case g.base:
171
- case g.baseOld:
174
+ case w.base:
175
+ case w.baseOld:
172
176
  return re(t);
173
- case g.bsc:
174
- case g.bscOld:
177
+ case w.bsc:
178
+ case w.bscOld:
175
179
  return ie(t);
176
180
  default:
177
181
  return i.ethereum;
178
182
  }
179
183
  }
180
184
  var Ae = /* @__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))(Ae || {}), 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 || {});
181
- async function pt({
185
+ async function ut({
182
186
  address: e,
183
187
  env: t
184
188
  }) {
@@ -211,7 +215,7 @@ function Ce(e) {
211
215
  });
212
216
  }
213
217
  const Se = 2e-4;
214
- async function ut({
218
+ async function yt({
215
219
  env: e,
216
220
  chainId: t = i.ethereum,
217
221
  amount: n = 1
@@ -222,7 +226,7 @@ async function ut({
222
226
  ), o = new x(Se).multipliedBy(F).toFixed();
223
227
  return { exchangeRate: +r.amount_out, minAmount: +o };
224
228
  }
225
- async function yt({
229
+ async function dt({
226
230
  address: e,
227
231
  chainId: t,
228
232
  env: n
@@ -244,11 +248,11 @@ async function yt({
244
248
  isDelayed: s == null ? void 0 : s.is_delayed
245
249
  };
246
250
  } catch (s) {
247
- const r = w(s);
251
+ const r = T(s);
248
252
  throw new Error(r);
249
253
  }
250
254
  }
251
- async function dt({
255
+ async function lt({
252
256
  userDestinationAddress: e,
253
257
  chainId: t,
254
258
  env: n
@@ -272,13 +276,13 @@ async function dt({
272
276
  chainId: s.chain_id
273
277
  };
274
278
  } catch (s) {
275
- const r = w(s);
279
+ const r = T(s);
276
280
  throw new Error(
277
281
  `Failed to get user stake and bake signature: ${r}`
278
282
  );
279
283
  }
280
284
  }
281
- async function lt({
285
+ async function ct({
282
286
  signature: e,
283
287
  typedData: t,
284
288
  address: n,
@@ -299,11 +303,11 @@ async function lt({
299
303
  );
300
304
  return r.status;
301
305
  } catch (r) {
302
- const o = w(r);
306
+ const o = T(r);
303
307
  throw new Error(o);
304
308
  }
305
309
  }
306
- async function ct({
310
+ async function mt({
307
311
  signature: e,
308
312
  typedData: t,
309
313
  env: n
@@ -322,10 +326,33 @@ async function ct({
322
326
  );
323
327
  return s.status;
324
328
  } catch (s) {
325
- const r = w(s);
329
+ const r = T(s);
326
330
  throw new Error(r);
327
331
  }
328
332
  }
333
+ const Ee = "api/v1/referral-system/referrer/";
334
+ async function bt({
335
+ address: e,
336
+ signature: t,
337
+ eip712Data: n,
338
+ referrerCode: a,
339
+ env: s
340
+ }) {
341
+ const { baseApiUrl: r } = v(s), o = {
342
+ referrer_code: a,
343
+ signature: t,
344
+ signature_typed_data: n
345
+ };
346
+ try {
347
+ await A.post(`${Ee}${e}`, o, {
348
+ baseURL: r
349
+ });
350
+ return;
351
+ } catch (p) {
352
+ const y = T(p);
353
+ throw new Error(y);
354
+ }
355
+ }
329
356
  const N = {
330
357
  [i.ethereum]: "https://rpc.ankr.com/eth",
331
358
  [i.holesky]: "https://rpc.ankr.com/eth_holesky",
@@ -335,7 +362,7 @@ const N = {
335
362
  [i.binanceSmartChain]: "https://bsc-dataseed.bnbchain.org",
336
363
  [i.binanceSmartChainTestnet]: "https://bsc-testnet-dataseed.bnbchain.org"
337
364
  };
338
- async function Ee(e) {
365
+ async function De(e) {
339
366
  const n = await (await fetch(e, {
340
367
  method: "POST",
341
368
  headers: {
@@ -350,7 +377,7 @@ async function Ee(e) {
350
377
  })).json(), a = Z.utils.hexToNumber(n == null ? void 0 : n.result);
351
378
  return new x(Number(a));
352
379
  }
353
- const De = 2, _e = 25e3;
380
+ const _e = 2, xe = 25e3;
354
381
  class M {
355
382
  constructor({ chainId: t, rpcUrlConfig: n }) {
356
383
  _(this, "chainId");
@@ -392,10 +419,10 @@ class M {
392
419
  async getMaxFees() {
393
420
  const t = this.getReadWeb3(), n = this.getRpcUrl(), [a, s] = await Promise.all([
394
421
  t.eth.getBlock("latest"),
395
- Ee(n)
422
+ De(n)
396
423
  ]);
397
424
  return !(a != null && a.baseFeePerGas) && typeof (a == null ? void 0 : a.baseFeePerGas) != "bigint" ? {} : {
398
- maxFeePerGas: +new x(a.baseFeePerGas.toString(10)).multipliedBy(De).plus(s),
425
+ maxFeePerGas: +new x(a.baseFeePerGas.toString(10)).multipliedBy(_e).plus(s),
399
426
  maxPriorityFeePerGas: +s
400
427
  };
401
428
  }
@@ -408,7 +435,7 @@ class M {
408
435
  async getSafeGasPriceWei() {
409
436
  const t = await this.getReadWeb3().eth.getGasPrice();
410
437
  return new x(t.toString(10)).plus(
411
- _e
438
+ xe
412
439
  );
413
440
  }
414
441
  /**
@@ -456,10 +483,10 @@ class D extends M {
456
483
  */
457
484
  async sendTransactionAsync(n, a, s) {
458
485
  const { chainId: r, web3: o } = this, p = this.getReadWeb3(), {
459
- data: u,
486
+ data: y,
460
487
  estimate: f = !1,
461
488
  estimateFee: c = !1,
462
- extendedGasLimit: T,
489
+ extendedGasLimit: h,
463
490
  gasLimit: m = "0",
464
491
  value: b = "0",
465
492
  gasLimitMultiplier: I = 1
@@ -470,36 +497,36 @@ class D extends M {
470
497
  from: n,
471
498
  to: a,
472
499
  value: E.numberToHex(b),
473
- data: u,
500
+ data: y,
474
501
  nonce: S,
475
502
  chainId: E.numberToHex(r)
476
503
  };
477
504
  if (f)
478
505
  try {
479
- const h = await p.eth.estimateGas(d), R = Math.round(
480
- Number(h) * I
506
+ const g = await p.eth.estimateGas(d), R = Math.round(
507
+ Number(g) * I
481
508
  );
482
- T ? d.gas = E.numberToHex(R + T) : d.gas = E.numberToHex(R);
483
- } catch (h) {
509
+ h ? d.gas = E.numberToHex(R + h) : d.gas = E.numberToHex(R);
510
+ } catch (g) {
484
511
  throw new Error(
485
- h.message ?? "Failed to estimate gas limit for transaction."
512
+ g.message ?? "Failed to estimate gas limit for transaction."
486
513
  );
487
514
  }
488
515
  else
489
516
  d.gas = E.numberToHex(m);
490
517
  const { maxFeePerGas: U, maxPriorityFeePerGas: L } = c ? await this.getMaxFees().catch(() => s) : s;
491
518
  if (L !== void 0 && (d.maxPriorityFeePerGas = E.numberToHex(L)), U !== void 0 && (d.maxFeePerGas = E.numberToHex(U)), !d.maxFeePerGas && !d.maxPriorityFeePerGas) {
492
- const h = await this.getSafeGasPriceWei();
493
- d.gasPrice = h.toString(10);
519
+ const g = await this.getSafeGasPriceWei();
520
+ d.gasPrice = g.toString(10);
494
521
  }
495
522
  if (!d.maxFeePerGas && !d.maxPriorityFeePerGas) {
496
- const h = await this.getSafeGasPriceWei();
497
- d.gasPrice = h.toString(10);
523
+ const g = await this.getSafeGasPriceWei();
524
+ d.gasPrice = g.toString(10);
498
525
  }
499
- return console.log("Sending transaction via Web3: ", d), new Promise((h, R) => {
526
+ return console.log("Sending transaction via Web3: ", d), new Promise((g, R) => {
500
527
  const W = o.eth.sendTransaction(d);
501
528
  W.once("transactionHash", async (G) => {
502
- console.log(`Just signed transaction has is: ${G}`), h({
529
+ console.log(`Just signed transaction has is: ${G}`), g({
503
530
  receiptPromise: W,
504
531
  transactionHash: G
505
532
  });
@@ -521,54 +548,66 @@ function k(e) {
521
548
  return 1.3;
522
549
  }
523
550
  }
524
- function q(e) {
551
+ function z(e) {
525
552
  return Object.values(i).includes(e);
526
553
  }
527
- const xe = {
554
+ const Me = {
528
555
  [i.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
529
- [i.ethereum]: y,
556
+ [i.ethereum]: u,
530
557
  [i.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
531
- [i.binanceSmartChain]: y,
558
+ [i.binanceSmartChain]: u,
532
559
  [i.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
533
- [i.base]: y,
560
+ [i.base]: u,
534
561
  [i.baseSepoliaTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
562
+ [i.berachain]: u,
535
563
  [i.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
536
- [i.corn]: y,
537
- [i.swell]: y
538
- }, Me = {
564
+ [i.corn]: u,
565
+ [i.swell]: u,
566
+ [i.sonic]: u,
567
+ [i.morph]: u,
568
+ [i.morphHolesky]: u
569
+ }, Ie = {
539
570
  [i.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
540
- [i.ethereum]: y,
571
+ [i.ethereum]: u,
541
572
  [i.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
542
- [i.binanceSmartChain]: y,
573
+ [i.binanceSmartChain]: u,
543
574
  [i.sepolia]: "0xc47e4b3124597fdf8dd07843d4a7052f2ee80c30",
544
- [i.base]: y,
545
- [i.baseSepoliaTestnet]: y,
575
+ [i.base]: u,
576
+ [i.baseSepoliaTestnet]: u,
577
+ [i.berachain]: u,
546
578
  [i.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
547
- [i.corn]: y,
548
- [i.swell]: y
549
- }, Ie = {
579
+ [i.corn]: u,
580
+ [i.swell]: u,
581
+ [i.sonic]: u,
582
+ [i.morph]: u,
583
+ [i.morphHolesky]: u
584
+ }, Re = {
550
585
  [i.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
551
- [i.holesky]: y,
552
- [i.sepolia]: y,
553
- [i.binanceSmartChainTestnet]: y,
586
+ [i.holesky]: u,
587
+ [i.sepolia]: u,
588
+ [i.binanceSmartChainTestnet]: u,
554
589
  [i.binanceSmartChain]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
555
590
  [i.base]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
556
- [i.baseSepoliaTestnet]: y,
557
- [i.berachainBartioTestnet]: y,
591
+ [i.baseSepoliaTestnet]: u,
592
+ [i.berachain]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
593
+ [i.berachainBartioTestnet]: u,
558
594
  [i.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
559
- [i.swell]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
595
+ [i.swell]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
596
+ [i.sonic]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
597
+ [i.morph]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
598
+ [i.morphHolesky]: u
560
599
  };
561
600
  function j(e = P) {
562
601
  switch (e) {
563
602
  case l.prod:
564
- return Ie;
603
+ return Re;
565
604
  case l.testnet:
566
- return Me;
605
+ return Ie;
567
606
  default:
568
- return xe;
607
+ return Me;
569
608
  }
570
609
  }
571
- const Re = [
610
+ const Ne = [
572
611
  {
573
612
  constant: !0,
574
613
  inputs: [],
@@ -789,7 +828,7 @@ const Re = [
789
828
  name: "Transfer",
790
829
  type: "event"
791
830
  }
792
- ], Ne = [
831
+ ], Pe = [
793
832
  {
794
833
  inputs: [],
795
834
  stateMutability: "nonpayable",
@@ -2549,7 +2588,7 @@ const Re = [
2549
2588
  stateMutability: "nonpayable",
2550
2589
  type: "function"
2551
2590
  }
2552
- ], Pe = [
2591
+ ], Oe = [
2553
2592
  {
2554
2593
  inputs: [
2555
2594
  {
@@ -3398,7 +3437,7 @@ const Re = [
3398
3437
  stateMutability: "nonpayable",
3399
3438
  type: "function"
3400
3439
  }
3401
- ], Oe = [
3440
+ ], Fe = [
3402
3441
  {
3403
3442
  inputs: [],
3404
3443
  name: "getStakeAndBakeFee",
@@ -3413,31 +3452,31 @@ const Re = [
3413
3452
  type: "function"
3414
3453
  }
3415
3454
  ];
3416
- function Fe(e) {
3455
+ function ke(e) {
3417
3456
  switch (e) {
3418
3457
  case "LBTC":
3419
- return Ne;
3458
+ return Pe;
3420
3459
  default:
3421
- return Re;
3460
+ return Ne;
3422
3461
  }
3423
3462
  }
3424
3463
  function C(e, t) {
3425
3464
  const n = j(t), { chainId: a } = e;
3426
- if (!q(a))
3465
+ if (!z(a))
3427
3466
  throw new Error(`This chain ${a} is not supported`);
3428
3467
  const s = n[a];
3429
3468
  if (!s)
3430
3469
  throw new Error(`Token address for chain ${a} is not defined`);
3431
- const r = Fe("LBTC"), o = e.createContract(r, s);
3470
+ const r = ke("LBTC"), o = e.createContract(r, s);
3432
3471
  return o.options.address || (o.options.address = s), o;
3433
3472
  }
3434
- function mt({
3473
+ function ft({
3435
3474
  spender: e,
3436
3475
  amount: t,
3437
3476
  env: n,
3438
3477
  ...a
3439
3478
  }) {
3440
- const s = new D(a), r = C(s, n), o = z(t), p = r.methods.approve(e, o);
3479
+ const s = new D(a), r = C(s, n), o = q(t), p = r.methods.approve(e, o);
3441
3480
  return s.sendTransactionAsync(
3442
3481
  s.account,
3443
3482
  r.options.address,
@@ -3449,8 +3488,8 @@ function mt({
3449
3488
  }
3450
3489
  );
3451
3490
  }
3452
- const ke = "insufficient funds", Be = "Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.", $ = (e) => e.startsWith("0x") ? e : "0x" + e;
3453
- async function bt({
3491
+ const Be = "insufficient funds", Ue = "Insufficient funds for transfer. Make sure you have enough ETH to cover the gas cost.", $ = (e) => e.startsWith("0x") ? e : "0x" + e;
3492
+ async function Tt({
3454
3493
  data: e,
3455
3494
  proofSignature: t,
3456
3495
  env: n,
@@ -3470,60 +3509,60 @@ async function bt({
3470
3509
  );
3471
3510
  } catch (p) {
3472
3511
  console.log("error", p);
3473
- const u = w(p);
3474
- throw u.includes(ke) ? new Error(Be) : new Error(u);
3512
+ const y = T(p);
3513
+ throw y.includes(Be) ? new Error(Ue) : new Error(y);
3475
3514
  }
3476
3515
  }
3477
- function Ue(e, t) {
3516
+ function Le(e, t) {
3478
3517
  if (!t)
3479
3518
  throw new Error("The address for bascule module is not defined");
3480
- const n = e.createContract(Pe, t);
3519
+ const n = e.createContract(Oe, t);
3481
3520
  return n.options.address || (n.options.address = t), n;
3482
3521
  }
3483
- const Le = "No deposit ID provided. Please provide a deposit ID as an argument.";
3484
- var We = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(We || {});
3485
- async function ft({
3522
+ const We = "No deposit ID provided. Please provide a deposit ID as an argument.";
3523
+ var Ge = /* @__PURE__ */ ((e) => (e[e.UNREPORTED = 0] = "UNREPORTED", e[e.REPORTED = 1] = "REPORTED", e[e.WITHDRAWN = 2] = "WITHDRAWN", e))(Ge || {});
3524
+ async function ht({
3486
3525
  rawPayload: e,
3487
3526
  env: t,
3488
3527
  ...n
3489
3528
  }) {
3490
3529
  if (!e)
3491
- throw new Error(Le);
3530
+ throw new Error(We);
3492
3531
  const a = new D(n), r = await C(a, t).methods.Bascule().call();
3493
- if (r === y)
3532
+ if (r === u)
3494
3533
  return 1;
3495
- const o = Ue(a, r);
3534
+ const o = Le(a, r);
3496
3535
  try {
3497
3536
  const p = a.getReadWeb3().utils.keccak256(
3498
3537
  Buffer.from(e.slice(8), "hex")
3499
- ), u = await o.methods.depositHistory(p).call();
3500
- return Number(u);
3538
+ ), y = await o.methods.depositHistory(p).call();
3539
+ return Number(y);
3501
3540
  } catch (p) {
3502
- const u = w(p);
3503
- throw new Error(u);
3541
+ const y = T(p);
3542
+ throw new Error(y);
3504
3543
  }
3505
3544
  }
3506
- const Ge = [
3545
+ const Ve = [
3507
3546
  i.ethereum,
3508
3547
  i.base,
3509
3548
  i.binanceSmartChain
3510
- ], J = (e) => Ge.includes(e) ? l.prod : l.stage;
3549
+ ], J = (e) => Ve.includes(e) ? l.prod : l.stage;
3511
3550
  function B(e, t) {
3512
- if (!q(e))
3551
+ if (!z(e))
3513
3552
  throw new Error(`This chain ${e} is not supported`);
3514
3553
  const n = t ? { [e]: t } : N;
3515
3554
  if (!n[e])
3516
3555
  throw new Error(`RPC URL for chainId ${e} not found`);
3517
3556
  return n;
3518
3557
  }
3519
- async function Tt({
3558
+ async function gt({
3520
3559
  chainId: e,
3521
3560
  rpcUrl: t
3522
3561
  }) {
3523
3562
  const n = B(e, t), a = new M({ chainId: e, rpcUrlConfig: n }), s = J(e), o = await C(a, s).methods.getMintFee().call();
3524
3563
  return new x(K(o.toString(10)));
3525
3564
  }
3526
- async function ht({
3565
+ async function wt({
3527
3566
  env: e,
3528
3567
  rpcUrl: t,
3529
3568
  chainId: n
@@ -3531,7 +3570,7 @@ async function ht({
3531
3570
  const a = { [n]: t }, s = new M({ chainId: n, rpcUrlConfig: a });
3532
3571
  return (await C(s, e).methods.totalSupply().call()).toString();
3533
3572
  }
3534
- async function Ve({
3573
+ async function He({
3535
3574
  owner: e,
3536
3575
  rpcUrl: t,
3537
3576
  chainId: n
@@ -3540,16 +3579,16 @@ async function Ve({
3540
3579
  try {
3541
3580
  return (await o.methods.nonces(e).call()).toString();
3542
3581
  } catch (p) {
3543
- const u = w(p);
3544
- throw new Error(u);
3582
+ const y = T(p);
3583
+ throw new Error(y);
3545
3584
  }
3546
3585
  }
3547
- async function gt(e) {
3586
+ async function At(e) {
3548
3587
  const t = new D(e), n = `destination chain id is ${e.chainId}`;
3549
3588
  return t.signMessage(n);
3550
3589
  }
3551
- const He = 24 * 60 * 60;
3552
- function $e({
3590
+ const $e = 24 * 60 * 60;
3591
+ function Ze({
3553
3592
  chainId: e,
3554
3593
  verifyingContract: t,
3555
3594
  fee: n,
@@ -3583,35 +3622,35 @@ function $e({
3583
3622
  }
3584
3623
  };
3585
3624
  }
3586
- const Ze = "Failed to obtain a valid signature. The response is undefined or invalid.", Ke = () => Math.floor(Date.now() / 1e3 + He);
3587
- async function wt({
3625
+ const Ke = "Failed to obtain a valid signature. The response is undefined or invalid.", qe = () => Math.floor(Date.now() / 1e3 + $e);
3626
+ async function vt({
3588
3627
  address: e,
3589
3628
  provider: t,
3590
3629
  fee: n,
3591
3630
  chainId: a,
3592
3631
  env: s,
3593
- expiry: r = Ke()
3632
+ expiry: r = qe()
3594
3633
  }) {
3595
- var T, m;
3634
+ var h, m;
3596
3635
  const o = new D({
3597
3636
  provider: t,
3598
3637
  account: e,
3599
3638
  chainId: a
3600
- }), u = C(o, s).options.address, f = JSON.stringify(
3601
- $e({
3639
+ }), y = C(o, s).options.address, f = JSON.stringify(
3640
+ Ze({
3602
3641
  chainId: a,
3603
- verifyingContract: u,
3642
+ verifyingContract: y,
3604
3643
  fee: n,
3605
3644
  expiry: r
3606
3645
  })
3607
- ), c = await ((m = (T = o.web3) == null ? void 0 : T.currentProvider) == null ? void 0 : m.request({
3646
+ ), c = await ((m = (h = o.web3) == null ? void 0 : h.currentProvider) == null ? void 0 : m.request({
3608
3647
  method: "eth_signTypedData_v4",
3609
3648
  params: [e, f]
3610
3649
  }));
3611
3650
  if (typeof c == "string")
3612
3651
  return { signature: c, typedData: f };
3613
3652
  if (!(c != null && c.result))
3614
- throw new Error(Ze);
3653
+ throw new Error(Ke);
3615
3654
  return { signature: c.result, typedData: f };
3616
3655
  }
3617
3656
  const X = {
@@ -3622,13 +3661,13 @@ const X = {
3622
3661
  address: "0x4A3cD83CEbb91E0Cd31EdA2Ee0F4AebfcCFCbBb6"
3623
3662
  }
3624
3663
  ],
3625
- // [OChainId.ethereum]: [
3626
- // {
3627
- // key: 'veda',
3628
- // name: 'Veda / Lombard DeFi Vault',
3629
- // address: '0x5401b8620e5fb570064ca9114fd1e135fd77d57c',
3630
- // },
3631
- // ],
3664
+ [i.ethereum]: [
3665
+ {
3666
+ key: "veda",
3667
+ name: "Veda / Lombard DeFi Vault",
3668
+ address: "0xC8bbF6153D7Ba105f1399D992ebd32B0541996ef"
3669
+ }
3670
+ ],
3632
3671
  [i.binanceSmartChain]: [
3633
3672
  {
3634
3673
  key: "veda",
@@ -3643,21 +3682,14 @@ const X = {
3643
3682
  address: "0x72143309A662bDB4aad5cA65Ab59eD8977D047C5"
3644
3683
  }
3645
3684
  ]
3646
- // [OChainId.base]: [
3647
- // {
3648
- // key: 'veda',
3649
- // name: 'Veda / Lombard DeFi Vault',
3650
- // address: '0x5401b8620e5fb570064ca9114fd1e135fd77d57c',
3651
- // },
3652
- // ],
3653
- }, At = Object.keys(
3685
+ }, Ct = Object.keys(
3654
3686
  X
3655
3687
  ).map(Number), ze = (e) => {
3656
3688
  const t = X[e];
3657
3689
  if (!(t != null && t.length))
3658
3690
  throw new Error(`No vaults configured for chain ID ${e}`);
3659
3691
  return t;
3660
- }, qe = (e, t) => {
3692
+ }, je = (e, t) => {
3661
3693
  const a = ze(e).find((s) => s.key === t);
3662
3694
  if (!a)
3663
3695
  throw new Error(
@@ -3665,7 +3697,7 @@ const X = {
3665
3697
  );
3666
3698
  return a.address;
3667
3699
  };
3668
- async function je({
3700
+ async function Je({
3669
3701
  chainId: e,
3670
3702
  expiry: t,
3671
3703
  owner: n,
@@ -3674,7 +3706,7 @@ async function je({
3674
3706
  rpcUrl: r,
3675
3707
  verifyingContract: o
3676
3708
  }) {
3677
- const p = await Ve({
3709
+ const p = await He({
3678
3710
  owner: n,
3679
3711
  chainId: e,
3680
3712
  rpcUrl: r
@@ -3723,15 +3755,15 @@ async function je({
3723
3755
  }
3724
3756
  };
3725
3757
  }
3726
- const Je = (e, t = l.prod) => {
3758
+ const Xe = (e, t = l.prod) => {
3727
3759
  const a = j(t)[e];
3728
3760
  if (!a)
3729
3761
  throw new Error(
3730
3762
  `No LBTC contract address configured for chain ID ${e}`
3731
3763
  );
3732
3764
  return a;
3733
- }, Xe = "Failed to obtain a valid signature. The response is undefined or invalid.";
3734
- async function vt({
3765
+ }, Ye = "Failed to obtain a valid signature. The response is undefined or invalid.";
3766
+ async function St({
3735
3767
  address: e,
3736
3768
  provider: t,
3737
3769
  chainId: n,
@@ -3742,11 +3774,11 @@ async function vt({
3742
3774
  env: p
3743
3775
  }) {
3744
3776
  var I, S;
3745
- const u = new D({
3777
+ const y = new D({
3746
3778
  provider: t,
3747
3779
  account: e,
3748
3780
  chainId: n
3749
- }), f = Je(n, p), c = qe(n, o), T = await je({
3781
+ }), f = Xe(n, p), c = je(n, o), h = await Je({
3750
3782
  chainId: n,
3751
3783
  expiry: s,
3752
3784
  owner: e,
@@ -3754,20 +3786,20 @@ async function vt({
3754
3786
  value: a,
3755
3787
  rpcUrl: r,
3756
3788
  verifyingContract: f
3757
- }), m = JSON.stringify(T), b = await ((S = (I = u.web3) == null ? void 0 : I.currentProvider) == null ? void 0 : S.request({
3789
+ }), m = JSON.stringify(h), b = await ((S = (I = y.web3) == null ? void 0 : I.currentProvider) == null ? void 0 : S.request({
3758
3790
  method: "eth_signTypedData_v4",
3759
3791
  params: [e, m]
3760
3792
  }));
3761
3793
  if (typeof b == "string")
3762
3794
  return { signature: b, typedData: m };
3763
3795
  if (!(b != null && b.result))
3764
- throw new Error(Xe);
3796
+ throw new Error(Ye);
3765
3797
  return { signature: b.result, typedData: m };
3766
3798
  }
3767
3799
  te(ee);
3768
- function Ye(e, t = l.prod) {
3800
+ function Qe(e, t = l.prod) {
3769
3801
  var r;
3770
- const n = Qe(e), s = (r = ne[n]({
3802
+ const n = et(e), s = (r = ne[n]({
3771
3803
  address: e,
3772
3804
  network: t === l.prod ? H.bitcoin : H.testnet
3773
3805
  }).output) == null ? void 0 : r.toString("hex");
@@ -3775,52 +3807,52 @@ function Ye(e, t = l.prod) {
3775
3807
  throw new Error("Output script is not found.");
3776
3808
  return `0x${s}`;
3777
3809
  }
3778
- function Qe(e) {
3810
+ function et(e) {
3779
3811
  const t = ae.fromBech32(e);
3780
3812
  if (t.version === 1 && t.data.length === 32)
3781
3813
  return "p2tr";
3782
3814
  if (t.version === 0 && t.data.length === 20)
3783
3815
  return "p2wpkh";
3784
- if (et(e))
3816
+ if (tt(e))
3785
3817
  return "p2wsh";
3786
3818
  throw new Error("Address type is not supported.");
3787
3819
  }
3788
- function et(e) {
3820
+ function tt(e) {
3789
3821
  return (e.startsWith("bc1") || e.startsWith("tb1")) && e.length === 62;
3790
3822
  }
3791
- function Ct({
3823
+ function Et({
3792
3824
  btcAddress: e,
3793
3825
  amount: t,
3794
3826
  env: n,
3795
3827
  ...a
3796
3828
  }) {
3797
- const s = new D(a), r = C(s, n), o = Ye(e, n), p = z(t), u = r.methods.redeem(o, p);
3829
+ const s = new D(a), r = C(s, n), o = Qe(e, n), p = q(t), y = r.methods.redeem(o, p);
3798
3830
  return s.sendTransactionAsync(
3799
3831
  s.account,
3800
3832
  r.options.address,
3801
3833
  {
3802
- data: u.encodeABI(),
3834
+ data: y.encodeABI(),
3803
3835
  estimate: !0,
3804
3836
  estimateFee: !0,
3805
3837
  gasLimitMultiplier: k(s.chainId)
3806
3838
  }
3807
3839
  );
3808
3840
  }
3809
- async function St({
3841
+ async function Dt({
3810
3842
  chainId: e,
3811
3843
  rpcUrl: t,
3812
3844
  vaultAddress: n
3813
3845
  }) {
3814
3846
  const a = B(e, t), s = new M({ chainId: e, rpcUrlConfig: a });
3815
3847
  try {
3816
- return (await s.createContract(Oe, n).methods.getStakeAndBakeFee().call()).toString();
3848
+ return (await s.createContract(Fe, n).methods.getStakeAndBakeFee().call()).toString();
3817
3849
  } catch (r) {
3818
- const o = w(r);
3850
+ const o = T(r);
3819
3851
  throw new Error(o);
3820
3852
  }
3821
3853
  }
3822
3854
  export {
3823
- We as BasculeDepositStatus,
3855
+ Ge as BasculeDepositStatus,
3824
3856
  Ae as ENotarizationStatus,
3825
3857
  ve as ESessionState,
3826
3858
  i as OChainId,
@@ -3828,39 +3860,40 @@ export {
3828
3860
  le as SANCTIONED_ADDRESS,
3829
3861
  F as SATOSHI_SCALE,
3830
3862
  X as STAKE_AND_BAKE_VAULTS,
3831
- At as SUPPORTED_STAKE_AND_BAKE_CHAINS,
3832
- mt as approveLBTC,
3833
- bt as claimLBTC,
3863
+ Ct as SUPPORTED_STAKE_AND_BAKE_CHAINS,
3864
+ ft as approveLBTC,
3865
+ Tt as claimLBTC,
3834
3866
  K as fromSatoshi,
3835
- rt as generateDepositBtcAddress,
3867
+ ot as generateDepositBtcAddress,
3836
3868
  v as getApiConfig,
3837
- ft as getBasculeDepositStatus,
3869
+ ht as getBasculeDepositStatus,
3838
3870
  re as getBaseNetworkByEnv,
3839
3871
  ie as getBscNetworkByEnv,
3840
3872
  we as getChainIdByName,
3841
3873
  O as getChainNameById,
3842
- ot as getDepositBtcAddress,
3874
+ pt as getDepositBtcAddress,
3843
3875
  he as getDepositBtcAddresses,
3844
- pt as getDepositsByAddress,
3876
+ ut as getDepositsByAddress,
3845
3877
  se as getEthNetworkByEnv,
3846
- ut as getLBTCExchangeRate,
3847
- Tt as getLBTCMintingFee,
3848
- ht as getLBTCTotalSupply,
3878
+ yt as getLBTCExchangeRate,
3879
+ gt as getLBTCMintingFee,
3880
+ wt as getLBTCTotalSupply,
3849
3881
  j as getLbtcAddressConfig,
3850
- yt as getNetworkFeeSignature,
3851
- Ve as getPermitNonce,
3852
- St as getStakeAndBakeFee,
3853
- qe as getStakeAndBakeSpenderContract,
3854
- je as getStakeAndBakeTypedData,
3882
+ dt as getNetworkFeeSignature,
3883
+ He as getPermitNonce,
3884
+ Dt as getStakeAndBakeFee,
3885
+ je as getStakeAndBakeSpenderContract,
3886
+ Je as getStakeAndBakeTypedData,
3855
3887
  ze as getStakeAndBakeVaults,
3856
- dt as getUserStakeAndBakeSignature,
3857
- q as isValidChain,
3858
- gt as signLbtcDestionationAddr,
3859
- wt as signNetworkFee,
3860
- vt as signStakeAndBake,
3861
- lt as storeNetworkFeeSignature,
3862
- ct as storeStakeAndBakeSignature,
3863
- z as toSatoshi,
3864
- Ct as unstakeLBTC
3888
+ lt as getUserStakeAndBakeSignature,
3889
+ z as isValidChain,
3890
+ bt as setReferral,
3891
+ At as signLbtcDestionationAddr,
3892
+ vt as signNetworkFee,
3893
+ St as signStakeAndBake,
3894
+ ct as storeNetworkFeeSignature,
3895
+ mt as storeStakeAndBakeSignature,
3896
+ q as toSatoshi,
3897
+ Et as unstakeLBTC
3865
3898
  };
3866
3899
  //# sourceMappingURL=index.js.map