@lombard.finance/sdk 5.0.4 → 5.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/btc.cjs +1 -1
  3. package/dist/btc.js +2 -2
  4. package/dist/chains/evm/EvmActions.d.ts +15 -6
  5. package/dist/chains/evm/EvmActions.d.ts.map +1 -1
  6. package/dist/chains/evm/actions/redeem/EvmRedeem.d.ts +15 -8
  7. package/dist/chains/evm/actions/redeem/EvmRedeem.d.ts.map +1 -1
  8. package/dist/chains/evm/actions/redeem/factory.d.ts +6 -2
  9. package/dist/chains/evm/actions/redeem/factory.d.ts.map +1 -1
  10. package/dist/chains/evm/actions/redeem/types.d.ts +10 -6
  11. package/dist/chains/evm/actions/redeem/types.d.ts.map +1 -1
  12. package/dist/chunks/{BtcActions-D7HekjRg.js → BtcActions-BDTnGE1D.js} +2 -2
  13. package/dist/chunks/{BtcActions-D7HekjRg.js.map → BtcActions-BDTnGE1D.js.map} +1 -1
  14. package/dist/chunks/{BtcActions-lp4P72ln.cjs → BtcActions-DZs5eXTb.cjs} +2 -2
  15. package/dist/chunks/{BtcActions-lp4P72ln.cjs.map → BtcActions-DZs5eXTb.cjs.map} +1 -1
  16. package/dist/chunks/{EvmActions-nbR8cSa4.js → EvmActions-8VeTiWrl.js} +337 -373
  17. package/dist/chunks/EvmActions-8VeTiWrl.js.map +1 -0
  18. package/dist/chunks/EvmActions-CEC3vNtR.cjs +7 -0
  19. package/dist/chunks/EvmActions-CEC3vNtR.cjs.map +1 -0
  20. package/dist/chunks/{events-BP_Ahnsm.js → events-22AhTtaL.js} +4 -4
  21. package/dist/chunks/{events-BP_Ahnsm.js.map → events-22AhTtaL.js.map} +1 -1
  22. package/dist/chunks/{events-DY2qn8Q0.cjs → events-CW_OMnKf.cjs} +2 -2
  23. package/dist/chunks/{events-DY2qn8Q0.cjs.map → events-CW_OMnKf.cjs.map} +1 -1
  24. package/dist/chunks/{statusConstants-D4DN05kK.cjs → statusConstants-Cz77HXnT.cjs} +2 -2
  25. package/dist/chunks/{statusConstants-D4DN05kK.cjs.map → statusConstants-Cz77HXnT.cjs.map} +1 -1
  26. package/dist/chunks/{statusConstants-DLrd03gT.js → statusConstants-DZlImWu7.js} +2 -2
  27. package/dist/chunks/{statusConstants-DLrd03gT.js.map → statusConstants-DZlImWu7.js.map} +1 -1
  28. package/dist/core.cjs +1 -1
  29. package/dist/core.js +4 -4
  30. package/dist/evm.cjs +1 -1
  31. package/dist/evm.js +2 -2
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.js +4 -4
  34. package/package.json +1 -1
  35. package/dist/chunks/EvmActions-CynfSVFq.cjs +0 -7
  36. package/dist/chunks/EvmActions-CynfSVFq.cjs.map +0 -1
  37. package/dist/chunks/EvmActions-nbR8cSa4.js.map +0 -1
@@ -1,20 +1,20 @@
1
1
  var dt = Object.defineProperty;
2
- var pt = (r, a, t) => a in r ? dt(r, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[a] = t;
3
- var m = (r, a, t) => pt(r, typeof a != "symbol" ? a + "" : a, t);
4
- import D from "bignumber.js";
5
- import { getMintingFee as at, signNetworkFee as it, getStakeAndBakeFee as mt, signStakeAndBake as lt, signLbtcDestinationAddr as vt, waitForTransactionReceipt as F, depositEarn as Et, claimLBTC as Ct, redeemToken as nt, getTokenAllowance as _t, approveToken as gt, depositToken as wt, cancelWithdrawInternal as At, withdrawEarn as ft, queueWithdrawInternal as It } from "./withdrawEarn-BM_JOe4k.js";
6
- import { Token as E, makeWalletClient as z, CHAIN_ID_TO_VIEM_CHAIN_MAP as M, AddressKind as Dt, ChainId as et } from "./token-addresses-DVnRPyu4.js";
7
- import { makePublicClient as N, getTokenInfo as U, toBaseDenomination as q, fromBaseDenomination as y, getErrorMessage as Tt, getTokenContractInfo as W } from "./tokens-BUrC15ra.js";
8
- import { Chain as f, BaseAction as x, EvmOperationStatus as s, validatePrepareParams as O, LombardError as h, parseChainIdentifier as w, StepStatus as i, objectType as B, evmAmountSchema as b, stringType as Pt, evmAddressSchema as rt, getEvmAssetChains as T, bitcoinAddressSchema as ot, getEvmChainsWithAllAssets as ct, WithdrawErrorCode as H, createEvmCoreContext as St } from "./statusConstants-DLrd03gT.js";
2
+ var pt = (n, a, t) => a in n ? dt(n, a, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[a] = t;
3
+ var d = (n, a, t) => pt(n, typeof a != "symbol" ? a + "" : a, t);
4
+ import P from "bignumber.js";
5
+ import { getMintingFee as et, signNetworkFee as st, getStakeAndBakeFee as mt, signStakeAndBake as lt, signLbtcDestinationAddr as vt, waitForTransactionReceipt as F, depositEarn as Et, claimLBTC as Ct, redeemToken as at, getTokenAllowance as _t, approveToken as gt, depositToken as wt, cancelWithdrawInternal as At, withdrawEarn as ft, queueWithdrawInternal as It } from "./withdrawEarn-BM_JOe4k.js";
6
+ import { Token as C, makeWalletClient as W, CHAIN_ID_TO_VIEM_CHAIN_MAP as M, AddressKind as Pt, ChainId as X } from "./token-addresses-DVnRPyu4.js";
7
+ import { makePublicClient as N, getTokenInfo as U, toBaseDenomination as Y, fromBaseDenomination as y, getErrorMessage as Tt, getTokenContractInfo as z } from "./tokens-BUrC15ra.js";
8
+ import { Chain as A, BaseAction as x, EvmOperationStatus as s, validatePrepareParams as B, LombardError as h, parseChainIdentifier as f, StepStatus as i, objectType as O, evmAmountSchema as b, stringType as Dt, evmAddressSchema as it, getEvmAssetChains as T, bitcoinAddressSchema as nt, getEvmChainsWithAllAssets as rt, WithdrawErrorCode as H, createEvmCoreContext as St } from "./statusConstants-DZlImWu7.js";
9
9
  import { storeNetworkFeeSignature as xt } from "./storeNetworkFeeSignature-sCt4_nHr.js";
10
10
  import { requiresAutoMintFee as Lt } from "./fee-requirements-CCNsxAvJ.js";
11
11
  import { getNetworkFeeSignature as Nt } from "./getNetworkFeeSignature-FuDJWrMC.js";
12
12
  import { DefiProtocol as S, AssetId as l } from "./defi-registry-DULXbu3D.js";
13
13
  import { r as o } from "./index-CfcQ_g3t.js";
14
- import { erc20Abi as st } from "viem";
14
+ import { erc20Abi as tt } from "viem";
15
15
  import { toBigInt as Z } from "./numbers-CclN2Ohk.js";
16
- import { isEarnChain as j, EARN_VAULT as Y, isBtceVaultChain as k, BTCE_VAULT as P } from "./config-wnjPtnjd.js";
17
- class Ot {
16
+ import { isEarnChain as j, EARN_VAULT as q, isBtceVaultChain as k, BTCE_VAULT as D } from "./config-wnjPtnjd.js";
17
+ class Bt {
18
18
  constructor(a) {
19
19
  this.env = a;
20
20
  }
@@ -24,8 +24,8 @@ class Ot {
24
24
  * @param token - Optional token (defaults to LBTC). Use Token.BTCb for BTC.b deposits.
25
25
  */
26
26
  async getMintingFee(a, t) {
27
- return (await at({
28
- token: t || E.LBTC,
27
+ return (await et({
28
+ token: t || C.LBTC,
29
29
  chainId: a,
30
30
  env: this.env
31
31
  })).toString();
@@ -34,14 +34,14 @@ class Ot {
34
34
  * Sign network fee authorization (EIP-712)
35
35
  */
36
36
  async signNetworkFee(a) {
37
- const t = await it({
38
- fee: new D(a.fee),
37
+ const t = await st({
38
+ fee: new P(a.fee),
39
39
  account: a.account,
40
40
  chainId: a.chainId,
41
41
  provider: a.provider,
42
42
  env: this.env,
43
43
  // Pass token for signing - defaults to LBTC for backwards compatibility
44
- token: a.token ?? E.LBTC
44
+ token: a.token ?? C.LBTC
45
45
  });
46
46
  return {
47
47
  signature: t.signature,
@@ -62,7 +62,7 @@ class Ot {
62
62
  */
63
63
  async signStakeAndBake(a) {
64
64
  const t = await lt({
65
- value: new D(a.value),
65
+ value: new P(a.value),
66
66
  account: a.account,
67
67
  chainId: a.chainId,
68
68
  provider: a.provider,
@@ -86,79 +86,79 @@ class Ot {
86
86
  }) };
87
87
  }
88
88
  }
89
- function Pe() {
89
+ function De() {
90
90
  return {
91
91
  id: "evm",
92
92
  chain: "evm",
93
- register(r) {
94
- return new Ot(r.env);
93
+ register(n) {
94
+ return new Bt(n.env);
95
95
  }
96
96
  };
97
97
  }
98
- const Bt = {
98
+ const Ot = {
99
99
  routes: [
100
100
  // Veda - Ethereum
101
101
  {
102
102
  asset: l.LBTC,
103
- sourceChains: [f.ETHEREUM],
103
+ sourceChains: [A.ETHEREUM],
104
104
  protocols: [S.Veda],
105
105
  envs: [o.prod]
106
106
  },
107
107
  // Veda - Base
108
108
  {
109
109
  asset: l.LBTC,
110
- sourceChains: [f.BASE],
110
+ sourceChains: [A.BASE],
111
111
  protocols: [S.Veda],
112
112
  envs: [o.prod]
113
113
  },
114
114
  // Veda - BSC
115
115
  {
116
116
  asset: l.LBTC,
117
- sourceChains: [f.BSC],
117
+ sourceChains: [A.BSC],
118
118
  protocols: [S.Veda],
119
119
  envs: [o.prod]
120
120
  },
121
121
  // Veda - Corn
122
122
  {
123
123
  asset: l.LBTC,
124
- sourceChains: [f.CORN],
124
+ sourceChains: [A.CORN],
125
125
  protocols: [S.Veda],
126
126
  envs: [o.prod]
127
127
  },
128
128
  // Silo - Avalanche
129
129
  {
130
130
  asset: l.LBTC,
131
- sourceChains: [f.AVALANCHE],
131
+ sourceChains: [A.AVALANCHE],
132
132
  protocols: [S.Silo],
133
133
  envs: [o.prod]
134
134
  }
135
135
  ]
136
136
  };
137
137
  async function bt({
138
- amount: r,
138
+ amount: n,
139
139
  approve: a = !0,
140
- token: t = E.LBTC,
140
+ token: t = C.LBTC,
141
141
  account: e,
142
- chainId: n,
143
- provider: d,
144
- rpcUrl: u,
142
+ chainId: r,
143
+ provider: m,
144
+ rpcUrl: c,
145
145
  env: p
146
146
  }) {
147
- const c = Y;
148
- if (!j(n))
147
+ const u = q;
148
+ if (!j(r))
149
149
  throw new Error(
150
- `Unsupported chain id: ${n}. Please switch to one of the supported chains: ${c.chains.join(", ")}`
150
+ `Unsupported chain id: ${r}. Please switch to one of the supported chains: ${u.chains.join(", ")}`
151
151
  );
152
- const _ = N({ chainId: n, rpcUrl: u }), g = z({ provider: d, chainId: n }), v = await U(t, n, p, u);
152
+ const _ = N({ chainId: r, rpcUrl: c }), g = W({ provider: m, chainId: r }), v = await U(t, r, p, c);
153
153
  if (!v)
154
154
  throw new Error(`Unknown deposit token: ${t}`);
155
- const C = D(r), A = Z(
156
- q(C, v.decimals)
155
+ const E = P(n), w = Z(
156
+ Y(E, v.decimals)
157
157
  ), R = await _.readContract({
158
158
  address: v.address,
159
159
  abi: v.abi,
160
160
  functionName: "allowance",
161
- args: [e, c.vaultContract.address]
161
+ args: [e, u.vaultContract.address]
162
162
  }), L = y(
163
163
  String(R),
164
164
  v.decimals
@@ -167,61 +167,61 @@ async function bt({
167
167
  abi: v.abi,
168
168
  functionName: "balanceOf",
169
169
  args: [e]
170
- }), X = y(
170
+ }), Q = y(
171
171
  String(V),
172
172
  v.decimals
173
173
  );
174
- if (C.isGreaterThan(X))
174
+ if (E.isGreaterThan(Q))
175
175
  throw new Error(
176
176
  `The deposit amount exceeds the account's balance.
177
- Deposit amount: ${C.toFixed()}
178
- Balance: ${X.toFixed()}`
177
+ Deposit amount: ${E.toFixed()}
178
+ Balance: ${Q.toFixed()}`
179
179
  );
180
- if (C.isGreaterThan(L)) {
181
- const tt = `The deposit amount exceeds allowance.
182
- Deposit amount: ${C.toFixed()}
180
+ if (E.isGreaterThan(L)) {
181
+ const J = `The deposit amount exceeds allowance.
182
+ Deposit amount: ${E.toFixed()}
183
183
  Allowance: ${L.toFixed()}`;
184
184
  if (!a)
185
- throw new Error(tt);
186
- console.info(tt);
185
+ throw new Error(J);
186
+ console.info(J);
187
187
  try {
188
- console.info(`Trying to approve ${A}`);
188
+ console.info(`Trying to approve ${w}`);
189
189
  const { request: $ } = await _.simulateContract({
190
190
  account: e,
191
- chain: M[n],
191
+ chain: M[r],
192
192
  address: v.address,
193
193
  abi: v.abi,
194
194
  functionName: "approve",
195
- args: [c.vaultContract.address, A]
195
+ args: [u.vaultContract.address, w]
196
196
  }), G = await g.writeContract($);
197
- console.info(`Approve tx hash: ${G}`), console.info(`Approved ${A} for ${c.vaultContract.address}`);
197
+ console.info(`Approve tx hash: ${G}`), console.info(`Approved ${w} for ${u.vaultContract.address}`);
198
198
  } catch ($) {
199
199
  const G = Tt($);
200
200
  throw new Error(
201
- `Could not approve ${A} for ${c.vaultContract.address}.
201
+ `Could not approve ${w} for ${u.vaultContract.address}.
202
202
  Reason: ${G}`
203
203
  );
204
204
  }
205
205
  }
206
206
  const { request: ut } = await _.simulateContract({
207
207
  account: e,
208
- chain: M[n],
209
- address: c.tellerContracts[n].address,
210
- abi: c.tellerContracts[n].abi,
208
+ chain: M[r],
209
+ address: u.tellerContracts[r].address,
210
+ abi: u.tellerContracts[r].abi,
211
211
  functionName: "deposit",
212
- args: [v.address, A, 0n]
212
+ args: [v.address, w, 0n]
213
213
  });
214
214
  return await g.writeContract(ut);
215
215
  }
216
216
  class Rt extends x {
217
217
  constructor(t, e) {
218
218
  super(s.IDLE);
219
- m(this, "_amount");
220
- m(this, "_protocol");
221
- m(this, "_needsApproval", !1);
222
- m(this, "_txHash");
223
- m(this, "_account");
224
- m(this, "_chainId");
219
+ d(this, "_amount");
220
+ d(this, "_protocol");
221
+ d(this, "_needsApproval", !1);
222
+ d(this, "_txHash");
223
+ d(this, "_account");
224
+ d(this, "_chainId");
225
225
  this.ctx = t, this.params = e;
226
226
  }
227
227
  get amount() {
@@ -249,23 +249,23 @@ class Rt extends x {
249
249
  * - LBTCv BoringVault address for all other cases
250
250
  */
251
251
  getSpenderAddress() {
252
- return this.isVedaBtcePath() ? P.contracts[this._chainId] : Y.vaultContract.address;
252
+ return this.isVedaBtcePath() ? D.contracts[this._chainId] : q.vaultContract.address;
253
253
  }
254
254
  async prepare(t) {
255
255
  return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
256
- const e = O(this.prepareSchema, t);
256
+ const e = B(this.prepareSchema, t);
257
257
  this._amount = e.amount, this._protocol = t.protocol, this.validateProtocol(t.protocol);
258
- const n = await this.ctx.getProvider("evm");
259
- if (!n)
258
+ const r = await this.ctx.getProvider("evm");
259
+ if (!r)
260
260
  throw h.providerMissing(this.params.sourceChain, "evm");
261
- const u = (await n.request({
261
+ const c = (await r.request({
262
262
  method: "eth_accounts"
263
263
  }))[0];
264
- if (!u)
264
+ if (!c)
265
265
  throw h.providerMissing(this.params.sourceChain, "evm");
266
- this._account = u, this._chainId = w(this.params.sourceChain);
266
+ this._account = c, this._chainId = f(this.params.sourceChain);
267
267
  const p = await U(
268
- E.LBTC,
268
+ C.LBTC,
269
269
  this._chainId,
270
270
  this.ctx.env
271
271
  );
@@ -274,13 +274,13 @@ class Rt extends x {
274
274
  "token",
275
275
  "Could not get LBTC token info"
276
276
  );
277
- const c = this.getSpenderAddress(), g = await N({ chainId: this._chainId }).readContract({
277
+ const u = this.getSpenderAddress(), g = await N({ chainId: this._chainId }).readContract({
278
278
  address: p.address,
279
- abi: st,
279
+ abi: tt,
280
280
  functionName: "allowance",
281
- args: [u, c]
282
- }), v = new D(e.amount), C = q(v, p.decimals), A = new D(String(g));
283
- this._needsApproval = C.isGreaterThan(A), this._needsApproval ? (this.emitProgress({
281
+ args: [c, u]
282
+ }), v = new P(e.amount), E = Y(v, p.decimals), w = new P(String(g));
283
+ this._needsApproval = E.isGreaterThan(w), this._needsApproval ? (this.emitProgress({
284
284
  status: s.NEEDS_APPROVAL,
285
285
  steps: { approval: i.PENDING, deploying: i.IDLE }
286
286
  }), this.updateStatus(s.NEEDS_APPROVAL)) : (this.emitProgress({
@@ -300,7 +300,7 @@ class Rt extends x {
300
300
  if (!t)
301
301
  throw h.providerMissing(this.params.sourceChain, "evm");
302
302
  const e = await U(
303
- E.LBTC,
303
+ C.LBTC,
304
304
  this._chainId,
305
305
  this.ctx.env
306
306
  );
@@ -309,19 +309,19 @@ class Rt extends x {
309
309
  "token",
310
310
  "Could not get LBTC token info"
311
311
  );
312
- const n = new D(this._amount), d = Z(
313
- q(n, e.decimals)
314
- ), u = this.getSpenderAddress(), p = N({ chainId: this._chainId }), c = z({
312
+ const r = new P(this._amount), m = Z(
313
+ Y(r, e.decimals)
314
+ ), c = this.getSpenderAddress(), p = N({ chainId: this._chainId }), u = W({
315
315
  provider: t,
316
316
  chainId: this._chainId
317
317
  }), { request: _ } = await p.simulateContract({
318
318
  account: this._account,
319
319
  chain: M[this._chainId],
320
320
  address: e.address,
321
- abi: st,
321
+ abi: tt,
322
322
  functionName: "approve",
323
- args: [u, d]
324
- }), g = await c.writeContract(_);
323
+ args: [c, m]
324
+ }), g = await u.writeContract(_);
325
325
  await F(
326
326
  p,
327
327
  g,
@@ -345,7 +345,7 @@ class Rt extends x {
345
345
  });
346
346
  let e;
347
347
  return this.isVedaBtcePath() ? e = await Et({
348
- token: E.LBTC,
348
+ token: C.LBTC,
349
349
  amount: this._amount,
350
350
  receiver: this.params.recipient,
351
351
  approve: !1,
@@ -356,7 +356,7 @@ class Rt extends x {
356
356
  }) : e = await bt({
357
357
  amount: this._amount,
358
358
  approve: !1,
359
- token: E.LBTC,
359
+ token: C.LBTC,
360
360
  account: this._account,
361
361
  chainId: this._chainId,
362
362
  provider: t,
@@ -371,14 +371,14 @@ class Rt extends x {
371
371
  }, s.COMPLETED);
372
372
  }
373
373
  get prepareSchema() {
374
- return B({
374
+ return O({
375
375
  amount: b,
376
- protocol: Pt().min(1, "Protocol is required")
376
+ protocol: Dt().min(1, "Protocol is required")
377
377
  });
378
378
  }
379
379
  validateProtocol(t) {
380
- if (!Bt.routes.some(
381
- (n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
380
+ if (!Ot.routes.some(
381
+ (r) => r.protocols.includes(t) && r.envs.includes(this.ctx.env)
382
382
  ))
383
383
  throw h.invalidParameter(
384
384
  "protocol",
@@ -386,8 +386,8 @@ class Rt extends x {
386
386
  );
387
387
  }
388
388
  }
389
- function yt(r, a) {
390
- return new Rt(r, a);
389
+ function yt(n, a) {
390
+ return new Rt(n, a);
391
391
  }
392
392
  const Mt = T(l.BTCb, [o.prod]), Ht = T(l.BTCb, [
393
393
  o.testnet,
@@ -399,7 +399,7 @@ const Mt = T(l.BTCb, [o.prod]), Ht = T(l.BTCb, [
399
399
  o.stage,
400
400
  o.dev,
401
401
  o.ibc
402
- ]), qt = {
402
+ ]), Yt = {
403
403
  routes: [
404
404
  // Production: BTCb → LBTC
405
405
  {
@@ -418,17 +418,17 @@ const Mt = T(l.BTCb, [o.prod]), Ht = T(l.BTCb, [
418
418
  envs: [o.testnet, o.stage, o.dev, o.ibc]
419
419
  }
420
420
  ],
421
- addressSchema: rt
421
+ addressSchema: it
422
422
  };
423
- var I = /* @__PURE__ */ ((r) => (r.IDLE = "idle", r.NEEDS_APPROVAL = "needs-approval", r.READY = "ready", r.BRIDGING = "bridging", r.COMPLETED = "completed", r))(I || {});
424
- class Yt extends x {
423
+ var I = /* @__PURE__ */ ((n) => (n.IDLE = "idle", n.NEEDS_APPROVAL = "needs-approval", n.READY = "ready", n.BRIDGING = "bridging", n.COMPLETED = "completed", n))(I || {});
424
+ class qt extends x {
425
425
  constructor(t, e) {
426
426
  super(I.IDLE);
427
- m(this, "_amount");
428
- m(this, "_recipient");
429
- m(this, "_needsApproval", !1);
430
- m(this, "_txHash");
431
- m(this, "_claimData");
427
+ d(this, "_amount");
428
+ d(this, "_recipient");
429
+ d(this, "_needsApproval", !1);
430
+ d(this, "_txHash");
431
+ d(this, "_claimData");
432
432
  this.ctx = t, this.params = e;
433
433
  }
434
434
  get amount() {
@@ -448,7 +448,7 @@ class Yt extends x {
448
448
  }
449
449
  async prepare(t) {
450
450
  return this.assertStatus(I.IDLE, "prepare"), this.act(async () => {
451
- const e = O(this.prepareSchema, t, {
451
+ const e = B(this.prepareSchema, t, {
452
452
  destChain: this.params.destChain
453
453
  });
454
454
  this._amount = e.amount, this._recipient = e.recipient, this._needsApproval = !1, this.emitProgress({
@@ -473,7 +473,7 @@ class Yt extends x {
473
473
  const t = await this.ctx.getProvider("evm");
474
474
  if (!t)
475
475
  throw h.providerMissing(this.params.sourceChain, "evm");
476
- const e = w(this.params.destChain);
476
+ const e = f(this.params.destChain);
477
477
  this.emitProgress({
478
478
  status: I.READY,
479
479
  steps: {
@@ -482,7 +482,7 @@ class Yt extends x {
482
482
  bridging: i.IDLE
483
483
  }
484
484
  });
485
- const n = await Ct({
485
+ const r = await Ct({
486
486
  provider: t,
487
487
  account: this._recipient,
488
488
  data: this._claimData.data,
@@ -490,25 +490,25 @@ class Yt extends x {
490
490
  chainId: e,
491
491
  env: this.ctx.env
492
492
  });
493
- return this._txHash = n, this.emitProgress({
493
+ return this._txHash = r, this.emitProgress({
494
494
  status: I.COMPLETED,
495
495
  steps: {
496
496
  approval: i.COMPLETE,
497
497
  execution: i.COMPLETE,
498
498
  bridging: i.IDLE
499
499
  }
500
- }), this.emitCompleted(), { txHash: n };
500
+ }), this.emitCompleted(), { txHash: r };
501
501
  }, I.COMPLETED);
502
502
  }
503
503
  get prepareSchema() {
504
- return B({
504
+ return O({
505
505
  amount: b,
506
- recipient: qt.addressSchema
506
+ recipient: Yt.addressSchema
507
507
  });
508
508
  }
509
509
  }
510
- function Vt(r, a) {
511
- return new Yt(r, a);
510
+ function Vt(n, a) {
511
+ return new qt(n, a);
512
512
  }
513
513
  const $t = T(l.BTCb, [o.prod]), Gt = T(l.BTCb, [
514
514
  o.testnet,
@@ -522,7 +522,7 @@ const $t = T(l.BTCb, [o.prod]), Gt = T(l.BTCb, [
522
522
  assetIn: l.BTCb,
523
523
  assetOut: l.BTC,
524
524
  sourceChains: $t,
525
- destChain: f.BITCOIN_MAINNET,
525
+ destChain: A.BITCOIN_MAINNET,
526
526
  envs: [o.prod]
527
527
  },
528
528
  // BTC.b → BTC (to Bitcoin Signet - testnet)
@@ -530,16 +530,16 @@ const $t = T(l.BTCb, [o.prod]), Gt = T(l.BTCb, [
530
530
  assetIn: l.BTCb,
531
531
  assetOut: l.BTC,
532
532
  sourceChains: Gt,
533
- destChain: f.BITCOIN_SIGNET,
533
+ destChain: A.BITCOIN_SIGNET,
534
534
  envs: [o.testnet, o.stage, o.dev, o.ibc]
535
535
  }
536
536
  // TODO: Add L-Asset routes when deployed
537
537
  // L-ZEC → ZEC, L-SOL → SOL, L-XRP → XRP, L-DOGE → DOGE
538
538
  ],
539
- recipientSchema: ot
539
+ recipientSchema: nt
540
540
  };
541
- async function K(r, a, t, e) {
542
- if (!Lt(r))
541
+ async function ot(n, a, t, e) {
542
+ if (!Lt(n))
543
543
  return {
544
544
  requiresAuth: !1,
545
545
  hasValidSignature: !1,
@@ -547,47 +547,47 @@ async function K(r, a, t, e) {
547
547
  feeFormatted: null,
548
548
  expirationDate: null
549
549
  };
550
- const n = await W(e, r, t), d = await Nt({
550
+ const r = await z(e, n, t), m = await Nt({
551
551
  address: a,
552
- chainId: r,
552
+ chainId: n,
553
553
  env: t,
554
- tokenAddress: n.address
555
- }), u = d.expirationDate ? new Date(Number(d.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1, p = d.hasSignature && !u;
556
- let c = null, _ = null;
554
+ tokenAddress: r.address
555
+ }), c = m.expirationDate ? new Date(Number(m.expirationDate) * 1e3) < /* @__PURE__ */ new Date() : !1, p = m.hasSignature && !c;
556
+ let u = null, _ = null;
557
557
  if (!p) {
558
- const g = await at({
558
+ const g = await et({
559
559
  token: e,
560
- chainId: r,
560
+ chainId: n,
561
561
  env: t
562
562
  });
563
- c = BigInt(g.times(1e8).toFixed(0)), _ = g.toFixed(8);
563
+ u = BigInt(g.times(1e8).toFixed(0)), _ = g.toFixed(8);
564
564
  }
565
565
  return {
566
566
  requiresAuth: !0,
567
567
  hasValidSignature: p,
568
- feeInSatoshis: c,
568
+ feeInSatoshis: u,
569
569
  feeFormatted: _,
570
- expirationDate: d.expirationDate ?? null
570
+ expirationDate: m.expirationDate ?? null
571
571
  };
572
572
  }
573
- async function Q(r) {
574
- const { chainId: a, account: t, feeInSatoshis: e, provider: n, env: d, token: u } = r, p = await W(u, a, d), c = await it({
573
+ async function ct(n) {
574
+ const { chainId: a, account: t, feeInSatoshis: e, provider: r, env: m, token: c } = n, p = await z(c, a, m), u = await st({
575
575
  fee: e,
576
576
  account: t,
577
577
  chainId: a,
578
- provider: n,
579
- env: d,
580
- token: u
578
+ provider: r,
579
+ env: m,
580
+ token: c
581
581
  });
582
582
  return await xt({
583
- signature: c.signature,
584
- typedData: c.typedData,
583
+ signature: u.signature,
584
+ typedData: u.typedData,
585
585
  address: t,
586
- env: d,
586
+ env: m,
587
587
  tokenAddress: p.address
588
- }), c;
588
+ }), u;
589
589
  }
590
- function J() {
590
+ function K() {
591
591
  return {
592
592
  requiresAuth: !1,
593
593
  isAuthorized: !1,
@@ -596,14 +596,14 @@ function J() {
596
596
  expirationDate: null
597
597
  };
598
598
  }
599
- class zt extends x {
599
+ class Wt extends x {
600
600
  constructor(t, e) {
601
601
  super(s.IDLE);
602
- m(this, "_amount");
603
- m(this, "_recipient");
604
- m(this, "_needsApproval", !1);
605
- m(this, "_txHash");
606
- m(this, "_feeAuth", J());
602
+ d(this, "_amount");
603
+ d(this, "_recipient");
604
+ d(this, "_needsApproval", !1);
605
+ d(this, "_txHash");
606
+ d(this, "_feeAuth", K());
607
607
  this.ctx = t, this.params = e;
608
608
  }
609
609
  get amount() {
@@ -624,71 +624,26 @@ class zt extends x {
624
624
  }
625
625
  async prepare(t) {
626
626
  return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
627
- const e = O(this.prepareSchema, t, {
627
+ const e = B(this.prepareSchema, t, {
628
628
  destChain: this.params.destChain
629
629
  });
630
- this._amount = e.amount, this._recipient = e.recipient;
631
- const n = w(this.params.sourceChain), d = await this.ctx.getProvider("evm");
632
- if (!d)
633
- throw h.providerMissing(this.params.sourceChain, "evm");
634
- const p = (await d.request({
635
- method: "eth_accounts"
636
- }))[0], c = await K(
637
- n,
638
- p,
639
- this.ctx.env,
640
- E.BTCb
641
- );
642
- if (this._feeAuth = {
643
- requiresAuth: c.requiresAuth,
644
- isAuthorized: c.hasValidSignature,
645
- feeInSatoshis: c.feeInSatoshis,
646
- feeFormatted: c.feeFormatted,
647
- expirationDate: c.expirationDate
648
- }, c.requiresAuth && !c.hasValidSignature) {
649
- this.updateStatus(s.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
650
- status: s.NEEDS_FEE_AUTHORIZATION,
651
- steps: { burning: i.IDLE, releasing: i.IDLE }
652
- });
653
- return;
654
- }
655
- this._needsApproval = !1, this.updateStatus(s.READY), this.emitProgress({
630
+ this._amount = e.amount, this._recipient = e.recipient, this._needsApproval = !1, this.emitProgress({
656
631
  status: s.READY,
657
632
  steps: { burning: i.IDLE, releasing: i.IDLE }
658
633
  });
659
- });
634
+ }, s.READY);
660
635
  }
661
636
  /**
662
637
  * Authorize the network fee
663
638
  *
664
- * Must be called when status is NEEDS_FEE_AUTHORIZATION.
665
- * Signs the fee authorization and stores it on the server.
639
+ * @deprecated EVM Redeem no longer requires fee authorization. The status
640
+ * machine never reaches `NEEDS_FEE_AUTHORIZATION`, so this method is a
641
+ * safe no-op kept only for backwards compatibility with the existing
642
+ * public interface. Calling it on a `READY` (or any other) status will
643
+ * resolve immediately without touching the wallet, the API, or the action
644
+ * state.
666
645
  */
667
646
  async authorizeFee() {
668
- if (this.assertStatus(
669
- s.NEEDS_FEE_AUTHORIZATION,
670
- "authorizeFee"
671
- ), !this._feeAuth.feeInSatoshis)
672
- throw h.missingParameter("feeInSatoshis");
673
- return this.act(async () => {
674
- const t = w(this.params.sourceChain), e = await this.ctx.getProvider("evm");
675
- if (!e)
676
- throw h.providerMissing(this.params.sourceChain, "evm");
677
- const d = (await e.request({
678
- method: "eth_accounts"
679
- }))[0];
680
- await Q({
681
- chainId: t,
682
- account: d,
683
- feeInSatoshis: this._feeAuth.feeInSatoshis,
684
- provider: e,
685
- env: this.ctx.env,
686
- token: E.BTCb
687
- }), this._feeAuth.isAuthorized = !0, this.emitProgress({
688
- status: s.READY,
689
- steps: { burning: i.IDLE, releasing: i.IDLE }
690
- });
691
- }, s.READY);
692
647
  }
693
648
  async approve() {
694
649
  return this.assertStatus(s.NEEDS_APPROVAL, "approve"), this.act(async () => {
@@ -703,60 +658,60 @@ class zt extends x {
703
658
  const t = await this.ctx.getProvider("evm");
704
659
  if (!t)
705
660
  throw h.providerMissing(this.params.sourceChain, "evm");
706
- const n = (await t.request({
661
+ const r = (await t.request({
707
662
  method: "eth_accounts"
708
663
  }))[0];
709
- if (!n)
664
+ if (!r)
710
665
  throw h.providerMissing(this.params.sourceChain, "evm");
711
- const d = w(this.params.sourceChain);
666
+ const m = f(this.params.sourceChain);
712
667
  this.emitProgress({
713
668
  status: s.READY,
714
669
  steps: { burning: i.PENDING, releasing: i.IDLE }
715
670
  });
716
- const u = await nt({
671
+ const c = await at({
717
672
  provider: t,
718
- account: n,
673
+ account: r,
719
674
  amount: this._amount,
720
675
  btcAddress: this._recipient,
721
676
  // Bitcoin address to receive BTC
722
- chainId: d,
677
+ chainId: m,
723
678
  env: this.ctx.env,
724
- tokenIn: E.BTCb,
679
+ tokenIn: C.BTCb,
725
680
  tokenOut: void 0
726
681
  // Native BTC output
727
682
  });
728
- return this._txHash = u, this.emitProgress({
683
+ return this._txHash = c, this.emitProgress({
729
684
  status: s.COMPLETED,
730
685
  steps: { burning: i.COMPLETE, releasing: i.PENDING }
731
- }), this.emitCompleted(), { txHash: u };
686
+ }), this.emitCompleted(), { txHash: c };
732
687
  }, s.COMPLETED);
733
688
  }
734
689
  get prepareSchema() {
735
- return B({
690
+ return O({
736
691
  amount: b,
737
692
  recipient: Ut.recipientSchema
738
693
  });
739
694
  }
740
695
  }
741
- function Wt(r, a) {
742
- return new zt(r, a);
696
+ function zt(n, a) {
697
+ return new Wt(n, a);
743
698
  }
744
699
  const Zt = [
745
- et.avalanche,
746
- et.avalancheFuji
700
+ X.avalanche,
701
+ X.avalancheFuji
747
702
  ];
748
- function jt(r) {
749
- return Zt.includes(r);
703
+ function jt(n) {
704
+ return Zt.includes(n);
750
705
  }
751
706
  class Kt extends x {
752
707
  constructor(t, e) {
753
708
  super(s.IDLE);
754
- m(this, "_amount");
755
- m(this, "_txHash");
756
- m(this, "_feeAuth", J());
757
- m(this, "_account");
758
- m(this, "_needsApproval", !1);
759
- m(this, "_spenderAddress");
709
+ d(this, "_amount");
710
+ d(this, "_txHash");
711
+ d(this, "_feeAuth", K());
712
+ d(this, "_account");
713
+ d(this, "_needsApproval", !1);
714
+ d(this, "_spenderAddress");
760
715
  this.ctx = t, this.params = e;
761
716
  }
762
717
  get amount() {
@@ -775,34 +730,34 @@ class Kt extends x {
775
730
  }
776
731
  async prepare(t) {
777
732
  return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
778
- const e = O(this.prepareSchema, t);
733
+ const e = B(this.prepareSchema, t);
779
734
  this._amount = e.amount;
780
- const n = await this.ctx.getProvider("evm");
781
- if (!n)
735
+ const r = await this.ctx.getProvider("evm");
736
+ if (!r)
782
737
  throw h.providerMissing(this.params.sourceChain, "evm");
783
- const u = (await n.request({
738
+ const c = (await r.request({
784
739
  method: "eth_accounts"
785
740
  }))[0];
786
- if (!u)
741
+ if (!c)
787
742
  throw h.providerMissing(this.params.sourceChain, "evm");
788
- this._account = u;
789
- const p = w(this.params.sourceChain);
743
+ this._account = c;
744
+ const p = f(this.params.sourceChain);
790
745
  if (jt(p)) {
791
- const g = await W(
792
- E.BTCb,
746
+ const g = await z(
747
+ C.BTCb,
793
748
  p,
794
749
  this.ctx.env,
795
- Dt.Adapter
750
+ Pt.Adapter
796
751
  );
797
752
  this._spenderAddress = g.address;
798
753
  const v = await _t({
799
- token: E.BTCb,
800
- owner: u,
754
+ token: C.BTCb,
755
+ owner: c,
801
756
  spender: g.address,
802
757
  chainId: p,
803
758
  env: this.ctx.env
804
- }), C = new D(e.amount);
805
- if (this._needsApproval = v.isLessThan(C), this._needsApproval) {
759
+ }), E = new P(e.amount);
760
+ if (this._needsApproval = v.isLessThan(E), this._needsApproval) {
806
761
  this.emitProgress({
807
762
  status: s.NEEDS_APPROVAL,
808
763
  steps: { approval: i.PENDING, staking: i.IDLE }
@@ -810,19 +765,19 @@ class Kt extends x {
810
765
  return;
811
766
  }
812
767
  }
813
- const c = await K(
768
+ const u = await ot(
814
769
  p,
815
- u,
770
+ c,
816
771
  this.ctx.env,
817
- E.LBTC
772
+ C.LBTC
818
773
  );
819
774
  this._feeAuth = {
820
- requiresAuth: c.requiresAuth,
821
- isAuthorized: c.hasValidSignature,
822
- feeInSatoshis: c.feeInSatoshis,
823
- feeFormatted: c.feeFormatted,
824
- expirationDate: c.expirationDate
825
- }, c.requiresAuth && !c.hasValidSignature ? (this.emitProgress({
775
+ requiresAuth: u.requiresAuth,
776
+ isAuthorized: u.hasValidSignature,
777
+ feeInSatoshis: u.feeInSatoshis,
778
+ feeFormatted: u.feeFormatted,
779
+ expirationDate: u.expirationDate
780
+ }, u.requiresAuth && !u.hasValidSignature ? (this.emitProgress({
826
781
  status: s.NEEDS_FEE_AUTHORIZATION,
827
782
  steps: { staking: i.IDLE }
828
783
  }), this.updateStatus(s.NEEDS_FEE_AUTHORIZATION)) : (this.emitProgress({
@@ -845,16 +800,16 @@ class Kt extends x {
845
800
  const t = await this.ctx.getProvider("evm");
846
801
  if (!t)
847
802
  throw h.providerMissing(this.params.sourceChain, "evm");
848
- const e = w(this.params.sourceChain), n = await gt({
803
+ const e = f(this.params.sourceChain), r = await gt({
849
804
  account: this._account,
850
- token: E.BTCb,
805
+ token: C.BTCb,
851
806
  spender: this._spenderAddress,
852
807
  amount: this._amount,
853
808
  chainId: e,
854
809
  provider: t,
855
810
  env: this.ctx.env
856
- }), d = N({ chainId: e, env: this.ctx.env });
857
- await F(d, n, "BTC.b approval"), this._needsApproval = !1, this.emitProgress({
811
+ }), m = N({ chainId: e, env: this.ctx.env });
812
+ await F(m, r, "BTC.b approval"), this._needsApproval = !1, this.emitProgress({
858
813
  status: s.READY,
859
814
  steps: { approval: i.COMPLETE, staking: i.PENDING }
860
815
  });
@@ -870,14 +825,14 @@ class Kt extends x {
870
825
  const t = await this.ctx.getProvider("evm");
871
826
  if (!t)
872
827
  throw h.providerMissing(this.params.sourceChain, "evm");
873
- const e = w(this.params.sourceChain);
874
- await Q({
828
+ const e = f(this.params.sourceChain);
829
+ await ct({
875
830
  chainId: e,
876
831
  account: this._account,
877
832
  feeInSatoshis: this._feeAuth.feeInSatoshis,
878
833
  provider: t,
879
834
  env: this.ctx.env,
880
- token: E.LBTC
835
+ token: C.LBTC
881
836
  // BTC.b → LBTC uses LBTC token for fee signature
882
837
  }), this._feeAuth = {
883
838
  ...this._feeAuth,
@@ -893,48 +848,48 @@ class Kt extends x {
893
848
  const t = await this.ctx.getProvider("evm");
894
849
  if (!t)
895
850
  throw h.providerMissing(this.params.sourceChain, "evm");
896
- const e = w(this.params.sourceChain), d = (await t.request({
851
+ const e = f(this.params.sourceChain), m = (await t.request({
897
852
  method: "eth_accounts"
898
853
  }))[0];
899
- if (!d)
854
+ if (!m)
900
855
  throw h.providerMissing(this.params.sourceChain, "evm");
901
856
  this.emitProgress({
902
857
  status: s.READY,
903
858
  steps: { staking: i.PENDING }
904
859
  });
905
- const u = await wt({
860
+ const c = await wt({
906
861
  amount: this._amount,
907
- tokenIn: E.BTCb,
908
- tokenOut: E.LBTC,
909
- account: d,
862
+ tokenIn: C.BTCb,
863
+ tokenOut: C.LBTC,
864
+ account: m,
910
865
  chainId: e,
911
866
  provider: t,
912
867
  env: this.ctx.env
913
868
  });
914
- return this._txHash = u, this.emitProgress({
869
+ return this._txHash = c, this.emitProgress({
915
870
  status: s.COMPLETED,
916
871
  steps: { staking: i.COMPLETE }
917
- }), this.emitCompleted(), { txHash: u };
872
+ }), this.emitCompleted(), { txHash: c };
918
873
  }, s.COMPLETED);
919
874
  }
920
875
  get prepareSchema() {
921
- return B({
876
+ return O({
922
877
  amount: b
923
878
  });
924
879
  }
925
880
  }
926
- function Qt(r, a) {
927
- return new Kt(r, a);
881
+ function Qt(n, a) {
882
+ return new Kt(n, a);
928
883
  }
929
884
  const Jt = T(l.LBTC, [o.prod]), Xt = T(l.LBTC, [
930
885
  o.testnet,
931
886
  o.stage,
932
887
  o.dev,
933
888
  o.ibc
934
- ]), te = ct(
889
+ ]), te = rt(
935
890
  [l.LBTC, l.BTCb],
936
891
  [o.prod]
937
- ), ee = ct(
892
+ ), ee = rt(
938
893
  [l.LBTC, l.BTCb],
939
894
  [o.testnet, o.stage, o.dev, o.ibc]
940
895
  ), se = {
@@ -942,41 +897,41 @@ const Jt = T(l.LBTC, [o.prod]), Xt = T(l.LBTC, [
942
897
  // Production: EVM chains with LBTC → Bitcoin Mainnet
943
898
  {
944
899
  sourceChains: Jt,
945
- destChain: f.BITCOIN_MAINNET,
900
+ destChain: A.BITCOIN_MAINNET,
946
901
  envs: [o.prod]
947
902
  },
948
903
  // Testnet: EVM chains with LBTC → Bitcoin Signet
949
904
  {
950
905
  sourceChains: Xt,
951
- destChain: f.BITCOIN_SIGNET,
906
+ destChain: A.BITCOIN_SIGNET,
952
907
  envs: [o.testnet, o.stage, o.dev, o.ibc]
953
908
  }
954
909
  ],
955
- recipientSchema: ot
910
+ recipientSchema: nt
956
911
  }, ae = {
957
912
  routes: [
958
913
  // Production: Same-chain routes for chains with both LBTC and BTCb
959
- ...te.map((r) => ({
960
- sourceChains: [r],
961
- destChain: r,
914
+ ...te.map((n) => ({
915
+ sourceChains: [n],
916
+ destChain: n,
962
917
  envs: [o.prod]
963
918
  })),
964
919
  // Testnet: Same-chain routes
965
- ...ee.map((r) => ({
966
- sourceChains: [r],
967
- destChain: r,
920
+ ...ee.map((n) => ({
921
+ sourceChains: [n],
922
+ destChain: n,
968
923
  envs: [o.testnet, o.stage, o.dev, o.ibc]
969
924
  }))
970
925
  ],
971
- recipientSchema: rt
926
+ recipientSchema: it
972
927
  };
973
928
  class ie extends x {
974
929
  constructor(t, e) {
975
930
  super(s.IDLE);
976
- m(this, "_amount");
977
- m(this, "_recipient");
978
- m(this, "_txHash");
979
- m(this, "_feeAuth", J());
931
+ d(this, "_amount");
932
+ d(this, "_recipient");
933
+ d(this, "_txHash");
934
+ d(this, "_feeAuth", K());
980
935
  this.ctx = t, this.params = e;
981
936
  }
982
937
  get amount() {
@@ -998,30 +953,30 @@ class ie extends x {
998
953
  }
999
954
  async prepare(t) {
1000
955
  return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
1001
- const e = O(this.prepareSchema, t, {
956
+ const e = B(this.prepareSchema, t, {
1002
957
  destChain: this.params.destChain
1003
958
  });
1004
959
  this._amount = e.amount, this._recipient = e.recipient;
1005
- const n = w(this.params.sourceChain);
960
+ const r = f(this.params.sourceChain);
1006
961
  if (this.isBtcbOutput) {
1007
- const d = await this.ctx.getProvider("evm");
1008
- if (!d)
962
+ const m = await this.ctx.getProvider("evm");
963
+ if (!m)
1009
964
  throw h.providerMissing(this.params.sourceChain, "evm");
1010
- const p = (await d.request({
965
+ const p = (await m.request({
1011
966
  method: "eth_accounts"
1012
- }))[0], c = await K(
1013
- n,
967
+ }))[0], u = await ot(
968
+ r,
1014
969
  p,
1015
970
  this.ctx.env,
1016
- E.BTCb
971
+ C.BTCb
1017
972
  );
1018
973
  if (this._feeAuth = {
1019
- requiresAuth: c.requiresAuth,
1020
- isAuthorized: c.hasValidSignature,
1021
- feeInSatoshis: c.feeInSatoshis,
1022
- feeFormatted: c.feeFormatted,
1023
- expirationDate: c.expirationDate
1024
- }, c.requiresAuth && !c.hasValidSignature) {
974
+ requiresAuth: u.requiresAuth,
975
+ isAuthorized: u.hasValidSignature,
976
+ feeInSatoshis: u.feeInSatoshis,
977
+ feeFormatted: u.feeFormatted,
978
+ expirationDate: u.expirationDate
979
+ }, u.requiresAuth && !u.hasValidSignature) {
1025
980
  this.updateStatus(s.NEEDS_FEE_AUTHORIZATION), this.emitProgress({
1026
981
  status: s.NEEDS_FEE_AUTHORIZATION,
1027
982
  steps: { burning: i.IDLE, releasing: i.IDLE }
@@ -1048,19 +1003,19 @@ class ie extends x {
1048
1003
  ), !this._feeAuth.feeInSatoshis)
1049
1004
  throw h.missingParameter("feeInSatoshis");
1050
1005
  return this.act(async () => {
1051
- const t = w(this.params.sourceChain), e = await this.ctx.getProvider("evm");
1006
+ const t = f(this.params.sourceChain), e = await this.ctx.getProvider("evm");
1052
1007
  if (!e)
1053
1008
  throw h.providerMissing(this.params.sourceChain, "evm");
1054
- const d = (await e.request({
1009
+ const m = (await e.request({
1055
1010
  method: "eth_accounts"
1056
1011
  }))[0];
1057
- await Q({
1012
+ await ct({
1058
1013
  chainId: t,
1059
- account: d,
1014
+ account: m,
1060
1015
  feeInSatoshis: this._feeAuth.feeInSatoshis,
1061
1016
  provider: e,
1062
1017
  env: this.ctx.env,
1063
- token: E.BTCb
1018
+ token: C.BTCb
1064
1019
  }), this._feeAuth.isAuthorized = !0, this.emitProgress({
1065
1020
  status: s.READY,
1066
1021
  steps: { burning: i.IDLE, releasing: i.IDLE }
@@ -1072,51 +1027,51 @@ class ie extends x {
1072
1027
  const t = await this.ctx.getProvider("evm");
1073
1028
  if (!t)
1074
1029
  throw h.providerMissing(this.params.sourceChain, "evm");
1075
- const n = (await t.request({
1030
+ const r = (await t.request({
1076
1031
  method: "eth_accounts"
1077
1032
  }))[0];
1078
- if (!n)
1033
+ if (!r)
1079
1034
  throw h.providerMissing(this.params.sourceChain, "evm");
1080
- const d = w(this.params.sourceChain), u = this.params.assetOut === l.BTCb;
1035
+ const m = f(this.params.sourceChain), c = this.params.assetOut === l.BTCb;
1081
1036
  this.emitProgress({
1082
1037
  status: s.READY,
1083
1038
  steps: { burning: i.PENDING, releasing: i.IDLE }
1084
1039
  });
1085
- const p = await nt({
1040
+ const p = await at({
1086
1041
  provider: t,
1087
- account: u ? this._recipient : n,
1042
+ account: c ? this._recipient : r,
1088
1043
  amount: this._amount,
1089
- btcAddress: u ? void 0 : this._recipient,
1090
- chainId: d,
1044
+ btcAddress: c ? void 0 : this._recipient,
1045
+ chainId: m,
1091
1046
  env: this.ctx.env,
1092
- tokenIn: E.LBTC,
1093
- tokenOut: u ? E.BTCb : void 0
1047
+ tokenIn: C.LBTC,
1048
+ tokenOut: c ? C.BTCb : void 0
1094
1049
  });
1095
1050
  return this._txHash = p, this.emitProgress({
1096
1051
  status: s.COMPLETED,
1097
1052
  steps: {
1098
1053
  burning: i.COMPLETE,
1099
- releasing: u ? i.COMPLETE : i.PENDING
1054
+ releasing: c ? i.COMPLETE : i.PENDING
1100
1055
  }
1101
1056
  }), this.emitCompleted(), { txHash: p };
1102
1057
  }, s.COMPLETED);
1103
1058
  }
1104
1059
  get prepareSchema() {
1105
1060
  const t = this.params.assetOut === l.BTC ? se : ae;
1106
- return B({
1061
+ return O({
1107
1062
  amount: b,
1108
1063
  recipient: t.recipientSchema
1109
1064
  });
1110
1065
  }
1111
1066
  }
1112
- function ne(r, a) {
1113
- return new ie(r, a);
1067
+ function ne(n, a) {
1068
+ return new ie(n, a);
1114
1069
  }
1115
1070
  const ht = {
1116
1071
  routes: [
1117
1072
  // Veda - Ethereum, Base, BSC, Corn
1118
1073
  {
1119
- sourceChains: [f.ETHEREUM, f.BASE, f.BSC, f.CORN],
1074
+ sourceChains: [A.ETHEREUM, A.BASE, A.BSC, A.CORN],
1120
1075
  protocols: [S.Veda],
1121
1076
  envs: [o.prod]
1122
1077
  }
@@ -1125,9 +1080,9 @@ const ht = {
1125
1080
  class re extends x {
1126
1081
  constructor(t, e) {
1127
1082
  super(s.IDLE);
1128
- m(this, "_txHash");
1129
- m(this, "_account");
1130
- m(this, "_chainId");
1083
+ d(this, "_txHash");
1084
+ d(this, "_account");
1085
+ d(this, "_chainId");
1131
1086
  this.ctx = t, this.params = e;
1132
1087
  }
1133
1088
  get txHash() {
@@ -1139,12 +1094,12 @@ class re extends x {
1139
1094
  const t = await this.ctx.getProvider("evm");
1140
1095
  if (!t)
1141
1096
  throw h.providerMissing(this.params.chain, "evm");
1142
- const n = (await t.request({
1097
+ const r = (await t.request({
1143
1098
  method: "eth_accounts"
1144
1099
  }))[0];
1145
- if (!n)
1100
+ if (!r)
1146
1101
  throw h.providerMissing(this.params.chain, "evm");
1147
- if (this._account = n, this._chainId = w(this.params.chain), !j(this._chainId))
1102
+ if (this._account = r, this._chainId = f(this.params.chain), !j(this._chainId))
1148
1103
  throw new h(
1149
1104
  H.PROTOCOL_NOT_SUPPORTED,
1150
1105
  `Chain ${this.params.chain} does not support Veda vault withdrawals`,
@@ -1181,7 +1136,7 @@ class re extends x {
1181
1136
  }
1182
1137
  validateProtocol(t) {
1183
1138
  if (!ht.routes.some(
1184
- (n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
1139
+ (r) => r.protocols.includes(t) && r.envs.includes(this.ctx.env)
1185
1140
  ))
1186
1141
  throw h.invalidParameter(
1187
1142
  "protocol",
@@ -1192,12 +1147,12 @@ class re extends x {
1192
1147
  class oe extends x {
1193
1148
  constructor(t, e) {
1194
1149
  super(s.IDLE);
1195
- m(this, "_amount");
1196
- m(this, "_protocol");
1197
- m(this, "_needsApproval", !1);
1198
- m(this, "_txHash");
1199
- m(this, "_account");
1200
- m(this, "_chainId");
1150
+ d(this, "_amount");
1151
+ d(this, "_protocol");
1152
+ d(this, "_needsApproval", !1);
1153
+ d(this, "_txHash");
1154
+ d(this, "_account");
1155
+ d(this, "_chainId");
1201
1156
  this.ctx = t, this.params = e;
1202
1157
  }
1203
1158
  get amount() {
@@ -1214,57 +1169,57 @@ class oe extends x {
1214
1169
  }
1215
1170
  async prepare(t) {
1216
1171
  return this.assertStatus(s.IDLE, "prepare"), this.act(async () => {
1217
- const e = O(this.prepareSchema, t);
1172
+ const e = B(this.prepareSchema, t);
1218
1173
  this._amount = e.amount, this._protocol = this.params.protocol, this.validateProtocol(this.params.protocol);
1219
- const n = await this.ctx.getProvider("evm");
1220
- if (!n)
1174
+ const r = await this.ctx.getProvider("evm");
1175
+ if (!r)
1221
1176
  throw h.providerMissing(this.params.sourceChain, "evm");
1222
- const u = (await n.request({
1177
+ const c = (await r.request({
1223
1178
  method: "eth_accounts"
1224
1179
  }))[0];
1225
- if (!u)
1180
+ if (!c)
1226
1181
  throw h.providerMissing(this.params.sourceChain, "evm");
1227
- if (this._account = u, this._chainId = w(this.params.sourceChain), !j(this._chainId))
1182
+ if (this._account = c, this._chainId = f(this.params.sourceChain), !j(this._chainId))
1228
1183
  throw new h(
1229
1184
  H.PROTOCOL_NOT_SUPPORTED,
1230
1185
  `Chain ${this.params.sourceChain} does not support Veda vault withdrawals`,
1231
1186
  { chain: this.params.sourceChain, protocol: this._protocol }
1232
1187
  );
1233
- const p = Y, c = N({ chainId: this._chainId }), _ = new D(e.amount), g = await c.readContract({
1188
+ const p = q, u = N({ chainId: this._chainId }), _ = new P(e.amount), g = await u.readContract({
1234
1189
  address: p.lensContract.address,
1235
1190
  abi: p.lensContract.abi,
1236
1191
  functionName: "balanceOf",
1237
- args: [u, p.vaultContract.address]
1192
+ args: [c, p.vaultContract.address]
1238
1193
  }), v = y(
1239
1194
  String(g),
1240
1195
  p.decimals
1241
1196
  );
1242
- let C = v;
1197
+ let E = v;
1243
1198
  if (k(this._chainId)) {
1244
- const L = await c.readContract({
1245
- address: P.contracts[this._chainId],
1246
- abi: P.abi,
1199
+ const L = await u.readContract({
1200
+ address: D.contracts[this._chainId],
1201
+ abi: D.abi,
1247
1202
  functionName: "balanceOf",
1248
- args: [u]
1203
+ args: [c]
1249
1204
  }), V = y(
1250
1205
  String(L),
1251
1206
  p.decimals
1252
1207
  );
1253
- C = v.plus(V);
1208
+ E = v.plus(V);
1254
1209
  }
1255
- if (_.isGreaterThan(C))
1210
+ if (_.isGreaterThan(E))
1256
1211
  throw new h(
1257
1212
  H.INSUFFICIENT_SHARES,
1258
- `Insufficient vault shares. Requested: ${_.toFixed()}, Available: ${C.toFixed()}`,
1259
- { requested: _.toFixed(), available: C.toFixed() }
1213
+ `Insufficient vault shares. Requested: ${_.toFixed()}, Available: ${E.toFixed()}`,
1214
+ { requested: _.toFixed(), available: E.toFixed() }
1260
1215
  );
1261
- const A = await c.readContract({
1216
+ const w = await u.readContract({
1262
1217
  address: p.vaultContract.address,
1263
1218
  abi: p.vaultContract.abi,
1264
1219
  functionName: "allowance",
1265
- args: [u, p.withdrawQueueContracts[this._chainId].address]
1220
+ args: [c, p.withdrawQueueContracts[this._chainId].address]
1266
1221
  }), R = y(
1267
- String(A),
1222
+ String(w),
1268
1223
  p.decimals
1269
1224
  );
1270
1225
  this._needsApproval = _.isGreaterThan(R), this._needsApproval ? (this.emitProgress({
@@ -1301,58 +1256,58 @@ class oe extends x {
1301
1256
  const t = await this.ctx.getProvider("evm");
1302
1257
  if (!t)
1303
1258
  throw h.providerMissing(this.params.sourceChain, "evm");
1304
- const e = Y, n = new D(this._amount), d = Z(q(n, e.decimals)), u = N({ chainId: this._chainId }), p = z({
1259
+ const e = q, r = new P(this._amount), m = Z(Y(r, e.decimals)), c = N({ chainId: this._chainId }), p = W({
1305
1260
  provider: t,
1306
1261
  chainId: this._chainId
1307
- }), c = this._chainId;
1262
+ }), u = this._chainId;
1308
1263
  if (k(this._chainId)) {
1309
- const v = await u.readContract({
1264
+ const v = await c.readContract({
1310
1265
  address: e.lensContract.address,
1311
1266
  abi: e.lensContract.abi,
1312
1267
  functionName: "balanceOf",
1313
1268
  args: [this._account, e.vaultContract.address]
1314
1269
  });
1315
- if (v < d) {
1316
- const C = d - v, A = await u.readContract({
1317
- address: P.contracts[this._chainId],
1318
- abi: P.abi,
1270
+ if (v < m) {
1271
+ const E = m - v, w = await c.readContract({
1272
+ address: D.contracts[this._chainId],
1273
+ abi: D.abi,
1319
1274
  functionName: "maxWithdraw",
1320
1275
  args: [this._account]
1321
1276
  });
1322
- if (A < C)
1277
+ if (w < E)
1323
1278
  throw new h(
1324
1279
  H.INSUFFICIENT_SHARES,
1325
- `BTCe wrapper cannot cover the required unwrap. needed=${C.toString()}, maxWithdraw=${A.toString()}.`,
1280
+ `BTCe wrapper cannot cover the required unwrap. needed=${E.toString()}, maxWithdraw=${w.toString()}.`,
1326
1281
  {
1327
- needed: C.toString(),
1328
- maxWithdraw: A.toString()
1282
+ needed: E.toString(),
1283
+ maxWithdraw: w.toString()
1329
1284
  }
1330
1285
  );
1331
- const { request: R } = await u.simulateContract({
1286
+ const { request: R } = await c.simulateContract({
1332
1287
  account: this._account,
1333
1288
  chain: M[this._chainId],
1334
- address: P.contracts[this._chainId],
1335
- abi: P.abi,
1289
+ address: D.contracts[this._chainId],
1290
+ abi: D.abi,
1336
1291
  functionName: "withdraw",
1337
- args: [C, this._account, this._account]
1292
+ args: [E, this._account, this._account]
1338
1293
  }), L = await p.writeContract(R);
1339
1294
  await F(
1340
- u,
1295
+ c,
1341
1296
  L,
1342
1297
  "BTCe unwrap"
1343
1298
  );
1344
1299
  }
1345
1300
  }
1346
- const { request: _ } = await u.simulateContract({
1301
+ const { request: _ } = await c.simulateContract({
1347
1302
  account: this._account,
1348
1303
  chain: M[this._chainId],
1349
1304
  address: e.vaultContract.address,
1350
1305
  abi: e.vaultContract.abi,
1351
1306
  functionName: "approve",
1352
- args: [e.withdrawQueueContracts[c].address, d]
1307
+ args: [e.withdrawQueueContracts[u].address, m]
1353
1308
  }), g = await p.writeContract(_);
1354
1309
  await F(
1355
- u,
1310
+ c,
1356
1311
  g,
1357
1312
  "vault share approval"
1358
1313
  ), this._needsApproval = !1, this.emitProgress({
@@ -1393,13 +1348,13 @@ class oe extends x {
1393
1348
  }, s.COMPLETED);
1394
1349
  }
1395
1350
  get prepareSchema() {
1396
- return B({
1351
+ return O({
1397
1352
  amount: b
1398
1353
  });
1399
1354
  }
1400
1355
  validateProtocol(t) {
1401
1356
  if (!ht.routes.some(
1402
- (n) => n.protocols.includes(t) && n.envs.includes(this.ctx.env)
1357
+ (r) => r.protocols.includes(t) && r.envs.includes(this.ctx.env)
1403
1358
  ))
1404
1359
  throw h.invalidParameter(
1405
1360
  "protocol",
@@ -1407,15 +1362,15 @@ class oe extends x {
1407
1362
  );
1408
1363
  }
1409
1364
  }
1410
- function ce(r, a) {
1411
- return new oe(r, a);
1365
+ function ce(n, a) {
1366
+ return new oe(n, a);
1412
1367
  }
1413
- function he(r, a) {
1414
- return new re(r, a);
1368
+ function he(n, a) {
1369
+ return new re(n, a);
1415
1370
  }
1416
1371
  class ue {
1417
1372
  constructor(a) {
1418
- m(this, "ctx");
1373
+ d(this, "ctx");
1419
1374
  this.ctx = St(a);
1420
1375
  }
1421
1376
  /**
@@ -1533,31 +1488,40 @@ class ue {
1533
1488
  return he(this.ctx, a);
1534
1489
  }
1535
1490
  /**
1536
- * Redeem LBTC to BTC.b (same-chain unwrap)
1491
+ * Redeem BTC.b to native BTC (cross-chain to Bitcoin)
1537
1492
  *
1538
- * Converts LBTC to BTC.b on the same EVM chain.
1539
- * For cross-chain BTC redemption, use unstake() with destChain set to Bitcoin.
1493
+ * Burns BTC.b on the EVM source chain and releases native BTC to a Bitcoin
1494
+ * recipient address. This is the inverse of BTC Deposit. The destination is
1495
+ * always the Bitcoin network — for LBTC → BTC.b on the same EVM chain, use
1496
+ * {@link unstake} with `assetOut: AssetId.BTCb`.
1540
1497
  *
1541
1498
  * @example
1542
1499
  * ```typescript
1543
1500
  * const redeem = evm.redeem({
1544
- * assetIn: AssetId.LBTC,
1545
- * assetOut: AssetId.BTCb,
1501
+ * assetIn: AssetId.BTCb,
1502
+ * assetOut: AssetId.BTC,
1546
1503
  * sourceChain: Chain.AVALANCHE,
1504
+ * destChain: Chain.BITCOIN_MAINNET,
1505
+ * });
1506
+ *
1507
+ * await redeem.prepare({
1508
+ * amount: '0.1',
1509
+ * recipient: 'bc1q...',
1547
1510
  * });
1511
+ * const { txHash } = await redeem.execute();
1548
1512
  * ```
1549
1513
  */
1550
1514
  redeem(a) {
1551
- return Wt(this.ctx, a);
1515
+ return zt(this.ctx, a);
1552
1516
  }
1553
1517
  }
1554
- function Se(r) {
1555
- return new ue(r);
1518
+ function Se(n) {
1519
+ return new ue(n);
1556
1520
  }
1557
1521
  export {
1558
1522
  ue as EvmActions,
1559
1523
  I as EvmDepositStatus,
1560
1524
  Se as evmActions,
1561
- Pe as evmModule
1525
+ De as evmModule
1562
1526
  };
1563
- //# sourceMappingURL=EvmActions-nbR8cSa4.js.map
1527
+ //# sourceMappingURL=EvmActions-8VeTiWrl.js.map