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