@lombard.finance/sdk 2.0.8 → 2.0.10

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,8 +1,8 @@
1
- var z = Object.defineProperty;
2
- var q = (e, t, n) => t in e ? z(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
- var A = (e, t, n) => (q(e, typeof t != "symbol" ? t + "" : t, n), n);
1
+ var K = Object.defineProperty;
2
+ var z = (e, t, n) => t in e ? K(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
3
+ var A = (e, t, n) => (z(e, typeof t != "symbol" ? t + "" : t, n), n);
4
4
  import h from "axios";
5
- import v from "bignumber.js";
5
+ import S from "bignumber.js";
6
6
  import H, { Web3 as G, utils as g } from "web3";
7
7
  const T = {
8
8
  prod: "prod",
@@ -19,35 +19,35 @@ const T = {
19
19
  berachainBartioTestnet: 80084,
20
20
  corn: 21e6,
21
21
  swell: 1923
22
- }, j = (e) => e === T.prod ? s.ethereum : s.holesky, J = (e) => e === T.prod ? s.binanceSmartChain : s.binanceSmartChainTestnet, X = (e) => e === T.prod ? s.base : s.baseTestnet, N = T.prod, u = "0x0000000000000000000000000000000000000000", Y = {
22
+ }, q = (e) => e === T.prod ? s.ethereum : s.holesky, j = (e) => e === T.prod ? s.binanceSmartChain : s.binanceSmartChainTestnet, J = (e) => e === T.prod ? s.base : s.baseTestnet, N = T.prod, u = "0x0000000000000000000000000000000000000000", Y = {
23
23
  baseApiUrl: "https://staging.prod.lombard.finance"
24
- }, Q = {
24
+ }, X = {
25
25
  baseApiUrl: "https://gastald-testnet.prod.lombard.finance"
26
- }, ee = {
26
+ }, Q = {
27
27
  baseApiUrl: "https://mainnet.prod.lombard.finance"
28
28
  }, w = (e = N) => {
29
29
  switch (e) {
30
30
  case T.prod:
31
- return ee;
32
- case T.testnet:
33
31
  return Q;
32
+ case T.testnet:
33
+ return X;
34
34
  default:
35
35
  return Y;
36
36
  }
37
37
  };
38
- function C(e) {
38
+ function v(e) {
39
39
  return typeof e == "string" ? e : ((n) => {
40
40
  var a;
41
41
  return ((a = n == null ? void 0 : n.data) == null ? void 0 : a.message) && typeof n.data.message == "string";
42
- })(e) ? e.data.message : e instanceof Error ? te(e) : ne(e);
42
+ })(e) ? e.data.message : e instanceof Error ? ee(e) : te(e);
43
43
  }
44
- function te(e) {
44
+ function ee(e) {
45
45
  return e.response ? e.response.data.message : e.message;
46
46
  }
47
- function ne(e) {
47
+ function te(e) {
48
48
  return e != null && e.message ? e.message : "Unknown error";
49
49
  }
50
- const S = {
50
+ const C = {
51
51
  eth: "DESTINATION_BLOCKCHAIN_ETHEREUM",
52
52
  base: "DESTINATION_BLOCKCHAIN_BASE",
53
53
  bsc: "DESTINATION_BLOCKCHAIN_BSC",
@@ -62,63 +62,63 @@ function D(e) {
62
62
  case s.ethereum:
63
63
  case s.holesky:
64
64
  case s.sepolia:
65
- return S.eth;
65
+ return C.eth;
66
66
  case s.base:
67
67
  case s.baseTestnet:
68
- return S.base;
68
+ return C.base;
69
69
  case s.binanceSmartChain:
70
70
  case s.binanceSmartChainTestnet:
71
- return S.bsc;
71
+ return C.bsc;
72
72
  default:
73
73
  throw new Error(`Unknown chain ID: ${e}`);
74
74
  }
75
75
  }
76
- const ae = "sanctioned_address", se = "api/v1/address/generate", ie = "destination address is under sanctions";
77
- async function Le({
76
+ const ne = "sanctioned_address", ae = "api/v1/address/generate", se = "destination address is under sanctions";
77
+ async function ke({
78
78
  address: e,
79
79
  chainId: t,
80
80
  signature: n,
81
81
  eip712Data: a,
82
82
  env: i,
83
83
  referrerCode: r,
84
- partnerId: o,
85
- captchaToken: p
84
+ partnerId: p,
85
+ captchaToken: o
86
86
  }) {
87
- const { baseApiUrl: d } = w(i), m = D(t), l = {
87
+ const { baseApiUrl: m } = w(i), c = D(t), d = {
88
88
  to_address: e,
89
89
  to_address_signature: n,
90
- to_chain: m,
91
- partner_id: o,
90
+ to_chain: c,
91
+ partner_id: p,
92
92
  nonce: 0,
93
- captcha: p,
93
+ captcha: o,
94
94
  referrer_code: r,
95
95
  eip_712_data: a
96
96
  };
97
97
  try {
98
98
  const { data: y } = await h.post(
99
- se,
100
- l,
101
- { baseURL: d }
99
+ ae,
100
+ d,
101
+ { baseURL: m }
102
102
  );
103
103
  return y.address;
104
104
  } catch (y) {
105
- const b = C(y);
106
- if (re(b))
107
- return ae;
105
+ const b = v(y);
106
+ if (ie(b))
107
+ return ne;
108
108
  throw new Error(b);
109
109
  }
110
110
  }
111
- function re(e) {
112
- return !!e.includes(ie);
111
+ function ie(e) {
112
+ return !!e.includes(se);
113
113
  }
114
- const oe = "api/v1/address";
115
- async function Ge({
114
+ const re = "api/v1/address";
115
+ async function Le({
116
116
  address: e,
117
117
  chainId: t,
118
118
  env: n,
119
119
  partnerId: a
120
120
  }) {
121
- const i = await ue({
121
+ const i = await oe({
122
122
  address: e,
123
123
  chainId: t,
124
124
  env: n,
@@ -134,46 +134,46 @@ function pe(e) {
134
134
  const t = e.reduce((n, a) => n.created_at < a.created_at ? a : n, e[0]);
135
135
  return t.deprecated ? void 0 : t;
136
136
  }
137
- async function ue({
137
+ async function oe({
138
138
  address: e,
139
139
  chainId: t,
140
140
  env: n,
141
141
  partnerId: a
142
142
  }) {
143
- const { baseApiUrl: i } = w(n), r = D(t), o = {
143
+ const { baseApiUrl: i } = w(n), r = D(t), p = {
144
144
  to_address: e,
145
145
  to_blockchain: r,
146
146
  limit: 1,
147
147
  offset: 0,
148
148
  asc: !1,
149
149
  referralId: a
150
- }, { data: p } = await h.get(oe, {
150
+ }, { data: o } = await h.get(re, {
151
151
  baseURL: i,
152
- params: o
152
+ params: p
153
153
  });
154
- return (p == null ? void 0 : p.addresses) || [];
154
+ return (o == null ? void 0 : o.addresses) || [];
155
155
  }
156
- const ye = 8, P = 10 ** ye;
156
+ const ue = 8, P = 10 ** ue;
157
157
  function M(e) {
158
158
  return +e / P;
159
159
  }
160
- function He(e) {
160
+ function Ge(e) {
161
161
  return Math.floor(+e * P);
162
162
  }
163
- function de(e, t = N) {
163
+ function ye(e, t = N) {
164
164
  switch (e) {
165
- case S.eth:
166
- return j(t);
167
- case S.base:
168
- return X(t);
169
- case S.bsc:
165
+ case C.eth:
166
+ return q(t);
167
+ case C.base:
170
168
  return J(t);
169
+ case C.bsc:
170
+ return j(t);
171
171
  default:
172
172
  return s.ethereum;
173
173
  }
174
174
  }
175
- 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 || {}), ce = /* @__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))(ce || {});
176
- async function We({
175
+ var de = /* @__PURE__ */ ((e) => (e.NOTARIZATION_STATUS_UNSPECIFIED = "NOTARIZATION_STATUS_UNSPECIFIED", e.NOTARIZATION_STATUS_PENDING = "NOTARIZATION_STATUS_PENDING", e.NOTARIZATION_STATUS_SUBMITTED = "NOTARIZATION_STATUS_SUBMITTED", e.NOTARIZATION_STATUS_SESSION_APPROVED = "NOTARIZATION_STATUS_SESSION_APPROVED", e.NOTARIZATION_STATUS_FAILED = "NOTARIZATION_STATUS_FAILED", e))(de || {}), le = /* @__PURE__ */ ((e) => (e.SESSION_STATE_UNSPECIFIED = "SESSION_STATE_UNSPECIFIED", e.SESSION_STATE_PENDING = "SESSION_STATE_PENDING", e.SESSION_STATE_COMPLETED = "SESSION_STATE_COMPLETED", e.SESSION_STATE_EXPIRED = "SESSION_STATE_EXPIRED", e))(le || {});
176
+ async function He({
177
177
  address: e,
178
178
  env: t
179
179
  }) {
@@ -189,9 +189,9 @@ function me(e) {
189
189
  index: t.index ?? 0,
190
190
  blockHeight: t.block_height ? Number(t.block_height) : void 0,
191
191
  blockTime: t.block_time ? Number(t.block_time) : void 0,
192
- value: new v(M(t.value)),
192
+ value: new S(M(t.value)),
193
193
  address: t.address,
194
- chainId: de(t.to_chain, e),
194
+ chainId: ye(t.to_chain, e),
195
195
  claimedTxId: t.claim_tx,
196
196
  rawPayload: t.raw_payload,
197
197
  signature: t.proof,
@@ -203,8 +203,8 @@ function me(e) {
203
203
  sessionState: t.session_state
204
204
  });
205
205
  }
206
- const be = 2e-4;
207
- async function $e({
206
+ const ce = 2e-4;
207
+ async function We({
208
208
  env: e,
209
209
  chainId: t = s.ethereum,
210
210
  amount: n = 1
@@ -212,10 +212,10 @@ async function $e({
212
212
  const { baseApiUrl: a } = w(e), i = D(t), { data: r } = await h.get(
213
213
  `api/v1/exchange/rate/${i}`,
214
214
  { baseURL: a, params: { amount: n } }
215
- ), o = new v(be).multipliedBy(P).toFixed();
216
- return { exchangeRate: +r.amount_out, minAmount: +o };
215
+ ), p = new S(ce).multipliedBy(P).toFixed();
216
+ return { exchangeRate: +r.amount_out, minAmount: +p };
217
217
  }
218
- async function Ve({
218
+ async function $e({
219
219
  address: e,
220
220
  chainId: t,
221
221
  env: n
@@ -237,11 +237,11 @@ async function Ve({
237
237
  isDelayed: i == null ? void 0 : i.is_delayed
238
238
  };
239
239
  } catch (i) {
240
- const r = C(i);
240
+ const r = v(i);
241
241
  throw new Error(r);
242
242
  }
243
243
  }
244
- async function Ze({
244
+ async function Ve({
245
245
  signature: e,
246
246
  typedData: t,
247
247
  address: n,
@@ -262,11 +262,11 @@ async function Ze({
262
262
  );
263
263
  return r.status;
264
264
  } catch (r) {
265
- const o = C(r);
266
- throw new Error(o);
265
+ const p = v(r);
266
+ throw new Error(p);
267
267
  }
268
268
  }
269
- async function Ke({
269
+ async function Ze({
270
270
  signature: e,
271
271
  typedData: t,
272
272
  env: n
@@ -285,7 +285,7 @@ async function Ke({
285
285
  );
286
286
  return i.status;
287
287
  } catch (i) {
288
- const r = C(i);
288
+ const r = v(i);
289
289
  throw new Error(r);
290
290
  }
291
291
  }
@@ -298,7 +298,7 @@ const x = {
298
298
  [s.binanceSmartChain]: "https://rpc.ankr.com/bsc",
299
299
  [s.binanceSmartChainTestnet]: "https://rpc.ankr.com/bsc_testnet_chapel"
300
300
  };
301
- async function Te(e) {
301
+ async function be(e) {
302
302
  const n = await (await fetch(e, {
303
303
  method: "POST",
304
304
  headers: {
@@ -311,9 +311,9 @@ async function Te(e) {
311
311
  params: []
312
312
  })
313
313
  })).json(), a = H.utils.hexToNumber(n == null ? void 0 : n.result);
314
- return new v(Number(a));
314
+ return new S(Number(a));
315
315
  }
316
- const fe = 2, ge = 25e3;
316
+ const Te = 2, fe = 25e3;
317
317
  class O {
318
318
  constructor({ chainId: t, rpcUrlConfig: n }) {
319
319
  A(this, "chainId");
@@ -355,10 +355,10 @@ class O {
355
355
  async getMaxFees() {
356
356
  const t = this.getReadWeb3(), n = this.getRpcUrl(), [a, i] = await Promise.all([
357
357
  t.eth.getBlock("latest"),
358
- Te(n)
358
+ be(n)
359
359
  ]);
360
360
  return !(a != null && a.baseFeePerGas) && typeof (a == null ? void 0 : a.baseFeePerGas) != "bigint" ? {} : {
361
- maxFeePerGas: +new v(a.baseFeePerGas.toString(10)).multipliedBy(fe).plus(i),
361
+ maxFeePerGas: +new S(a.baseFeePerGas.toString(10)).multipliedBy(Te).plus(i),
362
362
  maxPriorityFeePerGas: +i
363
363
  };
364
364
  }
@@ -370,8 +370,8 @@ class O {
370
370
  */
371
371
  async getSafeGasPriceWei() {
372
372
  const t = await this.getReadWeb3().eth.getGasPrice();
373
- return new v(t.toString(10)).plus(
374
- ge
373
+ return new S(t.toString(10)).plus(
374
+ fe
375
375
  );
376
376
  }
377
377
  /**
@@ -387,15 +387,15 @@ class O {
387
387
  return new a.eth.Contract(t, n);
388
388
  }
389
389
  }
390
- const he = [
390
+ const ge = [
391
391
  s.ethereum,
392
392
  s.base,
393
393
  s.binanceSmartChain
394
- ], W = (e) => he.includes(e) ? T.prod : T.stage;
394
+ ], W = (e) => ge.includes(e) ? T.prod : T.stage;
395
395
  function $(e) {
396
396
  return Object.values(s).includes(e);
397
397
  }
398
- const we = {
398
+ const he = {
399
399
  [s.holesky]: "0xED7bfd5C1790576105Af4649817f6d35A75CD818",
400
400
  [s.ethereum]: u,
401
401
  [s.binanceSmartChainTestnet]: "0x731eFa688F3679688cf60A3993b8658138953ED6",
@@ -407,7 +407,7 @@ const we = {
407
407
  [s.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
408
408
  [s.corn]: u,
409
409
  [s.swell]: u
410
- }, Ae = {
410
+ }, we = {
411
411
  [s.holesky]: "0x38A13AB20D15ffbE5A7312d2336EF1552580a4E2",
412
412
  [s.ethereum]: u,
413
413
  [s.binanceSmartChainTestnet]: "0x107Fc7d90484534704dD2A9e24c7BD45DB4dD1B5",
@@ -418,7 +418,7 @@ const we = {
418
418
  [s.berachainBartioTestnet]: "0xc47e4b3124597FDF8DD07843D4a7052F2eE80C30",
419
419
  [s.corn]: u,
420
420
  [s.swell]: u
421
- }, Se = {
421
+ }, Ae = {
422
422
  [s.ethereum]: "0x8236a87084f8b84306f72007f36f2618a5634494",
423
423
  [s.holesky]: u,
424
424
  [s.sepolia]: u,
@@ -430,17 +430,17 @@ const we = {
430
430
  [s.corn]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1",
431
431
  [s.swell]: "0xecAc9C5F704e954931349Da37F60E39f515c11c1"
432
432
  };
433
- function V(e = N) {
433
+ function Ce(e = N) {
434
434
  switch (e) {
435
435
  case T.prod:
436
- return Se;
437
- case T.testnet:
438
436
  return Ae;
439
- default:
437
+ case T.testnet:
440
438
  return we;
439
+ default:
440
+ return he;
441
441
  }
442
442
  }
443
- const ve = [
443
+ const Se = [
444
444
  {
445
445
  constant: !0,
446
446
  inputs: [],
@@ -661,7 +661,7 @@ const ve = [
661
661
  name: "Transfer",
662
662
  type: "event"
663
663
  }
664
- ], Ce = [
664
+ ], ve = [
665
665
  {
666
666
  inputs: [],
667
667
  stateMutability: "nonpayable",
@@ -2425,22 +2425,22 @@ const ve = [
2425
2425
  function _e(e) {
2426
2426
  switch (e) {
2427
2427
  case "LBTC":
2428
- return Ce;
2429
- default:
2430
2428
  return ve;
2429
+ default:
2430
+ return Se;
2431
2431
  }
2432
2432
  }
2433
2433
  function R(e, t) {
2434
- const n = V(t), { chainId: a } = e;
2434
+ const n = Ce(t), { chainId: a } = e;
2435
2435
  if (!$(a))
2436
2436
  throw new Error(`This chain ${a} is not supported`);
2437
2437
  const i = n[a];
2438
2438
  if (!i)
2439
2439
  throw new Error(`Token address for chain ${a} is not defined`);
2440
- const r = _e("LBTC"), o = e.createContract(r, i);
2441
- return o.options.address || (o.options.address = i), o;
2440
+ const r = _e("LBTC"), p = e.createContract(r, i);
2441
+ return p.options.address || (p.options.address = i), p;
2442
2442
  }
2443
- function Z(e, t) {
2443
+ function V(e, t) {
2444
2444
  if (!$(e))
2445
2445
  throw new Error(`This chain ${e} is not supported`);
2446
2446
  const n = t ? { [e]: t } : x;
@@ -2448,13 +2448,13 @@ function Z(e, t) {
2448
2448
  throw new Error(`RPC URL for chainId ${e} not found`);
2449
2449
  return n;
2450
2450
  }
2451
- async function ze({
2451
+ async function Ke({
2452
2452
  chainId: e,
2453
2453
  bakeGasEstimate: t = 0,
2454
2454
  rpcUrl: n
2455
2455
  }) {
2456
- const a = Z(e, n), i = new O({ chainId: e, rpcUrlConfig: a }), r = W(e), p = await R(i, r).methods.getMintFee().call(), d = new v(M(p.toString(10)));
2457
- return t ? d.plus(M(t)) : d;
2456
+ const a = V(e, n), i = new O({ chainId: e, rpcUrlConfig: a }), r = W(e), o = await R(i, r).methods.getMintFee().call(), m = new S(M(o.toString(10)));
2457
+ return t ? m.plus(M(t)) : m;
2458
2458
  }
2459
2459
  class F extends O {
2460
2460
  constructor({ provider: n, account: a, chainId: i, rpcUrlConfig: r }) {
@@ -2487,49 +2487,49 @@ class F extends O {
2487
2487
  * @returns {Promise<IWeb3SendResult>} Promise with transaction hash and receipt promise.
2488
2488
  */
2489
2489
  async sendTransactionAsync(n, a, i) {
2490
- const { chainId: r, web3: o } = this, p = this.getReadWeb3(), {
2491
- data: d,
2492
- estimate: m = !1,
2493
- estimateFee: l = !1,
2490
+ const { chainId: r, web3: p } = this, o = this.getReadWeb3(), {
2491
+ data: m,
2492
+ estimate: c = !1,
2493
+ estimateFee: d = !1,
2494
2494
  extendedGasLimit: y,
2495
2495
  gasLimit: b = "0",
2496
2496
  value: _ = "0",
2497
- gasLimitMultiplier: K = 1
2497
+ gasLimitMultiplier: Z = 1
2498
2498
  } = i;
2499
2499
  let { nonce: E } = i;
2500
- E || (E = await p.eth.getTransactionCount(n)), console.log(`Nonce: ${E}`);
2501
- const c = {
2500
+ E || (E = await o.eth.getTransactionCount(n)), console.log(`Nonce: ${E}`);
2501
+ const l = {
2502
2502
  from: n,
2503
2503
  to: a,
2504
2504
  value: g.numberToHex(_),
2505
- data: d,
2505
+ data: m,
2506
2506
  nonce: E,
2507
2507
  chainId: g.numberToHex(r)
2508
2508
  };
2509
- if (m)
2509
+ if (c)
2510
2510
  try {
2511
- const f = await p.eth.estimateGas(c), I = Math.round(
2512
- Number(f) * K
2511
+ const f = await o.eth.estimateGas(l), I = Math.round(
2512
+ Number(f) * Z
2513
2513
  );
2514
- y ? c.gas = g.numberToHex(I + y) : c.gas = g.numberToHex(I);
2514
+ y ? l.gas = g.numberToHex(I + y) : l.gas = g.numberToHex(I);
2515
2515
  } catch (f) {
2516
2516
  throw new Error(
2517
2517
  f.message ?? "Failed to estimate gas limit for transaction."
2518
2518
  );
2519
2519
  }
2520
2520
  else
2521
- c.gas = g.numberToHex(b);
2522
- const { maxFeePerGas: U, maxPriorityFeePerGas: B } = l ? await this.getMaxFees().catch(() => i) : i;
2523
- if (B !== void 0 && (c.maxPriorityFeePerGas = g.numberToHex(B)), U !== void 0 && (c.maxFeePerGas = g.numberToHex(U)), !c.maxFeePerGas && !c.maxPriorityFeePerGas) {
2521
+ l.gas = g.numberToHex(b);
2522
+ const { maxFeePerGas: U, maxPriorityFeePerGas: B } = d ? await this.getMaxFees().catch(() => i) : i;
2523
+ if (B !== void 0 && (l.maxPriorityFeePerGas = g.numberToHex(B)), U !== void 0 && (l.maxFeePerGas = g.numberToHex(U)), !l.maxFeePerGas && !l.maxPriorityFeePerGas) {
2524
2524
  const f = await this.getSafeGasPriceWei();
2525
- c.gasPrice = f.toString(10);
2525
+ l.gasPrice = f.toString(10);
2526
2526
  }
2527
- if (!c.maxFeePerGas && !c.maxPriorityFeePerGas) {
2527
+ if (!l.maxFeePerGas && !l.maxPriorityFeePerGas) {
2528
2528
  const f = await this.getSafeGasPriceWei();
2529
- c.gasPrice = f.toString(10);
2529
+ l.gasPrice = f.toString(10);
2530
2530
  }
2531
- return console.log("Sending transaction via Web3: ", c), new Promise((f, I) => {
2532
- const k = o.eth.sendTransaction(c);
2531
+ return console.log("Sending transaction via Web3: ", l), new Promise((f, I) => {
2532
+ const k = p.eth.sendTransaction(l);
2533
2533
  k.once("transactionHash", async (L) => {
2534
2534
  console.log(`Just signed transaction has is: ${L}`), f({
2535
2535
  receiptPromise: k,
@@ -2542,7 +2542,7 @@ class F extends O {
2542
2542
  return new this.web3.eth.Contract(n, a);
2543
2543
  }
2544
2544
  }
2545
- async function qe(e) {
2545
+ async function ze(e) {
2546
2546
  const t = new F(e), n = `destination chain id is ${e.chainId}`;
2547
2547
  return t.signMessage(n);
2548
2548
  }
@@ -2582,7 +2582,7 @@ function Ie({
2582
2582
  };
2583
2583
  }
2584
2584
  const xe = "Failed to obtain a valid signature. The response is undefined or invalid.", Me = () => Math.floor(Date.now() / 1e3 + Ee);
2585
- async function je({
2585
+ async function qe({
2586
2586
  address: e,
2587
2587
  provider: t,
2588
2588
  fee: n,
@@ -2591,60 +2591,60 @@ async function je({
2591
2591
  expiry: r = Me()
2592
2592
  }) {
2593
2593
  var y, b;
2594
- const o = new F({
2594
+ const p = new F({
2595
2595
  provider: t,
2596
2596
  account: e,
2597
2597
  chainId: a
2598
- }), d = R(o, i).options.address, m = JSON.stringify(
2598
+ }), m = R(p, i).options.address, c = JSON.stringify(
2599
2599
  Ie({
2600
2600
  chainId: a,
2601
- verifyingContract: d,
2601
+ verifyingContract: m,
2602
2602
  fee: n,
2603
2603
  expiry: r
2604
2604
  })
2605
- ), l = await ((b = (y = o.web3) == null ? void 0 : y.currentProvider) == null ? void 0 : b.request({
2605
+ ), d = await ((b = (y = p.web3) == null ? void 0 : y.currentProvider) == null ? void 0 : b.request({
2606
2606
  method: "eth_signTypedData_v4",
2607
- params: [e, m]
2607
+ params: [e, c]
2608
2608
  }));
2609
- if (typeof l == "string")
2610
- return { signature: l, typedData: m };
2611
- if (!(l != null && l.result))
2609
+ if (typeof d == "string")
2610
+ return { signature: d, typedData: c };
2611
+ if (!(d != null && d.result))
2612
2612
  throw new Error(xe);
2613
- return { signature: l.result, typedData: m };
2613
+ return { signature: d.result, typedData: c };
2614
2614
  }
2615
2615
  async function Ne({
2616
2616
  owner: e,
2617
2617
  rpcUrl: t,
2618
2618
  chainId: n
2619
2619
  }) {
2620
- const a = Z(n, t), i = new O({ chainId: n, rpcUrlConfig: a }), r = W(n), o = R(i, r);
2620
+ const a = V(n, t), i = new O({ chainId: n, rpcUrlConfig: a }), r = W(n), p = R(i, r);
2621
2621
  try {
2622
- return (await o.methods.nonces(e).call()).toString();
2623
- } catch (p) {
2624
- const d = C(p);
2625
- throw new Error(d);
2622
+ return (await p.methods.nonces(e).call()).toString();
2623
+ } catch (o) {
2624
+ const m = v(o);
2625
+ throw new Error(m);
2626
2626
  }
2627
2627
  }
2628
2628
  async function De({
2629
2629
  chainId: e,
2630
- expiryDate: t,
2630
+ expiry: t,
2631
2631
  owner: n,
2632
2632
  spender: a,
2633
2633
  value: i,
2634
- env: r,
2635
- rpcUrl: o
2634
+ rpcUrl: r,
2635
+ verifyingContract: p
2636
2636
  }) {
2637
- const d = V(r)[e], m = await Ne({
2637
+ const o = await Ne({
2638
2638
  owner: n,
2639
2639
  chainId: e,
2640
- rpcUrl: o
2640
+ rpcUrl: r
2641
2641
  });
2642
2642
  return {
2643
2643
  domain: {
2644
2644
  name: "Lombard Staked Bitcoin",
2645
2645
  version: "1",
2646
2646
  chainId: e,
2647
- verifyingContract: d
2647
+ verifyingContract: p
2648
2648
  },
2649
2649
  types: {
2650
2650
  EIP712Domain: [
@@ -2678,81 +2678,87 @@ async function De({
2678
2678
  owner: n,
2679
2679
  spender: a,
2680
2680
  value: i,
2681
- nonce: m,
2681
+ nonce: o,
2682
2682
  deadline: t.toString()
2683
2683
  }
2684
2684
  };
2685
2685
  }
2686
- const Pe = {
2687
- [s.holesky]: "0x52BD640617eeD47A00dA0da93351092D49208d1d"
2688
- }, Oe = (e) => {
2689
- const t = Pe[e];
2690
- if (!t)
2691
- throw new Error(`No spender address configured for chain ID ${e}`);
2692
- return t;
2693
- }, Re = "Failed to obtain a valid signature. The response is undefined or invalid.";
2694
- async function Je({
2686
+ const Pe = "Failed to obtain a valid signature. The response is undefined or invalid.";
2687
+ async function je({
2695
2688
  address: e,
2696
2689
  provider: t,
2697
2690
  chainId: n,
2698
2691
  value: a,
2699
- env: i,
2700
- expiryDate: r,
2701
- rpcUrl: o
2692
+ expiry: i,
2693
+ rpcUrl: r,
2694
+ spender: p,
2695
+ verifyingContract: o
2702
2696
  }) {
2703
2697
  var b, _;
2704
- const p = new F({
2698
+ const m = new F({
2705
2699
  provider: t,
2706
2700
  account: e,
2707
2701
  chainId: n
2708
- }), d = Oe(n), m = await De({
2702
+ }), c = await De({
2709
2703
  chainId: n,
2710
- expiryDate: r,
2704
+ expiry: i,
2711
2705
  owner: e,
2712
- spender: d,
2706
+ spender: p,
2713
2707
  value: a,
2714
- env: i,
2715
- rpcUrl: o
2716
- }), l = JSON.stringify(m), y = await ((_ = (b = p.web3) == null ? void 0 : b.currentProvider) == null ? void 0 : _.request({
2708
+ rpcUrl: r,
2709
+ verifyingContract: o
2710
+ }), d = JSON.stringify(c), y = await ((_ = (b = m.web3) == null ? void 0 : b.currentProvider) == null ? void 0 : _.request({
2717
2711
  method: "eth_signTypedData_v4",
2718
- params: [e, l]
2712
+ params: [e, d]
2719
2713
  }));
2720
2714
  if (typeof y == "string")
2721
- return { signature: y, typedData: l };
2715
+ return { signature: y, typedData: d };
2722
2716
  if (!(y != null && y.result))
2723
- throw new Error(Re);
2724
- return { signature: y.result, typedData: l };
2717
+ throw new Error(Pe);
2718
+ return { signature: y.result, typedData: d };
2725
2719
  }
2720
+ const Oe = {
2721
+ [s.holesky]: {
2722
+ SPENDER: "0x52BD640617eeD47A00dA0da93351092D49208d1d",
2723
+ VERIFYING_CONTRACT: "0xED7bfd5C1790576105Af4649817f6d35A75CD818"
2724
+ }
2725
+ }, Je = (e) => {
2726
+ var n;
2727
+ const t = (n = Oe[e]) == null ? void 0 : n.SPENDER;
2728
+ if (!t)
2729
+ throw new Error(`No spender address configured for chain ID ${e}`);
2730
+ return t;
2731
+ };
2726
2732
  export {
2727
- le as ENotarizationStatus,
2728
- ce as ESessionState,
2733
+ de as ENotarizationStatus,
2734
+ le as ESessionState,
2729
2735
  s as OChainId,
2730
2736
  T as OEnv,
2731
- ae as SANCTIONED_ADDRESS,
2737
+ ne as SANCTIONED_ADDRESS,
2732
2738
  P as SATOSHI_SCALE,
2733
- Pe as STAKE_AND_BAKE_SPENDER_ADDRESSES,
2734
2739
  M as fromSatoshi,
2735
- Le as generateDepositBtcAddress,
2740
+ ke as generateDepositBtcAddress,
2736
2741
  w as getApiConfig,
2737
- X as getBaseNetworkByEnv,
2738
- J as getBscNetworkByEnv,
2739
- de as getChainIdByName,
2742
+ J as getBaseNetworkByEnv,
2743
+ j as getBscNetworkByEnv,
2744
+ ye as getChainIdByName,
2740
2745
  D as getChainNameById,
2741
- Ge as getDepositBtcAddress,
2742
- ue as getDepositBtcAddresses,
2743
- We as getDepositsByAddress,
2744
- j as getEthNetworkByEnv,
2745
- $e as getLBTCExchangeRate,
2746
- ze as getLBTCMintingFee,
2747
- Ve as getNetworkFeeSignature,
2748
- Oe as getStakeAndBakeSpenderAddress,
2746
+ Le as getDepositBtcAddress,
2747
+ oe as getDepositBtcAddresses,
2748
+ He as getDepositsByAddress,
2749
+ q as getEthNetworkByEnv,
2750
+ We as getLBTCExchangeRate,
2751
+ Ke as getLBTCMintingFee,
2752
+ Ce as getLbtcAddressConfig,
2753
+ $e as getNetworkFeeSignature,
2754
+ Je as getStakeAndBakeSpenderAddress,
2749
2755
  De as getStakeAndBakeTypedData,
2750
2756
  $ as isValidChain,
2751
- qe as signLbtcDestionationAddr,
2752
- je as signNetworkFee,
2753
- Je as signStakeAndBake,
2754
- Ze as storeNetworkFeeSignature,
2755
- Ke as storeStakeAndBakeSignature,
2756
- He as toSatoshi
2757
+ ze as signLbtcDestionationAddr,
2758
+ qe as signNetworkFee,
2759
+ je as signStakeAndBake,
2760
+ Ve as storeNetworkFeeSignature,
2761
+ Ze as storeStakeAndBakeSignature,
2762
+ Ge as toSatoshi
2757
2763
  };
2758
2764
  //# sourceMappingURL=index.js.map